]> git.donarmstrong.com Git - debhelper.git/commitdiff
In my opinion, this way of putting it is more obvious.
authorModestas Vainius <modestas@vainius.eu>
Thu, 3 Dec 2009 22:11:00 +0000 (00:11 +0200)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 4 Dec 2009 20:02:01 +0000 (15:02 -0500)
$max is about upper limit. Make algorithm reflect that.
(cherry picked from commit 62d7dc07b97a12912cfe08483c6fb244161224f5)

Debian/Debhelper/Dh_Buildsystems.pm

index 77d7f9451c438588973e7020ee20ff5a2fbced58..d50c51739ff8dd3883805fa52d3e9d332618abfc 100644 (file)
@@ -165,14 +165,12 @@ sub set_parallel {
        $opt_parallel=1;
 
        if (exists $ENV{DEB_BUILD_OPTIONS}) {
-               # Parse parallel=n tag
+               # Get number of processes from parallel=n tag limiting it
+               # with $max if needed
                foreach my $opt (split(/\s+/, $ENV{DEB_BUILD_OPTIONS})) {
-                       if ($opt =~ /^parallel=([-\d]+)$/) {
-                               my $n=$1;
-                               if ($n > 0 && ($max == -1 || $n < $max)) {
-                                       $opt_parallel = $n;
-                               }
-                               else {
+                       if ($opt =~ /^parallel=(-?\d+)$/) {
+                               $opt_parallel = $1;
+                               if ($max > 0 && $opt_parallel > $max) {
                                        $opt_parallel = $max;
                                }
                        }