fix(rpm): debuginfo support on some distributions#1006
Merged
cgrindel merged 1 commit intobazelbuild:mainfrom Feb 4, 2026
Merged
fix(rpm): debuginfo support on some distributions#1006cgrindel merged 1 commit intobazelbuild:mainfrom
cgrindel merged 1 commit intobazelbuild:mainfrom
Conversation
2056729 to
1a89eb1
Compare
5dbe86a to
d618ca4
Compare
d618ca4 to
85bada1
Compare
cgrindel
reviewed
Jan 24, 2026
Collaborator
cgrindel
left a comment
There was a problem hiding this comment.
The change looks reasonable to me. However, there appear to be some CI failures.
b358709 to
15c0143
Compare
Collaborator
|
@kellyma2 IIRC, you're the only one who knows about rpm debug. |
15c0143 to
b3cfb2a
Compare
This enables RPM debuginfo package generation across different Linux
distributions (tested on Rocky and Ubuntu in CI) by implementing RPM
version-based detection if possible, and falling back to the existing OS
release-based detection otherwise.
RPM 4.18.0 introduced changes to make `%{buildsubdir}` independent of
the `%setup` macro:
- commit: `Make %{buildsubdir} more independent of %setup`
(rpm-software-management/rpm@6caca84c904423)
- since: `rpm-4.18.0-alpha1`
- release: https://rpm.org/wiki/Releases/4.18.0
While this change enabled setting `buildsubdir` as a regular macro
rather than a `spec` object property, it had the side effect of altering
the relative path handling in install scripts.
This requires different file path formats in the `%install` section:
- RPM < 4.18, corresponding to the project's "centos" type:
```
cp 'bazel-out/k8-fastbuild/bin/tests/rpm/test_debuginfo' '%{buildroot}/test_debuginfo'
```
- RPM >= 4.18, corresponding to the project's "fedora" type:
```
cp '../bazel-out/k8-fastbuild/bin/tests/rpm/test_debuginfo' '%{buildroot}/test_debuginfo'
```
Using the wrong "type" causes build failures:
- "fedora" with RPM < 4.18:
```
cp: cannot stat '../bazel-out/k8-fastbuild/bin/tests/rpm/test_debuginfo': No such file or directory
```
- "centos" with RPM >= 4.18:
```
rm: refusing to remove '.' or '..' directory: skipping '.'
```
The present change therefore implements version detection to
automatically select the appropriate "type".
**Additional fixes for cross-distribution compatibility**
RedHat distros have redhat-rpm-config with `%_enable_debug_packages`
that auto-invokes `%debug_package` (rpm-software-management/rpm#2204).
Debian/Ubuntu ship vanilla upstream RPM without this configuration:
```
output 'tests/rpm/test_debuginfo_rpm-debuginfo-1-0..rpm' was not created
```
That's why the change adds `%debug_package` only when applicable:
- `%{!?_enable_debug_packages:%debug_package}`.
Also, since RPM [4.14](https://rpm.org/wiki/Releases/4.14.0), unique
debug package filenames are enabled by default, leading to variadic
filenames being generated:
```
Executing tests from //tests/rpm:test_golden_debuginfo_rpm_contents
-----------------------------------------------------------------------------
29c29
< /usr/lib/debug/test_debuginfo-1-0.x86_64.debug
---
> /usr/lib/debug/test_debuginfo.debug
FAIL: files "tests/rpm/test_debuginfo_rpm_contents.txt" and "tests/rpm/test_debuginfo_rpm_contents.txt.golden" differ
```
That's why the change makes debug package filenames consistent across
distributions by means of:
- `%undefine _unique_debug_names` (safe no-op on older RPM versions).
Note: I also verified the change locally with:
- RPM 4.17.1 on Fedora 35 ("centos" type)
- RPM 4.18.2 on Ubuntu 24.04.3 ("fedora" type)
- RPM 4.19.1.1 on Fedora 40 ("fedora" type)
b3cfb2a to
46c531f
Compare
Collaborator
|
@meteorcloudy Can you make @kellyma2 part of the project so we can more accurately assign things to him. |
Contributor
I in touch with @rdesgroppes to get some understanding of the details. Will re-look at this. |
Member
|
Should we move rules_pkg to bazel-contrib? |
Contributor
Author
|
Is action expected from me? |
Collaborator
|
Now that @kellyma2 has approved. I will merge. |
rdesgroppes
added a commit
to DataDog/datadog-agent
that referenced
this pull request
Feb 6, 2026
### What does this PR do? Bump `rules_pkg` from archived release 1.2.0 to current `main` branch to benefit from recent bugfixes. ### Motivation The `main` branch includes unreleased fixes: - Bazel 9 compatibility - when we feel ready to switch to it, - enhanced RPM support so that it's now possible to build RPMs from within Ubuntu CI containers, also with debuginfo: bazelbuild/rules_pkg#1006 - dependency on a deprecated target: bazelbuild/rules_pkg#1005 ### Additional Notes To remove a warning (rightfully treated as error) implied by the latter, this implies to also bump `bazel_skylib`: > For repository 'bazel_skylib', the root module requires module version > bazel_skylib@1.8.2, but got bazel_skylib@1.9.0 in the resolved > dependency graph.
gh-worker-dd-mergequeue-cf854d bot
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
Feb 6, 2026
### What does this PR do? Bump `rules_pkg` from archived release 1.2.0 to current `main` branch to benefit from recent bugfixes. ### Motivation The `main` branch includes unreleased fixes: - Bazel 9 compatibility, for when we feel ready to switch to it, - enhanced RPM support so that it's now possible to build RPMs from within Ubuntu CI containers, also with debuginfo: bazelbuild/rules_pkg#1006 - dependency on a deprecated target: bazelbuild/rules_pkg#1005 ### Additional Notes To remove a warning (rightfully treated as error) implied by the latter, this implies to also bump `bazel_skylib`: > For repository 'bazel_skylib', the root module requires module version bazel_skylib@1.8.2, but got bazel_skylib@1.9.0 in the resolved dependency graph. Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
alopezz
pushed a commit
to DataDog/datadog-agent
that referenced
this pull request
Feb 6, 2026
### What does this PR do? Bump `rules_pkg` from archived release 1.2.0 to current `main` branch to benefit from recent bugfixes. ### Motivation The `main` branch includes unreleased fixes: - Bazel 9 compatibility, for when we feel ready to switch to it, - enhanced RPM support so that it's now possible to build RPMs from within Ubuntu CI containers, also with debuginfo: bazelbuild/rules_pkg#1006 - dependency on a deprecated target: bazelbuild/rules_pkg#1005 ### Additional Notes To remove a warning (rightfully treated as error) implied by the latter, this implies to also bump `bazel_skylib`: > For repository 'bazel_skylib', the root module requires module version bazel_skylib@1.8.2, but got bazel_skylib@1.9.0 in the resolved dependency graph. Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
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.
This enables RPM debuginfo package generation across different Linux distributions (tested on Rocky and Ubuntu in CI) by implementing RPM version-based detection if possible, and falling back to the existing OS release-based detection otherwise.
RPM 4.18.0 introduced changes to make
%{buildsubdir}independent of the%setupmacro:Make %{buildsubdir} more independent of %setup(rpm-software-management/rpm@6caca84c904423)rpm-4.18.0-alpha1While this change enabled setting
buildsubdiras a regular macro rather than aspecobject property, it had the side effect of altering the relative path handling in install scripts.This requires different file path formats in the
%installsection:Using the wrong "type" causes build failures:
The present change therefore implements version detection to automatically select the appropriate "type".
Additional fixes for cross-distribution compatibility
RedHat distros have redhat-rpm-config with
%_enable_debug_packagesthat auto-invokes%debug_package(rpm-software-management/rpm#2204).Debian/Ubuntu ship vanilla upstream RPM without this configuration:
That's why the change adds
%debug_packageonly when applicable:%{!?_enable_debug_packages:%debug_package}.Also, since RPM 4.14, unique debug package filenames are enabled by default, leading to variadic filenames being generated:
That's why the change makes debug package filenames consistent across distributions by means of:
%undefine _unique_debug_names(safe no-op on older RPM versions).Note: I also verified the change locally with: