From 7e35f3cf73dd5c6e4c8848217e33e2c6c8e00ed4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 29 Oct 2009 16:12:57 -0400 Subject: [PATCH] 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 ++++++++------ debhelper.pod | 15 ++++++++------- debian/changelog | 16 +++++++++------- dh | 6 +++--- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm index b0e0a56..8713aab 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 { diff --git a/debhelper.pod b/debhelper.pod index 20ca9d7..0a9ef41 100644 --- a/debhelper.pod +++ b/debhelper.pod @@ -205,15 +205,16 @@ 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<-j>[I], B<--parallel>[I<=maximum>] +=item B<--max-parallel>[I<=maximum>] -Indicate that a source package supports building using multiple parallel -processes. This only enables parallel building if the build system supports -it, and I is present in the DEB_BUILD_OPTIONS environment -variable (as per Debian Policy section 4.9.1). +By default, the DEB_BUILD_OPTIONS environment variable can be used to +enable parallel building, when supported by the build system. -The number of parallel processes will be the smaller value specified by -I<--parallel>, DEB_BUILD_OPTIONS, or a build system specific limit. +This option allows controlling how many parallel jobs can be used in a +build. If set to 1, concurrent builds are disabled -- do this if +the package build is known not to work in parallel. If the package build +is known to only work with certian levels of concurrency, you can set this +to the maximum level that is known to work, or that you wish to support. =item B<--list>, B<-l> diff --git a/debian/changelog b/debian/changelog index 9d1f81f..07296a9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,13 +1,15 @@ debhelper (7.4.4) UNRELEASED; urgency=low - * dh_auto_*: Add --parallel option that indicates the package supports - parallel building. Then if DH_BUILD_OPTIONS contains 'parallel=N', - and the build system supports it, parallel building is done. * The makefile buildsystem (and derived buildsystems) now supports - parallel building. - * Typically, to enable parallel building, the --parallel option will - be passed to dh. Closes: #532805 - * Thanks, Modestas Vainius for most of the work on parallel build support. + parallel building by default, as specified via DEB_BUILD_OPTIONS. + Closes: #532805 + * dh_auto_*: Add --max-parallel option that can be used to control + or disable parallel building. --max-parallel=1 will disable parallel + building, while --max-parallel=N will limit the maximum number of + parallel processes that can be specified via DEB_BUILD_OPTIONS. + * Added some hacks to avoid warnings about unavailable jobservers when + debhelper runs make. + * Thanks, Modestas Vainius for much of the work on parallel build support. -- Joey Hess Wed, 28 Oct 2009 18:10:45 -0400 diff --git a/dh b/dh index 0ecfe44..bd82d44 100755 --- a/dh +++ b/dh @@ -225,9 +225,9 @@ init(options => { }); inhibit_log(); -# If make was using a jobserver, but it is not available, clean out -# MAKEFLAGS so that further make invocations can start a new job -# server. +# If make is using a jobserver, but it is not available +# to this process, clean out MAKEFLAGS. This avoids +# ugly warnings when calling make. if (is_make_jobserver_unavailable()) { clean_jobserver_makeflags(); } -- 2.39.2