2019-07-03 14:25:36 +00:00
|
|
|
#!/usr/bin/bash -eux
|
2019-09-20 10:49:00 +00:00
|
|
|
. /etc/os-release
|
|
|
|
fedora=$VERSION_ID
|
2019-07-03 14:25:36 +00:00
|
|
|
|
2019-09-20 10:49:00 +00:00
|
|
|
# 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"
|
2019-07-03 14:25:36 +00:00
|
|
|
|
|
|
|
# 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
|
2019-09-20 10:49:00 +00:00
|
|
|
original="/etc/mock/fedora-${fedora}-x86_64.cfg"
|
2019-07-03 14:25:36 +00:00
|
|
|
split=$(sed -n '/\[fedora\]/=' $original | head -n1)
|
|
|
|
head -n$(($split-1)) $original > $config
|
|
|
|
cat /etc/yum.repos.d/test-pyproject-rpm-macros.repo >> $config
|
|
|
|
echo >> $config
|
|
|
|
tail -n +$split $original >> $config
|
|
|
|
fi
|
|
|
|
|
|
|
|
# prepare the rpmbuild folders, make sure nothing relevant is there
|
|
|
|
mkdir -p ~/rpmbuild/{SOURCES,SRPMS}
|
|
|
|
rm -f ~/rpmbuild/SRPMS/${1}-*.src.rpm
|
|
|
|
|
|
|
|
# download the sources and create SRPM
|
|
|
|
spectool -g -R ${1}.spec
|
|
|
|
rpmbuild -bs ${1}.spec
|
|
|
|
|
|
|
|
# build the SRPM in mock
|
2019-09-18 15:09:03 +00:00
|
|
|
res=0
|
2019-07-03 14:25:36 +00:00
|
|
|
mock -r $config --enablerepo=local init
|
2019-09-18 15:09:03 +00:00
|
|
|
mock -r $config --enablerepo=local ~/rpmbuild/SRPMS/${1}-*.src.rpm || res=$?
|
2019-07-03 14:25:36 +00:00
|
|
|
|
|
|
|
# move the results to the artifacts directory, so we can examine them
|
|
|
|
artifacts=${TEST_ARTIFACTS:-/tmp/artifacts}
|
2019-09-20 10:49:00 +00:00
|
|
|
pushd /var/lib/mock/fedora-*-x86_64/result
|
2019-09-18 15:09:03 +00:00
|
|
|
mv *.rpm ${artifacts}/ || :
|
2019-07-03 14:25:36 +00:00
|
|
|
for log in *.log; do
|
|
|
|
mv ${log} ${artifacts}/${1}-${log}
|
|
|
|
done
|
|
|
|
popd
|
2019-09-18 15:09:03 +00:00
|
|
|
|
|
|
|
exit $res
|