-
Notifications
You must be signed in to change notification settings - Fork 209
fix(rpm): debuginfo support on some distributions #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(rpm): debuginfo support on some distributions #1006
Conversation
2056729 to
1a89eb1
Compare
5dbe86a to
d618ca4
Compare
d618ca4 to
85bada1
Compare
cgrindel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks reasonable to me. However, there appear to be some CI failures.
b358709 to
15c0143
Compare
cgrindel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. @aiuto Would you like to take a look?
|
@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
|
@meteorcloudy Can you make @kellyma2 part of the project so we can more accurately assign things to him. |
I in touch with @rdesgroppes to get some understanding of the details. Will re-look at this. |
kellyma2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
|
Should we move rules_pkg to bazel-contrib? |
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: