[debhelper-devel] [debhelper] 04/09: dh_strip: Add debuglinks even under D_B_O=noautodbgsym

Niels Thykier nthykier at moszumanska.debian.org
Wed Jun 15 20:29:17 UTC 2016


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 481b565c89583542bb3f8970d14c4749241421a8
Author: Niels Thykier <niels at thykier.net>
Date:   Tue Jun 14 18:47:44 2016 +0000

    dh_strip: Add debuglinks even under D_B_O=noautodbgsym
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog |  4 ++++
 dh_strip         | 18 ++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 446f731..d245459 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,10 @@ debhelper (9.20160403+unreleased) UNRELEASED; urgency=medium
   * dh: Update documentation to reflect the current
     implementation.
   * Remove support for compat 4.
+  * dh_strip: Add debuglinks to ELF binaries even with
+    DEB_BUILD_OPTIONS=noautodbgsym to make the regular deb
+    bit-for-bit reproducible with vs. without this flag.
+    Thanks to Helmut Grohne for the report.
 
  -- Niels Thykier <niels at thykier.net>  Sat, 09 Apr 2016 09:20:32 +0000
 
diff --git a/dh_strip b/dh_strip
index 5222fe8..fcb8c7a 100755
--- a/dh_strip
+++ b/dh_strip
@@ -123,7 +123,10 @@ debug symbol packages.
 
 The automatic creation of debug symbol packages can also be prevented
 by adding B<noautodbgsym> to the B<DEB_BUILD_OPTIONS> environment
-variable.
+variable.  However, B<dh_strip> will still add debuglinks to ELF
+binaries when this flag is set.  This is to ensure that the regular
+deb package will be identical with and without this flag (assuming it
+is otherwise "bit-for-bit" reproducible).
 
 =head1 CONFORMS TO
 
@@ -170,7 +173,8 @@ if (get_buildoption('nostrip')) {
 
 my $objcopy = cross_command("objcopy");
 my $strip = cross_command("strip");
-$dh{ENABLE_DBGSYM} = 0 if get_buildoption('noautodbgsym') or get_buildoption('noddebs');
+my $no_auto_dbgsym = 0;
+$no_auto_dbgsym = 1 if get_buildoption('noautodbgsym') or get_buildoption('noddebs');
 
 # I could just use `file $_[0]`, but this is safer
 sub get_file_type {
@@ -343,6 +347,16 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 			doit($strip, @opts, $_);
 		}
 	}
+	if ($no_auto_dbgsym and $use_build_id > 1) {
+		# When DEB_BUILD_OPTIONS contains noautodbgsym, remove the
+		# dbgsym dir and clear the build-ids.
+		#
+		# Note we have to extract the dbg symbols as usual, since
+		# attach_debug (objcopy --add-gnu-debuglink) requires the dbg
+		# file to exist.
+		doit('rm', '-fr', $debugtmp);
+		@build_ids = ();
+	}
 	if ($use_build_id > 1 and -d $debugtmp) {
 		my $dbgsym_docdir = "${debugtmp}/usr/share/doc";
 		my $doc_symlink = "${dbgsym_docdir}/${package}-dbgsym";

-- 
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