]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blobdiff - lib/CPANPLUS/Dist/Gentoo.pm
Make 'ebuild' a normal accessor for C::D::G::Atom objects
[perl/modules/CPANPLUS-Dist-Gentoo.git] / lib / CPANPLUS / Dist / Gentoo.pm
index c27c5b50a7faaec8f250a1a1d3aa4024bbcc9005..307d802108c903dfda523ba9ce864ef69a7498f3 100644 (file)
@@ -85,7 +85,7 @@ Log in as root and unpack them in e.g. your home directory :
 Set up environment variables so that the toolchain is temporarily available :
 
     # export OLDPATH=$PATH
-    # export PATH=/root/CPANPLUS-Dist-Gentoo-0.08/bin:$PATH
+    # export PATH=/root/CPANPLUS-0.88/bin:$PATH
     # export PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.08/blib/lib:/root/CPANPLUS-0.88/lib:/root/CPANPLUS-0.88/inc/bundle
 
 Make sure you don't have an old C<.cpanplus> configuration visible :
@@ -550,31 +550,33 @@ 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 $last = reduce { $a < $b ? $b : $a } # handles overloading
+               map CPANPLUS::Dist::Gentoo::Atom->new_from_ebuild($_),
+                @ebuilds;
+   next if defined $version and $last < $version;
 
-   return $atom;
+   return CPANPLUS::Dist::Gentoo::Atom->new(
+    category => $last->category,
+    name     => $last->name,
+    (defined $version ? (version => $version, range => '>=') : ()),
+    ebuild   => $last->ebuild,
+   );
   }
 
  }