Add package_variables support to pkg_files and pkg_filegroup prefix#1052
Open
aiuto wants to merge 1 commit intobazelbuild:mainfrom
Open
Add package_variables support to pkg_files and pkg_filegroup prefix#1052aiuto wants to merge 1 commit intobazelbuild:mainfrom
aiuto wants to merge 1 commit intobazelbuild:mainfrom
Conversation
Closes bazelbuild#781. pkg_files and pkg_filegroup now accept a package_variables attribute, enabling make-variable substitution in their prefix attribute. For example: my_platform_vars(name = "platform_vars", os = "linux", arch = "x86_64") pkg_filegroup( name = "platform_libs", srcs = [":my_libs"], prefix = "usr/lib/$(os)_$(arch)", package_variables = ":platform_vars", ) Previously the only workaround was select() on prefix, while package_file_name already supported variable substitution via package_variables. This closes the inconsistency: the same mechanism now works for destination paths in the mapping rules. The implementation follows the same pattern as pkg_deb and pkg_tar, reusing substitute_package_variables() from //pkg/private:util.bzl. - Admittedly this was too small to use an agent, but it saved me time writing the tests. - I created a hints file for the next time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #781.
pkg_files and pkg_filegroup now accept a package_variables attribute, enabling make-variable substitution in their prefix attribute. For example:
my_platform_vars(name = "platform_vars", os = "linux", arch = "x86_64")
pkg_filegroup(
name = "platform_libs",
srcs = [":my_libs"],
prefix = "usr/lib/$(os)_$(arch)",
package_variables = ":platform_vars",
)
Previously the only workaround was select() on prefix, while package_file_name already supported variable substitution via package_variables. This closes the inconsistency: the same mechanism now works for destination paths in the mapping rules.
The implementation follows the same pattern as pkg_deb and pkg_tar, reusing substitute_package_variables() from //pkg/private:util.bzl.
Used Claude for the coding.