Ensure that foreign-arch multiarch multistraps work force_unpack was not considering architecture when de-duping the package list (This manifested when doing a foreign-arch multistrap which was also multiarch - i.e. two foreign arches relative to the build arch).

This commit is contained in:
Wookey 2017-01-25 03:36:41 +00:00
parent 4e775ab148
commit 796a419bd1

View file

@ -572,16 +572,17 @@ sub force_unpack {
my $escaped_path = shellescape("${dir}${cachedir}archives/$deb"); my $escaped_path = shellescape("${dir}${cachedir}archives/$deb");
my $version = `LC_ALL=C dpkg -f $escaped_path Version`; my $version = `LC_ALL=C dpkg -f $escaped_path Version`;
my $package = `LC_ALL=C dpkg -f $escaped_path Package`; my $package = `LC_ALL=C dpkg -f $escaped_path Package`;
my $arch = `LC_ALL=C dpkg -f $escaped_path Architecture`;
chomp ($version); chomp ($version);
chomp ($package); chomp ($package);
if (exists $unpack{$package}) { if (exists $unpack{$package}) {
my $test=system("dpkg --compare-versions ". shellescape($unpack{$package}) . " '<<' " . shellescape($version)); my $test=system("dpkg --compare-versions ". shellescape($unpack{$package.$arch}) . " '<<' " . shellescape($version));
$test >>= 8; $test >>= 8;
# unlink version in $unpack if 0 # unlink version in $unpack if 0
# unlink $deb (current one) if 1 # unlink $deb (current one) if 1
if ($test == 0) { if ($test == 0) {
my $old = $deb; my $old = $deb;
$old =~ s/$version/$unpack{$package}/; $old =~ s/$version/$unpack{$package.$arch}/;
printf (_g("I: Removing %s\n"), $old); printf (_g("I: Removing %s\n"), $old);
unlink "${dir}${cachedir}archives/$old"; unlink "${dir}${cachedir}archives/$old";
next; next;
@ -590,7 +591,7 @@ sub force_unpack {
unlink "${dir}${cachedir}archives/$deb"; unlink "${dir}${cachedir}archives/$deb";
} }
} }
$unpack{$package}=$version; $unpack{$package.$arch}=$version;
} }
if (not @limits) { if (not @limits) {
open (LOCK, ">${dir}${libdir}lists/lock"); open (LOCK, ">${dir}${libdir}lists/lock");