File 0001-Ensure-noarch-packages-don-t-get-debuginfo.patch of Package rpm

From 4bc89c300048b82362e31ed9cd4df39867b3b0e4 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Tue, 21 May 2024 12:24:09 +0300
Subject: [PATCH] Ensure noarch packages don't get debuginfo

Add back the %ifnarch noarch test overconfidently removed in
commit 8535694599ee7f35747d44e2ea0a62dc5e8880e5, "it's more complicated
than that". Add a test-case too.

This is band-aid for #3115.
---
 macros.in         |  2 ++
 tests/rpmbuild.at | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/macros.in b/macros.in
index f43912380..ba661d80a 100644
--- a/macros.in
+++ b/macros.in
@@ -195,9 +195,11 @@ package or when debugging this package.\
 %{nil}
 
 %debug_package \
+%ifnarch noarch\
 %global __debug_package 1\
 %_debuginfo_template\
 %{?_debugsource_packages:%_debugsource_template}\
+%endif\
 %{nil}
 
 %_langpack_template() \
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 0e1c628d6..8a06d8a84 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -2224,7 +2224,19 @@ No hello.debug
 [ignore])
 RPMTEST_CLEANUP
 
+AT_SETUP([explicit %_enable_debug_package on noarch])
+AT_KEYWORDS([build debuginfo])
+RPMTEST_CHECK([
+RPMDB_INIT
 
+runroot rpmbuild --quiet -bb \
+		--define "%_enable_debug_packages 1" \
+		/data/SPECS/hlinktest.spec
+],
+[0],
+[ignore],
+[ignore])
+RPMTEST_CLEANUP
 
 # ------------------------------
 # Check dynamic build requires
-- 
2.45.1

openSUSE Build Service is sponsored by