The branch, master has been updated
via a19946b71970f7854f9b15cc639b1a4039e902ff (commit)
from 530d60533f7f0281d2bd00b93168b91e7dda013c (commit)
- Shortlog ------------------------------------------------------------
a19946b dpkg-buildpackage: Add new option -j[<number>]
Summary of changes:
ChangeLog | 16 +++++++++++++++-
debian/changelog | 4 ++++
man/ChangeLog | 5 +++++
man/dpkg-buildpackage.1 | 11 +++++++++++
scripts/Dpkg/BuildOptions.pm | 38 ++++++++++++++++++++++++++++++++++++++
scripts/Makefile.am | 1 +
scripts/dpkg-buildpackage.pl | 24 ++++++++++++++++++++++--
7 files changed, 96 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
Details of changes:
commit a19946b71970f7854f9b15cc639b1a4039e902ff
Author: Frank Lichtenheld <[EMAIL PROTECTED]>
Date: Sun Sep 23 20:24:51 2007 +0200
dpkg-buildpackage: Add new option -j[<number>]
Works like the make options of the same name. It will be passed
to debian/rules in the MAKEFLAGS environment variable. Also the
parallel=<n> DEB_BUILD_OPTIONS option will be honored and set
correctly. The finally used value is determined by the
following order: -j > DEB_BUILD_OPTIONS > MAKEFLAGS.
Based on an idea by Robert Millan <[EMAIL PROTECTED]>.
diff --git a/ChangeLog b/ChangeLog
index 4356ebe..0362a3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2007-09-23 Frank Lichtenheld <[EMAIL PROTECTED]>
+
+ * scripts/dpkg-buildpackage.pl: Add new option
+ -j[<number>] that works like the make option of
+ the same name. It will be passed to debian/rules in
+ the MAKEFLAGS environment variable. Also the
+ parallel=<n> DEB_BUILD_OPTIONS option will be honored
+ and set correctly. The finally used value is determined by the
+ following order: -j > DEB_BUILD_OPTIONS > MAKEFLAGS.
+ Based on an idea by Robert Millan <[EMAIL PROTECTED]>.
+ * scripts/Dpkg/BuildOptions.pm: Added. Support code
+ for DEB_BUILD_OPTIONS handling by dpkg-buildpackage.
+ * scripts/Makefile.am: Adapt.
+
2007-09-23 Jari Aalto <[EMAIL PROTECTED]>
* scripts/dpkg-source.pl ($diff_ignore_default_regexp): Add
@@ -13,7 +27,7 @@
* scripts/Dpkg.pm: Make the regex for determining
$progname more robust.
-
+
* scripts/dpkg-buildpackage.sh: Move to...
* scripts/dpkg-buildpackage.pl: Convert from
Shell to Perl.
diff --git a/debian/changelog b/debian/changelog
index 1d822c9..6984a8e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,10 @@ dpkg (1.14.7) UNRELEASED; urgency=low
[ Frank Lichtenheld ]
* Add _MTN to dpkg-source -i default regex. Suggested by Jari Aalto.
* Convert dpkg-buildpackage to a Perl script.
+ * dpkg-buildpackage accepts a -j<n> option now which will set
+ MAKEFLAGS(-j<n>) and DEB_BUILD_OPTIONS(parallel=<n>) accordingly.
+ parallel=<n> in DEB_BUILD_OPTIONS will be passed to MAKEFLAGS as
+ well. Based on an idea by Robert Millan. Closes: #440636
[ Updated dpkg translations ]
* Basque (Piarres Beobide). Closes: #440859
diff --git a/man/ChangeLog b/man/ChangeLog
index 53112da..8ecb932 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,8 @@
+2007-09-23 Frank Lichtenheld <[EMAIL PROTECTED]>
+
+ * dpkg-buildpackage.1: Document the new -j
+ option.
+
2007-09-23 Peter Karlsson <[EMAIL PROTECTED]>
* po/sv.add: Fixed typo.
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 89e4a62..e7a6757 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -47,6 +47,17 @@ Specify the Debian architecture we build for. The
architecture of the
machine we build on is determined automatically, and is also the default
for the host machine.
.TP
+.BI \-j jobs
+Number of jobs allowed to be run simultaneously, equivalent to the
+.BR make (1)
+option of the same name. Will add itself to the MAKEFLAGS
+environment variable, which should cause all subsequent make
+invocations to inherit the option. Also adds \fBparallel=\fP\fIjobs\fP
+to the DEB_BUILD_OPTIONS environment variable which allows
+debian/rules files to use this information for their own purposes.
+If no \fB-j\fP option is given, an existing value for \fBparallel\fP will be
+honoured and added to MAKEFLAGS.
+.TP
.BI \-v version
Use changelog information from all versions strictly later than
.IR version .
diff --git a/scripts/Dpkg/BuildOptions.pm b/scripts/Dpkg/BuildOptions.pm
new file mode 100644
index 0000000..3ca38b9
--- /dev/null
+++ b/scripts/Dpkg/BuildOptions.pm
@@ -0,0 +1,38 @@
+package Dpkg::BuildOptions;
+
+use strict;
+use warnings;
+
+sub parse {
+ my ($env) = @_;
+
+ $env ||= $ENV{DEB_BUILD_OPTIONS};
+
+ unless ($env) { return {}; }
+
+ my %opts;
+ if ($env =~ s/(noopt|nostrip),?//ig) {
+ $opts{lc $1} = '';
+ } elsif ($env =~ s/(parallel)=(-?\d+),?//ig) {
+ $opts{lc $1} = $2;
+ }
+
+ return \%opts;
+}
+
+sub set {
+ my ($opts, $overwrite) = @_;
+
+ my $env = $overwrite ? '' : $ENV{DEB_BUILD_OPTIONS}||'';
+ if ($env) { $env .= ',' }
+
+ while (my ($k, $v) = each %$opts) {
+ if ($v) {
+ $env .= "$k=$v,";
+ } else {
+ $env .= "$k,";
+ }
+ }
+}
+
+1;
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index ed194dc..87ea060 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -55,6 +55,7 @@ CLEANFILES = \
perllibdir = $(PERL_LIBDIR)
nobase_dist_perllib_DATA = \
+ Dpkg/BuildOptions.pm \
Dpkg/Gettext.pm \
Dpkg.pm
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index bb40e93..73b7e9a 100644
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -8,6 +8,7 @@ use File::Basename;
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::BuildOptions;
push (@INC, $dpkglibdir);
require 'controllib.pl';
@@ -39,6 +40,7 @@ Options:
-p<sign-command>
-d do not check build dependencies and conflicts.
-D check build dependencies and conflicts.
+ -j[<number>] specify jobs to run simultaniously } passed to debian/rules
-k<keyid> the key to use for signing.
-sgpg the sign-command is called like GPG.
-spgp the sign-command is called like PGP.
@@ -95,7 +97,7 @@ if ( ( ($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME})
my ($admindir, $signkey, $forcesigninterface, $usepause, $noclean,
$warnable_errors, $sourcestyle, $cleansource,
$binaryonly, $sourceonly, $since, $maint,
- $changedby, $desc);
+ $changedby, $desc, $parallel);
my (@checkbuilddep_args, @passopts, @tarignore);
my $checkbuilddep = 1;
my $signsource = 1;
@@ -115,6 +117,8 @@ while (@ARGV) {
exit 0;
} elsif (/^--admindir=(.*)$/) {
$admindir = $1;
+ } elsif (/^-j(\d*)$/) {
+ $parallel = $1 || '-1';
} elsif (/^-r(.*)$/) {
$rootcommand = $1;
} elsif (/^-p(.*)$/) {
@@ -209,6 +213,22 @@ if ($signcommand && ($signinterface !~ /^(gpg|pgp)$/)) {
warning(_g("unknown sign command, assuming pgp style interface"));
}
+if ($parallel || $ENV{DEB_BUILD_OPTIONS}) {
+ my $build_opts = Dpkg::BuildOptions::parse();
+
+ $parallel ||= $build_opts->{parallel};
+ if (defined $parallel) {
+ $ENV{MAKEFLAGS} ||= '';
+ if ($parallel eq '-1') {
+ $ENV{MAKEFLAGS} .= " -j";
+ } else {
+ $ENV{MAKEFLAGS} .= " -j$parallel";
+ }
+ }
+ $build_opts->{parallel} = $parallel;
+ Dpkg::BuildOptions::set($build_opts);
+}
+
my $cwd = cwd();
my $dir = basename($cwd);
@@ -309,7 +329,7 @@ if ($checkbuilddep) {
}
if (system('dpkg-checkbuilddeps', @checkbuilddep_args)) {
- warning(_g("Build dependencies/conflicts unsatisfied; aborting.\n"));
+ warning(_g("Build dependencies/conflicts unsatisfied; aborting."));
warning(_g("(Use -d flag to override.)"));
exit 3;
}
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]