#!/usr/bin/perl use strict; use warnings; use Dpkg::Version; die "Syntax: $0 " unless (@ARGV == 1); my $want_pkg = $ARGV[0]; print "$want_pkg:\n"; $/ = ''; # slurp paragraphs my @packages_files = sort (glob ("dists/*/*/*/Packages"), glob ("dists/*/*/*/Sources.gz")); foreach my $packages (@packages_files) { my ($dists, $dist, $component, $arch) = split m!/!, $packages; $arch =~ s/^binary-//; if ($packages =~ /\.gz$/) { open P, '-|', 'gunzip', '-c', $packages or die "$packages: $!"; } else { open P, $packages or die "$packages: $!"; } while (

) { my ($pkg) = /^Package: (.+)/m or die "$packages: paragraph without Package: $_"; my ($ver) = /^Version: (.+)/m or die "$packages: paragraph without Version: $_"; next unless ($pkg eq $want_pkg); printf "%-20s %-4s %-7s %s\n", $dist, $component, $arch, $ver; } close P; }