From: Jos I. Boumans Date: Sun, 22 Apr 2007 10:18:10 +0000 (+0200) Subject: Update CPANPLUS to 0.79_01 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=494f1016b728a37665c950a6d0b4ae238a18cc78;p=p5sagit%2Fp5-mst-13.2.git Update CPANPLUS to 0.79_01 From: "Jos I. Boumans" Message-Id: p4raw-id: //depot/perl@31020 --- diff --git a/lib/CPANPLUS.pm b/lib/CPANPLUS.pm index b30aa7f..16650a7 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.78"; #have to hardcode or cpan.org gets unhappy + $VERSION = "0.79_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/Config.pm b/lib/CPANPLUS/Config.pm index 2516559..90cc6d3 100644 --- a/lib/CPANPLUS/Config.pm +++ b/lib/CPANPLUS/Config.pm @@ -114,80 +114,90 @@ my $Conf = { : can_run('sudo') ), ### perlwrapper that allows us to turn on autoflushing - 'perlwrapper' => ( ### parallel to your cpanp/cpanp-boxed - do { my $f = File::Spec->rel2abs( - File::Spec->catdir( - dirname($0), 'cpanp-run-perl' - ) - ); - -e $f ? $f : undef - } || - - ### parallel to your CPANPLUS.pm: - ### $INC{cpanplus}/../bin/cpanp-run-perl - do { my $f = File::Spec->rel2abs( - File::Spec->catdir( - dirname( $INC{'CPANPLUS.pm'} ), - '..', # lib dir - 'bin', # bin dir - 'cpanp-run-perl' - ) - ); - -e $f ? $f : undef - } || - ### you installed CPANPLUS in a custom prefix, - ### so go paralel to /that/. PREFIX=/tmp/cp - ### would put cpanp-run-perl in /tmp/cp/bin and - ### CPANPLUS.pm in - ### /tmp/cp/lib/perl5/site_perl/5.8.8 - do { my $f = File::Spec->rel2abs( - File::Spec->catdir( - dirname( $INC{'CPANPLUS.pm'} ), - '..', '..', '..', '..', # 4x updir - 'bin', # bin dir - 'cpanp-run-perl' - ) - ); - -e $f ? $f : undef - } || + 'perlwrapper' => sub{ + my $name = 'cpanp-run-perl'; - ### in your path -- take this one last, the - ### previous two assume extracted tarballs - ### or user installs - ### note that we don't use 'can_run' as it's - ### not an executable, just a wrapper... - do { my $rv; - for (split(/\Q$Config::Config{path_sep}\E/, - $ENV{PATH}), File::Spec->curdir - ) { - my $path = File::Spec->catfile( - $_, 'cpanp-run-perl' ); - if( -e $path ) { - $rv = $path; - last; - } - } - - $rv || undef; - } || + my @bins = do{ + require Config; + my $ver = $Config::Config{version}; + + ### if we are running with 'versiononly' enabled, + ### all binaries will have the perlversion appended + ### ie, cpanp will become cpanp5.9.5 + ### so prefer the versioned binary in that case + $Config::Config{versiononly} + ? ($name.$ver, $name) + : ($name, $name.$ver); + }; + + my $path; + BIN: for my $bin (@bins) { + + ### parallel to your cpanp/cpanp-boxed + my $maybe = File::Spec->rel2abs( + File::Spec->catdir( dirname($0), $bin ) + ); + $path = $maybe and last BIN if -f $maybe; + + ### parallel to your CPANPLUS.pm: + ### $INC{cpanplus}/../bin/cpanp-run-perl + $maybe = File::Spec->rel2abs( + File::Spec->catdir( + dirname($INC{'CPANPLUS.pm'}), + '..', # lib dir + 'bin', # bin dir + $bin, # script + ) + ); + $path = $maybe and last BIN if -f $maybe; + + ### you installed CPANPLUS in a custom prefix, + ### so go paralel to /that/. PREFIX=/tmp/cp + ### would put cpanp-run-perl in /tmp/cp/bin and + ### CPANPLUS.pm in + ### /tmp/cp/lib/perl5/site_perl/5.8.8 + $maybe = File::Spec->rel2abs( + File::Spec->catdir( + dirname( $INC{'CPANPLUS.pm'} ), + '..', '..', '..', '..', # 4x updir + 'bin', # bin dir + $bin, # script + ) + ); + $path = $maybe and last BIN if -f $maybe; - ### XXX try to be a no-op instead then.. - ### cross your fingers... - ### pass '-P' to perl: "run program through C - ### preprocessor before compilation" - do { - error(loc( - "Could not find the '%1' in your path". - "--this may be a problem.\n". - "Please locate this program and set ". - "your '%1' config entry to its path.\n". - "Attempting to provide a reasonable ". - "fallback...", - 'cpanp-run-perl', 'perlwrapper' - )); - '-P' - }, - ), + ### in your path -- take this one last, the + ### previous two assume extracted tarballs + ### or user installs + ### note that we don't use 'can_run' as it's + ### not an executable, just a wrapper... + for my $dir (split(/\Q$Config::Config{path_sep}\E/, $ENV{PATH}), + File::Spec->curdir + ) { + $maybe = File::Spec->catfile( $dir, $bin ); + $path = $maybe and last BIN if -f $maybe; + } + } + + ### we should have a $path by now ideally, if so return it + return $path if defined $path; + + ### if not, warn about it and give sensible default. + ### XXX try to be a no-op instead then.. + ### cross your fingers... + ### pass '-P' to perl: "run program through C + ### preprocessor before compilation" + error(loc( + "Could not find the '%1' in your path". + "--this may be a problem.\n". + "Please locate this program and set ". + "your '%1' config entry to its path.\n". + "Attempting to provide a reasonable ". + "fallback...", + $name, 'perlwrapper' + )); + return '-P' + }->(), }, ### _source, _build and _mirror are supposed to be static diff --git a/lib/CPANPLUS/Dist/MM.pm b/lib/CPANPLUS/Dist/MM.pm index f61cfc8..86c04dc 100644 --- a/lib/CPANPLUS/Dist/MM.pm +++ b/lib/CPANPLUS/Dist/MM.pm @@ -217,8 +217,7 @@ sub prepare { error( loc( "No dir found to operate on!" ) ); return; } - -$DB::single = 1; + my $args; my( $force, $verbose, $perl, $mmflags ); { local $Params::Check::ALLOW_UNKNOWN = 1; diff --git a/lib/CPANPLUS/Internals.pm b/lib/CPANPLUS/Internals.pm index 0ba2529..17760cb 100644 --- a/lib/CPANPLUS/Internals.pm +++ b/lib/CPANPLUS/Internals.pm @@ -40,7 +40,7 @@ use vars qw[@ISA $VERSION]; CPANPLUS::Internals::Report ]; -$VERSION = "0.78"; +$VERSION = "0.79_01"; =pod diff --git a/lib/CPANPLUS/Internals/Constants.pm b/lib/CPANPLUS/Internals/Constants.pm index 0961e25..4c666ea 100644 --- a/lib/CPANPLUS/Internals/Constants.pm +++ b/lib/CPANPLUS/Internals/Constants.pm @@ -27,6 +27,9 @@ use constant INSTALLER_SAMPLE => 'CPANPLUS::Dist::Sample'; use constant INSTALLER_BASE => 'CPANPLUS::Dist::Base'; +use constant SHELL_DEFAULT => 'CPANPLUS::Shell::Default'; +use constant SHELL_CLASSIC => 'CPANPLUS::Shell::Classic'; + use constant CONFIG => 'CPANPLUS::Config'; use constant CONFIG_USER => 'CPANPLUS::Config::User'; use constant CONFIG_SYSTEM => 'CPANPLUS::Config::System'; diff --git a/lib/CPANPLUS/Selfupdate.pm b/lib/CPANPLUS/Selfupdate.pm index 2271dd4..339d982 100644 --- a/lib/CPANPLUS/Selfupdate.pm +++ b/lib/CPANPLUS/Selfupdate.pm @@ -119,6 +119,13 @@ CPANPLUS::Selfupdate sub { my $cb = shift; my $dist = $cb->configure_object->get_conf('shell'); + + ### we bundle these shells, so don't bother having a dep + ### on them... If we don't do this, CPAN.pm actually detects + ### a recursive dependency and breaks (see #26077). + ### This is not an issue for CPANPLUS itself, it handles + ### it smartly. + return if $dist eq SHELL_DEFAULT or $dist eq SHELL_CLASSIC; return { $dist => '0.0' } if $dist; return; }, diff --git a/lib/CPANPLUS/Shell.pm b/lib/CPANPLUS/Shell.pm index 4128e03..13cb051 100644 --- a/lib/CPANPLUS/Shell.pm +++ b/lib/CPANPLUS/Shell.pm @@ -4,7 +4,7 @@ use strict; use CPANPLUS::Error; use CPANPLUS::Configure; - +use CPANPLUS::Internals::Constants; use Module::Load qw[load]; use Params::Check qw[check]; @@ -14,7 +14,7 @@ $Params::Check::VERBOSE = 1; use vars qw[@ISA $SHELL $DEFAULT]; -$DEFAULT = 'CPANPLUS::Shell::Default'; +$DEFAULT = SHELL_DEFAULT; =pod diff --git a/lib/CPANPLUS/Shell/Default.pm b/lib/CPANPLUS/Shell/Default.pm index c65cb88..c153e73 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.78"; + $VERSION = "0.79_01"; } load CPANPLUS::Shell; diff --git a/lib/CPANPLUS/t/15_CPANPLUS-Shell.t b/lib/CPANPLUS/t/15_CPANPLUS-Shell.t new file mode 100644 index 0000000..c1e9fbf --- /dev/null +++ b/lib/CPANPLUS/t/15_CPANPLUS-Shell.t @@ -0,0 +1,22 @@ +### make sure we can find our conf.pl file +BEGIN { + use FindBin; + require "$FindBin::Bin/inc/conf.pl"; +} + +use strict; +use Test::More 'no_plan'; + +use CPANPLUS::Internals::Constants; + + +my $Class = 'CPANPLUS::Shell'; +my $Conf = gimme_conf(); + +$Conf->set_conf( shell => SHELL_DEFAULT ); + +### basic load tests +use_ok( $Class ); +is( $Class->which, SHELL_DEFAULT, + "Default shell loaded" ); + diff --git a/lib/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t b/lib/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t index 79df1df..00b0c45 100644 --- a/lib/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t +++ b/lib/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t @@ -7,6 +7,7 @@ BEGIN { use strict; use CPANPLUS::Backend; +use CPANPLUS::Internals::Constants; use Test::More 'no_plan'; use Data::Dumper; @@ -33,6 +34,36 @@ my $Prereq = { $Dep => 0 }; isa_ok( $su, $Class ); } + +### check specifically if our bundled shells dont trigger a +### dependency (see #26077). +### do this _before_ changing the built in conf! +{ my $meth = 'modules_for_feature'; + my $type = 'shell'; + my $cobj = $CB->configure_object; + my $cur = $cobj->get_conf( $type ); + + for my $shell ( SHELL_DEFAULT, SHELL_CLASSIC ) { + ok( $cobj->set_conf( $type => $shell ), + "Testing dependencies for '$shell'" ); + + my $rv = $CB->$Acc->$meth( $type => 1); + ok( !$rv, " No dependencies for '$shell' -- bundled" ); + } + + for my $shell ( 'CPANPLUS::Test::Shell' ) { + ok( $cobj->set_conf( $type => $shell ), + "Testing dependencies for '$shell'" ); + + my $rv = $CB->$Acc->$meth( $type => 1 ); + ok( $rv, " Got prereq hash" ); + isa_ok( $rv, 'HASH', + " Return value" ); + is_deeply( $rv, { $shell => '0.0' }, + " With the proper entries" ); + } +} + ### test the feature list { ### start with defining our OWN type of config, as not all mentioned ### modules will be present in our bundled package files. @@ -111,7 +142,7 @@ my $Prereq = { $Dep => 0 }; ### declare twice because warnings are hateful ### declare in a block to quelch 'sub redefined' warnings. { local *CPANPLUS::Selfupdate::Module::install = sub { 1 }; } - local *CPANPLUS::Selfupdate::Module::install = sub { 1 }; + local *CPANPLUS::Selfupdate::Module::install = sub { 1 }; my $meth = 'selfupdate'; can_ok( $Class, $meth ); 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 7606c3b..b6eb10c 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 Sat Apr 7 13:06:48 2007 +Created at Sun Apr 22 10:12:09 2007 ######################################################################### __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/E/EU/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed b/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed index 20d4cb2..2f3061a 100644 --- a/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed +++ b/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/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/E/EU/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed -Created at Sat Apr 7 13:06:48 2007 +Created at Sun Apr 22 10:12:09 2007 ######################################################################### __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/E/EU/EUNOXS/Foo-Bar-0.01.tar.gz.packed b/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Foo-Bar-0.01.tar.gz.packed index c58d0e1..b777538 100644 --- a/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Foo-Bar-0.01.tar.gz.packed +++ b/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/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/E/EU/EUNOXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Foo-Bar-0.01.tar.gz.packed -Created at Sat Apr 7 13:06:48 2007 +Created at Sun Apr 22 10:12:09 2007 ######################################################################### __UU__ M'XL("/8X34("`T9O;RU"87(M,"XP,2YT87(`[9KQ;]I&%,?Y^?Z*1YE$(A5C diff --git a/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz.packed b/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz.packed index cb93428..e5e7121 100644 --- a/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz.packed +++ b/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz.packed @@ -10,7 +10,7 @@ To recreate it use the following command: uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz.packed -Created at Sat Apr 7 13:06:48 2007 +Created at Sun Apr 22 10:12:09 2007 ######################################################################### __UU__ M'XL(`'3DO44``^W/,0J`,`Q`T1RE)Y"T-O4XXN"DB%2]OR(*NNC4[;_E#\F0 diff --git a/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUXS/Foo-Bar-0.01.tar.gz.packed b/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUXS/Foo-Bar-0.01.tar.gz.packed index fd16409..bae77dc 100644 --- a/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUXS/Foo-Bar-0.01.tar.gz.packed +++ b/lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUXS/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/E/EU/EUXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUXS/Foo-Bar-0.01.tar.gz.packed -Created at Sat Apr 7 13:06:48 2007 +Created at Sun Apr 22 10:12:09 2007 ######################################################################### __UU__ M'XL("`DY34("`T9O;RU"87(M,"XP,2YT87(`[5IK3]M(%,U7YE='0`E=-1:]LP$`#@=_^* diff --git a/lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz.packed b/lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz.packed index e4fb69c..905849e 100644 --- a/lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz.packed +++ b/lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz.packed @@ -10,7 +10,7 @@ To recreate it use the following command: uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz.packed -Created at Sat Apr 7 13:06:48 2007 +Created at Sun Apr 22 10:12:09 2007 ######################################################################### __UU__ M'XL("#'FO$4``S`S;6]D;&ES="YD871A`%U3_6O;,!#].?HKCBXC"20A=<@& diff --git a/lib/CPANPLUS/t/inc/conf.pl b/lib/CPANPLUS/t/inc/conf.pl index 7ca8747..50c8970 100644 --- a/lib/CPANPLUS/t/inc/conf.pl +++ b/lib/CPANPLUS/t/inc/conf.pl @@ -66,6 +66,7 @@ use constant TEST_CONF_PREREQ => 'Cwd'; use constant TEST_CONF_MODULE => 'Foo::Bar::EU::NOXS'; use constant TEST_CONF_INST_MODULE => 'Foo::Bar'; use constant TEST_CONF_INVALID_MODULE => 'fnurk'; +use constant TEST_CONF_MIRROR_DIR => 'dummy-localmirror'; ### we might need this Some Day when we're installing into ### our own sandbox. see t/20.t for details @@ -114,6 +115,7 @@ sub gimme_conf { _clean_test_dir( [ $conf->get_conf('base'), + TEST_CONF_MIRROR_DIR, # TEST_INSTALL_DIR_LIB, # TEST_INSTALL_DIR_BIN, # TEST_INSTALL_DIR_MAN1, @@ -123,19 +125,40 @@ sub gimme_conf { return $conf; }; -my $fh; -my $file = ".".basename($0).".output"; -sub output_handle { - return $fh if $fh; +{ + my $fh; + my $file = ".".basename($0).".output"; + sub output_handle { + return $fh if $fh; + + $fh = FileHandle->new(">$file") + or warn "Could not open output file '$file': $!"; + + $fh->autoflush(1); + return $fh; + } - $fh = FileHandle->new(">$file") - or warn "Could not open output file '$file': $!"; - - $fh->autoflush(1); - return $fh; + sub output_file { return $file } } -sub output_file { return $file } + +### clean these files if we're under perl core +END { + if ( $ENV{PERL_CORE} ) { + close output_handle(); 1 while unlink output_file(); + + _clean_test_dir( [ + gimme_conf->get_conf('base'), + TEST_CONF_MIRROR_DIR, + # TEST_INSTALL_DIR_LIB, + # TEST_INSTALL_DIR_BIN, + # TEST_INSTALL_DIR_MAN1, + # TEST_INSTALL_DIR_MAN3, + ], 1 ); + } +} + + ### whenever we start a new script, we want to clean out our ### old files from the test '.cpanplus' dir..