X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo.pm;h=3813281622e8996152ff02716ff825abab186a77;hb=86462016ed808b9ce5584b040facdd48dce72b85;hp=22059a90b65ce689f5ea391267da16a61c9276b4;hpb=192c16f35be72d6b51e01855a15905313d407814;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 22059a9..3813281 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -21,11 +21,11 @@ CPANPLUS::Dist::Gentoo - CPANPLUS backend generating Gentoo ebuilds. =head1 VERSION -Version 0.04 +Version 0.05 =cut -our $VERSION = '0.04'; +our $VERSION = '0.05'; =head1 SYNOPSIS @@ -61,6 +61,8 @@ my $default_keywords; my $default_distdir; my $main_portdir; +my %forced; + sub _unquote { my $s = shift; $s =~ s/^["']*//; @@ -110,7 +112,7 @@ sub init { my $stat = $self->status; my $conf = $self->parent->parent->configure_object; - $stat->mk_accessors(qw/name version author distribution desc uri license + $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 @@ -294,9 +296,10 @@ sub prepare { if (-e $file) { my $skip = 1; - if ($stat->force) { + if ($stat->force and not $forced{$file}) { if (-w $file) { 1 while unlink $file; + $forced{$file} = 1; $skip = 0; } else { error "Can't force rewriting of $file -- skipping"; @@ -322,6 +325,13 @@ sub prepare { $stat->uri('http://search.cpan.org/dist/' . $name); + unless ($author =~ /^(.)(.)/) { + error 'Wrong author name -- aborting'; + return 0; + } + $stat->src("mirror://cpan/modules/by-authors/id/$1/$1$2/$author/" + . $mod->package); + $stat->license([ qw/Artistic GPL-2/ ]); my $prereqs = $mod->status->prereqs; @@ -389,8 +399,10 @@ sub create { 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->distribution . "\"\n"; $d .= 'DESCRIPTION="' . $stat->desc . "\"\n"; - $d .= 'HOMEPAGE="' . $stat->uri . "\"\n\n"; + $d .= 'HOMEPAGE="' . $stat->uri . "\"\n"; + $d .= 'SRC_URI="' . $stat->src . "\"\n"; $d .= "SLOT=\"0\"\n"; $d .= 'LICENSE="|| ( ' . join(' ', sort @{$stat->license}) . " )\"\n"; $d .= 'KEYWORDS="' . join(' ', sort @{$stat->keywords}) . "\"\n"; @@ -553,7 +565,7 @@ Kent Fredric, for testing and suggesting improvements. =head1 COPYRIGHT & LICENSE -Copyright 2008 Vincent Pit, all rights reserved. +Copyright 2008-2009 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.