From: Vincent Pit Date: Tue, 14 Dec 2010 23:53:48 +0000 (+0100) Subject: Require CPAN::DistnameInfo 0.11 in the gengentooisms script X-Git-Tag: v0.11~12 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=commitdiff_plain;h=ac553cd6107b4c4470b19f1b77a73889cd604659 Require CPAN::DistnameInfo 0.11 in the gengentooisms script Now we can get rid of the ugly monkeypatching hack. --- diff --git a/samples/gengentooisms b/samples/gengentooisms index e5f8f13..34d5869 100755 --- a/samples/gengentooisms +++ b/samples/gengentooisms @@ -10,18 +10,7 @@ use List::Util qw/max reduce/; 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 LWP::UserAgent; @@ -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/category name version/); + 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};