[Reproducible-commits] [dpkg] 43/90: dpkg-buildpackage: Add new -J option

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Aug 29 18:26:13 UTC 2015


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

lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit ec206658f9196eed04789d551d43651383e3fbc4
Author: Guillem Jover <guillem at debian.org>
Date:   Mon Jun 29 04:05:05 2015 +0200

    dpkg-buildpackage: Add new -J option
    
    This option behaves in the same way as -j, except that it does not set
    the MAKEFLAGS environment variable, and as such it is safer to use with
    any package including those that are not parallel-build safe.
---
 debian/changelog             |  1 +
 man/dpkg-buildpackage.1      |  6 ++++++
 scripts/dpkg-buildpackage.pl | 16 ++++++++++++----
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ae01285..6c37dff 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ dpkg (1.18.2) UNRELEASED; urgency=low
 
   [ Guillem Jover ]
   * Fix plural form translations for single plural languages. Closes: #790025
+  * Add new dpkg-buildpackage -J option, which is a safe version of -j.
   * Perl modules:
     - Remove non-functional timezone name support from
       Dpkg::Changelog::Entry::Debian.
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 4419f84..4543967 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -200,6 +200,12 @@ currently active processors, and as such will not get propagated to any
 child process. If the number of online processors cannot be inferred then
 the code will fallback to using an unlimited number.
 .TP
+.BR \-J [\fIjobs\fP|\fBauto\fP]
+This option (since dpkg 1.18.2) is equivalent to the \fB\-j\fP option
+except that it does not set the \fB\%MAKEFLAGS\fP environment variable,
+and as such it is safer to use with any package including those that are
+not parallel-build safe.
+.TP
 .B \-D
 Check build dependencies and conflicts; abort if unsatisfied. This is the
 default behavior.
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 3b5b9c0..a3f6080 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -4,7 +4,7 @@
 #
 # Copyright © 1996 Ian Jackson
 # Copyright © 2000 Wichert Akkerman
-# Copyright © 2006-2010,2012-2014 Guillem Jover <guillem at debian.org>
+# Copyright © 2006-2010, 2012-2015 Guillem Jover <guillem at debian.org>
 # Copyright © 2007 Frank Lichtenheld
 #
 # This program is free software; you can redistribute it and/or modify
@@ -74,7 +74,8 @@ sub usage {
   -R<rules>      rules file to execute (default is debian/rules).
   -T<target>     call debian/rules <target> with the proper environment.
       --as-root  ensure -T calls the target with root rights.
-  -j[<number>]   specify jobs to run simultaneously (passed to <rules>).
+  -j[<number>]   jobs to run simultaneously (passed to <rules>), forced mode.
+  -J[<number>]   jobs to run simultaneously (passed to <rules>), opt-in mode.
   -r<gain-root-command>
                  command to gain root privileges (default is fakeroot).
   --check-command=<check-command>
@@ -135,6 +136,7 @@ my $signcommand;
 my $noclean;
 my $cleansource;
 my $parallel;
+my $parallel_force;
 my $checkbuilddep = 1;
 my @source_opts;
 my $check_command = $ENV{DEB_CHECK_COMMAND};
@@ -233,6 +235,10 @@ while (@ARGV) {
 	push @changes_opts, $1;
     } elsif (/^-j(\d*|auto)$/) {
 	$parallel = $1 || '';
+	$parallel_force = 1;
+    } elsif (/^-J(\d*|auto)$/) {
+	$parallel = $1 || '';
+	$parallel_force = 0;
     } elsif (/^-r(.*)$/) {
 	my $arg = $1;
 	@rootcommand = split /\s+/, $arg;
@@ -395,8 +401,10 @@ if (defined $parallel) {
         $parallel = qx(getconf _NPROC_ONLN 2>/dev/null) if $?;
         chomp $parallel;
     }
-    $ENV{MAKEFLAGS} //= '';
-    $ENV{MAKEFLAGS} .= " -j$parallel";
+    if ($parallel_force) {
+        $ENV{MAKEFLAGS} //= '';
+        $ENV{MAKEFLAGS} .= " -j$parallel";
+    }
     $build_opts->set('parallel', $parallel);
     $build_opts->export();
 }

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