webbuild-sudo: fix defining builddir for %setup without -n argument

This commit is contained in:
Silvan Calarco 2025-01-05 12:24:14 +01:00
parent ad1c0cad9f
commit 23fd85f414

View File

@ -93,10 +93,10 @@ if [ "$MODE" = "specinfo" ]; then
echo "SPECVAR_Specfile=\"$SPECFILE\""
# Resolve builddir by parsing %setup macro or use default
BUILDDIR_UNPARSED=`grep "^%setup" ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
if [ ! "$BUILDDIR_UNPARSED" ]; then
if [ "$BUILDDIR_UNPARSED/%setup" != "$BUILDDIR_UNPARSED" ]; then
BUILDDIR_UNPARSED="$PACKAGE-%{version}"
fi
BUILDDIR=`rpmspec -q --srpm --queryformat \"${BUILDDIR_UNPARSED}\" ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec`
BUILDDIR=`rpmspec -q --srpm --queryformat "${BUILDDIR_UNPARSED}" ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec`
while read line; do
set -- $line
[ "$1" = "%package" -o "$1" = "%description" ] && break