The following commit has been merged in the master branch:
commit 063f0565dcdf069b7f9624c237ed7fce10571887
Author: Raphaël Hertzog <[email protected]>
Date:   Sun Feb 21 01:34:00 2010 +0100

    dpkg-gencontrol: don't accept arch-specific dependencies in arch: all 
packages
    
    Since an architecture all package is shared on all architectures, its
    dependency lines can't be simplified with the knowledge of the current host
    architecture.

diff --git a/debian/changelog b/debian/changelog
index c62b435..c76faa0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,6 +36,8 @@ dpkg (1.15.6) UNRELEASED; urgency=low
   * While parsing diff's output, accept any sentence that contains the word
     differ (as specified by POSIX) to identify that binary files could not be
     compared. Closes: #570008
+  * dpkg-gencontrol does no longer accept arch-specific dependencies in
+    arch: all packages. Closes: #560071
 
   [ Guillem Jover ]
   * Handle argument parsing in dpkg-checkbuilddeps and dpkg-scanpackages
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index e63818d..22bd27a 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -430,6 +430,12 @@ Simplify the dependency as much as possible given the list 
of facts (see
 object Dpkg::Deps::KnownFacts) and a list of other dependencies that we
 know to be true.
 
+=item $dep->has_arch_restriction()
+
+For a simple dependency, returns the package name if the dependency
+applies only to a subset of architectures.  For multiple dependencies, it
+returns the list of package names that have such a restriction.
+
 =back
 
 =head2 Dpkg::Deps::Simple
@@ -666,6 +672,15 @@ sub reduce_arch {
     }
 }
 
+sub has_arch_restriction {
+    my ($self) = @_;
+    if (defined $self->{arches}) {
+       return $self->{package};
+    } else {
+       return ();
+    }
+}
+
 sub get_evaluation {
     my ($self, $facts) = @_;
     return undef if not defined $self->{package};
@@ -815,6 +830,16 @@ sub reduce_arch {
     $self->{list} = [ @new ];
 }
 
+sub has_arch_restriction {
+    my ($self) = @_;
+    my @res;
+    foreach my $dep (@{$self->{list}}) {
+       push @res, $dep->has_arch_restriction();
+    }
+    return @res;
+}
+
+
 sub is_empty {
     my $self = shift;
     return scalar @{$self->{list}} == 0;
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index 605fe84..3d15da2 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -235,11 +235,14 @@ if (exists $pkg->{"Provides"}) {
 
 my (@seen_deps);
 foreach my $field (field_list_pkg_dep()) {
+    # Arch: all can't be simplified as the host architecture is not known
+    my $reduce_arch = debarch_eq('all', $pkg->{Architecture} || "all") ? 0 : 1;
     if (exists $pkg->{$field}) {
        my $dep;
        my $field_value = $substvars->substvars($pkg->{$field});
        if (field_get_dep_type($field) eq 'normal') {
-           $dep = deps_parse($field_value, use_arch => 1, reduce_arch => 1);
+           $dep = deps_parse($field_value, use_arch => 1,
+                             reduce_arch => $reduce_arch);
            error(_g("error occurred while parsing %s field: %s"), $field,
                   $field_value) unless defined $dep;
            $dep->simplify_deps($facts, @seen_deps);
@@ -247,12 +250,15 @@ foreach my $field (field_list_pkg_dep()) {
            push @seen_deps, $dep;
        } else {
            $dep = deps_parse($field_value, use_arch => 1,
-                              reduce_arch => 1, union => 1);
+                              reduce_arch => $reduce_arch, union => 1);
            error(_g("error occurred while parsing %s field: %s"), $field,
                   $field_value) unless defined $dep;
            $dep->simplify_deps($facts);
             $dep->sort();
        }
+       error(_g("the %s field contains an arch-specific dependency but the " .
+                "package is architecture all"), $field)
+           if $dep->has_arch_restriction();
        $fields->{$field} = $dep->output();
        delete $fields->{$field} unless $fields->{$field}; # Delete empty field
     }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to