X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo.pm;h=6c6ef13715fbca7886ec6a20d63a4c7cf72d745c;hb=b43c3fc0fe6291fc7aa4c97c48fe0e29d312c071;hp=b844c776848c9e314b3ef61354a22277e8de085c;hpb=021ebeecfb5f92eae3591ec9563874833c6fe2b4;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index b844c77..6c6ef13 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -26,11 +26,11 @@ CPANPLUS::Dist::Gentoo - CPANPLUS backend generating Gentoo ebuilds. =head1 VERSION -Version 0.09 +Version 0.10 =cut -our $VERSION = '0.09'; +our $VERSION = '0.10'; =head1 SYNOPSIS @@ -75,19 +75,19 @@ First, fetch tarballs for L and L : $ cd /tmp $ wget http://search.cpan.org/CPAN/authors/id/B/BI/BINGOS/CPANPLUS-0.9003.tar.gz - $ wget http://search.cpan.org/CPAN/authors/id/V/VP/VPIT/CPANPLUS-Dist-Gentoo-0.09.tar.gz + $ wget http://search.cpan.org/CPAN/authors/id/V/VP/VPIT/CPANPLUS-Dist-Gentoo-0.10.tar.gz Log in as root and unpack them in e.g. your home directory : # cd # tar xzf /tmp/CPANPLUS-0.9003.tar.gz - # tar xzf /tmp/CPANPLUS-Dist-Gentoo-0.09.tar.gz + # tar xzf /tmp/CPANPLUS-Dist-Gentoo-0.10.tar.gz Set up environment variables so that the toolchain is temporarily available : # export OLDPATH=$PATH # export PATH=/root/CPANPLUS-0.9003/bin:$PATH - # export PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.09/blib/lib:/root/CPANPLUS-0.9003/lib:/root/CPANPLUS-0.9003/inc/bundle + # export PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.10/blib/lib:/root/CPANPLUS-0.9003/lib:/root/CPANPLUS-0.9003/inc/bundle Make sure you don't have an old C<.cpanplus> configuration visible : @@ -95,7 +95,7 @@ Make sure you don't have an old C<.cpanplus> configuration visible : Bootstrap L : - # cd /root/CPANPLUS-Dist-Gentoo-0.09 + # cd /root/CPANPLUS-Dist-Gentoo-0.10 # samples/g-cpanp CPANPLUS Reset the environment : @@ -117,7 +117,7 @@ You may need to run each of these commands two times for them to succeed. At this point, you can bootstrap L using the system L : - # PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.09/blib/lib samples/g-cpanp CPANPLUS::Dist::Gentoo + # PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.10/blib/lib samples/g-cpanp CPANPLUS::Dist::Gentoo # emerge -tv CPANPLUS-Dist-Gentoo =back @@ -289,7 +289,7 @@ sub prepare { $stat->distribution($name . '-' . $version); - $stat->ebuild_version(CPANPLUS::Dist::Gentoo::Maps::version_c2g($version)); + $stat->ebuild_version(CPANPLUS::Dist::Gentoo::Maps::version_c2g($name, $version)); $stat->ebuild_name(CPANPLUS::Dist::Gentoo::Maps::name_c2g($name)); @@ -364,8 +364,9 @@ sub prepare { } $stat->requires(\@requires); + my $meta = $self->meta; $stat->min_perl(CPANPLUS::Dist::Gentoo::Maps::perl_version_c2g( - eval { $self->meta->{requires}->{perl} } + $meta->{requires}->{perl}, )); return $OK->(); @@ -391,6 +392,7 @@ sub meta { my $meta_file = File::Spec->catdir($extract_dir, $name); next unless -e $meta_file; + local $@; my $meta = eval { Parse::CPAN::Meta::LoadFile($meta_file) }; if (defined $meta) { $stat->meta($meta); @@ -426,7 +428,8 @@ sub intuit_license { return \@licenses if @licenses; } - my $license = $self->meta->{license}; + my $meta = $self->meta; + my $license = $meta->{license}; if (defined $license) { my @licenses = CPANPLUS::Dist::Gentoo::Maps::license_c2g($license); return \@licenses if @licenses; @@ -565,11 +568,10 @@ sub ebuild_source { push @requires, $atom; } - my $min_perl = $stat->min_perl; my $perl = CPANPLUS::Dist::Gentoo::Atom->new( category => 'dev-lang', name => 'perl', - (defined $min_perl ? (version => $min_perl, range => '>=') : ()), + version => $stat->min_perl, ); @requires = CPANPLUS::Dist::Gentoo::Atom->fold($perl, @requires); @@ -593,10 +595,10 @@ sub ebuild_source { } sub _cpan2portage { - my ($self, $name, $version) = @_; + my ($self, $dist_name, $dist_version) = @_; - $name = CPANPLUS::Dist::Gentoo::Maps::name_c2g($name); - $version = CPANPLUS::Dist::Gentoo::Maps::version_c2g($version); + my $name = CPANPLUS::Dist::Gentoo::Maps::name_c2g($dist_name); + my $version = CPANPLUS::Dist::Gentoo::Maps::version_c2g($dist_name, $dist_version); my @portdirs = ($main_portdir, @{$self->status->portdir_overlay}); @@ -619,7 +621,7 @@ sub _cpan2portage { return CPANPLUS::Dist::Gentoo::Atom->new( category => $last->category, name => $last->name, - (defined $version ? (version => $version, range => '>=') : ()), + version => $version, ebuild => $last->ebuild, ); }