+2007-09-23 Frank Lichtenheld <djpig@debian.org>
+
+ * 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 <rmh@aybabtu.com>.
+ * scripts/Dpkg/BuildOptions.pm: Added. Support code
+ for DEB_BUILD_OPTIONS handling by dpkg-buildpackage.
+ * scripts/Makefile.am: Adapt.
+
2007-09-23 Jari Aalto <jari.aalto@cante.net>
* scripts/dpkg-source.pl ($diff_ignore_default_regexp): Add
* 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.
[ 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
+2007-09-23 Frank Lichtenheld <djpig@debian.org>
+
+ * dpkg-buildpackage.1: Document the new -j
+ option.
+
2007-09-23 Peter Karlsson <peterk@debian.org>
* po/sv.add: Fixed typo.
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 .
--- /dev/null
+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;
perllibdir = $(PERL_LIBDIR)
nobase_dist_perllib_DATA = \
+ Dpkg/BuildOptions.pm \
Dpkg/Gettext.pm \
Dpkg.pm
use Dpkg;
use Dpkg::Gettext;
+use Dpkg::BuildOptions;
push (@INC, $dpkglibdir);
require 'controllib.pl';
-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.
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;
exit 0;
} elsif (/^--admindir=(.*)$/) {
$admindir = $1;
+ } elsif (/^-j(\d*)$/) {
+ $parallel = $1 || '-1';
} elsif (/^-r(.*)$/) {
$rootcommand = $1;
} elsif (/^-p(.*)$/) {
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);
}
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;
}