bazelbuild / rules_pkg

Bazel rules for creating packages of many types (zip, tar, deb, rpm, ...)
Apache License 2.0
221 stars 174 forks source link

Add support for generating debuginfo RPMs #842

Closed kellyma2 closed 5 months ago

kellyma2 commented 6 months ago

This change enables the creation and capture of debuginfo RPMs on Fedora40 and CentOS7.

See: https://docs.fedoraproject.org/en-US/packaging-guidelines/Debuginfo/

Fedora 40 expects the RPM contents to be located in a subdirectory which is specified using the buildsubdir variable. In order to account for this, we need to tweak some of the location details if debuginfo is enabled.

CentOS expects buildsubdir to have a value like . instead.

In both cases, we disable debugsource packages by ensuring that we undefine _debugsource_packages, otherwise we'll try to generate them alongside the debuginfo packages and will fail.

We only want this method of producing debuginfo to apply when we're using the system rpmbuild because the underlying behaviour is controlled by a combination of the rpmbuild version, macro definitions, find-debuginfo.sh, and debugedit. If we were to expand this to use a hermetic debuginfo then a different approach might be desirable.

aiuto commented 6 months ago

I'm going to be slow to respond. Every hour of this week is booked.

kellyma2 commented 6 months ago

I'm going to be slow to respond. Every hour of this week is booked.

Thanks for the heads up

kellyma2 commented 6 months ago

@aiuto any cycles to go over this in the near term?

kellyma2 commented 5 months ago

But it leads to the question of the name of debuginfo_type. Is it really distinguishing the format of the debuginfo, or is it really a distinguisher of the target os? If you could build for fedora from centos, should it be an attribute of the rule rather than picked up as a side effect in the toolchain?

Are there other constraints or information about cross building which should make sense in the docstring?

tl;dr I don't think I can assert anything about cross building with this at all, unfortunately :(

We're relying on the system rpmbuild for this which means that we're also relying on the various rpm macros and and supporting tools in place that belong to the system that we're building on. debuginfo_type is a bit of a misnomer here, perhaps, but what it's referring to is the OS configuration for the aforementioned version of rpmbuild (incl macros, etc) not the target OS. Initially I had allowed this to be selected in the module extension, but decided I just wanted to make this auto-detect so that we could at least hypothetically have the defined rules be system independant.

Can definitely clarify some of how this works in the docstring, however.

kellyma2 commented 5 months ago

Can you just fix that period in the docstring and I'll merge.

Done

aiuto commented 5 months ago

Sorry for the late merge. Hugely busy weekend.