[dpkg] 27/28: dpkg-buildpackage: Add new --rules-requires-root

Mattia Rizzolo mattia at debian.org
Mon Jan 22 17:11:25 UTC 2018


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

mattia pushed a commit to branch master
in repository dpkg.

commit 585db35d2356193e679dff3eb73d99e65c575f7b
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Oct 28 12:56:42 2017 +0200

    dpkg-buildpackage: Add new --rules-requires-root
    
    This new option makes it possible to force falling back to the legacy
    behavior of assuming that debian/rules files require root.
---
 debian/changelog             | 1 +
 man/dpkg-buildpackage.man    | 4 ++++
 scripts/dpkg-buildpackage.pl | 8 +++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 0a17899..fcfcf6a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -31,6 +31,7 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
   * Specify that DEB_GAIN_ROOT_CMD in R³ should preserve the environment.
     Proposed by Josh Triplett <josh at joshtriplett.org>.
   * Specify new DEB_RULES_REQUIRES_ROOT variable for R³ support.
+  * Add new --rules-requires-root option to dpkg-buildpackage.
   * Architecture support:
     - Add support for riscv64 CPU. Closes: #822914
       Thanks to Manuel A. Fernandez Montecelo <mafm at debian.org>
diff --git a/man/dpkg-buildpackage.man b/man/dpkg-buildpackage.man
index 76545eb..9063511 100644
--- a/man/dpkg-buildpackage.man
+++ b/man/dpkg-buildpackage.man
@@ -276,6 +276,10 @@ Do not check built-in build dependencies and conflicts (since dpkg 1.18.2).
 These are the distribution specific implicit build dependencies usually
 required in a build environment, the so called Build-Essential package set.
 .TP
+.B \-\-rules\-requires\-root
+Do not honor the \fBRules\-Requires\-Root\fP field, falling back to its
+legacy default value (since dpkg 1.19.1).
+.TP
 .BR \-nc ", " \-\-no\-pre\-clean
 Do not clean the source tree (long option since dpkg 1.18.8).
 Implies \fB\-b\fP if nothing else has been selected among \fB\-F\fP,
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index bd0a6f6..49c7173 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -80,6 +80,7 @@ sub usage {
                               do not check builtin build dependencies.
   -P, --build-profiles=<profiles>
                               assume comma-separated build profiles as active.
+      --rules-requires-root   assume legacy Rules-Requires-Root field value.
   -R, --rules-file=<rules>    rules file to execute (default is debian/rules).
   -T, --rules-target=<target> call debian/rules <target>.
       --as-root               ensure -T calls the target with root rights.
@@ -169,6 +170,7 @@ my $host_type = '';
 my $target_arch = '';
 my $target_type = '';
 my @build_profiles = ();
+my $rrr_override;
 my @call_target = ();
 my $call_target_as_root = 0;
 my $since;
@@ -309,6 +311,8 @@ while (@ARGV) {
     } elsif (/^(?:--target=|--rules-target=|-T)(.+)$/) {
         my $arg = $1;
         push @call_target, split /,/, $arg;
+    } elsif (/^--rules-requires-root$/) {
+        $rrr_override = 'binary-targets';
     } elsif (/^--as-root$/) {
         $call_target_as_root = 1;
     } elsif (/^--pre-clean$/) {
@@ -683,10 +687,12 @@ sub parse_rules_requires_root {
     my $ctrl = shift;
 
     my %rrr;
-    my $rrr = $ctrl->{'Rules-Requires-Root'} // 'binary-targets';
+    my $rrr;
     my $keywords_base;
     my $keywords_impl;
 
+    $rrr = $rrr_override // $ctrl->{'Rules-Requires-Root'} // 'binary-targets';
+
     foreach my $keyword (split ' ', $rrr) {
         if ($keyword =~ m{/}) {
             if ($keyword =~ m{^dpkg/target/(.*)$}p and $target_official{$1}) {

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