Skip to content

Support relocatable rpmbuild by adding data attribute to the toolchain#1047

Merged
aiuto merged 2 commits intobazelbuild:mainfrom
reutermj:main
Mar 17, 2026
Merged

Support relocatable rpmbuild by adding data attribute to the toolchain#1047
aiuto merged 2 commits intobazelbuild:mainfrom
reutermj:main

Conversation

@reutermj
Copy link
Copy Markdown
Contributor

@reutermj reutermj commented Mar 16, 2026

rpmbuild ships with runtime configuration files (lib/rpm/) that must be present for it to successfully build RPMs. When running under remote execution, these files were not being staged because the toolchain had no way to declare them as dependencies.

Add a data attribute to rpmbuild_toolchain so that runtime files can be specified alongside the rpmbuild binary. These files are propagated through RpmbuildInfo and included as inputs to the MakeRpm action in pkg_rpm.

Expanded examples/rpm/prebuilt_rpmbuild to demonstrate usage of the API. The existing example uses mocked rpmbuild, and this adds mocked lib/rpm/ runtime data files

@aiuto
Copy link
Copy Markdown
Collaborator

aiuto commented Mar 17, 2026

Could you add an example of the use under examples/rpm.
I think it is probably something like a glob of /usr/lib/rpm, but I'm just guessing.

Copy link
Copy Markdown
Collaborator

@aiuto aiuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. The example will make it useful to others.

rpmbuild ships with runtime configuration files (lib/rpm/) that must be
present for it to successfully build RPMs. When running under remote
execution, these files were not being staged because the toolchain had
no way to declare them as dependencies.

Add a `data` attribute to `rpmbuild_toolchain` so that runtime files
can be specified alongside the rpmbuild binary. These files are
propagated through `RpmbuildInfo` and included as inputs to the MakeRpm
action in `pkg_rpm`.
@reutermj
Copy link
Copy Markdown
Contributor Author

reutermj commented Mar 17, 2026

Thanks @aiuto. Updated the existing prebuilt rpmbuild example to use the new attribute.
Also tested it in with a toolchain module: https://github.com/reutermj/toolchains_rpmbuild_prebuilt

@aiuto
Copy link
Copy Markdown
Collaborator

aiuto commented Mar 17, 2026

buildifier complaining. I fixed the line.

@aiuto aiuto merged commit 261bb49 into bazelbuild:main Mar 17, 2026
6 checks passed
@reutermj
Copy link
Copy Markdown
Contributor Author

Thanks @aiuto!

rdesgroppes added a commit to DataDog/datadog-agent that referenced this pull request Mar 20, 2026
What does this PR do?
bump rules_pkg to Mar 17 main, picking up:
- bazelbuild/rules_pkg#1024: RPM build errors would go unnoticed without it
- bazelbuild/rules_pkg#1035: affects reproducibiliy of builds
- bazelbuild/rules_pkg#1044
- bazelbuild/rules_pkg#1046: a contribution of ours (@chouquette)
- bazelbuild/rules_pkg#1047: we might need this
gh-worker-dd-mergequeue-cf854d bot pushed a commit to DataDog/datadog-agent that referenced this pull request Mar 20, 2026
### What does this PR do?
Bump `rules_pkg` to current `main`.

### Motivation
Pick up:
- bazelbuild/rules_pkg#1021: a contribution of ours
- bazelbuild/rules_pkg#1024: RPM build errors would go unnoticed without it
- bazelbuild/rules_pkg#1035: affects reproducibiliy of builds
- bazelbuild/rules_pkg#1044
- bazelbuild/rules_pkg#1046: another contribution of ours (@chouquette)
- bazelbuild/rules_pkg#1047: we might need this feature

Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
StephenWakely pushed a commit to DataDog/datadog-agent that referenced this pull request Mar 27, 2026
### What does this PR do?
Bump `rules_pkg` to current `main`.

### Motivation
Pick up:
- bazelbuild/rules_pkg#1021: a contribution of ours
- bazelbuild/rules_pkg#1024: RPM build errors would go unnoticed without it
- bazelbuild/rules_pkg#1035: affects reproducibiliy of builds
- bazelbuild/rules_pkg#1044
- bazelbuild/rules_pkg#1046: another contribution of ours (@chouquette)
- bazelbuild/rules_pkg#1047: we might need this feature

Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
StephenWakely pushed a commit to DataDog/datadog-agent that referenced this pull request Mar 27, 2026
### What does this PR do?
Bump `rules_pkg` to current `main`.

### Motivation
Pick up:
- bazelbuild/rules_pkg#1021: a contribution of ours
- bazelbuild/rules_pkg#1024: RPM build errors would go unnoticed without it
- bazelbuild/rules_pkg#1035: affects reproducibiliy of builds
- bazelbuild/rules_pkg#1044
- bazelbuild/rules_pkg#1046: another contribution of ours (@chouquette)
- bazelbuild/rules_pkg#1047: we might need this feature

Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
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.

2 participants