From 24439cdd27ca8405c5cf3c405108a6ebdd2e6322 Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Wed, 12 Jul 2023 15:20:29 -0400 Subject: [PATCH] [CI:BUILD] Packit: downstream task action fix The downstream `pre-sync` task action script needs GOPATH to be specified for the golist tool mentioned in the script to work. [NO NEW TESTS NEEDED] Signed-off-by: Lokesh Mandvekar (cherry picked from commit 12dc546fc1ba78a05bcc1695c886dbd11e4a76bf) Signed-off-by: Lokesh Mandvekar --- rpm/update-spec-provides.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/rpm/update-spec-provides.sh b/rpm/update-spec-provides.sh index 6f5d3fa0fc..d302beb880 100644 --- a/rpm/update-spec-provides.sh +++ b/rpm/update-spec-provides.sh @@ -4,14 +4,26 @@ # packaging, via the `propose-downstream` packit action. # The goimports don't need to be present upstream. -set -eo pipefail +set -eox pipefail PACKAGE=podman # script is run from git root directory SPEC_FILE=rpm/$PACKAGE.spec -sed -i '/Provides: bundled(golang.*/d' $SPEC_FILE +export GOPATH=~/go +GOPATHDIR=$GOPATH/src/github.com/containers/ +mkdir -p $GOPATHDIR +ln -sf $(pwd) $GOPATHDIR/. + +# Packit sandbox doesn't allow root +# Install golist by downloading and extracting rpm +# We could handle this in packit `sandcastle` upstream itself +# but that depends on golist existing in epel +# https://github.com/packit/sandcastle/pull/186 +dnf download golist +rpm2cpio golist-*.rpm | cpio -idmv -GO_IMPORTS=$(golist --imported --package-path github.com/containers/$PACKAGE --skip-self | sort -u | xargs -I{} echo "Provides: bundled(golang({}))") +sed -i '/Provides: bundled(golang.*/d' $SPEC_FILE +GO_IMPORTS=$(./usr/bin/golist --imported --package-path github.com/containers/$PACKAGE --skip-self | sort -u | xargs -I{} echo "Provides: bundled(golang({}))") awk -v r="$GO_IMPORTS" '/^# vendored libraries/ {print; print r; next} 1' $SPEC_FILE > temp && mv temp $SPEC_FILE