From: Jos I. Boumans Date: Sat, 13 Jun 2009 08:04:46 +0000 (+0200) Subject: Update to CPANPLUS 0.87_01 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a0995fd479a7e2e390969122c63171250070a660;p=p5sagit%2Fp5-mst-13.2.git Update to CPANPLUS 0.87_01 --- diff --git a/lib/CPANPLUS.pm b/lib/CPANPLUS.pm index a4b9569..3a972d0 100644 --- a/lib/CPANPLUS.pm +++ b/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.8601"; #have to hardcode or cpan.org gets unhappy + $VERSION = "0.87_01"; #have to hardcode or cpan.org gets unhappy } ### purely for backward compatibility, so we can call it from the commandline: diff --git a/lib/CPANPLUS/Backend.pm b/lib/CPANPLUS/Backend.pm index fb71fcf..1431ce0 100644 --- a/lib/CPANPLUS/Backend.pm +++ b/lib/CPANPLUS/Backend.pm @@ -14,6 +14,7 @@ use CPANPLUS::Backend::RV; use FileHandle; use File::Spec (); use File::Spec::Unix (); +use File::Basename (); use Params::Check qw[check]; use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; @@ -405,7 +406,7 @@ for my $func (qw[fetch extract install readme files distributions]) { =pod -=head2 $mod_obj = $cb->parse_module( module => $modname|$distname|$modobj|URI ) +=head2 $mod_obj = $cb->parse_module( module => $modname|$distname|$modobj|URI|PATH ) C tries to find a C object that matches your query. Here's a list of examples you could give to @@ -429,6 +430,12 @@ C; =item file:///tmp/Text-Bastardize-1.06.tar.gz +=item /tmp/Text-Bastardize-1.06 + +=item ./Text-Bastardize-1.06 + +=item . + =back These items would all come up with a C object for @@ -436,6 +443,11 @@ C. The ones marked explicitly as being version 1.06 would give back a C object of that version. Even if the version on CPAN is currently higher. +The last three are examples of PATH resolution. In the first, we supply +an absolute path to the unwrapped distribution. In the second the +distribution is relative to the current working directory. +In the third, we will use the current working directory. + If C is unable to actually find the module you are looking for in its module tree, but you supplied it with an author, module and version part in a distribution name or URI, it will create a fake @@ -480,6 +492,42 @@ sub parse_module { return $maybe if IS_MODOBJ->( module => $maybe ); } + ### Special case arbitary file paths such as '.' etc. + if (-d File::Spec->rel2abs($mod) ) { + my $dir = File::Spec->rel2abs($mod); + my $parent = File::Spec->rel2abs( File::Spec->catdir( $dir, '..' ) ); + + my $dist = $mod = File::Basename::basename($dir); + $dist .= '-0' unless $dist =~ /\-[0-9._]+$/; + $dist .= '.tar.gz' unless $dist =~ /\.[A-Za-z]+$/; + + my $modobj = CPANPLUS::Module::Fake->new( + module => $mod, + version => 0, + package => $dist, + path => $parent, + author => CPANPLUS::Module::Author::Fake->new + ); + + ### better guess for the version + $modobj->version( $modobj->package_version ) + if defined $modobj->package_version; + + ### better guess at module name, if possible + if ( my $pkgname = $modobj->package_name ) { + $pkgname =~ s/-/::/g; + + ### no sense replacing it unless we changed something + $modobj->module( $pkgname ) + if ($pkgname ne $modobj->package_name) || $pkgname !~ /-/; + } + + $modobj->status->fetch( $parent ); + $modobj->status->extract( $dir ); + $modobj->get_installer_type; + return $modobj; + } + ### ok, so it looks like a distribution then? my @parts = split '/', $mod; my $dist = pop @parts; diff --git a/lib/CPANPLUS/Config.pm b/lib/CPANPLUS/Config.pm index 08c80df..28f4fb6 100644 --- a/lib/CPANPLUS/Config.pm +++ b/lib/CPANPLUS/Config.pm @@ -487,7 +487,7 @@ set it to: =item editor A string holding the path to your editor of choice. Defaults to your -$ENV{EDITOR}, $ENV{VISIUAL}, 'vi' or 'pico' programs, in that order. +$ENV{EDITOR}, $ENV{VISUAL}, 'vi' or 'pico' programs, in that order. =cut diff --git a/lib/CPANPLUS/Dist.pm b/lib/CPANPLUS/Dist.pm index 8c881bf..4bbbd1d 100644 --- a/lib/CPANPLUS/Dist.pm +++ b/lib/CPANPLUS/Dist.pm @@ -319,7 +319,7 @@ sub find_configure_requires { unless( $doc ) { error(loc( "Could not read %1: '%2'", $meta, $@ )); - return; + return $configure_requires; # Causes problems if we don't return a hashref } ### read the configure_requires key, make sure not to throw diff --git a/lib/CPANPLUS/Dist/MM.pm b/lib/CPANPLUS/Dist/MM.pm index e8fe3cd..5baa24f 100644 --- a/lib/CPANPLUS/Dist/MM.pm +++ b/lib/CPANPLUS/Dist/MM.pm @@ -1,5 +1,6 @@ package CPANPLUS::Dist::MM; +use warnings; use strict; use vars qw[@ISA $STATUS]; use base 'CPANPLUS::Dist::Base'; @@ -216,14 +217,14 @@ sub prepare { } my $args; - my( $force, $verbose, $perl, $mmflags, $prereq_target, $prereq_format, + my( $force, $verbose, $perl, @mmflags, $prereq_target, $prereq_format, $prereq_build ); { local $Params::Check::ALLOW_UNKNOWN = 1; my $tmpl = { perl => { default => $^X, store => \$perl }, makemakerflags => { default => $conf->get_conf('makemakerflags') || '', - store => \$mmflags }, + store => \$mmflags[0] }, force => { default => $conf->get_conf('force'), store => \$force }, verbose => { default => $conf->get_conf('verbose'), @@ -361,7 +362,7 @@ sub prepare { # my $cmd = "$perl $flush $makefile_pl $mmflags"; my $run_perl = $conf->get_program('perlwrapper'); - my $cmd = "$perl $run_perl $makefile_pl $mmflags"; + my $cmd = [$perl, $run_perl, $makefile_pl, @mmflags]; ### set ENV var to tell underlying code this is what we're ### executing. @@ -540,7 +541,7 @@ sub create { my $args; my( $force, $verbose, $make, $makeflags, $skiptest, $prereq_target, $perl, - $mmflags, $prereq_format, $prereq_build); + @mmflags, $prereq_format, $prereq_build); { local $Params::Check::ALLOW_UNKNOWN = 1; my $tmpl = { perl => { default => $^X, store => \$perl }, diff --git a/lib/CPANPLUS/Internals.pm b/lib/CPANPLUS/Internals.pm index f5d961b..b2ba20e 100644 --- a/lib/CPANPLUS/Internals.pm +++ b/lib/CPANPLUS/Internals.pm @@ -42,7 +42,7 @@ use vars qw[@ISA $VERSION]; CPANPLUS::Internals::Report ]; -$VERSION = "0.8601"; +$VERSION = "0.87_01"; =pod diff --git a/lib/CPANPLUS/Internals/Constants.pm b/lib/CPANPLUS/Internals/Constants.pm index f467f78..05c5f1c 100644 --- a/lib/CPANPLUS/Internals/Constants.pm +++ b/lib/CPANPLUS/Internals/Constants.pm @@ -316,6 +316,7 @@ use constant CALLING_FUNCTION return join '::', (caller(2+$lvl))[3] }; use constant PERL_CORE => 'perl'; +use constant STORABLE_EXT => '.stored'; use constant GET_XS_FILES => sub { my $dir = $_[0] or return; require File::Find; diff --git a/lib/CPANPLUS/Internals/Source.pm b/lib/CPANPLUS/Internals/Source.pm index 1a322cb..1d4a2d3 100644 --- a/lib/CPANPLUS/Internals/Source.pm +++ b/lib/CPANPLUS/Internals/Source.pm @@ -191,14 +191,14 @@ sub _build_trees { uptodate => $uptodate, path => $path, verbose => $verbose, - ); + ) or return; ### and now the module tree $self->_create_mod_tree( uptodate => $uptodate, path => $path, verbose => $verbose, - ); + ) or return; } ### XXX unpleasant hack. since custom sources uses ->parse_module, we @@ -628,20 +628,43 @@ sub _create_mod_tree { $ae->extract( to => $out ) or return; } - my $cont = $self->_get_file_contents( file => $out ) or return; + my $content = $self->_get_file_contents( file => $out ) or return; + my $lines = $content =~ tr/\n/\n/; ### don't need it anymore ### unlink $out; - my $flag; - - for ( split /\n/, $cont ) { + my($past_header, $count); + for ( split /\n/, $content ) { ### quick hack to read past the header of the file ### ### this is still rather evil... fix some time - Kane - $flag = 1 if m|^\s*$|; - next unless $flag; - + if( m|^\s*$| ) { + unless( $count ) { + error(loc("Could not determine line count from %1", $file)); + return; + } + $past_header = 1; + } + + ### we're still in the header -- find the amount of lines we expect + unless( $past_header ) { + + ### if the line count doesn't match what we expect, bail out + ### this should address: #45644: detect broken index + $count = $1 if /^Line-Count:\s+(\d+)/; + if( $count ) { + if( $lines < $count ) { + error(loc("Expected to read at least %1 lines, but %2 ". + "contains only %3 lines!", + $count, $file, $lines )); + return; + } + } + ### still in the header, keep moving + next; + } + ### skip empty lines ### next unless /\S/; chomp; diff --git a/lib/CPANPLUS/Internals/Source/Memory.pm b/lib/CPANPLUS/Internals/Source/Memory.pm index fc108d5..cb3fd4f 100644 --- a/lib/CPANPLUS/Internals/Source/Memory.pm +++ b/lib/CPANPLUS/Internals/Source/Memory.pm @@ -350,9 +350,11 @@ sub __memory_storable_file { File::Spec->catfile( $path, #base dir $conf->_get_source('stored') #file - . '.' . + . '.s' . $Storable::VERSION #the version of storable - . '.stored' #append a suffix + . '.c' . + $self->VERSION #the version of CPANPLUS + . STORABLE_EXT #append a suffix ) ); diff --git a/lib/CPANPLUS/Module.pm b/lib/CPANPLUS/Module.pm index b5602e1..3fc1462 100644 --- a/lib/CPANPLUS/Module.pm +++ b/lib/CPANPLUS/Module.pm @@ -677,7 +677,7 @@ sub get_installer_type { ### ok, so it's a 'build' installer, but you don't /have/ module build ### XXX duplicated from CPANPLUS::Selfupdate. fix somehow? - if( $type eq INSTALLER_BUILD and ( + if( $type and $type eq INSTALLER_BUILD and ( not CPANPLUS::Dist->has_dist_type( INSTALLER_BUILD ) or not $cb->module_tree( INSTALLER_BUILD ) ->is_uptodate( version => '0.24' ) diff --git a/lib/CPANPLUS/Shell/Default.pm b/lib/CPANPLUS/Shell/Default.pm index 8e059f7..a71dbc2 100644 --- a/lib/CPANPLUS/Shell/Default.pm +++ b/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.8601"; + $VERSION = "0.87_01"; } load CPANPLUS::Shell; @@ -104,6 +104,7 @@ CPANPLUS::Shell::Default cpanp> i Acme::Foo # install Acme::Foo cpanp> i Acme-Foo-1.3 # install version 1.3 of Acme::Foo cpanp> i # install from URI, like ftp://foo.com/X.tgz + cpanp> i # install from an absolute or relative directory cpanp> i 1 3..5 # install search results 1, 3, 4 and 5 cpanp> i * # install all search results cpanp> a KANE; i *; # find modules by kane, install all results @@ -536,7 +537,8 @@ loc(' w # display the result of your last search again' loc('[Operations]' ), loc(' i MODULE | NUMBER ... # install module(s), by name or by search number' ), loc(' i URI | ... # install module(s), by URI (ie http://foo.com/X.tgz)' ), -loc(' t MODULE | NUMBER ... # test module(s), by name or by search number' ), +loc(' i DIR | ... # install module(s), by path (ie ./Module-1.0)' ), +\loc(' t MODULE | NUMBER ... # test module(s), by name or by search number' ), loc(' u MODULE | NUMBER ... # uninstall module(s), by name or by search number' ), loc(' d MODULE | NUMBER ... # download module(s)' ), loc(' l MODULE | NUMBER ... # display detailed information about module(s)' ), diff --git a/lib/CPANPLUS/t/08_CPANPLUS-Backend.t b/lib/CPANPLUS/t/08_CPANPLUS-Backend.t index fbcaeca..7601864 100644 --- a/lib/CPANPLUS/t/08_CPANPLUS-Backend.t +++ b/lib/CPANPLUS/t/08_CPANPLUS-Backend.t @@ -187,6 +187,11 @@ ok( IS_CONFOBJ->(conf => $conf_obj), "Configure object found" ); 'IO-Stty', '.02', ], + '.' => [ + 'CPANPLUS', + 't', + '', + ], ); while ( my($guess, $attr) = splice @map, 0, 2 ) { diff --git a/lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t b/lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t index b4fd78d..241c6a2 100644 --- a/lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t +++ b/lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t @@ -152,6 +152,12 @@ SKIP: { SKIP: { ### EU::Installed tests ### + ### EU::I sometimes fails. See: + ### #43292: ~/CPANPLUS-0.85_04 fails t/20_CPANPLUS-Dist-MM.t + ### #46890: ExtUtils::Installed + EU::MM PREFIX= don't always work + ### well together + skip( "ExtUtils::Installed issue #46890 prevents these tests from running reliably", 8 ); + skip( "Old perl on cygwin detected " . "-- tests will fail due to known bugs", 8 diff --git a/lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz.packed b/lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz.packed index 0bcb0fa..b600352 100644 --- a/lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz.packed +++ b/lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz.packed @@ -10,7 +10,7 @@ To recreate it use the following command: uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz.packed -Created at Sun Apr 26 20:33:20 2009 +Created at Fri Jun 12 19:08:08 2009 ######################################################################### __UU__ M'XL("%_EO$4``S`Q;6%I;')C+G1X=`!+S,E,+%9P#8T(5@`#)=>*DM"2S)QB diff --git a/lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed b/lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed index bd58326..24c06c4 100644 --- a/lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed +++ b/lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed @@ -10,7 +10,7 @@ To recreate it use the following command: uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed -Created at Sun Apr 26 20:33:20 2009 +Created at Fri Jun 12 19:08:08 2009 ######################################################################### __UU__ M'XL("!1%OT4"`T)U;F1L92U&;V\M0F%R+3`N,#$N=&%R`.V7:V_:,!2&^8I_ diff --git a/lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz.packed b/lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz.packed index 553cbd3..0b7e18c 100644 --- a/lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz.packed +++ b/lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz.packed @@ -10,7 +10,7 @@ To recreate it use the following command: uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz.packed -Created at Sun Apr 26 20:33:20 2009 +Created at Fri Jun 12 19:08:08 2009 ######################################################################### __UU__ M'XL(`#P*BD<``^V:;6_B1A"`\WE_Q214(I$.QQ@;)*'0`G=-1;],P$`#@=_^* -M>^`!I,;Q4D63_$136@2T8Z)$VQORXEMKD=B1?5DHOQY[9=JH*#!.EB+9Y\]W -M5KPT+4IX"%'TJOFJMABX1E*F#9R^$:L_K1YS8$?4RSP?QY'WZ%O>N"Z?7\XN -M\L[IH<60GU#>8&B\ZQ&G:L7>6T&K4V=)Y";.!7*<(-=PB-3OP;B!C -M,4P.AT<(0;MFZ-"22N5Q=N4-12*K]NFTKM4FT*C2YI=W4/"I*%[!S1YF5GM4 -M@7]P:,WVM;*F4[%GMHI\-H\]4=I^)L[+DJU4H*SN=2I$PA7J"4P%O%<6"B$* -M$*4LXCB'M^O/C"V=D[)27LI%+>7U!HY"<'&6OHOZ>I/'Y"SF9FF2D_)\^_T) -ML*[^!*RK?P(N/AX3CT!:^PN1FCA-+.IG$%)NAIO_(8YOX!E$%7_.^$SD*>J( -B.*1GOY/FHSY5QWT4OTKI?95'0`G=-1;],P$`#@=_^* +M>^`!I,;Q4E5,?J(I+0+:;:)$V]ODQ;?6(K$C^[)0?CWVRK1146`[68IDGS_? +M6?'"-"CA(431J?J;VF#@&DF9)G#Z3JSZLGS,@2U1)_-\&`;>H6]X[=I\=C$] +MRUNG^P9#?D1YCZ'VIB/C;-0N]BE@58L!;EUO-1@+VGBLR?D=O+HW54];YT-N +M=,YFKNE;&WZ5TCT!1G"'/D1X%*=IRSY:0JM19POG)4Q[V3+RV2SV1&G[R2E;JD!9U>E4A81+U",8"_BD+!1"%"`F +MLHCC+7Q8?65LX9R4I?)2SBLIK]9P$(*+D_2=5U?K/"9G,3=+DYR4YYL?3X!5 +M^3=@5?X7<'9^2#P":>T?1&KB.#&OGD%(N>YO7D(