bazelbuild / bazelbuild/rules_pkg

pkg_rpm can't set `package_file_name = ${package_name}.rpm`

Open
#919 1 comment 0 reactions 0 assignees View on GitHub
need more information
Dominant language
Starlark
Stars
253
Forks
221
Avg merge
10h 33m
Merged PRs (30d)
1

Description

When `package_file_name = ${package_name}.rpm`, the rule will fail:

```
ERROR: file 'test.rpm' is generated by these conflicting actions:
Label: //:rpm
RuleClass: pkg_rpm rule
JavaActionClass: class com.google.devtools.build.lib.analysis.actions.StarlarkAction, class com.google.devtools.build.lib.analysis.actions.SymlinkAction
Configuration: 211cf97c47c3c3c62956d4ca62222b55a5848ae6122e5c02c157c85559f94b7f
Mnemonic: MakeRpm, Symlink
Action key: e01d1825161e914df618d1befd116e60fa70bc978a57f884fe40324b1bee6e03, 7a39b61d5744a8903119e17b3ddc7e56e330f240d2bead98c3ba081a81b5c9ac
Progress message: MakeRpm test.rpm, Creating symlink bazel-out/aarch64-fastbuild/bin/test.rpm
Action describeKey: MakeRpm test.rpm
...
```

relevant callsites:

https://github.com/bazelbuild/rules_pkg/blob/12fed4bc78b8a402be0b8761803b4e195f9902cd/pkg/rpm_pfg.bzl#L492-L497
https://github.com/bazelbuild/rules_pkg/blob/12fed4bc78b8a402be0b8761803b4e195f9902cd/pkg/rpm_pfg.bzl#L701-L705

So the `default_file` is `{rpm_name}.rpm` where `rpm_name` is `package_name`, and `output_file` generates a file `{package_file_name}`, and it will cause the conflict.

Contributor guide

Open the contributing guide

Research direction

Start by reading the two referenced sections of pkg/rpm_pfg.bzl at lines 492-497 and 701-705, focusing on how default_file and output_file are derived. Reproduce the configuration with package_file_name = ${package_name}.rpm and confirm that the conflicting MakeRpm and Symlink actions no longer target the same file.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.