This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=a034e7d53b0c96c419d71c86921d2a509b0d79bc commit a034e7d53b0c96c419d71c86921d2a509b0d79bc Author: Guillem Jover <[email protected]> AuthorDate: Mon Jul 30 16:42:21 2018 +0200 Dpkg::Vendor::Debian: Add fixfilepath support to reproducible feature This is a superset of the fixdebugpath feature supported by gcc-8, but covering in addition mappings for macros such as __FILE__ and similar. --- debian/changelog | 1 + man/dpkg-buildflags.man | 11 +++++++++++ scripts/Dpkg/Vendor/Debian.pm | 21 +++++++++++++++++---- scripts/t/Dpkg_BuildFlags.t | 1 + 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index d407098b0..5f45df110 100644 --- a/debian/changelog +++ b/debian/changelog @@ -168,6 +168,7 @@ dpkg (1.19.1) UNRELEASED; urgency=medium design, this was the only exception, which has become a source of packaging problems as of late. This was apparently an oversight in the original implementation. Closes: #854438 + - Dpkg::Vendor::Debian: Add fixfilepath support to reproducible feature. * Documentation: - Update gettext minimal version in README. - Add a missing dot on the dpkg-buildflags(1) «lfs» feature paragraph. diff --git a/man/dpkg-buildflags.man b/man/dpkg-buildflags.man index 7712c5576..ba18dbbb7 100644 --- a/man/dpkg-buildflags.man +++ b/man/dpkg-buildflags.man @@ -476,6 +476,17 @@ This will cause warnings when the \fB__TIME__\fP, \fB__DATE__\fP and \fB__TIMESTAMP__\fP macros are used. . .TP +.B fixfilepath +This setting (disabled by default) adds +.BI \-ffile\-prefix\-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 file. + +If both \fBfixdebugpath\fP and \fBfixfilepath\fP are set, this option +takes precedence, because it is a superset of the former. +.TP .B fixdebugpath This setting (enabled by default) adds .BI \-fdebug\-prefix\-map= BUILDPATH =. diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm index 1e8f24397..4bcf120e0 100644 --- a/scripts/Dpkg/Vendor/Debian.pm +++ b/scripts/Dpkg/Vendor/Debian.pm @@ -100,6 +100,7 @@ sub _add_build_flags { }, reproducible => { timeless => 1, + fixfilepath => 0, fixdebugpath => 1, }, sanitize => { @@ -205,7 +206,8 @@ sub _add_build_flags { my $build_path; # Mask features that might have an unsafe usage. - if ($use_feature{reproducible}{fixdebugpath}) { + if ($use_feature{reproducible}{fixfilepath} or + $use_feature{reproducible}{fixdebugpath}) { require Cwd; $build_path = $ENV{DEB_BUILD_PATH} || Cwd::cwd(); @@ -214,6 +216,7 @@ sub _add_build_flags { # so that we do not need to worry about escaping the characters # on output. if ($build_path =~ m/[^-+:.0-9a-zA-Z~\/_]/) { + $use_feature{reproducible}{fixfilepath} = 0; $use_feature{reproducible}{fixdebugpath} = 0; } } @@ -223,9 +226,19 @@ sub _add_build_flags { $flags->append('CPPFLAGS', '-Wdate-time'); } - # Avoid storing the build path in the debug symbols. - if ($use_feature{reproducible}{fixdebugpath}) { - my $map = '-fdebug-prefix-map=' . $build_path . '=.'; + # Avoid storing the build path in the binaries. + if ($use_feature{reproducible}{fixfilepath} or + $use_feature{reproducible}{fixdebugpath}) { + my $map; + + # -ffile-prefix-map is a superset of -fdebug-prefix-map, prefer it + # if both are set. + if ($use_feature{reproducible}{fixfilepath}) { + $map = '-ffile-prefix-map=' . $build_path . '=.'; + } else { + $map = '-fdebug-prefix-map=' . $build_path . '=.'; + } + $flags->append('CFLAGS', $map); $flags->append('CXXFLAGS', $map); $flags->append('OBJCFLAGS', $map); diff --git a/scripts/t/Dpkg_BuildFlags.t b/scripts/t/Dpkg_BuildFlags.t index 776fdf1a4..b087e0ab2 100644 --- a/scripts/t/Dpkg_BuildFlags.t +++ b/scripts/t/Dpkg_BuildFlags.t @@ -66,6 +66,7 @@ my %known_features = ( ) ], reproducible => [ qw( fixdebugpath + fixfilepath timeless ) ], sanitize => [ qw( -- Dpkg.Org's dpkg

