Fedora CI: Run mock on the current Fedora version (or 31 if less than 31)

This commit is contained in:
Miro Hrončok 2019-09-20 12:49:00 +02:00
parent 137aa316c4
commit 2a3b101709

View File

@ -1,12 +1,20 @@
#!/usr/bin/bash -eux
. /etc/os-release
fedora=$VERSION_ID
config="/tmp/fedora-rawhide-x86_64-ci.cfg"
# we don't have dynamic BuildRequires on Fedora 30
# so we at least test that we can build in a Fedora 31 mock
if [ $fedora -lt 31 ]; then
fedora=31
fi
config="/tmp/fedora-${fedora}-x86_64-ci.cfg"
# create mock config if not present
# this makes sure tested version of pyproject-rpm-macros is available
# TODO: check if it has precedence if the release was not bumped in tested PR
if [ ! -f $config ]; then
original="/etc/mock/fedora-rawhide-x86_64.cfg"
original="/etc/mock/fedora-${fedora}-x86_64.cfg"
split=$(sed -n '/\[fedora\]/=' $original | head -n1)
head -n$(($split-1)) $original > $config
cat /etc/yum.repos.d/test-pyproject-rpm-macros.repo >> $config
@ -29,7 +37,7 @@ mock -r $config --enablerepo=local ~/rpmbuild/SRPMS/${1}-*.src.rpm || res=$?
# move the results to the artifacts directory, so we can examine them
artifacts=${TEST_ARTIFACTS:-/tmp/artifacts}
pushd /var/lib/mock/fedora-rawhide-x86_64/result
pushd /var/lib/mock/fedora-*-x86_64/result
mv *.rpm ${artifacts}/ || :
for log in *.log; do
mv ${log} ${artifacts}/${1}-${log}