]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blobdiff - lib/CPANPLUS/Dist/Gentoo.pm
Introduce C::D::G::{Atom,Version}
[perl/modules/CPANPLUS-Dist-Gentoo.git] / lib / CPANPLUS / Dist / Gentoo.pm
index a6b773407e4320fa3c55c3e342bc6709e636f526..a753ab4048f3dbaccf7fb7e5f7ad7074bb0c55f3 100644 (file)
@@ -16,6 +16,7 @@ use CPANPLUS::Error ();
 
 use base qw/CPANPLUS::Dist::Base/;
 
+use CPANPLUS::Dist::Gentoo::Atom;
 use CPANPLUS::Dist::Gentoo::Maps;
 
 =head1 NAME
@@ -562,14 +563,13 @@ sub _cpan2portage {
     "$atom-*.ebuild",
    ) or next;
 
-   my $last = reduce {
-    CPANPLUS::Dist::Gentoo::Maps::version_gcmp($b->[1], $a->[1]) >= 0 ? $b : $a
-   } map [ $_, /\Q$atom\E-v?([\d._pr-]+).*?\.ebuild$/ ? $1 : 0 ], @ebuilds;
+   my $last = reduce { $a->[1] < $b->[1] ? $b : $a }
+               map [ $_, CPANPLUS::Dist::Gentoo::Atom->new(ebuild => $_) ],
+                @ebuilds;
 
    my $dep;
    if (defined $ver) { # implies that $version is defined
-    next unless
-              CPANPLUS::Dist::Gentoo::Maps::version_gcmp($last->[1], $ver) >= 0;
+    next if $last < $ver;
     $dep = ">=$category/$atom-$ver";
    } else {
     $dep = "$category/$atom";