Skip to content

Commit

Permalink
Merge pull request containers#19223 from lsm5/v4.6-packit-downstream-fix
Browse files Browse the repository at this point in the history
[v4.6 backport] [CI:BUILD] Packit: downstream task action fix
  • Loading branch information
openshift-merge-robot authored Jul 13, 2023
2 parents 981e532 + 24439cd commit af2d788
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions rpm/update-spec-provides.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit af2d788

Please sign in to comment.