Blob Blame History Raw
From 7bac47a54fef8fc01fa29865a9622677dbdfa28d Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
Date: Wed, 3 Aug 2016 11:14:05 +0200
Subject: [PATCH 55/55] let debuginfo packages provide the build-id

This patch lets debuginfo packages provide build-id like follows:

 debuginfo(build-id) = c63cb23876c5fa85f36beaff58f8557e1bf22517

Originally this patch was written by Jan Blunck <jblunck@suse.de>.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
(cherry picked from commit 95712183458748ea6cafebac1bdd5daa097d9bee)
---
 fileattrs/Makefile.am    |  4 ++--
 fileattrs/debuginfo.attr |  2 ++
 macros.in                |  3 ++-
 scripts/Makefile.am      |  2 ++
 scripts/debuginfo.prov   | 14 ++++++++++++++
 5 files changed, 22 insertions(+), 3 deletions(-)
 create mode 100644 fileattrs/debuginfo.attr
 create mode 100755 scripts/debuginfo.prov

diff --git a/fileattrs/Makefile.am b/fileattrs/Makefile.am
index e54395b3b..148d2ff0d 100644
--- a/fileattrs/Makefile.am
+++ b/fileattrs/Makefile.am
@@ -5,8 +5,8 @@ include $(top_srcdir)/rpm.am
 fattrsdir = $(rpmconfigdir)/fileattrs
 
 fattrs_DATA = \
-	appdata.attr desktop.attr elf.attr font.attr libtool.attr perl.attr \
-	perllib.attr pkgconfig.attr python.attr ocaml.attr script.attr \
+	appdata.attr debuginfo.attr desktop.attr elf.attr font.attr libtool.attr \
+	perl.attr perllib.attr pkgconfig.attr python.attr ocaml.attr script.attr \
 	mono.attr
 
 EXTRA_DIST = $(fattrs_DATA)
diff --git a/fileattrs/debuginfo.attr b/fileattrs/debuginfo.attr
new file mode 100644
index 000000000..03f453843
--- /dev/null
+++ b/fileattrs/debuginfo.attr
@@ -0,0 +1,2 @@
+%__debuginfo_provides %{_rpmconfigdir}/debuginfo.prov
+%__debuginfo_path ^/usr/lib/debug/
diff --git a/macros.in b/macros.in
index 2a114ccd7..962b84ade 100644
--- a/macros.in
+++ b/macros.in
@@ -200,7 +200,8 @@
 %package debuginfo\
 Summary: Debug information for package %{name}\
 Group: Development/Debug\
-AutoReqProv: 0\
+AutoReq: 0\
+AutoProv: 1\
 %description debuginfo\
 This package provides debug information for package %{name}.\
 Debug information is useful when developing applications that use this\
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 036105d63..8e60c3ce7 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -10,6 +10,7 @@ EXTRA_DIST = \
 	brp-strip-shared brp-strip-static-archive \
 	check-files check-prereqs \
 	check-buildroot check-rpaths check-rpaths-worker \
+	debuginfo.prov \
 	find-debuginfo.sh find-lang.sh \
 	perl.prov perl.req pythondeps.sh \
 	rpmdb_loadcvt rpm.daily rpm.log rpm.supp rpm2cpio.sh \
@@ -29,6 +30,7 @@ rpmconfig_SCRIPTS = \
 	brp-strip-shared brp-strip-static-archive \
 	check-files check-prereqs \
 	check-buildroot check-rpaths check-rpaths-worker \
+	debuginfo.prov \
 	find-lang.sh find-requires find-provides \
 	perl.prov perl.req pythondeps.sh \
 	mono-find-requires mono-find-provides \
diff --git a/scripts/debuginfo.prov b/scripts/debuginfo.prov
new file mode 100755
index 000000000..a8636c976
--- /dev/null
+++ b/scripts/debuginfo.prov
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+while read instfile; do
+  case "$instfile" in
+    */usr/lib/debug/.build-id/*.debug)
+      if [ -f "$instfile" ]; then
+        BUILDID=$(echo "$instfile" | sed -ne 's|.*/usr/lib/debug/.build-id/\([0-9a-f]\+\)/\([0-9a-f]\+\)\.debug|\1\2|p')
+        if [ -n "$BUILDID" ]; then
+          echo "debuginfo(build-id) = $BUILDID"
+        fi
+      fi
+      ;;
+  esac
+done
-- 
2.13.2