]> git.donarmstrong.com Git - debhelper.git/blobdiff - Debian/Debhelper/Dh_Lib.pm
setting OPTIMIZE could in theory lead to breakage, so make it v9
[debhelper.git] / Debian / Debhelper / Dh_Lib.pm
index 40c33e84722606c64b8afa293f3f65e2271cbaa1..60f13c30517664265b6b8b540b9bb8f0013381c1 100644 (file)
@@ -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;
 
@@ -328,6 +328,7 @@ sub dirname {
 
        sub compat {
                my $num=shift;
+               my $nowarn=shift;
        
                if (! defined $c) {
                        $c=1;
@@ -349,7 +350,7 @@ sub dirname {
                        }
                }
 
-               if ($c <= 4 && ! $warned_compat) {
+               if ($c <= 4 && ! $warned_compat && ! $nowarn) {
                        warning("Compatibility levels before 5 are deprecated.");
                        $warned_compat=1;
                }
@@ -926,4 +927,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