]> git.donarmstrong.com Git - debhelper.git/blobdiff - Debian/Debhelper/Dh_Lib.pm
refactor
[debhelper.git] / Debian / Debhelper / Dh_Lib.pm
index b3162d07ae9a77cc2844d73291e4b09436acbfe1..cd87ebe58f5ba1bbf8b58b06695c152ebe3d8c3e 100644 (file)
@@ -29,10 +29,10 @@ sub init {
        # Getopt::Long, which I'd prefer to avoid loading at all if possible.
        if ((defined $ENV{DH_OPTIONS} && length $ENV{DH_OPTIONS}) ||
            (defined $ENV{DH_INTERNAL_OPTIONS} && length $ENV{DH_INTERNAL_OPTIONS}) ||
-           (defined $params{extra_args}) || grep /^-/, @ARGV) {
+           grep /^-/, @ARGV) {
                eval "use Debian::Debhelper::Dh_Getopt";
                error($@) if $@;
-               Debian::Debhelper::Dh_Getopt::parseopts($params{options}, $params{extra_args});
+               Debian::Debhelper::Dh_Getopt::parseopts($params{options});
        }
 
        # Another way to set excludes.
@@ -630,10 +630,9 @@ sub dpkg_architecture_value {
        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;
+               if (!defined $os) {
+                       $os=dpkg_architecture_value("DEB_HOST_ARCH_OS");
+               }
                return $os;
        }
 }
@@ -681,12 +680,6 @@ sub getpackages {
        %package_arches=();
        
        $type="" if ! defined $type;
-       
-       # Look up the build arch if we need to.
-       my $buildarch='';
-       if ($type eq 'same') {
-               $buildarch=buildarch();
-       }
 
        my $package="";
        my $arch="";
@@ -724,7 +717,8 @@ sub getpackages {
                        if ($package &&
                            (($type eq 'indep' && $arch eq 'all') ||
                             ($type eq 'arch' && $arch ne 'all') ||
-                            ($type eq 'same' && ($arch eq 'any' || samearch($buildarch, $arch))) ||
+                            ($type eq 'same' && ($arch eq 'any' ||
+                                            samearch(buildarch(), $arch))) ||
                             ! $type)) {
                                push @list, $package;
                                $package="";