Skip to content

Unwrap pkg_deb rule to enable inherit_attrs#1026

Open
mxpv wants to merge 1 commit intobazelbuild:mainfrom
mxpv:unwrap
Open

Unwrap pkg_deb rule to enable inherit_attrs#1026
mxpv wants to merge 1 commit intobazelbuild:mainfrom
mxpv:unwrap

Conversation

@mxpv
Copy link

@mxpv mxpv commented Feb 13, 2026

I was trying to wrap pkg_deb into a macro to express some common functionality. One convenient thing that Bazel has is inherit_attrs = pkg_deb, which lets you redefine certain attributes and reuse everything else. However, in the current implementation it's not possible to use, because pkg_deb is being wrapped in a legacy macro.

Error in macro: in call to macro(), parameter 'inherit_attrs' got value of type 'function', want 'rule, macro, string, or NoneType'

This PR exposes the rule directly and moves the logic to default out into the rule implementation.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@tonyaiuto
Copy link
Collaborator

What if we just exposed the attribute list as something you can use yourself, and wrap the implementaion so you can reuse it.

Or, update this to a symbolic macro. Although that may break bazel 7 compatibilty. I'ld have to check.
Can you try that?

@mxpv
Copy link
Author

mxpv commented Feb 19, 2026

Or, update this to a symbolic macro. Although that may break bazel 7 compatibilty. I'ld have to check.

@tonyaiuto Symbolic macros were introduced in Bazel 8, so that won't work on 7.

What if we just exposed the attribute list as something you can use yourself, and wrap the implementaion so you can reuse it.

Exposing the attribute list is another option. Any particular reason not to expose the rule directly? That seems more natural and can be used directly with inherit_attrs.

@aiuto
Copy link
Collaborator

aiuto commented Feb 19, 2026 via email

@mxpv
Copy link
Author

mxpv commented Feb 20, 2026

What are you trying to do that requires wrapping the rule? Could this be something that turns into a base level feature?

@aiuto I'm maintaining a bunch of custom debian packages and rely on custom macros and rules to wrap common tasks (like managing systemd units similarly to dh_installsystemd). pkg_deb/tar are fairly low level primitives (which is nice!) that allow adding many building blocks on top. And hence being able to inherit attributes make things a bit nicer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants