[dpkg] 01/01: BUILD_PATH_PREFIX_MAP
Ximin Luo
infinity0 at debian.org
Wed Apr 5 15:17:57 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/build_path_prefix_map
in repository dpkg.
commit ea1d51f745ffc82c5314c6022022e8b78e359470
Author: Ximin Luo <infinity0 at debian.org>
Date: Sat Apr 1 10:02:40 2017 -0400
BUILD_PATH_PREFIX_MAP
---
debian/changelog | 6 ++++++
scripts/Dpkg/Path.pm | 17 +++++++++++++++++
scripts/Dpkg/Vendor/Debian.pm | 2 +-
scripts/dpkg-buildpackage.pl | 4 +++-
scripts/dpkg-genbuildinfo.pl | 5 ++++-
scripts/dpkg-source.pl | 3 +++
scripts/mk/pkg-info.mk | 15 ++++++++++++++-
7 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 6538c61..97918d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+dpkg (1.18.23.0~reproducible1) unstable; urgency=medium
+
+ * BUILD_PATH_PREFIX_MAP
+
+ -- Ximin Luo <infinity0 at debian.org> Fri, 31 Mar 2017 15:58:56 -0400
+
dpkg (1.18.23) unstable; urgency=medium
* Handle unmatched arch-qualified virtual packages in dpkg-genbuildinfo,
diff --git a/scripts/Dpkg/Path.pm b/scripts/Dpkg/Path.pm
index f352cac..058ac85 100644
--- a/scripts/Dpkg/Path.pm
+++ b/scripts/Dpkg/Path.pm
@@ -30,6 +30,7 @@ our @EXPORT_OK = qw(
get_pkg_root_dir
guess_pkg_root_dir
relative_to_pkg_root
+ bppm_append
);
use Exporter qw(import);
@@ -277,6 +278,22 @@ sub find_build_file($) {
return;
}
+sub bppm_enquote {
+ my $part = shift;
+ $part =~ s/%/%#/g;
+ $part =~ s/=/%+/g;
+ $part =~ s/:/%./g;
+ return $part;
+}
+
+sub bppm_append($$) {
+ my $dst = shift;
+ my $src = shift;
+ my $curmap = $ENV{"BUILD_PATH_PREFIX_MAP"};
+ $ENV{"BUILD_PATH_PREFIX_MAP"} = ($curmap ? $curmap . ":" : "") .
+ bppm_enquote($dst) . "=" . bppm_enquote($src);
+}
+
=back
=head1 CHANGES
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 091ec42..2562b29 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -145,7 +145,7 @@ sub _add_reproducible_flags {
# Default feature states.
my %use_feature = (
timeless => 1,
- fixdebugpath => 1,
+ fixdebugpath => 0,
);
my $build_path;
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 2eea203..0543205 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -43,7 +43,7 @@ use Dpkg::Version;
use Dpkg::Control;
use Dpkg::Control::Info;
use Dpkg::Changelog::Parse;
-use Dpkg::Path qw(find_command);
+use Dpkg::Path qw(find_command bppm_append);
use Dpkg::IPC;
textdomain('dpkg-dev');
@@ -449,6 +449,8 @@ if ($changedby) {
# <https://reproducible-builds.org/specs/source-date-epoch/>
$ENV{SOURCE_DATE_EPOCH} ||= $changelog->{timestamp} || time;
+# <https://reproducible-builds.org/specs/build-path-prefix-map/>
+bppm_append("${pkg}_${version}", $cwd);
my @arch_opts;
push @arch_opts, ('--host-arch', $host_arch) if $host_arch;
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl
index 27bf7dc..1e2d056 100755
--- a/scripts/dpkg-genbuildinfo.pl
+++ b/scripts/dpkg-genbuildinfo.pl
@@ -249,11 +249,14 @@ sub collect_installed_builddeps {
sub cleansed_environment {
# Consider only whitelisted variables which are not supposed to leak
# local user information.
+ my @env_whitelist = get_build_env_whitelist();
+ # See <https://reproducible-builds.org/specs/build-path-prefix-map>.
+ push(@env_whitelist, "BUILD_PATH_PREFIX_MAP") if ($use_feature{path});
my %env = map {
$_ => $ENV{$_}
} grep {
exists $ENV{$_}
- } get_build_env_whitelist();
+ } @env_whitelist;
# Record flags from dpkg-buildflags.
my $bf = Dpkg::BuildFlags->new();
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index dbb182f..c5fcaaa 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -48,6 +48,7 @@ use Dpkg::Substvars;
use Dpkg::Version;
use Dpkg::Vars;
use Dpkg::Changelog::Parse;
+use Dpkg::Path qw(bppm_append);
use Dpkg::Source::Package qw(get_default_diff_ignore_regex
set_default_diff_ignore_regex
get_default_tar_ignore_pattern);
@@ -238,6 +239,8 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
# <https://reproducible-builds.org/specs/source-date-epoch/>
$ENV{SOURCE_DATE_EPOCH} ||= $changelog->{timestamp} || time;
+ # <https://reproducible-builds.org/specs/build-path-prefix-map/>
+ bppm_append($changelog->{source} . "_" . $changelog->{version}, Cwd::abs_path($dir));
my $srcpkg = Dpkg::Source::Package->new(options => \%options);
my $fields = $srcpkg->{fields};
diff --git a/scripts/mk/pkg-info.mk b/scripts/mk/pkg-info.mk
index 15322ce..ae2ce03 100644
--- a/scripts/mk/pkg-info.mk
+++ b/scripts/mk/pkg-info.mk
@@ -9,6 +9,10 @@
#
# SOURCE_DATE_EPOCH: the source release date as seconds since the epoch, as
# specified by <https://reproducible-builds.org/specs/source-date-epoch/>
+#
+# BUILD_PATH_PREFIX_MAP: the package name and version mapped to the top-level
+# absolute package directory, as specified by
+# <https://reproducible-builds.org/specs/build-path-prefix-map/>
dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
@@ -20,5 +24,14 @@ DEB_VERSION_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM,echo '$(DEB_VE
DEB_DISTRIBUTION = $(call dpkg_late_eval,DEB_DISTRIBUTION,dpkg-parsechangelog -SDistribution)
SOURCE_DATE_EPOCH ?= $(call dpkg_late_eval,SOURCE_DATE_EPOCH,dpkg-parsechangelog -STimestamp)
-
export SOURCE_DATE_EPOCH
+
+bppm_enquote = $(subst :,%.,$(subst =,%+,$(subst %,%\#,$(1))))
+BUILD_PATH_PREFIX_MAP ?= $(call dpkg_late_eval,BUILD_PATH_PREFIX_MAP,echo\
+"$${BUILD_PATH_PREFIX_MAP:+$$BUILD_PATH_PREFIX_MAP:}"$(call\
+bppm_enquote,$(DEB_SOURCE)_$(DEB_VERSION))=$(call\
+bppm_enquote,$(CURDIR)))
+export BUILD_PATH_PREFIX_MAP
+
+# FIXME: "export" makes dpkg_late_eval completely pointless since it forces
+# evaluation. This is true for both SOURCE_DATE_EPOCH and BUILD_PATH_PREFIX_MAP
--
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