From 7e35f3cf73dd5c6e4c8848217e33e2c6c8e00ed4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 29 Oct 2009 16:12:57 -0400 Subject: implement the other option: parallel enabled implicitly by DEB_BUILD_OPTIONS I renamed --parallel to --max-parallel to clarify that it doesn't enable parallelism, but only controls how much of it is allowed. --- Debian/Debhelper/Dh_Buildsystems.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Debian/Debhelper/Dh_Buildsystems.pm') diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm index b0e0a568..8713aab4 100644 --- a/Debian/Debhelper/Dh_Buildsystems.pm +++ b/Debian/Debhelper/Dh_Buildsystems.pm @@ -112,6 +112,8 @@ sub load_all_buildsystems { sub buildsystems_init { my %args=@_; + + my $max_parallel=0; # Available command line options my %options = ( @@ -127,28 +129,28 @@ sub buildsystems_init { "l" => \$opt_list, "list" => \$opt_list, - "j:i" => \&set_parallel, - "parallel:i" => \&set_parallel, + "max-parallel:i" => \$max_parallel, ); $args{options}{$_} = $options{$_} foreach keys(%options); Debian::Debhelper::Dh_Lib::init(%args); + set_parallel($max_parallel); } sub set_parallel { - my ($option, $value)=@_; + my $max=shift; - if ($value >= 0 && exists $ENV{DEB_BUILD_OPTIONS}) { + 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 ($value == 0 || $n < $value) { + if ($max && $n < $max) { $opt_parallel = $n; } else { - $opt_parallel = $value; + $opt_parallel = $max; } } else { -- cgit v1.2.3