File fix2.patch of Package build

From 1b857f865d74e95660bda7257de1e67351dff8c5 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Mon, 10 Mar 2025 10:46:03 +0100
Subject: [PATCH] Move rpm macro setup to build-recipe-spec

---
 build-recipe      | 25 ++-----------------------
 build-recipe-spec | 26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/build-recipe b/build-recipe
index ff20e0d9..73e37f47 100644
--- a/build-recipe
+++ b/build-recipe
@@ -243,31 +243,10 @@ expand_recipe_directories() {
     fi
 }
 
-# extract rpm macros from configuration
+# extract macros from configuration
 # these are potentialy also used in non-rpm builds
 recipe_setup_macros() {
-    local rawcfgmacros=.rpmmacros
-    test "$BUILDTYPE" = debbuild && rawcfgmacros=.debmacros
-    queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/$rawcfgmacros
-    if test -n "$BUILD_DEBUG" && test "$BUILDTYPE" != debbuild ; then
-	echo '
-%prep %{?!__debug_package:%{?_build_create_debug:%?_build_insert_debug_package}}%%prep
-%package %{?!__debug_package:%{?_build_create_debug:%?_build_insert_debug_package}}%%package
-%_build_insert_debug_package \
-%global __debug_package 1 \
-%undefine _enable_debug_packages \
-%debug_package
-
-' >> $BUILD_ROOT/root/$rawcfgmacros
-    fi
-
-    if test -n "$BUILD_JOBS" ; then
-	local jobsmacro=$(queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" eval '%{?jobs}')
-	test "$jobsmacro" != '${RPM_BUILD_NCPUS}' && echo "%jobs $BUILD_JOBS" >> $BUILD_ROOT/root/$rawcfgmacros
-	local smpmflagsmacro=$(chroot rpm --eval '%_smp_mflags' 2>/dev/null)
-	if test "$smpmflags" != '-j${RPM_BUILD_NCPUS}' && echo "_smp_mflags -j$BUILD_JOBS" >> $BUILD_ROOT/root/$rawcfgmacros
-    fi
-    test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/$rawcfgmacros $BUILD_ROOT/home/abuild/$rawcfgmacros
+    spec_setup_macros
 }
 
 # generate a .build-changelog file from a .changes file
diff --git a/build-recipe-spec b/build-recipe-spec
index c5cfb2dc..d8c453a7 100644
--- a/build-recipe-spec
+++ b/build-recipe-spec
@@ -392,3 +392,29 @@ recipe_create_deltarpms() {
     fi
 }
 
+# extract rpm macros from configuration
+spec_setup_macros() {
+    local rawcfgmacros=.rpmmacros
+    test "$BUILDTYPE" = debbuild && rawcfgmacros=.debmacros
+    queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/$rawcfgmacros
+    if test -n "$BUILD_DEBUG" && test "$BUILDTYPE" != debbuild ; then
+	echo '
+%prep %{?!__debug_package:%{?_build_create_debug:%?_build_insert_debug_package}}%%prep
+%package %{?!__debug_package:%{?_build_create_debug:%?_build_insert_debug_package}}%%package
+%_build_insert_debug_package \
+%global __debug_package 1 \
+%undefine _enable_debug_packages \
+%debug_package
+
+' >> $BUILD_ROOT/root/$rawcfgmacros
+    fi
+
+    if test -n "$BUILD_JOBS" ; then
+	local jobsmacro=$(queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" eval '%{?jobs}')
+	test "$jobsmacro" != '${RPM_BUILD_NCPUS}' && echo "%jobs $BUILD_JOBS" >> $BUILD_ROOT/root/$rawcfgmacros
+	local smpmflagsmacro=$(chroot rpm --eval '%_smp_mflags' 2>/dev/null)
+	test "$smpmflags" != '-j${RPM_BUILD_NCPUS}' && echo "_smp_mflags -j$BUILD_JOBS" >> $BUILD_ROOT/root/$rawcfgmacros
+    fi
+    test $BUILD_USER = abuild && cp -p "$BUILD_ROOT/root/$rawcfgmacros" "$BUILD_ROOT/home/abuild/$rawcfgmacros"
+}
+
openSUSE Build Service is sponsored by