tools: replace spec Provides generator

Replace the generator for the spec file "Provides:" list with the one
from the current go-rpm-macros [1].  The new generator can handle
'replace' commands in vendor/modules.txt, which makes it possible to
build RPMs with temporarily modified dependencies.  This enables making
scratch builds against forks or branches of the new osbuild/images
repository for development and testing.

In the future, we can use the packaged version of the script, but this
isn't yet available in all supported distros (EL8).

Made some minor modifications to the original script to prepend each
dependency with "Provides:" and read input files as arguments instead of
lines from stdin.

https://pagure.io/go-rpm-macros/blob/c32fbbd25bbcedee8c0b898d3653255b18a0d30e/f/rpm/go_mod_vendor.prov
This commit is contained in:
Achilleas Koutsou 2023-07-18 13:49:55 +02:00 committed by Simon de Vlieger
parent 1c148c162f
commit f478323e3a
2 changed files with 57 additions and 1 deletions

View file

@ -5,7 +5,7 @@ SPEC_FILE=${1:-"osbuild-composer.spec"}
# Save the list of bundled packages into a file
WORKDIR=$(mktemp -d)
BUNDLES_FILE=${WORKDIR}/bundles.txt
grep "^# " vendor/modules.txt | awk '{print "Provides: bundled(golang("$2")) = "$3}' | sort --ignore-case | uniq | sed -e 's/-/_/g' > "${BUNDLES_FILE}"
./tools/rpm_spec_vendor2provides vendor/modules.txt > "${BUNDLES_FILE}"
# Remove the current bundle lines
sed -i '/^# BUNDLE_START/,/^# BUNDLE_END/{//p;d;}' "${SPEC_FILE}"