X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo.pm;h=3bc66a54e33b26ac96ae0d712f4be150d7a3cf7c;hp=c27c5b50a7faaec8f250a1a1d3aa4024bbcc9005;hb=5a5575483b3f3ae59a3895e1a571edd687becec0;hpb=1c081d8b9a6c65ece91fa1363a4bdd9e49b00a37 diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index c27c5b5..3bc66a5 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -550,29 +550,34 @@ sub ebuild_source { sub _cpan2portage { my ($self, $name, $version) = @_; - $name = CPANPLUS::Dist::Gentoo::Maps::name_c2g($name); - my $ver; - $ver = CPANPLUS::Dist::Gentoo::Maps::version_c2g($version) if defined $version; + $name = CPANPLUS::Dist::Gentoo::Maps::name_c2g($name); + $version = CPANPLUS::Dist::Gentoo::Maps::version_c2g($version); my @portdirs = ($main_portdir, @{$self->status->portdir_overlay}); for my $category (qw/virtual perl-core dev-perl perl-gcpan/, CATEGORY) { - my $atom = ($category eq 'virtual' ? 'perl-' : '') . $name; + my $name = ($category eq 'virtual' ? 'perl-' : '') . $name; for my $portdir (@portdirs) { my @ebuilds = glob File::Spec->catfile( $portdir, $category, - $atom, - "$atom-*.ebuild", + $name, + "$name-*.ebuild", ) or next; - my $atom = reduce { $a < $b ? $b : $a } # handles overloading - map CPANPLUS::Dist::Gentoo::Atom->new( - ebuild => $_, - minimum => 1, - ), @ebuilds; - next if defined $ver and $atom < $ver; + my @atoms = map CPANPLUS::Dist::Gentoo::Atom->new( + defined $version ? ( + ebuild => $_, + range => '>=', + ) : ( + category => $category, + name => $name, + ), + ), @ebuilds; + + my $atom = reduce { $a < $b ? $b : $a } @atoms; # handles overloading + next if defined $version and $atom < $version; return $atom; }