[Reproducible-commits] [dpkg] 28/74: dpkg-buildpackage: Add config file support

Mattia Rizzolo mattia at debian.org
Sun Jul 3 22:22:54 UTC 2016


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

mattia pushed a commit to annotated tag 1.18.8
in repository dpkg.

commit fc55edbf31dc9d8649229fdca441cb63844424d9
Author: Guillem Jover <guillem at debian.org>
Date:   Mon Nov 3 19:38:00 2014 +0100

    dpkg-buildpackage: Add config file support
    
    The new configuration file is buildpackage.conf under either the dpkg
    system or user configuration directories.
    
    Closes: #539692, #765494
---
 debian/changelog             |  3 +++
 man/dpkg-buildpackage.1      | 16 ++++++++++++++++
 scripts/dpkg-buildpackage.pl |  8 ++++++++
 3 files changed, 27 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 111badc..d48c6de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
     Thanks to Steven Chamberlain <steven at pyro.eu.org>.
   * Add new long options in dpkg-buildpackage for any short option that is
     a useful configurable candidate.
+  * Add configuration file support to dpkg-buildpackage, as buildpackage.conf
+    under either the dpkg system or user configuration directories.
+    Closes: #539692, #765494
   * Perl modules:
     - Use warnings::warnif() instead of carp() for deprecated warnings.
     - Add new format_range() method and deprecate dpkg() and rfc822() methods
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index a60f180..6908905 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -85,6 +85,12 @@ UNRELEASED builds).
 It runs the \fBdone\fP hook.
 .
 .SH OPTIONS
+All long options can be specified both on the command line and in the
+\fBdpkg\-buildpackage\fP system and user configuration files.
+Each line in the configuration file is either an option (exactly the same
+as the command line option but without leading hyphens) or a comment (if
+it starts with a \(oq\fB#\fP\(cq).
+
 .TP
 .BI \-\-build= type
 Specifies the build \fItype\fP from a comma-separated list of components
@@ -465,6 +471,16 @@ standalone should be supported.
 parameters forwarded. Any variable that is output by its \fB\-s\fP
 option is integrated in the build environment.
 .
+.SH FILES
+.TP
+.I /etc/dpkg/buildpackage.conf
+System wide configuration file
+.TP
+.IR $XDG_CONFIG_HOME/dpkg/buildflags.conf " or"
+.TQ
+.I $HOME/.config/dpkg/buildflags.conf
+User configuration file.
+.
 .SH NOTES
 .SS Compiler flags are no longer exported
 Between dpkg 1.14.17 and 1.16.1, \fBdpkg\-buildpackage\fP
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 5d19f95..7ff0384 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -35,6 +35,7 @@ use Dpkg::ErrorHandling;
 use Dpkg::Build::Types;
 use Dpkg::BuildOptions;
 use Dpkg::BuildProfiles qw(set_build_profiles);
+use Dpkg::Conf;
 use Dpkg::Compression;
 use Dpkg::Checksums;
 use Dpkg::Version;
@@ -173,6 +174,13 @@ my @hook_names = qw(
 my %hook;
 $hook{$_} = undef foreach @hook_names;
 
+
+my $conf = Dpkg::Conf->new();
+$conf->load_config('buildpackage.conf');
+
+# Inject config options for command-line parser.
+unshift @ARGV, @{$conf};
+
 my $build_opts = Dpkg::BuildOptions->new();
 
 if ($build_opts->has('nocheck')) {

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