From: Jos I. Boumans Date: Sat, 7 Jul 2007 11:39:12 +0000 (+0200) Subject: Update CPANPLUS to 0.81_01 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=502c7995877be9ece842894d300fc2022467f1df;p=p5sagit%2Fp5-mst-13.2.git Update CPANPLUS to 0.81_01 From: "Jos I. Boumans" Message-Id: <87949855-9BDE-4823-9C28-BD639844CA41@dwim.org> p4raw-id: //depot/perl@31558 --- diff --git a/lib/CPANPLUS.pm b/lib/CPANPLUS.pm index 585d051..c9ef109 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.80"; #have to hardcode or cpan.org gets unhappy + $VERSION = "0.81_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 1a1f4d0..91eae92 100644 --- a/lib/CPANPLUS/Config.pm +++ b/lib/CPANPLUS/Config.pm @@ -358,7 +358,11 @@ installed, 'false' otherwise. =cut $Conf->{'conf'}->{'signature'} = do { - (can_run('gpg') || check_install(module => 'Crypt::OpenPGP')) ?1:0 }; + check_install( module => 'Module::Signature', version => '0.06' ) + and ( can_run('gpg') || + check_install(module => 'Crypt::OpenPGP') + ); + } ? 1 : 0; =item skiptest @@ -517,7 +521,12 @@ with CPANPLUS, which is used to enable autoflushing in spawned processes. ? ($name.$ver, $name) : ($name, $name.$ver); }; - + + ### patch from Steve Hay Fri 29 Jun 2007 14:26:02 GMT+02:00 + ### Msg-Id: <4684FA5A.7030506@uk.radan.com> + ### look for files with a ".bat" extension as well on Win32 + @bins = map { $_, "$_.bat" } @bins if $^O eq 'MSWin32'; + my $path; BIN: for my $bin (@bins) { @@ -576,11 +585,16 @@ with CPANPLUS, which is used to enable autoflushing in spawned processes. ### pass '-P' to perl: "run program through C ### preprocessor before compilation" error(loc( - "Could not find the '%1' in your path". + "Could not find the '%1' binary in your path". "--this may be a problem.\n". "Please locate this program and set ". - "your '%2' config entry to its path.\n", - $name, 'perlwrapper' + "your '%2' config entry to its path.\n". + "From the default shell, you can do this by typing:\n\n". + " %3\n". + " %4\n", + $name, 'perlwrapper', + 's program perlwrapper FULL_PATH_TO_CPANP_RUN_PERL', + 's save' )); return ''; }->(); diff --git a/lib/CPANPLUS/Configure/Setup.pm b/lib/CPANPLUS/Configure/Setup.pm index 81ee2ca..13c5e0a 100644 --- a/lib/CPANPLUS/Configure/Setup.pm +++ b/lib/CPANPLUS/Configure/Setup.pm @@ -475,13 +475,12 @@ Note that the paths you provide should not contain spaces, which is needed to make a distinction between program name and options to that program. For Win32 machines, you can use the short name for a path, like '%1'. - - ", 'c:\Progra~1\prog.exe' ); +", 'c:\Progra~1\prog.exe' ); for my $prog ( sort $conf->options( type => 'program') ) { PROGRAM: { - print loc("Where can I find your '%1' utility? ". - "(Enter a single space to disable)", $prog ); + print "\n", loc("Where can I find your '%1' utility? ". + "(Enter a single space to disable)", $prog ), "\n"; my $loc = $term->get_reply( prompt => "Path to your '$prog'", @@ -518,9 +517,9 @@ like '%1'. $conf->set_program( $prog => $cmd ); print $cmd - ? loc( "Your '%1' utility has been set to '%2'", + ? loc( "Your '%1' utility has been set to '%2'.", $prog, $cmd ) - : loc( "Your '%1' has been disabled", $prog ); + : loc( "Your '%1' has been disabled.", $prog ); print "\n"; } } diff --git a/lib/CPANPLUS/Internals.pm b/lib/CPANPLUS/Internals.pm index 9c3b651..62cf6b0 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.80"; +$VERSION = "0.81_01"; =pod @@ -126,6 +126,7 @@ Returns the object on success, or dies on failure. filter_prereqs => sub { return $_[1] }, # continue if 'make test' fails? proceed_on_test_failure => sub { return 0 }, + munge_dist_metafile => sub { return $_[1] }, }; my $status = Object::Accessor->new; @@ -326,6 +327,13 @@ Is called when 'make test' or 'Build test' fails. Should return a boolean indicating whether the install should continue even if the test failed. +=item munge_dist_metafile + +Is called when the C metafile is created, like +C for C, giving the user a chance to +programatically alter it. Should return the (munged) text to be +written to the metafile. + =back =cut diff --git a/lib/CPANPLUS/Selfupdate.pm b/lib/CPANPLUS/Selfupdate.pm index da7e944..adcb575 100644 --- a/lib/CPANPLUS/Selfupdate.pm +++ b/lib/CPANPLUS/Selfupdate.pm @@ -134,14 +134,20 @@ CPANPLUS::Selfupdate signature => [ sub { my $cb = shift; - return if can_run('gpg'); - ### leave this out -- Crypt::OpenPGP is fairly - ### painful to install, and broken on some platforms - ### so we'll just always fall back to gpg. It may - ### issue a warning or 2, but that's about it. - ### this change due to this ticket: #26914 - # and $cb->configure_object->get_conf('prefer_bin'); - return { 'Crypt::OpenPGP' => '0.0' }; + return { + 'Module::Signature' => '0.06', + } if can_run('gpg'); + ### leave this out -- Crypt::OpenPGP is fairly + ### painful to install, and broken on some platforms + ### so we'll just always fall back to gpg. It may + ### issue a warning or 2, but that's about it. + ### this change due to this ticket: #26914 + # and $cb->configure_object->get_conf('prefer_bin'); + + return { + 'Crypt::OpenPGP' => '0.0', + 'Module::Signature' => '0.06', + }; }, sub { my $cb = shift; diff --git a/lib/CPANPLUS/Shell/Default.pm b/lib/CPANPLUS/Shell/Default.pm index b39a3a6..d959160 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.80"; + $VERSION = "0.81_01"; } load CPANPLUS::Shell; @@ -238,7 +238,7 @@ sub _input_loop { $SIG{$sig} = $entry->{handler} if exists($entry->{handler}); } - print "\n"; + print "\n"; last if $self->dispatch_on_input( input => $input ); ### flush the lib cache ### @@ -493,22 +493,22 @@ sub _quit { ### print out the help message ### ### perhaps, '?' should be a slightly different version ### -my @Help; -sub _help { - my $self = shift; - my %hash = @_; - - my $input; - { local $Params::Check::ALLOW_UNKNOWN = 1; - - my $tmpl = { - input => { required => 0, store => \$input } - }; - - my $args = check( $tmpl, \%hash ) or return; - } - - @Help = ( +{ my @help; + sub _help { + my $self = shift; + my %hash = @_; + + my $input; + { local $Params::Check::ALLOW_UNKNOWN = 1; + + my $tmpl = { + input => { required => 0, store => \$input } + }; + + my $args = check( $tmpl, \%hash ) or return; + } + + @help = ( loc('[General]' ), loc(' h | ? # display help' ), loc(' q # exit' ), @@ -541,20 +541,25 @@ loc(' s edit [user|system] # open configuration file in editor and reload' loc(' ! EXPR # evaluate a perl statement' ), loc(' p [FILE] # print the error stack (optionally to a file)' ), loc(' x # reload CPAN indices (purges cache)' ), -loc(' x --update_source # reload CPAN indices, get fresh source files' ), +loc(' x --update_source # reload CPAN indices, get fresh source files' ), +loc('[Common Options]' ), +loc(' i ... --skiptest # skip tests' ), +loc(' i ... --force # force all operations' ), +loc(' i ... --verbose # run in verbose mode' ), loc('[Plugins]' ), loc(' /plugins # list available plugins' ), loc(' /? [PLUGIN NAME] # show usage for (a particular) plugin(s)' ), - ) unless @Help; - - $self->_pager_open if (@Help >= $self->_term_rowcount); - ### XXX: functional placeholder for actual 'detailed' help. - print "Detailed help for the command '$input' is not available.\n\n" - if length $input; - print map {"$_\n"} @Help; - print $/; - $self->_pager_close; + ) unless @help; + + $self->_pager_open if (@help >= $self->_term_rowcount); + ### XXX: functional placeholder for actual 'detailed' help. + print "Detailed help for the command '$input' is not available.\n\n" + if length $input; + print map {"$_\n"} @help; + print $/; + $self->_pager_close; + } } ### eval some code ### @@ -1722,8 +1727,8 @@ sub _read_configuration_from_rc { loc( "You can use plugins. Type '%1' to list available plugins", '/plugins' ), loc( "You can show all your out of date modules using '%1'", 'o' ), - loc( "Many operations take options, like '%1' or '%2'", - '--verbose', '--skiptest' ), + loc( "Many operations take options, like '%1', '%2' or '%3'", + '--verbose', '--force', '--skiptest' ), loc( "The documentation in %1 and %2 is very useful", "CPANPLUS::Module", "CPANPLUS::Backend" ), loc( "You can type '%1' for help and '%2' to exit", 'h', 'q' ), diff --git a/lib/CPANPLUS/bin/cpan2dist b/lib/CPANPLUS/bin/cpan2dist index 70b9a10..41349f4 100644 --- a/lib/CPANPLUS/bin/cpan2dist +++ b/lib/CPANPLUS/bin/cpan2dist @@ -6,6 +6,7 @@ use CPANPLUS::Internals::Constants; use Data::Dumper; use Getopt::Long; use File::Spec; +use File::Temp qw|tempfile|; use File::Basename; use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext'; @@ -36,7 +37,7 @@ GetOptions( $opts, 'logfile=s', 'timeout=s', 'dist-opts=s%', 'set-config=s%', 'default-banlist!', 'set-program=s%', - 'default-ignorelist!', + 'default-ignorelist!', 'edit-metafile!' ); die usage() if exists $opts->{'help'}; @@ -101,6 +102,41 @@ if( exists $opts->{'modulelist'} ) { die usage() unless @modules; +### set up munge callback if requested +{ if( $opts->{'edit-metafile'} ) { + my $editor = $conf->get_program('editor'); + + if( $editor ) { + + ### register install callback ### + $cb->_register_callback( + name => 'munge_dist_metafile', + code => sub { + my $self = shift; + my $text = shift or return; + + my($fh,$file) = tempfile( UNLINK => 1 ); + + unless( print $fh $text ) { + warn "Could not print metafile information: $!"; + return; + } + + close $fh; + + system( $editor => $file ); + + my $cont = $cb->_get_file_contents( file => $file ); + + return $cont; + }, + ); + + } else { + warn "No editor configured. Can not edit metafiles!\n"; + } + } +} my $fh; LOGFILE: { @@ -413,23 +449,25 @@ $formats Options: ### take no argument: - --help Show this help message - --skiptest Skip tests. Can be negated using --noskiptest - --force Force operation. Can be negated using --noforce - --verbose Be verbose. Can be negated using --noverbose - --keepsource Keep sources after building distribution. Can be - negated by --nokeepsource. May not be supported - by all formats - --makefile Prefer Makefile.PL over Build.PL. Can be negated - using --nomakefile. Defaults to your config setting - --buildprereq Build packages of any prerequisites, even if they are - already uptodate on the local system. Can be negated - using --nobuildprereq. Defaults to false. - --archive Indicate that all modules listed are actually archives - --flushcache Update CPANPLUS' cache before commencing any operation - --defaults Instruct ExtUtils::MakeMaker and Module::Build to use - default answers during 'perl Makefile.PL' or 'perl - Build.PL' calls where possible + --help Show this help message + --skiptest Skip tests. Can be negated using --noskiptest + --force Force operation. Can be negated using --noforce + --verbose Be verbose. Can be negated using --noverbose + --keepsource Keep sources after building distribution. Can be + negated by --nokeepsource. May not be supported + by all formats + --makefile Prefer Makefile.PL over Build.PL. Can be negated + using --nomakefile. Defaults to your config setting + --buildprereq Build packages of any prerequisites, even if they are + already uptodate on the local system. Can be negated + using --nobuildprereq. Defaults to false. + --archive Indicate that all modules listed are actually archives + --flushcache Update CPANPLUS' cache before commencing any operation + --defaults Instruct ExtUtils::MakeMaker and Module::Build to use + default answers during 'perl Makefile.PL' or 'perl + Build.PL' calls where possible + --edit-metafile Edit the distributions metafile(s) before the distribution + is built. Requires a configured editor. ### take argument: --format Installer format to use (defaults to config setting) diff --git a/lib/CPANPLUS/t/02_CPANPLUS-Internals.t b/lib/CPANPLUS/t/02_CPANPLUS-Internals.t index 29bf2ff..f576174 100644 --- a/lib/CPANPLUS/t/02_CPANPLUS-Internals.t +++ b/lib/CPANPLUS/t/02_CPANPLUS-Internals.t @@ -82,6 +82,7 @@ is($cb->_id, $cb->_last_id, "Comparing ID's"); munge_test_report => $$, # munge the test report filter_prereqs => $$, # limit prereqs proceed_on_test_failure => 0, # continue on failed 'make test'? + munge_dist_metafile => $$, # munge the metailfe }; for my $callback ( keys %$callback_map ) { 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 e08012c..8fb567c 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 Jun 17 14:15:09 2007 +Created at Sat Jul 7 11:15:17 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 21bf801..0be5624 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 Sun Jun 17 14:15:09 2007 +Created at Sat Jul 7 11:15:17 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 96cbf0e..17acea3 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 Sun Jun 17 14:15:09 2007 +Created at Sat Jul 7 11:15:17 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 3dee267..55f37de 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 Sun Jun 17 14:15:09 2007 +Created at Sat Jul 7 11:15:17 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 9393b59..a71a9e2 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 Sun Jun 17 14:15:09 2007 +Created at Sat Jul 7 11:15:17 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 afee040..82e35f5 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 Sun Jun 17 14:15:10 2007 +Created at Sat Jul 7 11:15:18 2007 ######################################################################### __UU__ M'XL("#'FO$4``S`S;6]D;&ES="YD871A`%U3_6O;,!#].?HKCBXC"20A=<@&