teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame 0036-Support-debugsource-subpackages.patch

Igor Gnatenko 082d5d
From 01145b9b68b89d0d4d6d5a77d9af70dba7dbc9a3 Mon Sep 17 00:00:00 2001
Igor Gnatenko 082d5d
From: Michael Schroeder <mls@suse.de>
Igor Gnatenko 082d5d
Date: Tue, 28 Mar 2017 14:21:40 +0200
Igor Gnatenko 3992a6
Subject: [PATCH 36/54] Support debugsource subpackages
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
This can be enabled by setting the _debugsource_packages macro.
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
(cherry picked from commit 538cecf0f1fe127dc416afce7a7ee6f94fdb1ad7)
Igor Gnatenko 082d5d
---
Igor Gnatenko 082d5d
 macros.in                 | 28 +++++++++++++++++++++++++---
Igor Gnatenko 082d5d
 scripts/find-debuginfo.sh | 17 ++++++++++++++++-
Igor Gnatenko 082d5d
 2 files changed, 41 insertions(+), 4 deletions(-)
Igor Gnatenko 082d5d
Igor Gnatenko 082d5d
diff --git a/macros.in b/macros.in
Igor Gnatenko 082d5d
index b5bf26ac9..d104ad5a7 100644
Igor Gnatenko 082d5d
--- a/macros.in
Igor Gnatenko 082d5d
+++ b/macros.in
Igor Gnatenko 082d5d
@@ -191,13 +191,12 @@
Igor Gnatenko 082d5d
     %{?_unique_debug_srcs:--unique-debug-src-base "%{name}-%{VERSION}-%{RELEASE}.%{_arch}"} \\\
Igor Gnatenko 082d5d
     %{?_find_debuginfo_dwz_opts} \\\
Igor Gnatenko 082d5d
     %{?_find_debuginfo_opts} \\\
Igor Gnatenko 082d5d
+    %{?_debugsource_packages:-S debugsourcefiles.list} \\\
Igor Gnatenko 082d5d
     "%{_builddir}/%{?buildsubdir}"\
Igor Gnatenko 082d5d
 %{nil}
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
 #	Template for debug information sub-package.
Igor Gnatenko 082d5d
-%debug_package \
Igor Gnatenko 082d5d
-%ifnarch noarch\
Igor Gnatenko 082d5d
-%global __debug_package 1\
Igor Gnatenko 082d5d
+%_debuginfo_template \
Igor Gnatenko 082d5d
 %package debuginfo\
Igor Gnatenko 082d5d
 Summary: Debug information for package %{name}\
Igor Gnatenko 082d5d
 Group: Development/Debug\
Igor Gnatenko 082d5d
@@ -208,6 +207,26 @@ Debug information is useful when developing applications that use this\
Igor Gnatenko 082d5d
 package or when debugging this package.\
Igor Gnatenko 082d5d
 %files debuginfo -f debugfiles.list\
Igor Gnatenko 082d5d
 %defattr(-,root,root)\
Igor Gnatenko 082d5d
+%{nil}
Igor Gnatenko 082d5d
+
Igor Gnatenko 082d5d
+%_debugsource_template \
Igor Gnatenko 082d5d
+%package debugsource\
Igor Gnatenko 082d5d
+Summary: Debug sources for package %{name}\
Igor Gnatenko 082d5d
+Group: Development/Debug\
Igor Gnatenko 082d5d
+AutoReqProv: 0\
Igor Gnatenko 082d5d
+%description debugsource\
Igor Gnatenko 082d5d
+This package provides debug sources for package %{name}.\
Igor Gnatenko 082d5d
+Debug sources are useful when developing applications that use this\
Igor Gnatenko 082d5d
+package or when debugging this package.\
Igor Gnatenko 082d5d
+%files debugsource -f debugsourcefiles.list\
Igor Gnatenko 082d5d
+%defattr(-,root,root)\
Igor Gnatenko 082d5d
+%{nil}
Igor Gnatenko 082d5d
+
Igor Gnatenko 082d5d
+%debug_package \
Igor Gnatenko 082d5d
+%ifnarch noarch\
Igor Gnatenko 082d5d
+%global __debug_package 1\
Igor Gnatenko 082d5d
+%_debuginfo_template\
Igor Gnatenko 082d5d
+%{?_debugsource_packages:%_debugsource_template}\
Igor Gnatenko 082d5d
 %endif\
