Package: debhelper
Version: 8.9.7
Severity: wishlist
Tags: patch

Here's a patch to make dh_strip use build-id if compat is >=9. Please note that this requires relatively new binutils to work as expected, but that shouldn't be a big deal, since it'll just fall back to the old path-based schema if build-id cannot be extracted.

--
Jakub Wilk
diff --git a/dh_strip b/dh_strip
--- a/dh_strip
+++ b/dh_strip
@@ -161,7 +161,15 @@
 	return unless get_file_type($file) =~ /not stripped/;
 
 	my ($base_file)=$file=~/^\Q$tmp\E(.*)/;
-	my $debug_path=$desttmp."/usr/lib/debug/".$base_file;
+	my $debug_path;
+	if (! compat(8)) {
+		my $elfnotes=`readelf -n $file`;
+		$debug_path=$desttmp."/usr/lib/debug/.build-id/$1/$2.debug"
+			if $elfnotes=~/^\s+Build ID: ([0-9a-f]{2})([0-9a-f]+)$/m;
+	}
+	if (! defined($debug_path)) {
+		$debug_path=$desttmp."/usr/lib/debug/".$base_file;
+	}
 	my $debug_dir=dirname($debug_path);
 	if (! -d $debug_dir) {
 		doit("install", "-d", $debug_dir);

Reply via email to