Package: apt-show-versions
Version: 0.20
Followup-For: Bug #696655

Hi,

The attached patch makes apt-show-versions report information about
packages of foreign architectures correctly. The existing cache files
need to be removed first.

Gabor

-- System Information:
Debian Release: 7.0
  APT prefers stable
  APT policy: (990, 'stable'), (103, 'testing'), (102, 'unstable'), (101, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.7.3 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apt-show-versions depends on:
ii  apt                      0.9.7.7
ii  libapt-pkg-perl          0.1.26+b1
ii  perl [libstorable-perl]  5.14.2-16

apt-show-versions recommends no packages.

apt-show-versions suggests no packages.

/- no debconf information
--- apt-show-versions.orig	2012-10-26 21:04:26.000000000 +0200
+++ apt-show-versions	2013-01-24 21:05:37.079635767 +0100
@@ -69,6 +69,7 @@
 my $SUITE    = 'Suite';
 my $UNKNOWN  = 'unknown';
 my $VERS     = 'Version';
+my $ARCH     = 'Architecture';
 
 # process commandline parameters
 my %opts;
@@ -518,6 +519,7 @@
         if (/^$/){
             unless (defined $package) {next};
 
+            my $package_arch = $package->{$PACKAGE} . ':' . $package->{$ARCH};
             if ($status) { # Are we parsing the status file?
                 # if we did not specify a package or pattern
                 # only include installed packages
@@ -525,21 +527,21 @@
                         ($package->{$STATUS} =~ /not-installed|config-files/ or
                          # don't print holded packages if requested
                          ($opts{'nohold'} and $package->{$STATUS} =~ /hold/))) {
-                    $packages->{ $package->{$PACKAGE}} = $package;
+                    $packages->{$package_arch} = $package;
                 }
             }
             else {
-                if (!defined $packages->{$package->{$PACKAGE}} or
-                    $vs->compare($packages->{$package->{$PACKAGE}}{$VERS},
+                if (!defined $packages->{$package_arch} or
+                    $vs->compare($packages->{$package_arch}{$VERS},
                         $package->{$VERS}) < 0) {
                     $package->{$RELEASE} = $release;
-                    $packages->{$package->{$PACKAGE}} = $package;
+                    $packages->{$package_arch} = $package;
                 }
             }
             undef $package;
             next;
         }
-        unless ((/^Package/) || (/^Version/) || (/^Status/) || (/^Source/)) {next};
+        unless ((/^Package/) || (/^Version/) || (/^Status/) || (/^Source/) || (/^Architecture/)) {next};
         ($key, $value) = split /: /, $_;
         $value =~ s/\n//;
         $value =~ s/\s\(.*\)$//; # Remove any Version information in ()

Reply via email to