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