rules_pkg
rules_pkg copied to clipboard
pkg_rpm can't set `package_file_name = ${package_name}.rpm`
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.
Can you provide a reproduction example?