]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/commitdiff
Importing CPANPLUS-Dist-Gentoo-0.02_01.tar.gz v0.02_01
authorVincent Pit <vince@profvince.com>
Sun, 29 Jun 2008 15:33:48 +0000 (17:33 +0200)
committerVincent Pit <vince@profvince.com>
Sun, 29 Jun 2008 15:33:48 +0000 (17:33 +0200)
Changes
META.yml
README
lib/CPANPLUS/Dist/Gentoo.pm

diff --git a/Changes b/Changes
index 58c766acf14b2efdb24fb45317ba89a0d0642273..1879f958b55378cb03acd1c09c877dbfd6707fe3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,13 @@
 Revision history for CPANPLUS-Dist-Gentoo
 
+0.02_01 2008-05-26 22:35 UTC
+        + Add : The 'keywords' option.
+        + Chg : From now, the portage category is perl-gcpanp, for consistency
+                with g-cpan.
+        + Fix : Empty emerge command.
+        + Fix : Missing '-C' to the uninstall command.
+        + Fix : Removed an useless debug message.
+
 0.01    2008-05-20 18:10 UTC
         First version, released on an unsuspecting world.
 
index ba2e5664a2c29b2cbc496552d6e0206d2d199fb7..f813df3338257b747c97ca3b7a54d74ef6b030b4 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                CPANPLUS-Dist-Gentoo
-version:             0.01
+version:             0.02_01
 abstract:            CPANPLUS backend generating Gentoo ebuilds.
 license:             perl
 author:              
diff --git a/README b/README
index 05c6e8d3b416ab41e16cff6bf054328b9f9c3892..d770efc2c2dbbf2a3aabc2651e79bcbd796577d3 100644 (file)
--- a/README
+++ b/README
@@ -2,13 +2,14 @@ NAME
     CPANPLUS::Dist::Gentoo - CPANPLUS backend generating Gentoo ebuilds.
 
 VERSION
-    Version 0.01
+    Version 0.02_01
 
 SYNOPSIS
         cpan2dist --format=CPANPLUS::Dist::Gentoo \
                   --dist-opts overlay=/usr/local/portage \
                   --dist-opts distdir=/usr/portage/distfiles \
                   --dist-opts manifest=yes \
+                  --dist-opts keywords=x86 \
                   Any::Module You::Like
 
 DESCRPITON
@@ -19,8 +20,8 @@ DESCRPITON
     permissions on the directory where Gentoo fetches its source files
     (usually "/usr/portage/distfiles").
 
-    The generated ebuilds are placed into the section "perl-cpanp". They
-    favour depending on "perl-core" or "dev-perl" rather than "perl-cpanp".
+    The generated ebuilds are placed into the section "perl-gcpanp". They
+    favour depending on "perl-core" or "dev-perl" rather than "perl-gcpanp".
 
 METHODS
     All the methods are inherited from CPANPLUS::Dist::Base. Please refer to
index 945095428f563c4ea6b50ddc4935ea7180c5af32..4a3c275593740e271479e0777e9233b651a5e981 100644 (file)
@@ -19,11 +19,11 @@ CPANPLUS::Dist::Gentoo - CPANPLUS backend generating Gentoo ebuilds.
 
 =head1 VERSION
 
-Version 0.01
+Version 0.02_01
 
 =cut
 
-our $VERSION = '0.01';
+our $VERSION = '0.02_01';
 
 =head1 SYNOPSIS
 
@@ -31,13 +31,14 @@ our $VERSION = '0.01';
               --dist-opts overlay=/usr/local/portage \
               --dist-opts distdir=/usr/portage/distfiles \
               --dist-opts manifest=yes \
+              --dist-opts keywords=x86 \
               Any::Module You::Like
 
 =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>).
 
-The generated ebuilds are placed into the section C<perl-cpanp>. They favour depending on C<perl-core> or C<dev-perl> rather than C<perl-cpanp>.
+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>.
 
 =head1 METHODS
 
