]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blobdiff - lib/CPANPLUS/Dist/Gentoo.pm
This is 0.03
[perl/modules/CPANPLUS-Dist-Gentoo.git] / lib / CPANPLUS / Dist / Gentoo.pm
index 54ccae0767ba1f67c110d4f3d669f38f2ccf15b0..e5c40fb979a59ba935d60050dc8b38caa01e54a2 100644 (file)
@@ -19,11 +19,11 @@ CPANPLUS::Dist::Gentoo - CPANPLUS backend generating Gentoo ebuilds.
 
 =head1 VERSION
 
-Version 0.02_01
+Version 0.03
 
 =cut
 
-our $VERSION = '0.02_01';
+our $VERSION = '0.03';
 
 =head1 SYNOPSIS
 
@@ -36,9 +36,9 @@ our $VERSION = '0.02_01';
 
 =head1 DESCRPITON
 
-This module is a CPANPLUS backend that recursively generates Gentoo ebuilds for a given package in the specified overlay (defaults to C</usr/local/portage>), update the manifest, and even emerge it (together with its dependencies) if the user requires it. You need write permissions on the directory where Gentoo fetches its source files (usually C</usr/portage/distfiles>).
+This module is a CPANPLUS backend that recursively generates Gentoo ebuilds for a given package in the specified overlay (defaults to F</usr/local/portage>), updates the manifest, and even emerges it (together with its dependencies) if the user requires it. You need write permissions on the directory where Gentoo fetches its source files (usually F</usr/portage/distfiles>). You also need to specify the correct keyword for your architecture if it differs from the default C<x86>.
 
-The generated ebuilds are placed into the section C<perl-gcpanp>. They favour depending on C<perl-core> or C<dev-perl> rather than C<perl-gcpanp>.
+The generated ebuilds are placed into the C<perl-gcpanp> category. They favour depending on C<perl-core>, C<dev-perl> or C<perl-gcpan> (in that order) rather than C<perl-gcpanp>.
 
 =head1 INSTALLATION
 
@@ -46,7 +46,7 @@ After installing this module, you should append C<perl-gcpanp> to your F</etc/po
 
 =head1 METHODS
 
-All the methods are inherited from L<CPANPLUS::Dist::Base>. Please refer to its perldoc for precise information on what's done at each step.
+All the methods are inherited from L<CPANPLUS::Dist::Base>. Please refer to its documentation for precise information on what's done at each step.
 
 =cut
 
@@ -107,11 +107,10 @@ sub prepare {
  $manifest = 0 if $manifest =~ /^\s*no?\s*$/i;
  $stat->do_manifest($manifest);
 
- my $overlay = catdir(delete($opts{'overlay'}) || '/usr/local/portage',
-                      CATEGORY);
- $stat->overlay($overlay);
+ $stat->overlay(delete($opts{'overlay'}) || '/usr/local/portage');
 
  $stat->distdir(delete($opts{'distdir'}) || '/usr/portage/distfiles');
+
  if ($stat->do_manifest && !-w $stat->distdir) {
   error 'distdir isn\'t writable -- aborting';
   return 0;
@@ -123,19 +122,26 @@ sub prepare {
 
  my $version = $mod->package_version;
  $stat->version($version);
+
  $stat->dist($name . '-' . $version);
- my $f = 1;
- $version =~ s/_+/$f ? do { $f = 0; '_p' } : ''/ge;
- 1 while $version =~ s/(_p[^.]*)\.+/$1/;
+
+ $version =~ s/[^\d._]+//g;
+ $version =~ s/^[._]*//;
+ $version =~ s/[._]*$//;
+ $version =~ s/[._]*_[._]*/_/g;
+ {
+  ($version, my $patch, my @rest) = split /_/, $version;
+  $version .= '_p' . $patch if defined $patch;
+  $version .= join('.', '', @rest) if @rest;
+ }
  $stat->eb_version($version);
 
- $stat->eb_name($gentooism{$stat->name} || $stat->name);
- $stat->eb_dir(catdir($overlay, $stat->eb_name));
+ $stat->eb_name($gentooism{$name} || $name);
+
+ $stat->eb_dir(catdir($stat->overlay, CATEGORY, $stat->eb_name));
 
  my $file = catfile($stat->eb_dir,
                     $stat->eb_name . '-' . $stat->eb_version . '.ebuild');
- $stat->eb_file($file);
-
  if (-e $file) {
   my $skip = 1;
   if ($stat->force) {
@@ -154,18 +160,22 @@ sub prepare {
    return 1;
   }
  }
+ $stat->eb_file($file);
 
  $self->SUPER::prepare(%opts);
 
  my $desc = $mod->description;
  ($desc = $name) =~ s/-+/::/g unless $desc;
  $stat->desc($desc);
+
  $stat->uri('http://search.cpan.org/dist/' . $name);
+
  unless ($name =~ /^([^-]+)/) {
   error 'Wrong distribution name -- aborting';
   return 0;
  }
  $stat->src('mirror://cpan/modules/by-module/' . $1 . '/' . $mod->package);
+
  $stat->license([ qw/Artistic GPL-2/ ]);
 
  my $prereqs = $mod->status->prereqs;