summaryrefslogtreecommitdiff
path: root/packaging/debugsource-package.diff
blob: f8e2dfedf94b461937d989313820432c6c18b5a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Subject: Split sources for debugging into separate -debugsource package

At the moment the -debuginfo package also include the sources where used to
build the binary. The patches moves them into a separate package -debugsource.

Index: macros.in
===================================================================
--- macros.in.orig
+++ macros.in
@@ -180,15 +180,27 @@
 %debug_package \
 %ifnarch noarch\
 %global __debug_package 1\
-%package debug\
+%package debuginfo\
 Summary: Debug information for package %{name}\
 Group: Development/Debug\
 AutoReqProv: 0\
-%description debug\
+%description debuginfo\
 This package provides debug information for package %{name}.\
 Debug information is useful when developing applications that use this\
 package or when debugging this package.\
-%files debug -f debugfiles.list\
+%files debuginfo -f debugfiles.list\
+%defattr(-,root,root)\
+\
+%package debugsource\
+Summary: Debug sources for package %{name}\
+Group: Development/Debug\
+AutoReqProv: 0\
+Requires: %{name}-debuginfo = %{version}-%{release}\
+%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 debugsources.list\
 %defattr(-,root,root)\
 %endif\
 %{nil}
Index: scripts/find-debuginfo.sh
===================================================================
--- scripts/find-debuginfo.sh.orig
+++ scripts/find-debuginfo.sh
@@ -187,8 +187,8 @@ set -o pipefail
 strict_error=ERROR
 $strict || strict_error=WARNING
 
-# Strip ELF binaries
-find $RPM_BUILD_ROOT ! -path "${debugdir}/*.debug" -type f \( -perm +111 -or -name "*.so*" -or -name "*.ko" \) -print 0 | sort -z |
+# Strip ELF binaries (and no static libraries)
+find $RPM_BUILD_ROOT ! -path "${debugdir}/*.debug" -type f \( -perm +111 -or -name "*.so*" -or -name "*.ko" \) ! -name "*.a" -print0 | sort -z |
 xargs --no-run-if-empty -0 stat -c '%h %D_%i %n' |
 while read nlinks inum f; do
   case $(objdump -h $f 2>/dev/null | egrep -o '(debug[\.a-z_]*|gnu.version)') in
@@ -300,10 +300,16 @@ if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -
 
   (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
   ) | sed 's,^,/usr/,' >> "$LISTFILE"
 fi
 
+: > "$SOURCEFILE"
+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/,' >> "$SOURCEFILE"
+fi
+
 # Append to $1 only the lines from stdin not already in the file.
 append_uniq()
 {