[Pkg-asv-commits] r60 - in trunk: . debian
Christoph Martin
chrism at alioth.debian.org
Wed Jun 19 14:35:53 UTC 2013
Author: chrism
Date: 2013-06-19 14:35:52 +0000 (Wed, 19 Jun 2013)
New Revision: 60
Added:
trunk/debian/NEWS
Modified:
trunk/apt-show-versions
trunk/apt-show-versions.bash_completion
trunk/debian/apt-show-versions.postinst
trunk/debian/changelog
trunk/debian/control
trunk/debian/rules
Log:
releasing version 0.21
Modified: trunk/apt-show-versions
===================================================================
--- trunk/apt-show-versions 2012-10-26 19:00:07 UTC (rev 59)
+++ trunk/apt-show-versions 2013-06-19 14:35:52 UTC (rev 60)
@@ -11,7 +11,7 @@
# Author: Christoph Martin <martin at uni-mainz.de>
# Maintainer: Christoph Martin <martin at 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,8 +240,10 @@
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:
# - Keys: Known official suite names
@@ -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");
}
}
}
@@ -324,8 +329,23 @@
sub print_package {
my ($package) = @_;
+ if ($package =~ m/:/) {
+ my ($pkgname, $arch) = split /:/, $package;
+ print_package_internal($pkgname, $arch);
+ } else {
+ my $pkgs = ($opts{'regex-all'}) ? $apackages : $ipackages;
+ foreach my $arch (sort keys $pkgs->{$package}) {
+ print_package_internal($package, $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 +357,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 +392,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 +410,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 +430,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 +453,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 +469,7 @@
$vs->compare($iversion, $cmp_version) < 0)
{
push(@print_info,
- $package,
+ $pkgarch,
'/',
&get_rel_name($release->{$RELEASE}),
(defined($opts{'brief'})) ? "\n" :
@@ -460,14 +482,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 +544,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 ()
Modified: trunk/apt-show-versions.bash_completion
===================================================================
--- trunk/apt-show-versions.bash_completion 2012-10-26 19:00:07 UTC (rev 59)
+++ trunk/apt-show-versions.bash_completion 2013-06-19 14:35:52 UTC (rev 60)
@@ -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
}
Added: trunk/debian/NEWS
===================================================================
--- trunk/debian/NEWS (rev 0)
+++ trunk/debian/NEWS 2013-06-19 14:35:52 UTC (rev 60)
@@ -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.martin at uni-mainz.de> Wed, 19 Jun 2013 11:18:17 +0200
+
Modified: trunk/debian/apt-show-versions.postinst
===================================================================
--- trunk/debian/apt-show-versions.postinst 2012-10-26 19:00:07 UTC (rev 59)
+++ trunk/debian/apt-show-versions.postinst 2013-06-19 14:35:52 UTC (rev 60)
@@ -25,7 +25,12 @@
case "$1" in
configure)
+ if dpkg --compare-versions $2 lt "0.21" ; then
+ echo "removing old cache files"
+ rm -v /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
;;
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2012-10-26 19:00:07 UTC (rev 59)
+++ trunk/debian/changelog 2013-06-19 14:35:52 UTC (rev 60)
@@ -1,3 +1,19 @@
+apt-show-versions (0.21) unstable; urgency=low
+
+ * add support for multiarch (Closes: #696655) thanks to
+ Greg Klanderman <gak at 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.martin at uni-mainz.de> Wed, 19 Jun 2013 16:23:47 +0200
+
apt-show-versions (0.20) unstable; urgency=low
* fix race condition in parallel build mode. (Closes: #689681)
Modified: trunk/debian/control
===================================================================
--- trunk/debian/control 2012-10-26 19:00:07 UTC (rev 59)
+++ trunk/debian/control 2013-06-19 14:35:52 UTC (rev 60)
@@ -5,13 +5,13 @@
Uploaders: Andreas Hoenen <andreas at 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
Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules 2012-10-26 19:00:07 UTC (rev 59)
+++ trunk/debian/rules 2013-06-19 14:35:52 UTC (rev 60)
@@ -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
More information about the Pkg-asv-commits
mailing list