X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=samples%2Fgengentooisms;h=fcd656a12aa5b52b18ac80783ae650fea7079a56;hb=868b43315fb46d028fc3a7b9b244c3a5f9699b20;hp=e5f8f1315175c63148ba8572e02b61c0d1e7fae1;hpb=81b5731129ec4df7c299707f9650bf4a693a8154;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/samples/gengentooisms b/samples/gengentooisms index e5f8f13..fcd656a 100755 --- a/samples/gengentooisms +++ b/samples/gengentooisms @@ -5,25 +5,14 @@ use warnings; use Fatal; use File::Spec; -use File::Copy qw/copy/; -use List::Util qw/max reduce/; +use File::Copy qw; +use List::Util qw; use Storable (); use Term::ANSIColor; -use CPAN::DistnameInfo; -BEGIN { - my $old_cdi_new = \&CPAN::DistnameInfo::new; - die 'CPAN::DistnameInfo is not loaded' unless $old_cdi_new; - my $new_cdi_new = sub { - my $dist = $old_cdi_new->(@_); - $dist->{version} =~ s/-withoutworldwriteables$//; - $dist; - }; - no warnings 'redefine'; - *CPAN::DistnameInfo::new = $new_cdi_new; -} +use CPAN::DistnameInfo 0.11; -use Capture::Tiny qw/capture/; +use Capture::Tiny qw; use LWP::UserAgent; use Parse::CPAN::Packages::Fast; @@ -85,7 +74,7 @@ my (@not_on_cpan, @unfindable, @missing, %name_mismatch, %version); sub parse_portage_tree { my $pcp = Parse::CPAN::Packages::Fast->new(PACKAGES); - for my $category (qw/perl-core dev-perl/) { + for my $category (qw) { p(0, "Browsing the $category category.\n"); my $cat_dir = File::Spec->catdir(PORTAGE, $category); @@ -95,6 +84,12 @@ sub parse_portage_tree { my $pkg_name = (File::Spec->splitdir($pkg_dir))[-1]; + my $last = reduce { $a->[1] > $b->[1] ? $a : $b } + map [ $_, CPANPLUS::Dist::Gentoo::Atom->new_from_ebuild($_) ], + glob File::Spec->catfile($pkg_dir, "$pkg_name-*"); + my ($ebuild, $atom) = @$last; + p(1, "%s/%s-%s\n", map $atom->$_, qw); + if (exists $is_on_cpan{$pkg_name} and not $is_on_cpan{$pkg_name}) { p(2, colored("$pkg_name is not a CPAN distribution (forced)", 'bright_red') . "\n"); @@ -102,12 +97,6 @@ sub parse_portage_tree { next; } - my $last = reduce { $a->[1] > $b->[1] ? $a : $b } - map [ $_, CPANPLUS::Dist::Gentoo::Atom->new_from_ebuild($_) ], - glob File::Spec->catfile($pkg_dir, "$pkg_name-*"); - my ($ebuild, $atom) = @$last; - p(1, "%s/%s-%s\n", map $atom->$_, qw/category name version/); - my $uri; if (exists $fetched_uri{$ebuild}) { $uri = $fetched_uri{$ebuild};