Re: [Rpm-maint] [PATCH] Support debugsource subpackages

2017-03-24 Thread Dmitry V. Levin
On Fri, Mar 24, 2017 at 04:15:36PM +0100, Michael Schroeder wrote:
> 
> The attached patch makes rpm create -debugsource subpackages containing
> the debug sources.
[...]
> +if [ -n "$srcout" ]; then
> +  > "$srcout"
> +  if [ -d "${RPM_BUILD_ROOT}/usr/src" ]; then
> +(cd "${RPM_BUILD_ROOT}/usr"
> + test ! -d src/debug || find src/debug -mindepth 1 -maxdepth 1
> +) | sed 's,^,/usr/,' >> "$srcout"
> +  fi
> +fi
> +

Why do you need two subsequent checks here?  This could be done with
a single [ -d "${RPM_BUILD_ROOT}/usr/src/debug" ] check.


-- 
ldv


signature.asc
Description: PGP signature
___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


[Rpm-maint] [PATCH] Support debugsource subpackages

2017-03-24 Thread Michael Schroeder

The attached patch makes rpm create -debugsource subpackages containing
the debug sources.

Cheers,
  Michael.

-- 
Michael Schroeder   m...@suse.de
SUSE LINUX GmbH,   GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
>From 04f11f213ebdd60418a420712376bc6314c744fb Mon Sep 17 00:00:00 2001
From: Michael Schroeder 
Date: Wed, 22 Mar 2017 17:10:27 +0100
Subject: [PATCH 1/2] Support debugsource subpackages

This can be enabled by setting the _debugsource_packages macro.
---
 macros.in | 29 +
 scripts/find-debuginfo.sh | 17 -
 2 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/macros.in b/macros.in
index f7d16de..b2cfceb 100644
--- a/macros.in
+++ b/macros.in
@@ -172,13 +172,11 @@
 #	the script.  See the script for details.
 #
 %__debug_install_post   \
-   %{_rpmconfigdir}/find-debuginfo.sh %{?_smp_mflags} %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_include_gdb_index:-i} %{?_unique_build_ids:--ver-rel "%{VERSION}-%{RELEASE}"} %{?_unique_debug_names:--unique-debug-arch "%{_arch}"} %{?_unique_debug_srcs:--unique-debug-src-base "%{name}"} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
+   %{_rpmconfigdir}/find-debuginfo.sh %{?_smp_mflags} %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_include_gdb_index:-i} %{?_unique_build_ids:--ver-rel "%{VERSION}-%{RELEASE}"} %{?_unique_debug_names:--unique-debug-arch "%{_arch}"} %{?_unique_debug_srcs:--unique-debug-src-base "%{name}"} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} %{?_debugsource_packages:-S debugsourcefiles.list} "%{_builddir}/%{?buildsubdir}"\
 %{nil}
 
 #	Template for debug information sub-package.
-%debug_package \
-%ifnarch noarch\
-%global __debug_package 1\
+%_debuginfo_template \
 %package debuginfo\
 Summary: Debug information for package %{name}\
 Group: Development/Debug\
@@ -190,6 +188,26 @@ Debug information is useful when developing applications that use this\
 package or when debugging this package.\
 %files debuginfo -f debugfiles.list\
 %defattr(-,root,root)\
+%{nil}
+
+%_debugsource_template \
+%package debugsource\
+Summary: Debug sources for package %{name}\
+Group: Development/Debug\
+AutoReqProv: 0\
+%description debugsource\
+This package provides debug sources for package %{name}.\
+Debug sources are useful when developing applications that use this\
+package or when debugging this package.\
+%files debugsource -f debugsourcefiles.list\
+%defattr(-,root,root)\
+%{nil}
+
+%debug_package \
+%ifnarch noarch\
+%global __debug_package 1\
+%_debuginfo_template\
+%{?_debugsource_packages:%_debugsource_template}\
 %endif\
 %{nil}
 
@@ -511,6 +529,9 @@ package or when debugging this package.\
 # directory under /usr/debug/src as --.
 %_unique_debug_srcs	1
 
+# Whether rpm should put debug source files into an own subpackage
+#%_debugsource_packages	1
+
 #
 # Use internal dependency generator rather than external helpers?
 %_use_internal_dependency_generator	1
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index 547dbd9..cdae26e 100644
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -4,6 +4,7 @@
 #
 # Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m] [-i]
 #	 		   [-o debugfiles.list]
+#	 		   [-S debugsourcefiles.list]
 #			   [--run-dwz] [--dwz-low-mem-die-limit N]
 #			   [--dwz-max-die-limit N]
 #			   [--ver-rel VERSION-RELEASE]
@@ -75,6 +76,7 @@ n_jobs=1
 
 BUILDDIR=.
 out=debugfiles.list
+srcout=
 nout=0
 while [ $# -gt 0 ]; do
   case "$1" in
@@ -140,6 +142,10 @@ while [ $# -gt 0 ]; do
   -j*)
 n_jobs=${1#-j}
 ;;
+  -S)
+srcout=$2
+shift
+;;
   *)
 BUILDDIR=$1
 shift
@@ -503,10 +509,19 @@ if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then
 
   (cd "${RPM_BUILD_ROOT}/usr"
test ! -d lib/debug || find lib/debug ! -type d
-   test ! -d src/debug || find src/debug -mindepth 1 -maxdepth 1
+   test ! -d src/debug -o -n "$srcout" || find src/debug -mindepth 1 -maxdepth 1
   ) | sed 's,^,/usr/,' >> "$LISTFILE"
 fi
 
+if [ -n "$srcout" ]; then
+  > "$srcout"
+  if [ -d "${RPM_BUILD_ROOT}/usr/src" ]; then
+(cd "${RPM_BUILD_ROOT}/usr"
+ test ! -d src/debug || find src/debug -mindepth 1 -maxdepth 1
+) | sed 's,^,/usr/,' >> "$srcout"
+  fi
+fi
+
 # Append to $1 only the lines from stdin not already in the file.
 append_uniq()
 {
-- 
2.1.4

___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint