diff -Nuar g-cpan-0.15.0.orig/ChangeLog g-cpan-0.15.0/ChangeLog --- g-cpan-0.15.0.orig/ChangeLog 2007-04-24 17:06:19.000000000 -0700 +++ g-cpan-0.15.0/ChangeLog 2008-09-30 21:17:14.304101792 -0700 @@ -1,6 +1,17 @@ # ChangeLog for g-cpan # Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + + 30 Sep 2008; Robin H. Johnson bin/g-cpan, + lib/Gentoo/CPAN.pm, lib/Gentoo/Portage.pm: + If there is no DESCRIPTION set by the CPAN data, extract it from the POD + manpage after unpacking. Use MODULE_AUTHOR and optionally MODULE_SECTION to + generate slimmer ebuilds. This will allow the eclass to populate HOMEPAGE and + SRC_URI easily. + + 30 Sep 2008; Robin H. Johnson lib/Gentoo/CPAN.pm: + Generate MyConfig.pm without extra quotes in urllist, as this breaks newer + libwww-perl. 05 Apr 2007; Michael Cummings ChangeLog: Quick fix for search results of 0 diff -Nuar g-cpan-0.15.0.orig/bin/g-cpan g-cpan-0.15.0/bin/g-cpan --- g-cpan-0.15.0.orig/bin/g-cpan 2007-04-24 17:07:19.000000000 -0700 +++ g-cpan-0.15.0/bin/g-cpan 2008-09-30 21:08:47.500918554 -0700 @@ -28,7 +28,7 @@ use Log::Agent::Driver::File; use Log::Agent::Driver::Silent; -our $VERSION = "0.15.0"; +our $VERSION = "0.16.0"; my $prog = basename($0); ##### Establish our tmpdir @@ -598,6 +598,8 @@ # Let's unpack it and get all the deps out of it. spinner_start(); $gcpan_run->unpackModule($gcpan_run->{cpan}{lc($original_ebuild)}{name}); + # Force re-compute of the information, as MANPAGE is now valid. + $gcpan_run->getCPANInfo($original_ebuild); spinner_stop(); foreach my $dep (keys %{$gcpan_run->{cpan}{lc($original_ebuild)}{depends}}) @@ -664,19 +666,27 @@ print_info('Generating ebuild for ' . $gcpan_run->{cpan}{lc($original_ebuild)}{name}); my $EBUILD = IO::File->new($ebuild, '>') or fatal(print_err("Couldn't open(write) file $ebuild: $!")); + my $module_author = $gcpan_run->{'cpan'}{lc($original_ebuild)}{'src_uri'}; + $module_author =~ s/.\/..\/(.*)\/[^\/]+$/$1/g; + my $module_section = ''; + if($module_author =~ /\//) { + $module_section = $module_author; + my @module_bits = split /\//, $module_author, 2; + $module_author = $module_bits[0]; + $module_section = sprintf "MODULE_SECTION=\"%s\"\n", $module_bits[1]; + } + my $description = $gcpan_run->{'cpan'}{lc($original_ebuild)}{'description'}; + print $EBUILD <<"HERE"; # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # This ebuild generated by $prog $VERSION +MODULE_AUTHOR="$module_author" +$module_section inherit perl-module -S=\${WORKDIR}/$gcpan_run->{'cpan'}{lc($original_ebuild)}{'portage_sdir'} - -DESCRIPTION="$gcpan_run->{'cpan'}{lc($original_ebuild)}{'description'}" -HOMEPAGE="http://search.cpan.org/search?query=$gcpan_run->{cpan}{lc($original_ebuild)}{portage_name}\&mode=dist" -SRC_URI="mirror://cpan/authors/id/$gcpan_run->{'cpan'}{lc($original_ebuild)}{'src_uri'}" - +DESCRIPTION="$description" IUSE="" diff -Nuar g-cpan-0.15.0.orig/lib/Gentoo/CPAN.pm g-cpan-0.15.0/lib/Gentoo/CPAN.pm --- g-cpan-0.15.0.orig/lib/Gentoo/CPAN.pm 2007-04-24 17:06:19.000000000 -0700 +++ g-cpan-0.15.0/lib/Gentoo/CPAN.pm 2008-09-30 21:09:24.315814196 -0700 @@ -133,8 +133,21 @@ # missing a lot of our ebuilds/packages > # Addendum. Appears we are missing items both ways - have to test both the name in cpan_file and the mod->id. :/ next unless ( $mod->id ); + # manpage_headline spews a bunch of warnings, and is not always valid. + # If this is a # CPAN::Bundle, manual work is needed anyway. + sub manpage_title { + my $mod = shift; + # Force the calculation of contents. + $mod->as_string(); + my $module_name = shift; + my $desc = $mod->{MANPAGE}; + return $desc unless $desc; + return $desc unless $module_name; + $desc =~ s/^$module_name - //g; + return $desc; + } $self->{'cpan'}{ lc($find_module) }{'description'} = - $mod->{RO}{'description'} || "No description available"; + $mod->{RO}{'description'} || manpage_title($mod, $find_module) || "No description available"; $self->{'cpan'}{ lc($find_module) }{'src_uri'} = $mod->{RO}{'CPAN_FILE'}; $self->{'cpan'}{ lc($find_module) }{'name'} = $mod->id; $self->{'cpan'}{ lc($find_module) }{'version'} = $mod->{RO}{'CPAN_VERSION'} @@ -169,7 +182,9 @@ } # Grab the tarball and unpack it - $pack->get or die "Insufficient permissions!"; + unless (defined($pack->{build_dir})) { + $pack->get or die "Insufficient permissions!"; + } my $tmp_dir = $pack->{build_dir}; # Set our starting point @@ -553,7 +568,7 @@ 'tar' => q[$tar_prog], 'term_is_latin' => q[1], 'unzip' => q[$unzip_prog], - 'urllist' => [qw["http://search.cpan.org/CPAN" "http://www.cpan.org/pub/CPAN" ],], + 'urllist' => [qw[http://search.cpan.org/CPAN http://www.cpan.org/pub/CPAN ],], 'wget' => q[$wget_prog], }; 1; diff -Nuar g-cpan-0.15.0.orig/lib/Gentoo/Portage.pm g-cpan-0.15.0/lib/Gentoo/Portage.pm --- g-cpan-0.15.0.orig/lib/Gentoo/Portage.pm 2007-04-24 17:06:19.000000000 -0700 +++ g-cpan-0.15.0/lib/Gentoo/Portage.pm 2008-09-30 16:59:23.012076447 -0700 @@ -69,6 +69,7 @@ sub strip_env { my $key = shift; + return $key unless defined($key); if (defined($ENV{$key})) { $ENV{$key} =~ s{\\n}{ }gxms; $ENV{$key} =~ s{\\|\'|\\'|\$|\s*$}{}gmxs;