Don't rely on Architecture field in indextargets output because it's only filled for non-flat mirrors

This commit is contained in:
Johannes 'josch' Schauer 2018-10-22 11:29:56 +02:00
parent bdbe12fec8
commit 7a25de31db
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -715,7 +715,7 @@ sub setup {
# Same if we want to install priority based variants.
if ($options->{variant} ne 'apt') {
my %ess_pkgs;
open(my $pipe_apt, '-|', 'apt-get', 'indextargets', '--format', '$(FILENAME)', 'Created-By: Packages', "Architecture: $options->{nativearch}") or die "cannot start apt-get indextargets: $!";
open(my $pipe_apt, '-|', 'apt-get', 'indextargets', '--format', '$(FILENAME)', 'Created-By: Packages') or die "cannot start apt-get indextargets: $!";
while (my $fname = <$pipe_apt>) {
chomp $fname;
open (my $pipe_cat, '-|', '/usr/lib/apt/apt-helper', 'cat-file', $fname) or die "cannot start apt-helper cat-file: $!";
@ -723,6 +723,7 @@ sub setup {
my $pkgname;
my $ess = '';
my $prio = 'optional';
my $arch = '';
while (my $line = <$pipe_cat>) {
chomp $line;
# Dpkg::Index takes 10 seconds to parse a typical Packages
@ -735,9 +736,14 @@ sub setup {
$ess = 'yes'
} elsif ($line =~ /^Priority: (.*)/) {
$prio = $1;
} elsif ($line =~ /^Architecture: (.*)/) {
$arch = $1;
}
next;
}
# we are only interested of packages of native architecture or
# Architecture:all
if ($arch eq $options->{nativearch} or $arch eq 'all') {
# the line is empty, thus a package stanza just finished
# processing and we can handle it now
if ($ess eq 'yes') {
@ -766,10 +772,12 @@ sub setup {
} else {
die "unknown variant: $options->{variant}";
}
}
# reset values
undef $pkgname;
$ess = '';
$prio = 'optional';
$arch = '';
}
close $pipe_cat;