]> git.donarmstrong.com Git - debhelper.git/blobdiff - Debian/Debhelper/Dh_Lib.pm
Merge branch 'master' into buildsystems
[debhelper.git] / Debian / Debhelper / Dh_Lib.pm
index f0ad505b1a1fd4a9a19fca6ec002e5f9fcba2962..28a90f7bdad16b37900c7021d9b055f2d8f6388b 100644 (file)
@@ -301,6 +301,7 @@ sub dirname {
                                # Try the file..
                                open (COMPAT_IN, "debian/compat") || error "debian/compat: $!";
                                my $l=<COMPAT_IN>;
+                               close COMPAT_IN;
                                if (! defined $l || ! length $l) {
                                        warning("debian/compat is empty, assuming level $c");
                                }
@@ -346,12 +347,15 @@ sub tmpdir {
 #
 # It tries several filenames:
 #   * debian/package.filename.buildarch
+#   * debian/package.filename.buildos
 #   * debian/package.filename
-#   * debian/file (if the package is the main package)
-# If --name was specified then tonly the first two are tried, and they must
-# have the name after the pacage name:
+#   * debian/filename (if the package is the main package)
+# If --name was specified then the files
+# must have the name after the package name:
 #   * debian/package.name.filename.buildarch
+#   * debian/package.name.filename.buildos
 #   * debian/package.name.filename
+#   * debian/name.filename (if the package is the main package)
 sub pkgfile {
        my $package=shift;
        my $filename=shift;
@@ -361,6 +365,7 @@ sub pkgfile {
        }
        
        my @try=("debian/$package.$filename.".buildarch(),
+                "debian/$package.$filename.".buildos(),
                 "debian/$package.$filename");
        if ($package eq $dh{MAINPACKAGE}) {
                push @try, "debian/$filename";
@@ -620,6 +625,19 @@ sub dpkg_architecture_value {
        }
 }
 
+# Returns the build OS. (Memoized)
+{
+       my $os;
+
+       sub buildos {
+               return $os if defined $os;
+
+               $os=`dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null` || error("dpkg-architecture failed");
+               chomp $os;
+               return $os;
+       }
+}
+
 # Passed an arch and a list of arches to match against, returns true if matched
 sub samearch {
        my $arch=shift;