From: Chris Williams Date: Thu, 5 Nov 2009 14:38:29 +0000 (+0000) Subject: Updated CPANPLUS to cpan version 0.89_07 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f395eedc84e42f36a84c71a79c9224f84ec41177;p=p5sagit%2Fp5-mst-13.2.git Updated CPANPLUS to cpan version 0.89_07 --- diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index e4794c3..9bf94c3 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -423,7 +423,7 @@ use File::Glob qw(:case); 'CPANPLUS' => { 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/CPANPLUS-0.89_06.tar.gz', + 'DISTRIBUTION' => 'BINGOS/CPANPLUS-0.89_07.tar.gz', 'FILES' => q[cpan/CPANPLUS], 'EXCLUDED' => [ qr{^inc/}, qr{^t/dummy-.*\.hidden$}, diff --git a/cpan/CPANPLUS/lib/CPANPLUS.pm b/cpan/CPANPLUS/lib/CPANPLUS.pm index c10d0c1..53be374 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS.pm @@ -13,7 +13,7 @@ BEGIN { use vars qw( @EXPORT @ISA $VERSION ); @EXPORT = qw( shell fetch get install ); @ISA = qw( Exporter ); - $VERSION = "0.89_06"; #have to hardcode or cpan.org gets unhappy + $VERSION = "0.89_07"; #have to hardcode or cpan.org gets unhappy } ### purely for backward compatibility, so we can call it from the commandline: diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Dist.pm b/cpan/CPANPLUS/lib/CPANPLUS/Dist.pm index b6ffdbe..551b8ec 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Dist.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Dist.pm @@ -293,23 +293,70 @@ and versions required. sub find_configure_requires { my $self = shift; my $mod = $self->parent; - my %hash = @_; + my $meth = 'configure_requires'; + + ### the prereqs as we have them now + my @args = ( + defaults => $mod->status->$meth || {}, + keys => [ $meth ], + ); + + ### the default file to use, which may be overriden + push @args, ( file => META_YML->( $mod->status->extract ) ) + if defined $mod->status->extract; + + my $href = $self->_prereqs_from_meta_file( @args, @_ ); + + ### and store it in the module + $mod->status->$meth( $href ); + + return { %$href }; +} + +sub find_mymeta_requires { + my $self = shift; + my $mod = $self->parent; + my $meth = 'prereqs'; - my $meta; + ### the prereqs as we have them now + my @args = ( + defaults => $mod->status->$meth || {}, + keys => [qw|requires build_requires|], + ); + + ### the default file to use, which may be overriden + push @args, ( file => MYMETA_YML->( $mod->status->extract ) ) + if defined $mod->status->extract; + + my $href = $self->_prereqs_from_meta_file( @args, @_ ); + + ### and store it in the module + $mod->status->$meth( $href ); + + return { %$href }; +} + +sub _prereqs_from_meta_file { + my $self = shift; + my $mod = $self->parent; + my %hash = @_; + + my( $meta, $defaults, $keys ); my $tmpl = { ### check if we have an extract path. if not, we ### get 'undef value' warnings from file::spec - file => { default => do { defined $mod->status->extract + file => { default => do { defined $mod->status->extract ? META_YML->( $mod->status->extract ) : '' }, - store => \$meta, - }, + store => \$meta, + }, + defaults => { required => 1, default => {}, strict_type => 1, + store => \$defaults }, + keys => { required => 1, default => [], strict_type => 1, + store => \$keys }, }; check( $tmpl, \%hash ) or return; - ### default is an empty hashref - my $configure_requires = $mod->status->configure_requires || {}; - ### if there's a meta file, we read it; if( -e $meta ) { @@ -319,22 +366,21 @@ sub find_configure_requires { unless( $doc ) { error(loc( "Could not read %1: '%2'", $meta, $@ )); - return $configure_requires; # Causes problems if we don't return a hashref + return $defaults; } - ### read the configure_requires key, make sure not to throw + ### read the keys now, make sure not to throw ### away anything that was already added - $configure_requires = { - %$configure_requires, - %{ $doc->{'configure_requires'} }, - } if $doc->{'configure_requires'}; + for my $key ( @$keys ) { + $defaults = { + %$defaults, + %{ $doc->{$key} }, + } if $doc->{ $key }; + } } - ### and store it in the module - $mod->status->configure_requires( $configure_requires ); - ### and return a copy - return \%{$configure_requires}; + return \%{ $defaults }; } =head2 $bool = $dist->_resolve_prereqs( ... ) diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm b/cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm index 21852ff..4249ecc 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm @@ -465,6 +465,13 @@ sub _find_prereqs { }; my $args = check( $tmpl, \%hash ) or return; + + ### see if we got prereqs from MYMETA + my $prereqs = $dist->find_mymeta_requires(); + + ### we found some prereqs, we'll trust MYMETA + ### but we do need to run it through the callback + return $cb->_callbacks->filter_prereqs->( $cb, $prereqs ) if keys %$prereqs; my $fh = FileHandle->new(); unless( $fh->open( $file ) ) { diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Internals.pm b/cpan/CPANPLUS/lib/CPANPLUS/Internals.pm index 8cd6a82..d21dc8e 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Internals.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Internals.pm @@ -42,7 +42,7 @@ use vars qw[@ISA $VERSION]; CPANPLUS::Internals::Report ]; -$VERSION = "0.89_06"; +$VERSION = "0.89_07"; =pod diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm index 1d05c98..1a38200 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm @@ -149,6 +149,11 @@ use constant META_YML => sub { return @_ : 'META.yml'; }; +use constant MYMETA_YML => sub { return @_ + ? File::Spec->catfile( @_, 'MYMETA.yml' ) + : 'MYMETA.yml'; + }; + use constant BLIB => sub { return @_ ? File::Spec->catfile(@_, 'blib') : 'blib'; diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Shell/Default.pm b/cpan/CPANPLUS/lib/CPANPLUS/Shell/Default.pm index 0429122..b37e2b7 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Shell/Default.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Shell/Default.pm @@ -26,7 +26,7 @@ local $Data::Dumper::Indent = 1; # for dumpering from ! BEGIN { use vars qw[ $VERSION @ISA ]; @ISA = qw[ CPANPLUS::Shell::_Base::ReadLine ]; - $VERSION = "0.89_06"; + $VERSION = "0.89_07"; } load CPANPLUS::Shell;