rules_pkg/examples
Mike Kelly 581a86a294
Add support for generating debuginfo RPMs (#842)
* Enable creation and capture of debuginfo RPMs

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.

* Add an RPM example that generates debuginfo

This provides a basic example that generates a debuginfo RPM
configured to run on CentOS7.

* Upgrade rules_python to 0.31.0

rules_python seems to fail us when we're generating debuginfo RPMs
unless we upgrade to a version more recent than 0.24.0.

* Only generate debuginfo RPM when pkg_rpm() asks for it

In lieu of enabling this behaviour by default on the supported
platforms, we add an additional argument to the pkg_rpm() rule that
will allow us to enable it for pkg_rpm() targets.  This prevents us
from enabling it in cases where it's not desired.

* Add test for building debuginfo RPM

This test is modelled on the subrpm test.  In lieu of using a simple
text file as an input it instead generates a binary that includes
debug symbosl from a C source file and includes that in the RPM.

The baseline comparison strips out the `.build-id` paths because the
hashes that are generated may not be stable.x

* Remove architecture and size from debuginfo test output

These values may vary depending on the platform that this is being run
on and we don't really care about them.

* Add period to docstring

* Enable debuginfo support for CentOS Stream 9

CentOS Stream 9 appears to work more or less the same for debuginfo
generation as CentOS 7.  `os-release` describes it as os == `centos`
and version == `9`.  This change creates an extra token for `centos9`
and sticks it in the places where we currently have controls for
`centos7`.
2024-04-24 16:03:11 -04:00
..
naming_package_files Fall back to WORKSPACE.bzlmod for examples/naming. Something about a local_repository in MODULE.bazel and bazel 7.0.0 is wonky. 2023-12-19 14:30:48 -05:00
rich_structure create empty MODULE.bazel files in examples to bazel does not complain (#855) 2024-04-17 18:44:38 -04:00
rpm Add support for generating debuginfo RPMs (#842) 2024-04-24 16:03:11 -04:00
time_stamping create empty MODULE.bazel files in examples to bazel does not complain (#855) 2024-04-17 18:44:38 -04:00
where_is_my_output create empty MODULE.bazel files in examples to bazel does not complain (#855) 2024-04-17 18:44:38 -04:00
BUILD Provide rpmbuild as a toolchain. (#254) 2021-01-14 00:00:35 -05:00
readme.md Add examples of how to name packages with build time values. (#256) 2021-01-19 15:32:42 -05:00

readme.md

rules_pkg - Examples

TBD