[debhelper-devel] [debhelper] 02/02: Default to --parallel in compat 10

Niels Thykier nthykier at moszumanska.debian.org
Sun Sep 6 08:02:01 UTC 2015


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

nthykier pushed a commit to branch master
in repository debhelper.

commit 40d834ef3e6a7dcbbf34710daa9d301d1f2178ec
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Sep 6 09:58:38 2015 +0200

    Default to --parallel in compat 10
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Buildsystems.pm |  4 +++-
 debhelper.pod                       | 29 ++++++++++++++++++++++-------
 debian/changelog                    |  4 ++++
 dh                                  | 28 +++++++++++++++++++++-------
 4 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm
index 04b1be9..501372d 100644
--- a/Debian/Debhelper/Dh_Buildsystems.pm
+++ b/Debian/Debhelper/Dh_Buildsystems.pm
@@ -139,7 +139,8 @@ sub load_all_buildsystems {
 sub buildsystems_init {
 	my %args=@_;
 
-	my $max_parallel=1;
+	# Compat 10 defaults to --parallel by default
+	my $max_parallel = compat(9) ? 1 : -1;
 
 	# Available command line options
 	my %options = (
@@ -156,6 +157,7 @@ sub buildsystems_init {
 	    "list" => \$opt_list,
 
 	    "parallel" => sub { $max_parallel = -1 },
+	    'no-parallel' => sub { $max_parallel = 1 },
 	    "max-parallel=i" => \$max_parallel,
 	);
 	$args{options}{$_} = $options{$_} foreach keys(%options);
diff --git a/debhelper.pod b/debhelper.pod
index 091d23d..3003bb8 100644
--- a/debhelper.pod
+++ b/debhelper.pod
@@ -232,15 +232,21 @@ If the build system prefers out of source tree building but still
 allows in source building, the latter can be re-enabled by passing a build
 directory path that is the same as the source directory path.
 
-=item B<--parallel>
+=item B<--parallel>, B<--no-parallel>
 
-Enable parallel builds if underlying build system supports them.
-The number of parallel jobs is controlled by the
-B<DEB_BUILD_OPTIONS> environment variable (L<Debian Policy, section 4.9.1>) at
-build time. It might also be subject to a build system specific limit.
+Control whether parallel builds should be used if underlying build
+system supports them.  The number of parallel jobs is controlled by
+the B<DEB_BUILD_OPTIONS> environment variable (L<Debian Policy,
+section 4.9.1>) at build time. It might also be subject to a build
+system specific limit.
 
-If this option is not specified, debhelper currently defaults to not
-allowing parallel package builds.
+If neither option are not specified, debhelper currently defaults to
+B<--parallel> in compat 10 (or later) and B<--no-parallel> otherwise.
+
+As an optimization, B<dh> will try to avoid passing these options to
+subprocesses, if they are unncessary and the only options passed.
+Notably this happens when B<DEB_BUILD_OPTIONS> does not have a
+I<parallel> parameter (or its value is 1).
 
 =item B<--max-parallel=>I<maximum>
 
@@ -249,6 +255,9 @@ jobs that can be used in a parallel build. If the package build is known to
 only work with certain levels of concurrency, you can set this to the maximum
 level that is known to work, or that you wish to support.
 
+Notably, setting the maximum to 1 is effectively the same as using
+B<--no-parallel>.
+
 =item B<--list>, B<-l>
 
 List all build systems supported by debhelper on this system. The list
@@ -563,6 +572,12 @@ instead.
 B<dh_installwm> refuses to create a broken package if no man page
 can be found (required to register for the x-window-manager alternative).
 
+=item -
+
+Debhelper will default to B<--parallel> for all buildsystems that
+support parallel building.  This can be disabled by using either
+B<--no-parallel> or passing B<--max-parallel> with a value of 1.
+
 =back
 
 =back
diff --git a/debian/changelog b/debian/changelog
index 52f6e71..87bdfb6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -54,6 +54,10 @@ debhelper (9.20150811+unreleased) UNRELEASED; urgency=medium
   * dh_shlibdeps: The "-L" option can now be passed multiple
     times with different package names.  Thanks to Tristan
     Schmelcher for the suggestion.  (Closes: #776103)
+  * dh,Buildsytems: In compat 10, default to --parallel.
+  * dh,Buildsytems: Accept "--no-parallel" to disable
+    parallel builds.  It is effectively the same as using
+    --max-parallel=1 but may be more intuative to some people.
 
   [ Paul Tagliamonte ]
   * dh_gencontrol: Put debug debs back in the "debug" section.
diff --git a/dh b/dh
index 4cba226..4d93563 100755
--- a/dh
+++ b/dh
@@ -167,13 +167,22 @@ in a subdirectory, which will be removed on B<clean>.
 	%:
 		dh $@ --builddirectory=build
 
-If your package can be built in parallel, you can support parallel building
-as follows. Then B<dpkg-buildpackage -j> will work.
+If your package can be built in parallel, please either use compat 10 or
+pass B<--parallel> to dh. Then B<dpkg-buildpackage -j> will work.
 
 	#!/usr/bin/make -f
 	%:
 		dh $@ --parallel
 
+If your package cannot be built reliably while using multiple threads,
+please pass B<--no-parallel> to dh (or the relevant B<dh_auto_>I<*>
+command):
+
+
+	#!/usr/bin/make -f
+	%:
+		dh $@ --no-parallel
+
 Here is a way to prevent B<dh> from running several commands that you don't
 want it to run, by defining empty override targets for each command.
 
@@ -578,17 +587,22 @@ while (@ARGV_orig) {
 		next;
 	}
 	elsif ($opt=~/^-/) {
-		if (not @options and $opt eq '--parallel') {
+		if (not @options and $opt eq '--parallel' or $opt eq '--no-parallel') {
+			my $max_parallel;
+			# Ignore the option if it is the default for the given
+			# compat level.
+			next if compat(9) and $opt eq '--no-parallel';
+			next if not compat(9) and $opt eq '--parallel';
 			# Having an non-empty "@options" hurts performance quite a
 			# bit.  At the same time, we want to promote the use of
-			# --parallel, so "tweak" the options a bit if there is no
-			# reason to include it.
-			my $max_parallel = get_buildoption('parallel') // 1;
+			# --(no-)parallel, so "tweak" the options a bit if there
+			# is no reason to include this option.
+			$max_parallel = get_buildoption('parallel') // 1;
 			next if $max_parallel == 1;
 		}
 		push @options, "-O".$opt;
 		$user_specified_options=1
-			unless $opt =~ /^--(parallel|buildsystem|sourcedirectory|builddirectory|)/;
+			unless $opt =~ /^--((?:no-)?parallel|buildsystem|sourcedirectory|builddirectory|)/;
 	}
 	elsif (@options) {
 		$user_specified_options=1;

-- 
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