summaryrefslogtreecommitdiff
path: root/Debian
diff options
context:
space:
mode:
Diffstat (limited to 'Debian')
-rw-r--r--Debian/Debhelper/Dh_Buildsystems.pm19
-rw-r--r--Debian/Debhelper/Dh_Lib.pm19
2 files changed, 24 insertions, 14 deletions
diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm
index 405b79c..0a51a4d 100644
--- a/Debian/Debhelper/Dh_Buildsystems.pm
+++ b/Debian/Debhelper/Dh_Buildsystems.pm
@@ -167,19 +167,12 @@ sub buildsystems_init {
sub set_parallel {
my $max=shift;
- $opt_parallel=1;
-
- if (exists $ENV{DEB_BUILD_OPTIONS}) {
- # 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+)$/) {
- $opt_parallel = $1;
- if ($max > 0 && $opt_parallel > $max) {
- $opt_parallel = $max;
- }
- }
- }
+ # Get number of processes from parallel=n option, limiting it
+ # with $max if needed
+ $opt_parallel=get_buildoption("parallel") || 1;
+
+ if ($max > 0 && $opt_parallel > $max) {
+ $opt_parallel = $max;
}
}
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 40c33e8..e28cb32 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -18,7 +18,7 @@ use vars qw(@ISA @EXPORT %dh);
&inhibit_log &load_log &write_log &commit_override_log
&dpkg_architecture_value &sourcepackage
&is_make_jobserver_unavailable &clean_jobserver_makeflags
- &cross_command &set_buildflags);
+ &cross_command &set_buildflags &get_buildoption);
my $max_compat=9;
@@ -926,4 +926,21 @@ sub set_buildflags {
}
}
+# Gets a DEB_BUILD_OPTIONS option, if set.
+sub get_buildoption {
+ my $wanted=shift;
+
+ return undef unless exists $ENV{DEB_BUILD_OPTIONS};
+
+ foreach my $opt (split(/\s+/, $ENV{DEB_BUILD_OPTIONS})) {
+ # currently parallel= is the only one with a parameter
+ if ($opt =~ /^parallel=(-?\d+)$/ && $wanted eq 'parallel') {
+ return $1;
+ }
+ elsif ($opt eq $wanted) {
+ return 1;
+ }
+ }
+}
+
1