X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo.pm;h=de074580dc694861666a41e426a63ebb490e604e;hb=c05a7e9a72d4c2aef3614edc5c115d67bd89b174;hp=2df7afc08844d078f53ffef1d89e3e2783177f8e;hpb=9ef904834ac972929aae212b5af61e4d354fe093;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 2df7afc..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. @@ -55,6 +55,9 @@ 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/) { unless (can_run($prog)) { @@ -62,6 +65,32 @@ sub format_available { return 0; } } + + if (IPC::Cmd->can_capture_buffer) { + 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; } @@ -72,6 +101,7 @@ sub init { $stat->mk_accessors(qw/name version author distribution desc uri src license deps eb_name eb_version eb_dir eb_file fetched_arch + portdir_overlay overlay distdir keywords do_manifest header footer force verbose/); @@ -82,16 +112,77 @@ sub init { } my %gentooism = ( - 'Crypt-RSA' => 'crypt-rsa', - 'Digest' => 'digest-base', - 'Locale-Maketext' => 'locale-maketext', - 'Math-Pari' => 'math-pari', - 'Net-Ping' => 'net-ping', - 'PathTools' => 'File-Spec', - 'PodParser' => 'Pod-Parser', - 'Set-Scalar' => 'set-scalar', - 'Tie-EncryptedHash' => 'tie-encryptedhash', - 'YAML' => 'yaml', + 'ANSIColor' => 'Term-ANSIColor', + 'Audio-CD' => 'Audio-CD-disc-cover', + 'CGI-Simple' => 'Cgi-Simple', + 'Cache-Mmap' => 'cache-mmap', + 'Class-Loader' => 'class-loader', + 'Class-ReturnValue' => 'class-returnvalue', + 'Config-General' => 'config-general', + 'Convert-ASCII-Armour' => 'convert-ascii-armour', + 'Convert-PEM' => 'convert-pem', + 'Crypt-CBC' => 'crypt-cbc', + 'Crypt-DES_EDE3' => 'crypt-des-ede3', + 'Crypt-DH' => 'crypt-dh', + 'Crypt-DSA' => 'crypt-dsa', + 'Crypt-IDEA' => 'crypt-idea', + 'Crypt-Primes' => 'crypt-primes', + 'Crypt-RSA' => 'crypt-rsa', + 'Crypt-Random' => 'crypt-random', + 'DBIx-SearchBuilder' => 'dbix-searchbuilder', + 'Data-Buffer' => 'data-buffer', + 'Digest' => 'digest-base', + 'Digest-BubbleBabble' => 'digest-bubblebabble', + 'Digest-MD2' => 'digest-md2', + 'ExtUtils-Depends' => 'extutils-depends', + 'ExtUtils-PkgConfig' => 'extutils-pkgconfig', + 'Frontier-RPC' => 'frontier-rpc', + 'Gimp' => 'gimp-perl', + 'Glib' => 'glib-perl', + 'Gnome2-Canvas' => 'gnome2-canvas', + 'Gnome2-GConf' => 'gnome2-gconf', + 'Gnome2-Print' => 'gnome2-print', + 'Gnome2-VFS' => 'gnome2-vfs-perl', + 'Gnome2-Wnck' => 'gnome2-wnck', + 'Gtk2' => 'gtk2-perl', + 'Gtk2-Ex-FormFactory' => 'gtk2-ex-formfactory', + 'Gtk2-GladeXML' => 'gtk2-gladexml', + 'Gtk2-Spell' => 'gtk2-spell', + 'Gtk2-TrayIcon' => 'gtk2-trayicon', + 'Gtk2-TrayManager' => 'gtk2-traymanager', + 'Gtk2Fu' => 'gtk2-fu', + 'I18N-LangTags' => 'i18n-langtags', + 'Image-Info' => 'ImageInfo', + 'Image-Size' => 'ImageSize', + 'Inline-Files' => 'inline-files', + 'Locale-Maketext' => 'locale-maketext', + 'Locale-Maketext-Fuzzy' => 'locale-maketext-fuzzy', + 'Locale-Maketext-Lexicon' => 'locale-maketext-lexicon', + 'Log-Dispatch' => 'log-dispatch', + 'Math-Pari' => 'math-pari', + 'Module-Info' => 'module-info', + 'Net-Ping' => 'net-ping', + 'Net-SFTP' => 'net-sftp', + 'Net-SSH-Perl' => 'net-ssh-perl', + 'Net-Server' => 'net-server', + 'OLE-Storage_Lite' => 'OLE-StorageLite', + 'Ogg-Vorbis-Header' => 'ogg-vorbis-header', + 'PathTools' => 'File-Spec', + 'Pod-Parser' => 'PodParser', + 'Regexp-Common' => 'regexp-common', + 'SDL_Perl' => 'sdl-perl', + 'Set-Scalar' => 'set-scalar', + 'String-CRC32' => 'string-crc32', + 'Text-Autoformat' => 'text-autoformat', + 'Text-Reform' => 'text-reform', + 'Text-Template' => 'text-template', + 'Text-Wrapper' => 'text-wrapper', + 'Tie-EncryptedHash' => 'tie-encryptedhash', + 'Tk' => 'perl-tk', + 'Wx' => 'wxperl', + 'YAML' => 'yaml', + 'gettext' => 'Locale-gettext', + 'txt2html' => 'TextToHTML', ); sub prepare { @@ -106,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'}; @@ -146,6 +240,18 @@ sub prepare { } $stat->fetched_arch($mod->status->fetch); + my $cur = File::Spec::Functions::curdir(); + my $portdir_overlay; + for (@$overlays) { + if ($_ eq $overlay or File::Spec::Functions::abs2rel($overlay, $_) eq $cur) { + $portdir_overlay = join ':', @$overlays; + last; + } + } + $portdir_overlay = join ':', @$overlays, $overlay + unless defined $portdir_overlay; + $stat->portdir_overlay($portdir_overlay); + my $name = $mod->package_name; $stat->name($name); @@ -174,6 +280,8 @@ sub prepare { 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) { @@ -193,7 +301,6 @@ sub prepare { return 1; } } - $stat->eb_file($file); $self->SUPER::prepare(%opts); @@ -366,7 +473,7 @@ sub _run { my $stat = $self->status; my ($success, $errmsg, $output) = do { - local $ENV{PORTDIR_OVERLAY} = $stat->overlay; + local $ENV{PORTDIR_OVERLAY} = $stat->portdir_overlay; local $ENV{PORTAGE_RO_DISTDIRS} = $stat->distdir; run command => $cmd, verbose => $verbose; };