[debhelper-devel] [debhelper] 02/02: Handle renamed/changed make parallel options

Niels Thykier nthykier at moszumanska.debian.org
Sat Jul 2 08:42:57 UTC 2016


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 0663b19f878dd69487d99065ce6ad28a2c866551
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Jul 2 08:19:06 2016 +0000

    Handle renamed/changed make parallel options
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm         |  6 ++--
 debian/changelog                   |  2 ++
 t/buildsystems/buildsystem_tests.t | 62 +++++++++++++++++++++++---------------
 3 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index cfe054d..f1b5b4d 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -1193,7 +1193,7 @@ sub _expand_path {
 # the FD used to communicate with it is actually not available.
 sub is_make_jobserver_unavailable {
 	if (exists $ENV{MAKEFLAGS} && 
-	    $ENV{MAKEFLAGS} =~ /(?:^|\s)--jobserver-fds=(\d+)/) {
+	    $ENV{MAKEFLAGS} =~ /(?:^|\s)--jobserver-(?:fds|auth)=(\d+)/) {
 		if (!open(my $in, "<&$1")) {
 			return 1; # unavailable
 		}
@@ -1209,8 +1209,8 @@ sub is_make_jobserver_unavailable {
 # Cleans out jobserver options from MAKEFLAGS.
 sub clean_jobserver_makeflags {
 	if (exists $ENV{MAKEFLAGS}) {
-		if ($ENV{MAKEFLAGS} =~ /(?:^|\s)--jobserver-fds=(\d+)/) {
-			$ENV{MAKEFLAGS} =~ s/(?:^|\s)--jobserver-fds=\S+//g;
+		if ($ENV{MAKEFLAGS} =~ /(?:^|\s)--jobserver-(?:fds|auth)=\d+/) {
+			$ENV{MAKEFLAGS} =~ s/(?:^|\s)--jobserver-(?:fds|auth)=\S+//g;
 			$ENV{MAKEFLAGS} =~ s/(?:^|\s)-j\b//g;
 		}
 		delete $ENV{MAKEFLAGS} if $ENV{MAKEFLAGS} =~ /^\s*$/;
diff --git a/debian/changelog b/debian/changelog
index b96ce30..e2a8ca9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,8 @@ debhelper (9.20160618.1+unreleased) UNRELEASED; urgency=medium
     package.  Thanks to Sven Joachim for the report, the
     analysis/testing and for providing a patch for the
     most common case.  (Closes: #829142)
+  * Dh_Lib.pm: Cope with the parallel options in make 4.2.
+    Thanks to Martin Dorey for the report.  (Closes: #827132)
 
   [ Translations ]
   * Update German translation (Chris Leick + Eduard Bloch)
diff --git a/t/buildsystems/buildsystem_tests.t b/t/buildsystems/buildsystem_tests.t
index 6493cae..b6e2c91 100755
--- a/t/buildsystems/buildsystem_tests.t
+++ b/t/buildsystems/buildsystem_tests.t
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use Test::More tests => 299;
+use Test::More tests => 300;
 
 use strict;
 use warnings;
@@ -509,37 +509,41 @@ ok ( ! -e 'bld', "bld got deleted too" );
 
 # Test clean_jobserver_makeflags.
 
-$ENV{MAKEFLAGS} = "--jobserver-fds=103,104 -j";
-clean_jobserver_makeflags();
-ok(! exists $ENV{MAKEFLAGS}, "unset makeflags");
+test_clean_jobserver_makeflags('--jobserver-fds=103,104 -j',
+                               undef,
+                               'unset makeflags');
 
-$ENV{MAKEFLAGS} = "-a --jobserver-fds=103,104 -j -b";
-clean_jobserver_makeflags();
-is($ENV{MAKEFLAGS}, "-a -b", "clean makeflags");
+test_clean_jobserver_makeflags('-a --jobserver-fds=103,104 -j -b',
+                               '-a -b',
+                               'clean makeflags');
 
-$ENV{MAKEFLAGS} = " --jobserver-fds=1,2 -j  ";
-clean_jobserver_makeflags();
-ok(! exists $ENV{MAKEFLAGS}, "unset makeflags");
+test_clean_jobserver_makeflags(' --jobserver-fds=1,2 -j  ',
+                               undef,
+                               'unset makeflags');
 
-$ENV{MAKEFLAGS} = "-a -j -b";
-clean_jobserver_makeflags();
-is($ENV{MAKEFLAGS}, "-a -j -b", "clean makeflags does not remove -j");
+test_clean_jobserver_makeflags('-a -j -b',
+                               '-a -j -b',
+                               'clean makeflags does not remove -j');
 
-$ENV{MAKEFLAGS} = "-a --jobs -b";
-clean_jobserver_makeflags();
-is($ENV{MAKEFLAGS}, "-a --jobs -b", "clean makeflags does not remove --jobs");
+test_clean_jobserver_makeflags('-a --jobs -b',
+                               '-a --jobs -b',
+                               'clean makeflags does not remove --jobs');
 
-$ENV{MAKEFLAGS} = "-j6";
-clean_jobserver_makeflags();
-is($ENV{MAKEFLAGS}, "-j6", "clean makeflags does not remove -j6");
+test_clean_jobserver_makeflags('-j6',
+                               '-j6',
+                               'clean makeflags does not remove -j6');
 
-$ENV{MAKEFLAGS} = "-a -j6 --jobs=7";
-clean_jobserver_makeflags();
-is($ENV{MAKEFLAGS}, "-a -j6 --jobs=7", "clean makeflags does not remove -j or --jobs");
+test_clean_jobserver_makeflags('-a -j6 --jobs=7',
+                               '-a -j6 --jobs=7',
+                               'clean makeflags does not remove -j or --jobs');
 
-$ENV{MAKEFLAGS} = "-j6 --jobserver-fds=103,104 --jobs=8";
-clean_jobserver_makeflags();
-is($ENV{MAKEFLAGS}, "-j6 --jobs=8", "jobserver options removed");
+test_clean_jobserver_makeflags('-j6 --jobserver-fds=103,104 --jobs=8',
+                               '-j6 --jobs=8',
+                               'jobserver options removed');
+
+test_clean_jobserver_makeflags('-j6 --jobserver-auth=103,104 --jobs=8',
+                               '-j6 --jobs=8',
+                               'jobserver options removed');
 
 # Test parallel building with makefile build system.
 $ENV{MAKEFLAGS} = "";
@@ -570,6 +574,14 @@ sub test_is_parallel {
 	is( $?, 0, "(exit status=0) $desc");
 }
 
+sub test_clean_jobserver_makeflags {
+    my ($orig, $expected, $test) = @_;
+
+    local $ENV{MAKEFLAGS} = $orig;
+    clean_jobserver_makeflags();
+    is($ENV{MAKEFLAGS}, $expected, $test);
+}
+
 test_isnt_parallel( do_parallel_mk(),
 	"No parallel by default" );
 test_isnt_parallel( do_parallel_mk("parallel"),

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list