Ver código fonte

Dpkg::Deps: Add support for a build_arch option in deps_parse()

Dpkg::Deps::deps_parse takes a host_arch option, but doesn't take a
corresponding build_arch option. This means that if you're evaluating
dependencies relative to a non-default build architecture, you get
Dpkg::Deps::* objects back with the wrong build_arch set, which may
cause unexpected behaviour later in simplify_deps.

Closes: #697297

Signed-off-by: Guillem Jover <guillem@debian.org>
Colin Watson 13 anos atrás
pai
commit
e8950d7e2d
2 arquivos alterados com 10 adições e 0 exclusões
  1. 2 0
      debian/changelog
  2. 8 0
      scripts/Dpkg/Deps.pm

+ 2 - 0
debian/changelog

@@ -110,6 +110,8 @@ dpkg (1.17.0) UNRELEASED; urgency=low
   * Support parsing compressed changelog files transparently. Closes: #684196
   * Support parsing compressed changelog files transparently. Closes: #684196
   * Sort files inside new diffs generated by dpkg-source lexicographically.
   * Sort files inside new diffs generated by dpkg-source lexicographically.
     Closes: #689193
     Closes: #689193
+  * Add support for a build_arch option in Dpkg::Deps deps_parse().
+    Thanks to Colin Watson <cjwatson@ubuntu.com>. Closes: #697297
 
 
   [ Updated programs translations ]
   [ Updated programs translations ]
   * Fix typo in Spanish translation of update-alternatives.
   * Fix typo in Spanish translation of update-alternatives.

+ 8 - 0
scripts/Dpkg/Deps.pm

@@ -273,6 +273,11 @@ Set to 0 to completely ignore that information.
 Define the host architecture. By default it uses
 Define the host architecture. By default it uses
 Dpkg::Arch::get_host_arch() to identify the proper architecture.
 Dpkg::Arch::get_host_arch() to identify the proper architecture.
 
 
+=item build_arch (defaults to the current architecture)
+
+Define the build architecture. By default it uses
+Dpkg::Arch::get_build_arch() to identify the proper architecture.
+
 =item reduce_arch (defaults to 0)
 =item reduce_arch (defaults to 0)
 
 
 If set to 1, ignore dependencies that do not concern the current host
 If set to 1, ignore dependencies that do not concern the current host
@@ -300,6 +305,7 @@ sub deps_parse {
     $options{use_arch} = 1 if not exists $options{use_arch};
     $options{use_arch} = 1 if not exists $options{use_arch};
     $options{reduce_arch} = 0 if not exists $options{reduce_arch};
     $options{reduce_arch} = 0 if not exists $options{reduce_arch};
     $options{host_arch} = get_host_arch() if not exists $options{host_arch};
     $options{host_arch} = get_host_arch() if not exists $options{host_arch};
+    $options{build_arch} = get_build_arch() if not exists $options{build_arch};
     $options{union} = 0 if not exists $options{union};
     $options{union} = 0 if not exists $options{union};
     $options{build_dep} = 0 if not exists $options{build_dep};
     $options{build_dep} = 0 if not exists $options{build_dep};
 
 
@@ -313,6 +319,8 @@ sub deps_parse {
         foreach my $dep_or (split(/\s*\|\s*/m, $dep_and)) {
         foreach my $dep_or (split(/\s*\|\s*/m, $dep_and)) {
 	    my $dep_simple = Dpkg::Deps::Simple->new($dep_or, host_arch =>
 	    my $dep_simple = Dpkg::Deps::Simple->new($dep_or, host_arch =>
 	                                             $options{host_arch},
 	                                             $options{host_arch},
+	                                             build_arch =>
+	                                             $options{build_arch},
 	                                             build_dep =>
 	                                             build_dep =>
 	                                             $options{build_dep});
 	                                             $options{build_dep});
 	    if (not defined $dep_simple->{package}) {
 	    if (not defined $dep_simple->{package}) {