[Reproducible-commits] [dpkg] 92/105: Dpkg::Vendor::Debian: Add fixdebugpath to reproducible feature

Niko Tyni ntyni at moszumanska.debian.org
Mon May 2 13:49:57 UTC 2016


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

ntyni pushed a commit to branch ntyni/reproducible_builds
in repository dpkg.

commit eb58be2f272cf619971d66e40d368111ac0d3dbc
Author: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Date:   Thu Mar 24 13:19:28 2016 -0400

    Dpkg::Vendor::Debian: Add fixdebugpath to reproducible feature
    
    This feature normalizes the path stored in debug symbols, so that
    these symbols can be built reproducibly regardless of the location
    of the build in the larger filesystem.
    
    It defaults to off, but should be enabled by systems trying to
    generate reproducible packages.
    
    [guillem at debian.org:
     - Add additional build flags.
     - Rename feature name.
     - Import Cwd module with require instead of use. ]
    
    Closes: #819194
    Signed-off-by: Guillem Jover <guillem at debian.org>
---
 debian/changelog              |  2 ++
 man/dpkg-buildflags.1         | 10 ++++++++++
 scripts/Dpkg/Vendor/Debian.pm | 14 ++++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 5a26207..22c5744 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -119,6 +119,8 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
       version 1.0 non-native source packages.
     - Include upstream orig tarball signatures in source packages.
       See #759478.
+    - Add fixdebugpath to reproducible feature in Dpkg::Vendor::Debian.
+      Thanks to Daniel Kahn Gillmor <dkg at fifthhorseman.net>. Closes: #819194
   * Build system:
     - Fix building development documentation.
     - Remove unused UA_LIBS variable.
diff --git a/man/dpkg-buildflags.1 b/man/dpkg-buildflags.1
index 577b056..3aa79c7 100644
--- a/man/dpkg-buildflags.1
+++ b/man/dpkg-buildflags.1
@@ -381,6 +381,16 @@ to \fBCPPFLAGS\fP.
 This will cause warnings when the \fB__TIME__\fP, \fB__DATE__\fP and
 \fB\%__TIMESTAMP__\fP macros are used.
 .
+.TP
+.B fixdebugpath
+This setting (disabled by default) adds
+.BI %\-fdebug\-path\-map= BUILDPATH =.
+to \fBCFLAGS\fP, \fBCXXFLAGS\fP, \fBOBJCFLAGS\fP, \fBOBJCXXFLAGS\fP,
+\fBGCJFLAGS\fP, \fBFFLAGS\fP and \fBFCFLAGS\fP where \fBBUILDPATH\fP is
+set to the top-level directory of the package being built.
+This has the effect of removing the build path from any generated debug
+symbols.
+.
 .SH ENVIRONMENT
 There are 2 sets of environment variables doing the same operations, the
 first one (DEB_\fIflag\fP_\fIop\fP) should never be used within
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index bf47144..8e9cee0 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -158,6 +158,7 @@ sub _add_reproducible_flags {
     # Default feature states.
     my %use_feature = (
         timeless => 1,
+        fixdebugpath => 0,
     );
 
     # Adjust features based on user or maintainer's desires.
@@ -168,6 +169,19 @@ sub _add_reproducible_flags {
        $flags->append('CPPFLAGS', '-Wdate-time');
     }
 
+    # Avoid storing the build path in the debug symbols.
+    if ($use_feature{fixdebugpath}) {
+        require Cwd;
+        my $map = '-fdebug-prefix-map=' . Cwd::cwd() . '=.';
+        $flags->append('CFLAGS', $map);
+        $flags->append('CXXFLAGS', $map);
+        $flags->append('OBJCFLAGS', $map);
+        $flags->append('OBJCXXFLAGS', $map);
+        $flags->append('FFLAGS', $map);
+        $flags->append('FCFLAGS', $map);
+        $flags->append('GCJFLAGS', $map);
+    }
+
     # Store the feature usage.
     while (my ($feature, $enabled) = each %use_feature) {
        $flags->set_feature('reproducible', $feature, $enabled);

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



More information about the Reproducible-commits mailing list