@@ -45,6 +46,8 @@ All the methods are inherited from L<CPANPLUS::Dist::Base>. Please refer to its
 
 =cut
 
+use constant CATEGORY => 'perl-gcpanp';
+
 sub format_available {
  for my $prog (qw/emerge ebuild/) {
   unless (can_run($prog)) {
@@ -55,14 +58,12 @@ sub format_available {
  return 1;
 }
 
-my $overlay;
-
 sub init {
  my ($self) = @_;
  my $stat = $self->status;
  $stat->mk_accessors(qw/name version dist desc uri src license deps
                         eb_name eb_version eb_dir eb_file distdir fetched_arch
-                        do_manifest/);
+                        keywords do_manifest/);
 
  return 1;
 }
@@ -84,11 +85,19 @@ sub prepare {
 
  my %opts = @_;
 
- my $manifest = delete($opts{'manifest'});
- $manifest = 0 if not defined $manifest or $manifest =~ /^\s*no?\s*$/i;
+ my $keywords = delete $opts{'keywords'};
+ $keywords = 'x86' unless defined $keywords;
+ $keywords = [ split ' ', $keywords ];
+ $stat->keywords($keywords);
+
+ my $manifest = delete $opts{'manifest'};
+ $manifest = 1 unless defined $manifest;
+ $manifest = 0 if $manifest =~ /^\s*no?\s*$/i;
  $stat->do_manifest($manifest);
+
  my $overlay = catdir(delete($opts{'overlay'}) || '/usr/local/portage',
-                      'perl-cpanp');
+                      CATEGORY);
+
  $stat->distdir(delete($opts{'distdir'}) || '/usr/portage/distfiles');
  if ($stat->do_manifest && !-w $stat->distdir) {
   error 'distdir isn\'t writable -- aborting';
@@ -174,7 +183,6 @@ sub create {
  $self->SUPER::create(@_);
 
  my $dir = $stat->eb_dir;
- print STDERR "@@@ mkdir $dir\n";
  unless (-d $dir) {
   eval { mkpath $dir };
   if ($@) {
@@ -190,6 +198,7 @@ sub create {
  $d   .= 'SRC_URI="' . $stat->src . "\"\n";
  $d   .= "SLOT=\"0\"\n";
  $d   .= 'LICENSE="|| ( ' . join(' ', sort @{$stat->license}) . " )\"\n";
+ $d   .= 'KEYWORDS="' . join(' ', sort @{$stat->keywords}) . "\"\n";
  $d   .= 'DEPEND="' . join "\n",
   'dev-lang/perl',
   map {
@@ -200,7 +209,7 @@ sub create {
     $a .= '-' . $_->[1];
    }
    '|| ( ' . join(' ', map "$x$_/$a",
-                           qw/perl-core dev-perl perl-cpanp/) # perl-gcpan ?
+                           qw/perl-core dev-perl/, CATEGORY) # perl-gcpan ?
            . ' )';
   } @{$stat->deps};
  $d   .= "\"\n";
@@ -237,7 +246,7 @@ sub install {
  my $conf = $self->parent->parent->configure_object;
 
  my $sudo = $conf->get_program('sudo');
- my @cmd = 'emerge', '=' . $stat->eb_name . '-' . $stat->eb_version;
+ my @cmd = ('emerge', '=' . $stat->eb_name . '-' . $stat->eb_version);
  unshift @cmd, $sudo if $sudo;
 
  unless (run command => \@cmd, verbose => 1) {
@@ -254,7 +263,7 @@ sub uninstall {
  my $conf = $self->parent->parent->configure_object;
 
  my $sudo = $conf->get_program('sudo');
- my @cmd = 'emerge', '=' . $stat->eb_name . '-' . $stat->eb_version;
+ my @cmd = ('emerge', '-C', '=' . $stat->eb_name . '-' . $stat->eb_version);
  unshift @cmd, $sudo if $sudo;
 
  unless (run command => \@cmd, verbose => 1) {