summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Dpkg/Deps.pm25
-rwxr-xr-xscripts/dpkg-gencontrol.pl10
2 files changed, 33 insertions, 2 deletions
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index e63818d68..22bd27aef 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 605fe84df..3d15da2f2 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
}