diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-10-29 19:45:06 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-10-29 19:48:51 -0400 |
commit | db49690fa990eab385d1e6844c285b22c2219f30 (patch) | |
tree | be3872e2888aa019f55a1d9f5032ee02a5e53b45 /Debian/Debhelper/Dh_Buildsystems.pm | |
parent | a4a29fb6c4ae999ff732a0b9479a767f685cad2f (diff) |
support unlimited parallel jobs
dpkg-buildpackage -j sets DEB_BUILD_OPTIONS=parallel=-1. Policy does not
cover this but the intent is to allow unlimited parallel jobs.
Also, there is no longer any way for parallel to be set to undef, so remove
code to handle that.
Diffstat (limited to 'Debian/Debhelper/Dh_Buildsystems.pm')
-rw-r--r-- | Debian/Debhelper/Dh_Buildsystems.pm | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm index f43c87d4..fc06a2ac 100644 --- a/Debian/Debhelper/Dh_Buildsystems.pm +++ b/Debian/Debhelper/Dh_Buildsystems.pm @@ -113,7 +113,7 @@ sub load_all_buildsystems { sub buildsystems_init { my %args=@_; - my $max_parallel=0; + my $max_parallel=-1; # unlimited # Available command line options my %options = ( @@ -139,27 +139,21 @@ sub buildsystems_init { sub set_parallel { my $max=shift; + $opt_parallel=1; + if (exists $ENV{DEB_BUILD_OPTIONS}) { # Parse parallel=n tag - my $n; foreach my $opt (split(/\s+/, $ENV{DEB_BUILD_OPTIONS})) { - $n = $1 if $opt =~ /^parallel=(\d+)$/; - } - if (defined $n && $n > 0) { - if (!$max || $n < $max) { - $opt_parallel = $n; - } - else { - $opt_parallel = $max; + if ($opt =~ /^parallel=([-\d]+)$/) { + my $n=$1; + if ($n > 0 && ($max == -1 || $n < $max)) { + $opt_parallel = $n; + } + else { + $opt_parallel = $max; + } } } - else { - # Invalid value in the parallel tag. Disable. - $opt_parallel = 1; - } - } - else { - $opt_parallel = 1; } } |