X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo.pm;h=de074580dc694861666a41e426a63ebb490e604e;hb=c05a7e9a72d4c2aef3614edc5c115d67bd89b174;hp=e0e6bb883e3849518370bae988ffe8ab6355a81c;hpb=f90f7df97016d80e86803b1a5ec136906c5e72e9;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index e0e6bb8..de07458 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -39,7 +39,7 @@ our $VERSION = '0.04'; =head1 DESCRPITON -This module is a CPANPLUS backend that recursively generates Gentoo ebuilds for a given package in the specified overlay (defaults to F), 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). You also need to specify the correct keyword for your architecture if it differs from the default C. +This module is a CPANPLUS backend that recursively generates Gentoo ebuilds for a given package in the specified overlay (defaults to F), 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). The valid C for the generated ebuilds are by default those given in C, but you can specify your own with the C dist-option. The generated ebuilds are placed into the C category. They favour depending on C, C or C (in that order) rather than C. @@ -56,6 +56,7 @@ All the methods are inherited from L. Please refer to its use constant CATEGORY => 'perl-gcpanp'; my $overlays; +my $default_keywords; sub format_available { for my $prog (qw/emerge ebuild/) { @@ -66,20 +67,30 @@ sub format_available { } if (IPC::Cmd->can_capture_buffer) { - my $output = ''; - my $success = run command => [ qw/emerge --info/ ], - verbose => 0, - buffer => \$output; - if ($success and $output) { - if ($output =~ /^PORTDIR_OVERLAY=(.*)$/m) { - my $o = $1; - $o =~ s/^["']*//; - $o =~ s/["']*$//; - $overlays = [ map abs_path($_), grep length, split /:/, $o ]; + my ($success, $errmsg, $output) = run command => [ qw/emerge --info/ ], + verbose => 0; + if ($success) { + for (@{$output || []}) { + if (/^PORTDIR_OVERLAY=(.*)$/m) { + my $o = $1; + $o =~ s/^["']*//; + $o =~ s/["']*$//; + $overlays = [ map abs_path($_), grep length, split /:/, $o ]; + } + if (/^ACCEPT_KEYWORDS=(.*)$/m) { + my $k = $1; + $k =~ s/^["']*//; + $k =~ s/["']*$//; + $default_keywords = [ split ' ', $k ]; + } } + } else { + error $errmsg; } } + $default_keywords = [ 'x86' ] unless defined $default_keywords; + return 1; } @@ -186,8 +197,11 @@ sub prepare { $stat->prepared(0); my $keywords = delete $opts{'keywords'}; - $keywords = 'x86' unless defined $keywords; - $keywords = [ split ' ', $keywords ]; + if (defined $keywords) { + $keywords = [ split ' ', $keywords ]; + } else { + $keywords = $default_keywords; + } $stat->keywords($keywords); my $manifest = delete $opts{'manifest'};