This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

commit e23943051599ff21e6ca955ac8e5ead4cda1891c
Author: Guillem Jover <guil...@debian.org>
Date:   Sun Apr 9 03:17:26 2017 +0200

    Dpkg::Deps: Do not unnecessarily require setting the host_arch
    
    If we are not reducing the architectures, or we are not going to use the
    known facts, we do not need to know and set the host architecture, which
    relies on gcc being present.
    
    Closes: #856396
---
 debian/changelog     |  2 ++
 scripts/Dpkg/Deps.pm | 18 +++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a904cf6..6231ede 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -113,6 +113,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
     - Unify Dpkg::ErrorHandling subprocess errors with the ones from libdpkg.
     - Do not emit a perl warning if gcc or dpkg is not found from Dpkg::Arch,
       the code already handles the commands not being present.
+    - Do not unnecessarily require setting the host_arch in Dpkg::Deps.
+      Closes: #856396
   * Documentation:
     - Document currently accepted syntax for changelogs in deb-changelog(5).
       Closes: #858579
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index f2d0742..3560e1a 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -259,11 +259,8 @@ sub deps_parse {
 
     $options{use_arch} //= 1;
     $options{reduce_arch} //= 0;
-    $options{host_arch} //= get_host_arch();
-    $options{build_arch} //= get_build_arch();
     $options{use_profiles} //= 1;
     $options{reduce_profiles} //= 0;
-    $options{build_profiles} //= [ get_build_profiles() ];
     $options{reduce_restrictions} //= 0;
     $options{union} //= 0;
     $options{build_dep} //= 0;
@@ -273,6 +270,13 @@ sub deps_parse {
         $options{reduce_arch} = 1;
         $options{reduce_profiles} = 1;
     }
+    if ($options{reduce_arch}) {
+        $options{host_arch} //= get_host_arch();
+        $options{build_arch} //= get_build_arch();
+    }
+    if ($options{reduce_profiles}) {
+        $options{build_profiles} //= [ get_build_profiles() ];
+    }
 
     # Options for Dpkg::Deps::Simple.
     my %deps_options = (
@@ -582,8 +586,8 @@ sub new {
     my $self = {};
     bless $self, $class;
     $self->reset();
-    $self->{host_arch} = $opts{host_arch} || Dpkg::Arch::get_host_arch();
-    $self->{build_arch} = $opts{build_arch} || Dpkg::Arch::get_build_arch();
+    $self->{host_arch} = $opts{host_arch};
+    $self->{build_arch} = $opts{build_arch};
     $self->{build_dep} = $opts{build_dep} // 0;
     $self->{tests_dep} = $opts{tests_dep} // 0;
     $self->parse_string($arg) if defined($arg);
@@ -1460,8 +1464,8 @@ sub _find_package {
     my ($self, $dep, $lackinfos) = @_;
     my ($pkg, $archqual) = ($dep->{package}, $dep->{archqual});
     return if not exists $self->{pkg}{$pkg};
-    my $host_arch = $dep->{host_arch};
-    my $build_arch = $dep->{build_arch};
+    my $host_arch = $dep->{host_arch} // Dpkg::Arch::get_host_arch();
+    my $build_arch = $dep->{build_arch} // Dpkg::Arch::get_build_arch();
     foreach my $p (@{$self->{pkg}{$pkg}}) {
        my $a = $p->{architecture};
        my $ma = $p->{multiarch};

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/dpkg/dpkg.git

Reply via email to