[debhelper-devel] [debhelper] 01/07: Add X-Build-Ids to all debug packages built with dh_strip

Niels Thykier nthykier at moszumanska.debian.org
Sat Aug 22 17:35:36 UTC 2015


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 5549f841fd7cba07e21df8e4f70b21c31cfb3da6
Author: Paul Tagliamonte <tag at pault.ag>
Date:   Tue Aug 18 21:29:58 2015 +0200

    Add X-Build-Ids to all debug packages built with dh_strip
    
    This is outstandingly helpful for anyone looking to track down what
    debug package provides the symbols for the build id they're looking at.
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 dh_gencontrol | 14 +++++++++++---
 dh_strip      | 12 ++++++++++--
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/dh_gencontrol b/dh_gencontrol
index 7512545..ff205e0 100755
--- a/dh_gencontrol
+++ b/dh_gencontrol
@@ -78,12 +78,15 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	if (! -e $substvars || system("grep -q '^misc:Pre-Depends=' $substvars") != 0) {
 		complex_doit("echo misc:Pre-Depends= >> $substvars");
 	}
-	
+
+	my $build_ids = undef;
+	if ( -d $ddeb_info_dir ) {
+		$build_ids = read_ddeb_build_ids($ddeb_info_dir);
+	}
 
 	if ( -d $ddeb_tmp) {
 		my $multiarch = package_multiarch($package);
 		my $replaces = read_ddeb_migration($ddeb_info_dir);
-		my $build_ids = read_ddeb_build_ids($ddeb_info_dir);
 
 		# Remove and override more or less every standard field.
 		my @ddeb_options = (qw(
@@ -120,9 +123,14 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 		doit("chown","0:0","${ddeb_tmp}/DEBIAN/control");
 	}
 
+	my @debug_info_params = ();
+	if ($build_ids) {
+		push(@debug_info_params, "-DX-Build-Ids=${build_ids}");
+	}
+
 	# Generate and install control file.
 	doit("dpkg-gencontrol", "-p$package", "-l$changelog", "-T$substvars",
-		"-P$tmp",@{$dh{U_PARAMS}});
+		"-P$tmp", @debug_info_params, @{$dh{U_PARAMS}});
 
 	# This chmod is only necessary if the user sets the umask to
 	# something odd.
diff --git a/dh_strip b/dh_strip
index 7149e14..7937303 100755
--- a/dh_strip
+++ b/dh_strip
@@ -9,6 +9,7 @@ dh_strip - strip executables, shared libraries, and some static libraries
 use strict;
 use warnings;
 use File::Find;
+use File::Path 'make_path';
 use Debian::Debhelper::Dh_Lib;
 
 =head1 SYNOPSIS
@@ -254,8 +255,15 @@ sub make_debug {
 		doit($objcopy, "--only-keep-debug", "--compress-debug-sections", $file, $debug_path);
 	}
 
-	if ($use_build_id > 1) {
-		my $path = "debian/.debhelper/${package}/ddeb-build-ids";
+	if ($use_build_id) {
+		my $debugpackagename=$package;
+		if (ref $dh{DEBUGPACKAGES}) {
+			$debugpackagename=@{$dh{DEBUGPACKAGES}}[0];
+		}
+
+		my $internal_path = "debian/.debhelper/${debugpackagename}";
+		make_path($internal_path) if ! -d $internal_path;
+		my $path = "${internal_path}/ddeb-build-ids";
 		open(my $fd, '>>', $path) or error("open $path failed: $!");
 		print {$fd} "$debug_build_id ";
 		close($fd) or error("close $path failed: $!");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list