Dear Release Team,

please consider including apt-show-versions 0.22.2 into the next point
release of wheezy (or wheezy-updates). It mainly fixes an important Bug
(626867) with an incompatibility in the perl storable module and
introduces multiarch support.

Please see the attached debdiff.

Christoph
-- 
============================================================================
Christoph Martin, Zentrum für Datenverarbeitung, Uni-Mainz, Germany
 Anselm Franz von Bentzel-Weg 12, 55128 Mainz
 Telefon: +49(6131)3926337
 Instant-Messaging: Jabber: mar...@uni-mainz.de
  (Siehe http://www.zdv.uni-mainz.de/4010.php)
diff -Nru apt-show-versions-0.20/apt-show-versions 
apt-show-versions-0.22.2/apt-show-versions
--- apt-show-versions-0.20/apt-show-versions    2012-10-26 20:58:12.000000000 
+0200
+++ apt-show-versions-0.22.2/apt-show-versions  2013-08-27 10:32:48.000000000 
+0200
@@ -11,7 +11,7 @@
 
 # Author: Christoph Martin <mar...@uni-mainz.de>
 # Maintainer: Christoph Martin <mar...@uni-mainz.de>
-# Version: 0.16
+# Version: 0.21
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -31,10 +31,10 @@
 
 use strict;
 use Getopt::Long;
-use Storable qw(store retrieve);
+use Storable qw(nstore retrieve);
 
-my $apackagescachefile="/var/cache/apt-show-versions/apackages";
-my $ipackagescachefile="/var/cache/apt-show-versions/ipackages";
+my $apackagescachefile="/var/cache/apt-show-versions/apackages-multiarch";
+my $ipackagescachefile="/var/cache/apt-show-versions/ipackages-multiarch";
 my $filescachefile="/var/cache/apt-show-versions/files";
 
 use AptPkg::Cache;
@@ -66,6 +66,7 @@
 my $SUITE    = 'Suite';
 my $UNKNOWN  = 'unknown';
 my $VERS     = 'Version';
+my $ARCH     = 'Architecture';
 
 # process commandline parameters
 my %opts;
@@ -189,7 +190,7 @@
 if (!-e $filescachefile or -M $list_dir < -M $filescachefile or 
!ref($filesref)) {
     opendir(DIR, $list_dir) or &die("Can't opendir $list_dir: $!\n");
     @files = map { $list_dir . $_} grep /Packages$/, readdir(DIR);
-    ($< == 0) and (store(\@files, $filescachefile) or
+    ($< == 0) and (nstore(\@files, $filescachefile) or
         warn "Can't write $filescachefile\n");
 
     closedir DIR ;
@@ -201,9 +202,9 @@
 # Get hash with all installed packages from cache or create new hash
 # and write cache if root
 # $ipackages structure example:
-# {'dblatex' => {'Version' => '0.2.8-6',
-#                'Status' => 'install ok installed',
-#                'Package' => 'dblatex'},
+# {'dblatex' => {'amd64' => {'Version' => '0.2.8-6',
+#                            'Status' => 'install ok installed',
+#                            'Package' => 'dblatex'}},
 #  ...}
 my $ipackages;
 
@@ -212,24 +213,24 @@
 }
 if (!-e $ipackagescachefile or -M $status_file < -M $ipackagescachefile or 
!ref($ipackages)) {
     ($ipackages, undef) = parse_file ($status_file, 1);
-    ($< == 0) and (store($ipackages, $ipackagescachefile) or
+    ($< == 0) and (nstore($ipackages, $ipackagescachefile) or
         warn "Can't write $ipackagescachefile\n");
 }
 
 # Get available packages list from cache if possible
 # $apackages structure example:
-# {'dblatex' => {'ftp.de.debian.org_debian_dists_stable'
-#                 => {'Version' => '0.2-2',
-#                     'Release' => 'ftp.de.debian.org_debian_dists_stable',
-#                     'Package' => 'dblatex'},
-#                'ftp.de.debian.org_debian_dists_testing'
-#                 => {'Version' => '0.2.8-2',
-#                     'Release' => 'ftp.de.debian.org_debian_dists_testing',
-#                     'Package' => 'dblatex'},
-#                'ftp.de.debian.org_debian_dists_unstable'
-#                 => {'Version' => '0.2.8-6',
-#                     'Release' => 'ftp.de.debian.org_debian_dists_unstable',
-#                     'Package' => 'dblatex'}},
+# {'dblatex' => {'amd64' => {'ftp.de.debian.org_debian_dists_stable'
+#                             => {'Version' => '0.2-2',
+#                                 'Release' => 
'ftp.de.debian.org_debian_dists_stable',
+#                                 'Package' => 'dblatex'},
+#                            'ftp.de.debian.org_debian_dists_testing'
+#                             => {'Version' => '0.2.8-2',
+#                                 'Release' => 
'ftp.de.debian.org_debian_dists_testing',
+#                                 'Package' => 'dblatex'},
+#                            'ftp.de.debian.org_debian_dists_unstable'
+#                             => {'Version' => '0.2.8-6',
+#                                 'Release' => 
'ftp.de.debian.org_debian_dists_unstable',
+#                                 'Package' => 'dblatex'}}},
 #  ...}
 my $apackages;
 my $cache_file_corrupt;
@@ -239,7 +240,9 @@
     undef $apackages;
 }
 
-my $default_release = $_config->get("APT::Default-Release");
+my $default_release;
+
+$default_release = $_config->get("APT::Default-Release");
 
 my @official_suites = qw(oldstable stable proposed-updates stable-updates 
testing testing-proposed-updates testing-updates unstable experimental);
 # %official_suites:
@@ -254,13 +257,15 @@
     if (! -e $apackagescachefile or -C $_ < -M $apackagescachefile
         or $cache_file_corrupt) {
         my ($href, $release) = &parse_file ($_);
-        foreach (keys %$href) {
-            $apackages->{$_}{$release} = $href->{$_};
-        }
+        foreach my $pkg (keys %$href) {
+            foreach my $arch (keys $href->{$pkg}) {
+                $apackages->{$pkg}{$arch}{$release} = $href->{$pkg}{$arch};
+            }
+       }
     }
 }
 # Store if we are root
-($< == 0) and (store($apackages, $apackagescachefile) or
+($< == 0) and (nstore($apackages, $apackagescachefile) or
                &die("Warning: Can't write to $apackagescachefile!\n"));
 # Exit if we are root and using the -i option
 ($< == 0) and (exists $opts{'initialize'}) and exit;
@@ -296,21 +301,21 @@
 #   Version information to be printed (undef if no information exists)
 
################################################################################
 sub print_version {
-    my ($archiv, $package, $iversion, $aversion, $cand) = @_;
+    my ($archiv, $pkgarch, $iversion, $aversion, $cand) = @_;
 
-    if (defined($aversion) and $cache->{$package}) {
+    if (defined($aversion) and $cache->{$pkgarch}) {
         if ($cand and $aversion eq $cand->{VerStr})
         {
             my $cmp_versions = $vs->compare($aversion, $iversion);
             if ($cmp_versions != 0) {
                 my $direction = ($cmp_versions > 0) ? 'up' : 'down';
-                return(2, "$package/$archiv",
+                return(2, "$pkgarch/$archiv",
                        (defined($opts{'brief'})) ? "\n" :
-                       " ${direction}gradeable from $iversion to $aversion\n");
+                       " $iversion ${direction}gradeable to $aversion\n");
             }
             else {
-                return(1, "$package/$archiv", defined($opts{'brief'}) ? "\n"
-                       : " uptodate $iversion\n");
+                return(1, "$pkgarch/$archiv", defined($opts{'brief'}) ? "\n"
+                       : " $iversion uptodate\n");
             }
         }
     }
@@ -323,9 +328,43 @@
 
 sub print_package {
     my ($package) = @_;
+    my ($pkgname, $archname);
+
+    if ($package =~ m/:/) {
+        ($pkgname, $archname) = split /:/, $package;
+    } else {
+        $pkgname = $package;
+    }
+    
+    my $pkgs = ($opts{'regex-all'}) ? $apackages : $ipackages;
+
+    if ($archname and ! defined $apackages->{$pkgname}{$archname}) {
+        printf("%s not available for architecture %s\n", $pkgname, $archname);
+    } elsif (! defined $pkgs->{$pkgname}) {
+        if ($mode != $MODE_SINGLE || $archname) {
+            printf("%s not installed\n", $package);
+        } elsif (keys(%{$apackages->{$pkgname}})) {
+            my $archlist = "";
+            foreach my $a (sort keys(%{$apackages->{$pkgname}})) {
+                $archlist .= ($archlist ? ", $a" : "$a");
+            }
+            printf("%s not installed (available for: %s)\n", $pkgname, 
$archlist);
+        } else {
+            printf("%s not installed (not available)\n", $pkgname);
+        }
+    } else {
+        foreach my $arch ($archname or sort keys $pkgs->{$pkgname}) {
+            print_package_internal($pkgname, $arch);
+        }
+    }
+}
+
+sub print_package_internal {
+    my ($package, $arch) = @_;
+    my $pkgarch = $package . ":" . $arch;
 
     # Sort all releases of package.
-    my @pkg_releases = sort sort_pkg_releases 
values(%{$apackages->{$package}});
+    my @pkg_releases = sort sort_pkg_releases 
values(%{$apackages->{$package}{$arch}});
 
     # All print information of package must be buffered, as the decision
     # whether to suppress all printing for the package can be executed only at
@@ -337,16 +376,17 @@
     my $max_package_len = 0;
     my $max_version_len = 0;
     my $max_name_len = 0;
+    my $ipkg = $ipackages->{$package}{$arch};
 
     # print more information if required
     if ($opts{'allversions'}) {
-        if ($ipackages->{$package}->{$PACKAGE}) {
-            push @print_info, "$ipackages->{$package}->{$PACKAGE} ";
-            unless ($ipackages->{$package}->{$STATUS} =~ /not-installed/ ||
-                $ipackages->{$package}->{$STATUS} =~ /config-files/) {
-                push @print_info, "$ipackages->{$package}->{$VERS} ";
+        if ($ipkg->{$PACKAGE}) {
+            push @print_info, "$ipkg->{$PACKAGE}:$ipkg->{$ARCH} ";
+            unless ($ipkg->{$STATUS} =~ /not-installed/ ||
+                $ipkg->{$STATUS} =~ /config-files/) {
+                push @print_info, "$ipkg->{$VERS} ";
             }
-            push @print_info, "$ipackages->{$package}->{$STATUS}\n";
+            push @print_info, "$ipkg->{$STATUS}\n";
         } else {
             push @print_info, "Not installed\n";
         }
@@ -371,11 +411,12 @@
             }
             # Then handle current release.
             (my $archive = $pkg->{$RELEASE}) =~ s/_.*//;
-            push @print_info, {$PACKAGE => $pkg->{$PACKAGE},
+            my $pa = $pkg->{$PACKAGE} . ":" . $pkg->{$ARCH};
+            push @print_info, {$PACKAGE => $pa,
                                $VERS => $pkg->{$VERS},
                                $NAME => &get_rel_name($pkg->{$RELEASE}),
                                $ARCHIVE => $archive};
-            $max_package_len = &max(length($pkg->{$PACKAGE}), 
$max_package_len);
+            $max_package_len = &max(length($pa), $max_package_len);
             $max_version_len = &max(length($pkg->{$VERS}), $max_version_len);
             $max_name_len = &max(length(&get_rel_name($pkg->{$RELEASE})),
                                  $max_name_len);
@@ -388,19 +429,19 @@
         }
     }
 
-    my $iversion = $ipackages->{$package}->{$VERS};
+    my $iversion = $ipkg->{$VERS};
 
     # print info about upgrade status (only if package is installed)
 
-    if (($ipackages->{$package}->{$VERS}) &&
-        (!($ipackages->{$package}->{$STATUS} =~ /config-files/))) {
+    if (($ipkg->{$VERS}) &&
+        (!($ipkg->{$STATUS} =~ /config-files/))) {
         # Reorder package version structures to prefer the default release.
         @pkg_releases = &reorder_pkg_releases(@pkg_releases);
         my $found = 0;
         my $aversion = 0;
         my $cand;
-        if ($cache->{$package}) {
-            $cand = $policy->candidate($cache->{$package});
+        if ($cache->{$pkgarch}) {
+            $cand = $policy->candidate($cache->{$pkgarch});
         }
         foreach (@pkg_releases) {
             my $version = $_->{$VERS};
@@ -408,7 +449,7 @@
                 my @version_info;
                 ($found, @version_info) =
                     &print_version(&get_rel_name($_->{$RELEASE}),
-                                   $package, $iversion, $version, $cand);
+                                   $pkgarch, $iversion, $version, $cand);
                 push @print_info, @version_info if ($found);
                 $aversion = $version;
             }
@@ -431,7 +472,7 @@
             if ($newer_indic and not defined($opts{'brief'}))
             {
                 push(@print_info,
-                     "$package $iversion newer than version in archive\n");
+                     "$pkgarch $iversion newer than version in archive\n");
             }
         } elsif (not $found) {
             # Check for manual upgrade possibility:
@@ -447,7 +488,7 @@
                         $vs->compare($iversion, $cmp_version) < 0)
                     {
                         push(@print_info,
-                             $package,
+                             $pkgarch,
                              '/',
                              &get_rel_name($release->{$RELEASE}),
                              (defined($opts{'brief'})) ? "\n" :
@@ -460,14 +501,14 @@
                 }
             }
             if (not $found) {
-                push(@print_info, "$package $iversion installed: No available 
",
+                push(@print_info, "$pkgarch $iversion installed: No available 
",
                      "version in archive\n");
             }
         }
     } else {
-        push(@print_info, "$package not installed",
-             ($mode == $MODE_SINGLE and not keys(%{$apackages->{$package}}))
-             ? " (even not available)\n" : "\n");
+        push(@print_info, "$pkgarch not installed",
+             ($mode == $MODE_SINGLE and not 
keys(%{$apackages->{$package}{$arch}}))
+            ? " (even not available)\n" : "\n");
     }
 
     if ($opts{'upgradeable'}
@@ -522,21 +563,22 @@
                         ($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->{$PACKAGE}}{$package->{$ARCH}} = 
$package;
                 }
             }
             else {
                 if (!defined $packages->{$package->{$PACKAGE}} or
-                    $vs->compare($packages->{$package->{$PACKAGE}}{$VERS},
-                        $package->{$VERS}) < 0) {
+                   !defined 
$packages->{$package->{$PACKAGE}}{$package->{$ARCH}}{$VERS} or
+                    
$vs->compare($packages->{$package->{$PACKAGE}}{$package->{$ARCH}}{$VERS},
+                        $package->{$VERS}) < 0) {
                     $package->{$RELEASE} = $release;
-                    $packages->{$package->{$PACKAGE}} = $package;
+                    $packages->{$package->{$PACKAGE}}{$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 ()
diff -Nru apt-show-versions-0.20/apt-show-versions.bash_completion 
apt-show-versions-0.22.2/apt-show-versions.bash_completion
--- apt-show-versions-0.20/apt-show-versions.bash_completion    2009-06-19 
17:37:00.000000000 +0200
+++ apt-show-versions-0.22.2/apt-show-versions.bash_completion  2013-06-19 
11:12:33.000000000 +0200
@@ -27,7 +27,7 @@
             return 0
             ;;
         -p|--package)
-            COMPREPLY=( $(_comp_dpkg_installed_packages $cur) )
+            COMPREPLY=( $(_xfunc dpkg _comp_dpkg_installed_packages $cur) )
             return 0
             ;;
         -stf|--status-file)
@@ -44,7 +44,7 @@
         COMPREPLY=( $(compgen -W "$opts" -- $cur) )
         return 0
     else
-        COMPREPLY=( $(_comp_dpkg_installed_packages $cur) )
+        COMPREPLY=( $(_xfunc dpkg _comp_dpkg_installed_packages $cur) )
         return 0
     fi
 }
diff -Nru apt-show-versions-0.20/debian/apt-show-versions.postinst 
apt-show-versions-0.22.2/debian/apt-show-versions.postinst
--- apt-show-versions-0.20/debian/apt-show-versions.postinst    2008-09-16 
09:39:21.000000000 +0200
+++ apt-show-versions-0.22.2/debian/apt-show-versions.postinst  2013-07-02 
11:20:15.000000000 +0200
@@ -25,7 +25,12 @@
 
 case "$1" in
     configure)
+       if [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.21" ; then
+           echo "removing old cache files"
+           rm -vf /var/cache/apt-show-versions/apackages 
/var/cache/apt-show-versions/ipackages
+       fi
        echo "** initializing cache. This may take a while **"
+       umask 0022
        apt-show-versions -i
     ;;
 
diff -Nru apt-show-versions-0.20/debian/changelog 
apt-show-versions-0.22.2/debian/changelog
--- apt-show-versions-0.20/debian/changelog     2012-10-26 20:59:16.000000000 
+0200
+++ apt-show-versions-0.22.2/debian/changelog   2013-08-27 10:52:31.000000000 
+0200
@@ -1,3 +1,39 @@
+apt-show-versions (0.22.2) unstable; urgency=low
+
+  * fix display for not installed packages (thanks to Greg Klanderman
+    <g...@klanderman.net>) (closes: #715314)
+
+ -- Christoph Martin <christoph.mar...@uni-mainz.de>  Tue, 27 Aug 2013 
10:40:41 +0200
+
+apt-show-versions (0.22.1) unstable; urgency=low
+
+  * fix postinst for new installs (closes: #714563)
+
+ -- Christoph Martin <christoph.mar...@uni-mainz.de>  Tue, 02 Jul 2013 
11:21:37 +0200
+
+apt-show-versions (0.22) unstable; urgency=low
+
+  * fix postinst to not fail if old cache files are absent (closes:
+    #712911)
+
+ -- Christoph Martin <christoph.mar...@uni-mainz.de>  Fri, 21 Jun 2013 
11:59:24 +0200
+
+apt-show-versions (0.21) unstable; urgency=low
+
+  * add support for multiarch (Closes: #696655) thanks to
+    Greg Klanderman <g...@klanderman.net>
+  * fix storable byteorder problem (Closes: #626867)
+  * fix bash completion (Closes: #680663)
+  * debian/NEWS: added about multiarch
+  * explicitly set umask to 0022 in postinstall to assure readable cache
+    files (Closes: #706083)
+  * change ordering of fields to consistently show version is second
+    column (Closes: #611435)
+  * add $misc:Depends to control
+  * conform to standards version 3.9.3 (no changes)
+
+ -- Christoph Martin <christoph.mar...@uni-mainz.de>  Fri, 21 Jun 2013 
11:57:59 +0200
+
 apt-show-versions (0.20) unstable; urgency=low
 
   * fix race condition in parallel build mode. (Closes: #689681)
diff -Nru apt-show-versions-0.20/debian/control 
apt-show-versions-0.22.2/debian/control
--- apt-show-versions-0.20/debian/control       2012-08-24 15:50:41.000000000 
+0200
+++ apt-show-versions-0.22.2/debian/control     2013-06-19 16:23:20.000000000 
+0200
@@ -5,13 +5,13 @@
 Uploaders: Andreas Hoenen <andr...@hoenen-terstappen.de>
 Build-Depends: debhelper (>= 5)
 Build-Depends-Indep: po4a
-Standards-Version: 3.8.1
+Standards-Version: 3.9.3
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-asv
 Vcs-Svn: svn://svn.debian.org/pkg-asv/
 
 Package: apt-show-versions
 Architecture: all
-Depends: ${perl:Depends} | perl-5.005 | perl-5.004, apt, libapt-pkg-perl (>= 
0.1.21), libstorable-perl
+Depends: ${misc:Depends}, ${perl:Depends} | perl-5.005 | perl-5.004, apt, 
libapt-pkg-perl (>= 0.1.21), libstorable-perl
 Description: lists available package versions with distribution
  apt-show-versions parses the dpkg status file and the APT lists for
  the installed and available package versions and distribution and
diff -Nru apt-show-versions-0.20/debian/NEWS 
apt-show-versions-0.22.2/debian/NEWS
--- apt-show-versions-0.20/debian/NEWS  1970-01-01 01:00:00.000000000 +0100
+++ apt-show-versions-0.22.2/debian/NEWS        2013-06-19 11:44:57.000000000 
+0200
@@ -0,0 +1,14 @@
+apt-show-versions (0.21) unstable; urgency=low
+
+  apt-show-versions now supports multiarch.
+  
+  This results in a slightly different output format. Each package name
+    gets its architecture appended with a colon. Also the version field
+    now goes consistently to the second colum:
+
+    bash:amd64/wheezy 4.2+dfsg-0.1 uptodate
+    cpp-4.3:amd64 4.3.5-4 installed: No available version in archive
+    subversion:amd64/wheezy 1.6.12dfsg-7 upgradeable to 1.6.17dfsg-4+deb7u3
+
+ -- Christoph Martin <christoph.mar...@uni-mainz.de>  Wed, 19 Jun 2013 
11:18:17 +0200
+
diff -Nru apt-show-versions-0.20/debian/rules 
apt-show-versions-0.22.2/debian/rules
--- apt-show-versions-0.20/debian/rules 2012-10-08 18:11:47.000000000 +0200
+++ apt-show-versions-0.22.2/debian/rules       2013-06-19 16:31:26.000000000 
+0200
@@ -14,7 +14,9 @@
 
        touch configure-stamp
 
-build: configure-stamp build-stamp
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
 build-stamp: configure-stamp
        dh_testdir
 
@@ -47,7 +49,7 @@
        dh_installdirs
 
        # Add here commands to install the package into 
debian/apt-show-versions.
-       $(MAKE) install PREFIX=$(CURDIR)/debian/apt-show-versions/usr
+       $(MAKE) install DESTDIR=$(CURDIR)/debian/apt-show-versions/
        rm -fr debian/apt-show-versions/usr/lib 
debian/apt-show-versions/usr/share/perl5
        install -D --mode=644 debian/apt-show-versions.apt.conf \
                 
$(CURDIR)/debian/apt-show-versions/etc/apt/apt.conf.d/20apt-show-versions
@@ -76,4 +78,4 @@
 # We have nothing to do by default.
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
+.PHONY: build build-arch build-indep clean binary-indep binary-arch binary 
install configure

<<attachment: martin.vcf>>

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to