Make sure we test the correct SRPM

rlFetchSrcForInstalled is very resourceful and I'm afraid it may find
and download a SRPM of the matching NVR from other sources, not
necessarily the same we want to test. Since we know the CI tests
a scratch build hosted in a local repo called "test-artifacts" then
using "dnf download" directly and limited to that specific repo is
a better approach.

I'm adding a fallback using the repo's local files just in case "dnf"
suffers some temporary hiccup.
This commit is contained in:
Václav Kadlčík 2021-09-24 11:29:37 +02:00 committed by vkadlcik
parent 461c56c6ec
commit 3523d0b26a

View File

@ -33,12 +33,13 @@ PACKAGE="nasm"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "NVR=$(rpm -q --qf='%{NAME}-%{VERSION}-%{RELEASE}' $PACKAGE)"
rlRun "TMP=\$(mktemp -p $HOME -d)"
rlRun "pushd $TMP"
rlFetchSrcForInstalled $PACKAGE
rlRun "dnf builddep -y *src.rpm --nobest"
rlRun "rpm --define='_topdir $TMP' -Uvh *src.rpm"
rlRun "dnf download --disablerepo='*' --enablerepo=test-artifacts --source $NVR || cp /var/share/test-artifacts/$NVR.src.rpm ."
rlRun "dnf builddep -y $NVR.src.rpm --nobest"
rlRun "rpm --define='_topdir $TMP' -Uvh $NVR.src.rpm"
rlRun "rpmbuild --define='_topdir $TMP' -bc SPECS/nasm.spec"
rlPhaseEnd