File setup-pass-define-to-rpmbuild-instead-of-eval-define.patch of Package quilt.40649

From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 14 Mar 2025 17:32:45 +0100
Subject: setup: Pass --define to rpmbuild instead of --eval "%define ..."
Git-commit: ff2210b24772bd675987930cde359a1078b89012
Patch-mainline: yes
References: boo#1238516

Changes in rpmbuild 4.20 break defining macros using --eval "%define
..." for noarch packages. While this is a bug, it is possible and
recommended to define macros using option --define instead, so let's
just do that.

Backporting notes: this also helps with older versions of rpmbuild
when using option --target.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 quilt/setup.in |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -255,13 +255,13 @@ inspect()
 	echo -n "### rpmbuild: " >&4
 
 	PATH="$tmpdir/bin:$PATH" \
-	rpmbuild --eval "%define _sourcedir $abs_sourcedir" \
-		 --eval "%define _specdir   $specdir" \
-		 --eval "%define _builddir  $tmpdir/build" \
-		 --eval "%define __patch    $tmpdir/bin/patch" \
-		 --eval "%define __tar      $tmpdir/bin/tar" \
-		 --eval "%define __unzip    $tmpdir/bin/unzip" \
-		 --eval "$DEFINE_FUZZ" \
+	rpmbuild --define "_sourcedir $abs_sourcedir" \
+		 --define "_specdir   $specdir" \
+		 --define "_builddir  $tmpdir/build" \
+		 --define "__patch    $tmpdir/bin/patch" \
+		 --define "__tar      $tmpdir/bin/tar" \
+		 --define "__unzip    $tmpdir/bin/unzip" \
+		 "${DEFINE_FUZZ[@]}" \
 		 --nodeps \
 		 -bp "$specdir/$specfile" < /dev/null >&5 2>&5
 	status=$?
@@ -315,6 +315,7 @@ eval set -- "$options"
 
 prefix=
 sourcedir=
+declare -a DEFINE_FUZZ
 
 while true
 do
@@ -332,7 +333,7 @@ do
 		shift 2 ;;
 	--fuzz)
 		# Only works with rpm 4.6 and later
-		DEFINE_FUZZ="%define _default_patch_fuzz $2"
+		DEFINE_FUZZ=( "--define" "_default_patch_fuzz $2" )
 		shift 2 ;;
 	--slow)
 		QUILT_SETUP_FAST=
openSUSE Build Service is sponsored by