X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo.pm;h=fda4b054b8fb67c9c32911fa0db1452f73e0c4ef;hb=07bd0229f3fe4814b4355061f6cf2e97a3c76921;hp=2e876336ac6045552c7ce42005f3153042631790;hpb=fd9a4dd76ae879b6838e530ebcc876589de4ed09;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 2e87633..fda4b05 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -3,6 +3,7 @@ package CPANPLUS::Dist::Gentoo; use strict; use warnings; +use Cwd qw/abs_path/; use File::Copy qw/copy/; use File::Path qw/mkpath/; use File::Spec::Functions qw/catdir catfile/; @@ -19,11 +20,11 @@ CPANPLUS::Dist::Gentoo - CPANPLUS backend generating Gentoo ebuilds. =head1 VERSION -Version 0.03 +Version 0.04 =cut -our $VERSION = '0.03'; +our $VERSION = '0.04'; =head1 SYNOPSIS @@ -32,6 +33,8 @@ our $VERSION = '0.03'; --dist-opts distdir=/usr/portage/distfiles \ --dist-opts manifest=yes \ --dist-opts keywords=x86 \ + --dist-opts header="# Copyright 1999-2008 Gentoo Foundation" \ + --dist-opts footer="# End" \ Any::Module You::Like =head1 DESCRPITON @@ -69,7 +72,7 @@ sub init { $stat->mk_accessors(qw/name version author dist desc uri src license deps eb_name eb_version eb_dir eb_file fetched_arch - overlay distdir keywords do_manifest + overlay distdir keywords do_manifest header footer force verbose/); $stat->force($conf->get_conf('force')); @@ -107,9 +110,30 @@ sub prepare { $manifest = 0 if $manifest =~ /^\s*no?\s*$/i; $stat->do_manifest($manifest); - $stat->overlay(delete($opts{'overlay'}) || '/usr/local/portage'); + my $header = delete $opts{'header'}; + if (defined $header) { + 1 while chomp $header; + $header .= "\n\n"; + } else { + $header = ''; + } + $stat->header($header); + + my $footer = delete $opts{'footer'}; + if (defined $footer) { + $footer = "\n" . $footer; + } else { + $footer = ''; + } + $stat->footer($footer); - $stat->distdir(delete($opts{'distdir'}) || '/usr/portage/distfiles'); + my $overlay = delete $opts{'overlay'}; + $overlay = (defined $overlay) ? abs_path $overlay : '/usr/local/portage'; + $stat->overlay($overlay); + + my $distdir = delete $opts{'distdir'}; + $distdir = (defined $distdir) ? abs_path $distdir : '/usr/portage/distfiles'; + $stat->distdir($distdir); if ($stat->do_manifest && !-w $stat->distdir) { error 'distdir isn\'t writable -- aborting'; @@ -235,7 +259,8 @@ sub create { } } - my $d = "# Generated by CPANPLUS::Dist::Gentoo\n\n"; + my $d = $stat->header; + $d .= "# Generated by CPANPLUS::Dist::Gentoo version $VERSION\n\n"; $d .= 'MODULE_AUTHOR="' . $stat->author . "\"\ninherit perl-module\n\n"; $d .= 'S="${WORKDIR}/' . $stat->dist . "\"\n"; $d .= 'DESCRIPTION="' . $stat->desc . "\"\n"; @@ -259,6 +284,7 @@ sub create { } @{$stat->deps}; $d .= "\"\n"; $d .= "SRC_TEST=\"do\"\n"; + $d .= $stat->footer; my $file = $stat->eb_file; open my $eb, '>', $file or do { @@ -337,7 +363,7 @@ Gentoo (L). L, L (core modules since 5.9.5). -L (since 5.001), L (5.002), L (5.00504). +L (since perl 5) L (5.001), L (5.002), L (5.00504). =head1 SEE ALSO @@ -365,6 +391,8 @@ You can find documentation for this module with the perldoc command. The module is to some extend cargo-culted from L and L. +Kent Fredric, for testing and suggesting improvements. + =head1 COPYRIGHT & LICENSE Copyright 2008 Vincent Pit, all rights reserved.