Igor Gnatenko 082d5d
 %{nil}
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
@@ -517,6 +536,9 @@ package or when debugging this package.\
Igor Gnatenko 082d5d
 # directory under /usr/debug/src as <name>-<ver>-<rel>.<arch>
Igor Gnatenko 082d5d
 %_unique_debug_srcs	1
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
+# Whether rpm should put debug source files into its own subpackage
Igor Gnatenko 082d5d
+#%_debugsource_packages	1
Igor Gnatenko 082d5d
+
Igor Gnatenko 082d5d
 #
Igor Gnatenko 082d5d
 # Use internal dependency generator rather than external helpers?
Igor Gnatenko 082d5d
 %_use_internal_dependency_generator	1
Igor Gnatenko 082d5d
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
index cd2931c0d..bede833d7 100644
Igor Gnatenko 082d5d
--- a/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
+++ b/scripts/find-debuginfo.sh
Igor Gnatenko 082d5d
@@ -4,6 +4,7 @@
Igor Gnatenko 082d5d
 #
Igor Gnatenko 082d5d
 # Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m] [-i] [-n]
Igor Gnatenko 082d5d
 #	 		   [-o debugfiles.list]
Igor Gnatenko 082d5d
+#	 		   [-S debugsourcefiles.list]
Igor Gnatenko 082d5d
 #			   [--run-dwz] [--dwz-low-mem-die-limit N]
Igor Gnatenko 082d5d
 #			   [--dwz-max-die-limit N]
Igor Gnatenko 082d5d
 #			   [--build-id-seed VERSION-RELEASE]
Igor Gnatenko 082d5d
@@ -79,6 +80,7 @@ n_jobs=1
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
 BUILDDIR=.
Igor Gnatenko 082d5d
 out=debugfiles.list
Igor Gnatenko 082d5d
+srcout=
Igor Gnatenko 082d5d
 nout=0
Igor Gnatenko 082d5d
 while [ $# -gt 0 ]; do
Igor Gnatenko 082d5d
   case "$1" in
Igor Gnatenko 082d5d
@@ -147,6 +149,10 @@ while [ $# -gt 0 ]; do
Igor Gnatenko 082d5d
   -j*)
Igor Gnatenko 082d5d
     n_jobs=${1#-j}
Igor Gnatenko 082d5d
     ;;
Igor Gnatenko 082d5d
+  -S)
Igor Gnatenko 082d5d
+    srcout=$2
Igor Gnatenko 082d5d
+    shift
Igor Gnatenko 082d5d
+    ;;
Igor Gnatenko 082d5d
   *)
Igor Gnatenko 082d5d
     BUILDDIR=$1
Igor Gnatenko 082d5d
     shift
Igor Gnatenko 082d5d
@@ -512,10 +518,19 @@ if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
   (cd "${RPM_BUILD_ROOT}/usr"
Igor Gnatenko 082d5d
    test ! -d lib/debug || find lib/debug ! -type d
Igor Gnatenko 082d5d
-   test ! -d src/debug || find src/debug -mindepth 1 -maxdepth 1
Igor Gnatenko 082d5d
+   test ! -d src/debug -o -n "$srcout" || find src/debug -mindepth 1 -maxdepth 1
Igor Gnatenko 082d5d
   ) | sed 's,^,/usr/,' >> "$LISTFILE"
Igor Gnatenko 082d5d
 fi
Igor Gnatenko 082d5d
 
Igor Gnatenko 082d5d
+if [ -n "$srcout" ]; then
Igor Gnatenko 082d5d
+  > "$srcout"
Igor Gnatenko 082d5d
+  if [ -d "${RPM_BUILD_ROOT}/usr/src/debug" ]; then
Igor Gnatenko 082d5d
+    (cd "${RPM_BUILD_ROOT}/usr"
Igor Gnatenko 082d5d
+     find src/debug -mindepth 1 -maxdepth 1
Igor Gnatenko 082d5d
+    ) | sed 's,^,/usr/,' >> "$srcout"
Igor Gnatenko 082d5d
+  fi
Igor Gnatenko 082d5d
+fi
Igor Gnatenko 082d5d
+
Igor Gnatenko 082d5d
 # Append to $1 only the lines from stdin not already in the file.
Igor Gnatenko 082d5d
 append_uniq()
Igor Gnatenko 082d5d
 {
Igor Gnatenko 082d5d
-- 
Igor Gnatenko 082d5d
2.13.2
Igor Gnatenko 082d5d