[dpkg] 131/200: dpkg-genbuildinfo: Add initial support for DEB_BUILD_OPTIONS

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:17:28 UTC 2017


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

infinity0 pushed a commit to branch master
in repository dpkg.

commit feab90e61d0cdaf113a8c233cc584f3125f85924
Author: Guillem Jover <guillem at debian.org>
Date:   Tue Dec 20 11:05:39 2016 +0100

    dpkg-genbuildinfo: Add initial support for DEB_BUILD_OPTIONS
    
    This will make it possible to enable or disable specific features that
    should be recorded in the .buildinfo file. For now only “all” and “path”
    are supported.
    
    Closes: #848705
---
 debian/changelog             |  4 ++++
 man/dpkg-genbuildinfo.man    | 14 ++++++++++++++
 scripts/dpkg-genbuildinfo.pl | 12 +++++++++---
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a5f4ab1..90a46f6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,10 @@ dpkg (1.18.19) UNRELEASED; urgency=medium
     hurd-i386 will still match), it will filter lots of previously matching
     objects that should have been ignored, and will work even when objdump
     does not know about the specific object details. Closes: #849913
+  * Add initial support for DEB_BUILD_OPTIONS to dpkg-genbuildinfo. This will
+    make it possible to enable or disable specific features that should be
+    recorded in the .buildinfo file. For now only “all” and “path” are
+    supported. Closes: #848705
   * Portability:
     - On GNU/Hurd try to use the new process executable name attribute from
       libps, to properly match on start-stop-daemon --exec.
diff --git a/man/dpkg-genbuildinfo.man b/man/dpkg-genbuildinfo.man
index 5a39a76..98f9107 100644
--- a/man/dpkg-genbuildinfo.man
+++ b/man/dpkg-genbuildinfo.man
@@ -130,6 +130,20 @@ Show the usage message and exit.
 .BR \-\-version
 Show the version and exit.
 .
+.SH ENVIRONMENT
+.TP
+.B DEB_BUILD_OPTIONS
+This variable can be used to enable or disable various features that affect
+the information included in the .buildinfo file, via the \fBbuildinfo\fP
+option (since dpkg 1.18.19).
+This option contains a comma-separated list of features, prefixed with the
+‘\fB+\fP’ or ‘\fB\-\fP’ modifiers, to denote whether to enable or disable
+them.
+The special feature “\fBall\fP” can be used to enable or disable all other
+features.
+The feature “\fBpath\fP” controls whether to unconditionally include the
+\fBBuild\-Path\fP field.
+.
 .SH FILES
 .TP
 .B debian/files
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl
index 09bcc13..57f881e 100755
--- a/scripts/dpkg-genbuildinfo.pl
+++ b/scripts/dpkg-genbuildinfo.pl
@@ -36,6 +36,7 @@ use Dpkg::ErrorHandling;
 use Dpkg::Arch qw(get_build_arch get_host_arch);
 use Dpkg::Build::Types;
 use Dpkg::Build::Info qw(get_build_env_whitelist);
+use Dpkg::BuildOptions;
 use Dpkg::BuildFlags;
 use Dpkg::BuildProfiles qw(get_build_profiles);
 use Dpkg::Control::Info;
@@ -59,7 +60,9 @@ my $uploadfilesdir = '..';
 my $outputfile;
 my $stdout = 0;
 my $admindir = $Dpkg::ADMINDIR;
-my $always_include_path = 0;
+my %use_feature = (
+    path => 0,
+);
 my @build_profiles = get_build_profiles();
 my $buildinfo_format = '0.2';
 my $buildinfo;
@@ -295,6 +298,9 @@ sub usage {
 "), $Dpkg::PROGNAME;
 }
 
+my $build_opts = Dpkg::BuildOptions->new();
+$build_opts->parse_features('buildinfo', \%use_feature);
+
 while (@ARGV) {
     $_ = shift @ARGV ;
     if (m/^--build=(.*)$/) {
@@ -317,7 +323,7 @@ while (@ARGV) {
         # Deprecated option
         warning('--buildinfo-id is deprecated, it is without effect');
     } elsif (m/^--always-include-path$/) {
-        $always_include_path = 1;
+        $use_feature{path} = 1;
     } elsif (m/^--admindir=(.*)$/) {
         $admindir = $1;
     } elsif (m/^-(?:\?|-help)$/) {
@@ -407,7 +413,7 @@ $fields->{'Build-Architecture'} = get_build_arch();
 $fields->{'Build-Date'} = get_build_date();
 
 my $cwd = cwd();
-if ($always_include_path) {
+if ($use_feature{path}) {
     $fields->{'Build-Path'} = $cwd;
 } else {
     # Only include the build path if its root path is considered acceptable

-- 
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