Skip to content

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

Open
@ashi009

Description

@ashi009

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:

rules_pkg/pkg/rpm_pfg.bzl

Lines 492 to 497 in 12fed4b

if ctx.attr.package_name:
rpm_name = ctx.attr.package_name
else:
rpm_name = ctx.attr.name
default_file = ctx.actions.declare_file("{}.rpm".format(rpm_name))

rules_pkg/pkg/rpm_pfg.bzl

Lines 701 to 705 in 12fed4b

_, output_file, _ = setup_output_files(
ctx,
package_file_name = package_file_name,
default_output_file = default_file,
)

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions