X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debian%2FDebhelper%2FDh_Lib.pm;h=28a90f7bdad16b37900c7021d9b055f2d8f6388b;hb=9b758456f806e9813e2b7b91d7596c63b63f55ae;hp=f0ad505b1a1fd4a9a19fca6ec002e5f9fcba2962;hpb=61b285ce676c5fc557cf8b1ed6b637db46cda257;p=debhelper.git diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm index f0ad505..28a90f7 100644 --- a/Debian/Debhelper/Dh_Lib.pm +++ b/Debian/Debhelper/Dh_Lib.pm @@ -301,6 +301,7 @@ sub dirname { # Try the file.. open (COMPAT_IN, "debian/compat") || error "debian/compat: $!"; my $l=; + 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;