[Reproducible-commits] [dpkg] 27/37: dpkg-genbuildinfo: implement allowed Build-Paths as a vendor hook
Jérémy Bobbio
lunar at moszumanska.debian.org
Sun Jan 31 16:28:40 UTC 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/buildinfo
in repository dpkg.
commit 414eda95fa3632be4a9c3eab45ab1531b3b7a2fa
Author: Jérémy Bobbio <lunar at debian.org>
Date: Fri Jan 29 16:28:27 2016 +0000
dpkg-genbuildinfo: implement allowed Build-Paths as a vendor hook
We introduce a new vender hook named 'builtin-system-build-paths'
which returns a list of allowed root paths. Make Debian defaults
to '/build/'.
---
scripts/Dpkg/Vendor/Debian.pm | 2 ++
scripts/Dpkg/Vendor/Default.pm | 12 ++++++++++++
scripts/dpkg-genbuildinfo.pl | 11 +++++++++--
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index db40b2c..b981cc4 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -76,6 +76,8 @@ sub run_hook {
$self->_add_reproducible_flags(@params);
$self->_add_sanitize_flags(@params);
$self->_add_hardening_flags(@params);
+ } elsif ($hook eq 'builtin-system-build-paths') {
+ return qw(/build/);
} else {
return $self->SUPER::run_hook($hook, @params);
}
diff --git a/scripts/Dpkg/Vendor/Default.pm b/scripts/Dpkg/Vendor/Default.pm
index 3685001..e44a277 100644
--- a/scripts/Dpkg/Vendor/Default.pm
+++ b/scripts/Dpkg/Vendor/Default.pm
@@ -116,6 +116,16 @@ The hook is called in Dpkg::BuildFlags to allow the vendor to override
the default values set for the various build flags. $flags is a
Dpkg::BuildFlags object.
+=item builtin-system-build-paths ()
+
+The hook is called by dpkg-genbuildinfo to determine if the current
+path should be recorded in the Build-Path field. It takes no parameters,
+but returns a (possibly empty) list of root paths considered acceptable.
+As an example, if the list contains "/build/", a Build-Path field will
+be created if the current directory is "/build/dpkg-1.18.5". If the
+list contains "/", the path will always be recorded. If the list is
+empty, the current path will never be recorded.
+
=back
=cut
@@ -139,6 +149,8 @@ sub run_hook {
my ($textref, $ch_info) = @params;
} elsif ($hook eq 'update-buildflags') {
my $flags = shift @params;
+ } elsif ($hook eq 'builtin-system-build-paths') {
+ return ();
}
# Default return value for unknown/unimplemented hooks
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl
index 8eb5ced..ed02139 100755
--- a/scripts/dpkg-genbuildinfo.pl
+++ b/scripts/dpkg-genbuildinfo.pl
@@ -267,9 +267,16 @@ $fields->{'Architecture'} = join ' ', sort @archvalues;
$fields->{'Version'} = $binaryversion;
my $cwd = cwd();
-# Only include build path if explicitely required or in the common location
-if ($always_include_path or $cwd =~ /\A\/build\//) {
+if ($always_include_path) {
$fields->{'Build-Path'} = $cwd;
+} else {
+ # Only include build path if its root path is considered acceptable by the vendor
+ foreach my $root_path (run_vendor_hook('builtin-system-build-path')) {
+ if (index($cwd, $root_path) == 0) {
+ $fields->{'Build-Path'} = $cwd;
+ last;
+ }
+ }
}
$checksums->export_to_control($fields);
--
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