Permalink
Browse files

Simple program to list the versions of CPAN modules that are availabl…

…e across various Fedora RPM repositories.
  • Loading branch information...
1 parent 4864b41 commit 39ed7db0dc3b73ccd06341b1b3c6191d5bf9003c Dave Cross committed Apr 25, 2010
Showing with 60 additions and 0 deletions.
  1. +60 −0 fedora_rpms
View
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Parse::CPAN::Packages;
+
+my $packfile = '/home/dave/cpan/modules/02packages.details.txt.gz';
+
+my $cmd = q(repoquery --repoid=REPO ) .
+ q(--qf="%{name},%{version},%{vendor},%{repoid}" 'perl-*');
+
+my @repos = qw(fedora updates magnum livna);
+my @cols = qw(name version vendor repo);
+
+open my $csv, '>', 'fedora_perl.csv' or die $!;
+
+my $rpm;
+
+foreach my $r (@repos) {
+ my $exec = $cmd;
+ $exec =~ s/REPO/$r/;
+
+ foreach (`$exec`) {
+ chomp;
+ my %rec;
+ @rec{@cols} = split /,/;
+
+ $rpm->{$rec{name}}{$rec{repo}} = $rec{version};
+ }
+}
+
+my $p = Parse::CPAN::Packages->new($packfile);
+
+print $csv 'Distribution name,cpan,', join ',', @repos;
+print $csv "\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 $csv join(',', @out);
+ print $csv "\n";
+}

0 comments on commit 39ed7db

Please sign in to comment.