Fix the setup in tests/Sanity/testsuite

"koji download-build" is a wrong tool to download artifacts being
tested. They are freshly scratch-built and hosted in a local repo
called "test-artifacts" unknown to koji. Using "dnf download"
directly and limited to that specific repo is a correct way to
reach them.

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 15:38:05 +02:00 committed by vkadlcik
parent 86336d536a
commit 5dbfbba047

View File

@ -38,6 +38,7 @@ GCC="${GCC:-$(which gcc)}"
BUILT_BY="${BUILT_BY:-$(which built-by)}"
PACKAGE="${PACKAGE:-$(rpm --qf '%{name}\n' -qf $(which $LD) | head -1)}"
NVR="$(rpm -q --qf='%{NAME}-%{VERSION}-%{RELEASE}' $PACKAGE)"
GCC_PACKAGE="${GCC_PACKAGE:-$(rpm --qf '%{name}\n' -qf $(which $GCC) | head -1)}"
ANNOBIN_PACKAGE="${ANNOBIN_PACKAGE:-$(rpm --qf '%{name}\n' -qf $(which $BUILT_BY) | head -1)}"
@ -50,6 +51,7 @@ rlJournalStart
rlLogInfo "REQUIRES=$REQUIRES"
rlLogInfo "COLLECTIONS=$COLLECTIONS"
rlLogInfo "PACKAGE=$PACKAGE"
rlLogInfo "NVR=$NVR"
rlLogInfo "LD=$LD"
rlLogInfo "GCC=$GCC"
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
@ -80,9 +82,9 @@ rlJournalStart
rlRun "LOGDIR=$TmpDir/LOGS"
# fetch'n'build the source
rlRun "koji download-build --arch=src $(rpm -q binutils)"
rlRun "dnf builddep -y *.src.rpm"
rlRun "rpm -i *.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"
rlRun "rpm -i $NVR.src.rpm"
export SPECDIR=`rpm --eval=%_specdir`
export BUILDDIR=`rpm --eval=%_builddir`
export CURRENT_BUILD=${BUILDDIR}/binutils-`rpmquery $PACKAGE --queryformat=%{VERSION}`