From: Vincent Pit Date: Sun, 29 Jun 2008 15:33:48 +0000 (+0200) Subject: Importing CPANPLUS-Dist-Gentoo-0.02_01.tar.gz X-Git-Tag: v0.02_01^0 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=commitdiff_plain;h=3fe1cf15912402baf940ae163c50cc6526cf2c5d Importing CPANPLUS-Dist-Gentoo-0.02_01.tar.gz --- diff --git a/Changes b/Changes index 58c766a..1879f95 100644 --- 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. diff --git a/META.yml b/META.yml index ba2e566..f813df3 100644 --- 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 05c6e8d..d770efc 100644 --- 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 diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 9450954..4a3c275 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -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), 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). -The generated ebuilds are placed into the section C. They favour depending on C or C rather than C. +The generated ebuilds are placed into the section C. They favour depending on C or C rather than C. =head1 METHODS @@ -45,6 +46,8 @@ All the methods are inherited from L. 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) {