From: Vincent Pit Date: Sat, 6 Dec 2008 16:42:20 +0000 (+0100) Subject: Allow specifying an header and a footer X-Git-Tag: v0.04~4 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=5142e895bd8c21b1b542466a8deeb8a1730e2856;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Allow specifying an header and a footer --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 2e87633..cf3d3e8 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -32,6 +32,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 +71,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,6 +109,23 @@ sub prepare { $manifest = 0 if $manifest =~ /^\s*no?\s*$/i; $stat->do_manifest($manifest); + 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->overlay(delete($opts{'overlay'}) || '/usr/local/portage'); $stat->distdir(delete($opts{'distdir'}) || '/usr/portage/distfiles'); @@ -235,7 +254,8 @@ sub create { } } - my $d = "# Generated by CPANPLUS::Dist::Gentoo\n\n"; + my $d = $stat->header; + $d .= "# Generated by CPANPLUS::Dist::Gentoo\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 +279,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 {