]> git.donarmstrong.com Git - debhelper.git/blobdiff - Debian/Debhelper/Dh_Lib.pm
note that the hardcoded arg_max here is obsolete
[debhelper.git] / Debian / Debhelper / Dh_Lib.pm
index 97c3193b875dc6f270b267dc6e65bb3b92617256..3c23e092beb9cf0f215338eeec83cc638719d805 100644 (file)
@@ -19,7 +19,7 @@ use vars qw(@ISA @EXPORT %dh);
            &sourcepackage
            &is_make_jobserver_unavailable &clean_jobserver_makeflags);
 
-my $max_compat=7;
+my $max_compat=8;
 
 sub init {
        my %params=@_;
@@ -215,6 +215,7 @@ sub xargs {
 
         # The kernel can accept command lines up to 20k worth of characters.
        my $command_max=20000; # LINUX SPECIFIC!!
+                       # (And obsolete; it's bigger now.)
                        # I could use POSIX::ARG_MAX, but that would be slow.
 
        # Figure out length of static portion of command.
@@ -364,9 +365,23 @@ sub pkgfile {
                $filename="$dh{NAME}.$filename";
        }
        
-       my @try=("debian/$package.$filename.".buildarch(),
-                "debian/$package.$filename.".buildos(),
-                "debian/$package.$filename");
+       # First, check for files ending in buildarch and buildos.
+       my $match;
+       foreach my $file (glob("debian/$package.$filename.*")) {
+               next if ! -f $file;
+               next if $dh{IGNORE} && exists $dh{IGNORE}->{$file};
+               if ($file eq "debian/$package.$filename.".buildarch()) {
+                       $match=$file;
+                       # buildarch files are used in preference to buildos files.
+                       last;
+               }
+               elsif ($file eq "debian/$package.$filename.".buildos()) {
+                       $match=$file;
+               }
+       }
+       return $match if defined $match;
+
+       my @try=("debian/$package.$filename");
        if ($package eq $dh{MAINPACKAGE}) {
                push @try, "debian/$filename";
        }
@@ -616,7 +631,7 @@ sub excludefile {
                                or error("dpkg-architecture failed");
                        while (<PIPE>) {
                                chomp;
-                               my ($k, $v) = split(/=/, 2);
+                               my ($k, $v) = split(/=/, $_, 2);
                                $dpkg_arch_output{$k} = $v;
                        }
                        close(PIPE);