X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=blobdiff_plain;f=samples%2Fgengentooisms;fp=samples%2Fgengentooisms;h=a1482d10d05daf8c3761865420bfbbc27e81bb19;hp=24238e3b0ae6402528f1d6d80c1d7ae912d8a7ca;hb=5c6c1007e5bdb11e4d8a9ff25cc4e563f9f378b4;hpb=a693bb0868d5a92f81d7da01b2f4f4d866ac13e4 diff --git a/samples/gengentooisms b/samples/gengentooisms index 24238e3..a1482d1 100755 --- a/samples/gengentooisms +++ b/samples/gengentooisms @@ -135,16 +135,14 @@ sub parse_portage_tree { my ($fqn_dist, $path); if (defined $uri) { if ($uri =~ m{cpan.*?/id/(\S+)}) { - $fqn_dist = $1; - $path = "authors/id/$fqn_dist"; - $is_on_cpan{$pkg_name} = 1; + $fqn_dist = $1; + $path = "authors/id/$fqn_dist"; } elsif ($uri =~ m{mirror://cpan/(\S+)}) { - $path = $1; - $is_on_cpan{$pkg_name} = 1; + $path = $1; } elsif ($uri =~ m{/([^/\s]+)(?:\s|$)}) { - my $archive = $1; + my $archive = $1; my ($top_level) = $archive =~ /^([^-]+)/; - $path = "modules/by-module/$top_level/$archive"; + $path = "modules/by-module/$top_level/$archive"; } } @@ -154,11 +152,10 @@ sub parse_portage_tree { push @not_on_cpan, "$category/$pkg_name"; next; } - p(2, "fetches $path\n"); my $dist; if (defined $fqn_dist) { - p(2, 'is indexed on the CPAN... '); + p(2, "is $fqn_dist indexed on the CPAN... "); $dist = do { local $@; eval { $pcp->distribution($fqn_dist) } @@ -167,7 +164,7 @@ sub parse_portage_tree { } unless (defined $dist) { - p(2, 'can directly be found on a CPAN mirror... '); + p(2, "can $path be found on a CPAN mirror... "); if (cpan_http_test($path)) { print "yes\n"; $dist = CPAN::DistnameInfo->new($path); @@ -179,10 +176,11 @@ sub parse_portage_tree { my ($pseudo_dist, $latest_dist); unless (defined $dist) { - p(2, 'has the same name as a distribution on the CPAN... '); $path =~ m{([^/\s]+)$} or die 'Could not get the last part of the path'; my $archive = $1; $pseudo_dist = CPAN::DistnameInfo->new($archive); + + p(2, 'is ' . $pseudo_dist->dist . ' the name of a CPAN distribution... '); $latest_dist = do { local $@; eval { $pcp->latest_distribution($pseudo_dist->dist) }; @@ -190,8 +188,8 @@ sub parse_portage_tree { unless (defined $latest_dist) { print "no\n"; - p(2, 'is similiar to a module indexed in another distribution of the CPAN... '); (my $mod_name = $pkg_name) =~ s/-/::/g; + p(2, "is $mod_name indexed in another CPAN distribution... "); $latest_dist = do { local $@; eval { @@ -213,7 +211,7 @@ sub parse_portage_tree { if (defined $latest_dist) { $latest_file = $latest_dist->filename; $latest_author = $latest_dist->cpanid; - printf "yes, %s by %s\n", + printf "yes, in %s by %s\n", $latest_file, (defined $latest_author ? $latest_author : 'unknown'); } else { @@ -222,7 +220,7 @@ sub parse_portage_tree { if (defined $latest_author) { my ($au, $a) = $latest_author =~ /^((.).)/ or die 'Author name too short'; - p(2, 'is in that author\'s CPAN directory... '); + p(2, "is $archive in that author\'s CPAN directory... "); my $alternate_path = "authors/id/$a/$au/$latest_author/$archive"; if ($alternate_path eq $path) { print "already checked\n"; @@ -242,10 +240,14 @@ sub parse_portage_tree { unless (defined $dist) { if ($latest_dist or $is_on_cpan{$pkg_name}) { $dist = $pseudo_dist; - unless ($latest_dist) { + p(2, "seems to be a CPAN distribution"); + if ($latest_dist) { + print "\n"; + } else { + # Implies $is_on_cpan{$pkg_name} + print " (forced)\n"; push @unfindable, "$category/$pkg_name"; } - p(2, "seems to come from the CPAN anyway\n"); } else { p(2, colored("$pkg_name is not a CPAN distribution", 'bright_red') . "\n"); push @not_on_cpan, "$category/$pkg_name";