summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Thykier <niels@thykier.net>2016-06-14 18:47:44 +0000
committerNiels Thykier <niels@thykier.net>2016-06-15 20:20:29 +0000
commit481b565c89583542bb3f8970d14c4749241421a8 (patch)
tree679cac582a91adda23646efc20c1b56150abe02d
parentea488551db0821b73af7f969db7373d2e1f06bb8 (diff)
downloaddebhelper-481b565c89583542bb3f8970d14c4749241421a8.tar.gz
dh_strip: Add debuglinks even under D_B_O=noautodbgsym
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/changelog4
-rwxr-xr-xdh_strip18
2 files changed, 20 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 446f7311..d245459a 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@thykier.net> Sat, 09 Apr 2016 09:20:32 +0000
diff --git a/dh_strip b/dh_strip
index 5222fe8c..fcb8c7a7 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";