summaryrefslogtreecommitdiff
path: root/Debian/Debhelper/Dh_Lib.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-09-09 11:17:27 -0400
committerJoey Hess <joey@kitenet.net>2011-09-09 11:17:27 -0400
commite845fcc47b244db30a8d19eaaf927de1d8c0a073 (patch)
tree81a08c988ca293f7ab097fe631ff9c5b88935cc6 /Debian/Debhelper/Dh_Lib.pm
parentf3afdd51e82972541cefebb15ec5a1d78ce67215 (diff)
Tighten parsing of DEB_BUILD_OPTIONS.
A future nostripexceptonfullmoon option seems unlikely, but sure, let's be strict. More importantly, let's reuse good code.
Diffstat (limited to 'Debian/Debhelper/Dh_Lib.pm')
-rw-r--r--Debian/Debhelper/Dh_Lib.pm19
1 files changed, 18 insertions, 1 deletions
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