Skip to content

Commit

Permalink
build: work around issues between pkg_rpm and rpmbuild after 4.20 (#4652
Browse files Browse the repository at this point in the history
)

Since rpmbuild v4.20, the _builddir variable is forcefully set to
<chosen_builddir>/<pkg_name> (which is created if it doesn't exist). Any
files that are not built/copied by the %prep% phase must be already
present in <chosen_builddir>/<pkg_name>/[%buildsubdir].

pkg_rpm doesn't expect that and places the files to be packaged in
<chosen_builddir>. Since %buildsubdir is not used (=="."), we compensate
by setting it to "..". As a result
<chosen_builddir>/<pkg_name>/[%buildsubdir] evaluates to
<chosen_buildir> thereby restoring pre-4.20 behavior.

Since 4.20, debug-info rpms are built by default. We don't support or
want that, so we now set "don't-do-it" explicitly.

Fixes #4653
  • Loading branch information
jiceatscion authored Nov 20, 2024
1 parent 5c3b50d commit 8109a33
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion dist/package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ def scion_pkg_rpm(name, package, executables = {}, systemds = [], configs = [],
if post:
kwargs.pop("postinst")

# defines are work-arounds for pkg_rpm issues:
# _smp_build_ncpus: used to be default.
# buildsubdir: starting with rpmbuild 4.20, builddir is forcefully replaced with:
# <chosen_builddir>/<package_name> (which is created if it doesn't exist).
# pkg_rpm assumes that one can place ready-to-package files directly into
# <chosen_builddir>, we need <builddir>/<buildsubdir> to evealuate as
# <chosen_buidldir>. Hence the "buildsubdir=..". It's a hack. Check if later
# versions of pkg_rpm fix that.
# debug_package: Starting with rpmbuild 4.20, debug-info packages are built by default. We
# currently don't want that and our binaries do not have the required symbols.

pkg_rpm(
name = name,
summary = kwargs["description"],
Expand All @@ -132,9 +143,10 @@ def scion_pkg_rpm(name, package, executables = {}, systemds = [], configs = [],
package_name = package,
release = "%autorelease",
version_file = ":%s_version" % name,
defines = {"_smp_build_ncpus": "1"},
defines = {"_smp_build_ncpus": "1", "buildsubdir": "..", "debug_package": "%{nil}"},
requires = deps,
post_scriptlet_file = post,
source_date_epoch = 0,
**kwargs
)

Expand Down

0 comments on commit 8109a33

Please sign in to comment.