Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5efc5fb7e2
Fetching contributors…

Cannot retrieve contributors at this time

executable file 104 lines (75 sloc) 2.046 kb
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Std;
use Parse::CPAN::Packages;
my %opts;
getopts('p:d:r:', \%opts);
my $packfile = $opts{p}
|| $ENV{CPAN_PACKFILE}
|| '/home/dave/cpan/modules/02packages.details.txt.gz';
unless (-f $packfile) {
require LWP::Simple;
warn "Downloading 02packages\n";
LWP::Simple::getstore('http://www.cpan.org/modules/02packages.details.txt.gz',
$packfile);
};
my $cmd = q(repoquery --repoid=REPO ) .
q(--qf="%{name},%{version},%{vendor},%{repoid}" 'perl-*');
my %repos = (
fedora => [ qw(fedora updates magnum rpmfusion-free
rpmfusion-nonfree rpmfusion-free-updates
rpmfusion-nonfree-updates livna) ],
centos => [ qw(base updates epel magnum rpmforge) ],
);
my $dist = $opts{d};
unless ($dist) {
open my $rel, '<', '/etc/redhat-release' or
die "Can't open redhat-release: $!\n";
($dist) = <$rel> =~ /^(\w+)/;
$dist = lc $dist;
}
die "$dist is an unknown distribution\n" unless exists $repos{$dist};
my @repos;
if ($opts{r}) {
@repos = split /,/, $opts{r};
} else {
@repos = @{ $repos{$dist} };
}
my @cols = qw(name version vendor repo);
my $rpm;
my %xlate = (' http://dag.wieers.com/apt/' => 'rpmforge');
foreach my $r (@repos) {
my $exec = $cmd;
$exec =~ s/REPO/$r/;
foreach (`$exec`) {
chomp;
my %rec;
@rec{@cols} = split /,/;
if (exists $xlate{$rec{repo}}) {
$rec{repo} = $xlate{$rec{repo}};
}
$rpm->{$rec{name}}{$rec{repo}} = $rec{version};
}
}
my $p = Parse::CPAN::Packages->new($packfile);
print 'Distribution name,cpan,', join ',', @repos;
print "\n";
foreach (sort keys %$rpm) {
my $distname = $_;
$distname =~ s/^perl-//;
my $dist = $p->latest_distribution($distname);
if ($dist) {
$rpm->{$_}{cpan} = $dist->version;
}
my @out;
push @out, $_;
foreach my $r ('cpan', @repos) {
if (exists $rpm->{$_}{$r}) {
push @out, "'$rpm->{$_}{$r}";
} else {
push @out, '';
}
}
print join(',', @out), "\n";
}
Jump to Line
Something went wrong with that request. Please try again.