diff options
author | Niels Thykier <niels@thykier.net> | 2016-07-02 08:19:06 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2016-07-02 08:41:38 +0000 |
commit | 0663b19f878dd69487d99065ce6ad28a2c866551 (patch) | |
tree | 8472bb690c662e6310e77412a1500c4b6d0832eb | |
parent | 94af03240ad3b70926234422161ff7cc60ae72ee (diff) | |
download | debhelper-0663b19f878dd69487d99065ce6ad28a2c866551.tar.gz |
Handle renamed/changed make parallel options
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r-- | Debian/Debhelper/Dh_Lib.pm | 6 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rwxr-xr-x | 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 cfe054d6..f1b5b4da 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 b96ce30d..e2a8ca9e 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 6493caea..b6e2c91b 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"), |