webbuild-sudo: fix parsing SPECFILE_BUILDDIR since rpmspec started expanding %setup macro

This commit is contained in:
Silvan Calarco 2024-02-08 17:06:19 +01:00
parent 5354160b25
commit 9d218a005a

View File

@ -88,10 +88,11 @@ if [ "$MODE" = "specinfo" ]; then
done < ${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec
[ "$AUTOBUILDREQ_BEGIN" -a "$AUTOBUILDREQ_END" -a ! "$AUTOBUILDREQ_UNDONE" ] || \
echo "SPECVAR_CHECK_NOAUTOBUILDREQ=1"
$SUCMDPREFIX "rpmspec -P ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec > ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec.tmp 2>/dev/null"
# _setup: prevent %setup macro expansion
$SUCMDPREFIX "rpmspec -P ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec --define \"%setup _setup\" > ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec.tmp 2>/dev/null"
if [ -e $SPECFILE.tmp ]; then
echo "SPECVAR_Specfile=\"$SPECFILE\""
BUILDDIR=`grep -m1 "^%setup.*-n " $SPECFILE.tmp | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
BUILDDIR=`grep -m1 "^_setup.*-n " $SPECFILE.tmp | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
while read line; do
set -- $line
[ "$1" = "%package" -o "$1" = "%description" ] && break