diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2012-05-31 12:37:46 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2012-06-15 14:33:49 +0100 |
commit | 430a63c8434e43cb1c265660a3a8560a27b6629c (patch) | |
tree | c4b5a6aeb7bd0566f04f9d24527785ecd089d5a8 | |
parent | fcfb9f49f0bdeeefc0c369bbb92e2cc159e06676 (diff) | |
download | perl-430a63c8434e43cb1c265660a3a8560a27b6629c.tar.gz |
Updated CPANPLUS to CPAN version 0.9130
[DELTA]
Changes for 0.9130 Thu May 24 22:04:10 2012
================================================
* Always re-fetch CHECKSUMS if fetchdir is set
(Torsten Schoenfeld)
Changes for 0.9129 Wed May 9 21:22:41 2012
================================================
* Handle multiple makemakerargs and makeflags
arguments better.
* Use File::HomeDir for home directory location
if it is available, thanks to kmx
* Added PERL5_CPANPLUS_HOME for altering where
the .cpanplus directory is located
Changes for 0.9128 Sat Apr 28 21:27:06 2012
================================================
* Fix the previous fix
Changes for 0.9127 Sat Apr 28 20:34:44 2012
================================================
* Silenced annoying warnings related to older
perls and the progress indicators
Changes for 0.9126 Sat Apr 28 00:49:43 2012
================================================
* More speed enhancements to module indexing,
thanks to Vincent Pit
Changes for 0.9125 Wed Apr 25 14:28:34 2012
================================================
* Speed enhancements to module indexing, thanks
to Vincent Pit
Changes for 0.9124 Fri Apr 6 19:24:55 2012
================================================
* Save the history between invocations of the
shell.
Changes for 0.9123 Fri Mar 30 16:46:52 2012
================================================
* Added support for adding blib/script to PATH
Changes for 0.9122 Wed Mar 28 21:52:38 2012
================================================
* Don't spawn a process to check whether perl
version prereqs are satisfied
-rw-r--r-- | MANIFEST | 1 | ||||
-rwxr-xr-x | Porting/Maintainers.pl | 3 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS.pm | 2 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Config.pm | 14 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Config/HomeEnv.pm | 62 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Configure.pm | 18 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Dist.pm | 6 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm | 25 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Internals.pm | 45 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm | 4 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Internals/Source.pm | 83 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Internals/Source/Memory.pm | 35 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Internals/Utils.pm | 9 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Module.pm | 12 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Module/Checksums.pm | 9 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Selfupdate.pm | 6 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Shell/Classic.pm | 32 | ||||
-rw-r--r-- | cpan/CPANPLUS/lib/CPANPLUS/Shell/Default.pm | 33 | ||||
-rw-r--r-- | cpan/CPANPLUS/t/inc/conf.pl | 2 | ||||
-rw-r--r-- | lib/.gitignore | 1 |
20 files changed, 315 insertions, 87 deletions
@@ -433,6 +433,7 @@ cpan/CPANPLUS-Dist-Build/t/src/noxs/Foo-Bar-0.01.tar.gz CPANPLUS::Dist::Build t cpan/CPANPLUS-Dist-Build/t/src/xs/Foo-Bar-0.01.tar.gz CPANPLUS::Dist::Build tests cpan/CPANPLUS/lib/CPANPLUS/Backend.pm CPANPLUS cpan/CPANPLUS/lib/CPANPLUS/Backend/RV.pm CPANPLUS +cpan/CPANPLUS/lib/CPANPLUS/Config/HomeEnv.pm cpan/CPANPLUS/lib/CPANPLUS/Config.pm CPANPLUS cpan/CPANPLUS/lib/CPANPLUS/Configure.pm CPANPLUS cpan/CPANPLUS/lib/CPANPLUS/Configure/Setup.pm CPANPLUS diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 9ff188474f..d338d309e6 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -448,11 +448,12 @@ use File::Glob qw(:case); 'CPANPLUS' => { 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/CPANPLUS-0.9121.tar.gz', + 'DISTRIBUTION' => 'BINGOS/CPANPLUS-0.9130.tar.gz', 'FILES' => q[cpan/CPANPLUS], 'EXCLUDED' => [ qr{^inc/}, qr{^t/dummy-.*\.hidden$}, + qr{^t/dummy-(cpanplus|perl|localmirror)/}, 'bin/cpanp-boxed', # SQLite tests would be skipped in core, and diff --git a/cpan/CPANPLUS/lib/CPANPLUS.pm b/cpan/CPANPLUS/lib/CPANPLUS.pm index e1fc6ef8ad..e03a3fb136 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.9121"; #have to hardcode or cpan.org gets unhappy + $VERSION = "0.9130"; #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/Config.pm b/cpan/CPANPLUS/lib/CPANPLUS/Config.pm index e148b8fca7..51029c7518 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Config.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Config.pm @@ -166,7 +166,10 @@ Defaults to C<true>. =item base The directory CPANPLUS keeps all its build and state information in. -Defaults to ~/.cpanplus. +Defaults to ~/.cpanplus. If L<File::HomeDir> is available, that will +be used to work out your C<HOME> directory. This may be overriden by +setting the C<PERL5_CPANPLUS_HOME> environment variable, see +L<CPANPLUS::Config::HomeEnv> for more details. =cut @@ -282,6 +285,15 @@ etc. Defaults to 'false'. $Conf->{'conf'}->{'force'} = 0; +=item histfile + +A string containing the history filename of the CPANPLUS readline instance. + +=cut + + $Conf->{'conf'}->{'histfile'} = File::Spec->catdir( + __PACKAGE__->_home_dir, DOT_CPANPLUS, 'history' ); + =item lib An array ref holding directories to be added to C<@INC> when CPANPLUS diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Config/HomeEnv.pm b/cpan/CPANPLUS/lib/CPANPLUS/Config/HomeEnv.pm new file mode 100644 index 0000000000..5fb59d7f57 --- /dev/null +++ b/cpan/CPANPLUS/lib/CPANPLUS/Config/HomeEnv.pm @@ -0,0 +1,62 @@ +package CPANPLUS::Config::HomeEnv; + +use strict; +use File::Spec; +use vars qw($VERSION); + +$VERSION = '0.04'; + +sub setup { + my $conf = shift; + $conf->set_conf( base => File::Spec->catdir( $ENV{PERL5_CPANPLUS_HOME}, '.cpanplus' ) ) + if $ENV{PERL5_CPANPLUS_HOME}; + return 1; +} + +qq'Wherever I hang my hat is home'; + +__END__ + +=head1 NAME + +CPANPLUS::Config::HomeEnv - Set the environment for the CPANPLUS base dir + +=head1 SYNOPSIS + + export PERL5_CPANPLUS_HOME=/home/moo/perls/conf/perl-5.8.9/ + +=head1 DESCRIPTION + +CPANPLUS::Config::HomeEnv is a L<CPANPLUS::Config> file that allows the CPANPLUS user to +specify where L<CPANPLUS> gets its configuration from. + +Setting the environment variable C<PERL5_CPANPLUS_HOME> to a path location, determines +where the C<.cpanplus> directory will be located. + +=head1 METHODS + +=over + +=item C<setup> + +Called by L<CPANPLUS::Configure>. + +=back + +=head1 AUTHOR + +Chris C<BinGOs> Williams <chris@bingosnet.co.uk> + +Contributions and patience from Jos Boumans the L<CPANPLUS> guy! + +=head1 LICENSE + +Copyright E<copy> Chris Williams and Jos Boumans. + +This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details. + +=head1 SEE ALSO + +L<CPANPLUS> + +=cut diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Configure.pm b/cpan/CPANPLUS/lib/CPANPLUS/Configure.pm index 04a08753d5..9251894062 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Configure.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Configure.pm @@ -523,10 +523,12 @@ sub AUTOLOAD { $type .= '_' if $private; $type .= $field if $field; - unless ( $conf->can($type) ) { + my $type_code = $conf->can($type); + unless ( $type_code ) { error( loc("Invalid method type: '%1'", $name) ); return; } + my $type_obj = $type_code->(); unless( scalar @_ ) { error( loc("No arguments provided!") ); @@ -539,8 +541,8 @@ sub AUTOLOAD { my @list = (); ### get it from the user config first - if( $conf->can($type) and $conf->$type->can($key) ) { - push @list, $conf->$type->$key; + if( my $code = $type_obj->can($key) ) { + push @list, $code->(); ### XXX EU::AI compatibility hack to provide lookups like in ### cpanplus 0.04x; we renamed ->_get_build('base') to @@ -562,8 +564,8 @@ sub AUTOLOAD { while( my($key,$val) = each %args ) { - if( $conf->can($type) and $conf->$type->can($key) ) { - $conf->$type->$key( $val ); + if( my $code = $type_obj->can($key) ) { + $code->( $val ); } else { error( loc(q[No such key '%1' in field '%2'], $key, $type) ); @@ -579,13 +581,13 @@ sub AUTOLOAD { while( my($key,$val) = each %args ) { - if( $conf->$type->can($key) ) { + if( $type_obj->can($key) ) { error( loc( q[Key '%1' already exists for field '%2'], $key, $type)); return; } else { - $conf->$type->mk_accessors( $key ); - $conf->$type->$key( $val ); + $type_obj->mk_accessors( $key ); + $type_obj->$key( $val ); } } return 1; diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Dist.pm b/cpan/CPANPLUS/lib/CPANPLUS/Dist.pm index 5df2ef0c64..5189c3eb52 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Dist.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Dist.pm @@ -610,11 +610,7 @@ sub _resolve_prereqs { ### 'perl' is a special case, there's no mod object for it if( $mod eq PERL_CORE ) { - ### run a CLI invocation to see if the perl you specified is - ### uptodate - my $ok = run( command => "$^X -M$version -e1", verbose => 0 ); - - unless( $ok ) { + unless( $cb->_vcmp( sprintf('v%vd',$^V), $version ) >= 0 ) { error(loc( "Module '%1' needs perl version '%2', but you ". "only have version '%3' -- can not proceed", $self->module, $version, diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm b/cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm index cd428691bc..5d48a90104 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm @@ -221,14 +221,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[0] }, + store => \$mmflags }, force => { default => $conf->get_conf('force'), store => \$force }, verbose => { default => $conf->get_conf('verbose'), @@ -242,6 +242,7 @@ sub prepare { $args = check( $tmpl, \%hash ) or return; } + my @mmflags = $dist->_split_like_shell( $mmflags ); ### maybe we already ran a create on this object? ### return 1 if $dist->status->prepared && !$force; @@ -578,6 +579,8 @@ sub create { $args = check( $tmpl, \%hash ) or return; } + my @makeflags = $dist->_split_like_shell( $makeflags ); + ### maybe we already ran a create on this object? ### make sure we add to include path again, just in case we came from ### ->save_state, at which point we need to restore @INC/$PERL5LIB @@ -641,7 +644,7 @@ sub create { "not running again unless you force", $make, $self->module ), $verbose ); } else { - unless(scalar run( command => [$make, $makeflags], + unless(scalar run( command => [$make, @makeflags], buffer => \$captured, verbose => $verbose ) ) { @@ -687,7 +690,7 @@ sub create { ### XXX need to add makeflags here too? ### yes, but they should really be split out -- see bug #4143 if( scalar run( - command => [$make, 'test', $makeflags], + command => [$make, 'test', @makeflags], buffer => \$captured, verbose => $run_verbose, ) ) { @@ -815,6 +818,7 @@ sub install { return; } + my @makeflags = $dist->_split_like_shell( $makeflags ); $dist->status->_install_args( $args ); @@ -829,7 +833,7 @@ sub install { ### 'make install' section ### ### XXX need makeflags here too? ### yes, but they should really be split out.. see bug #4143 - my $cmd = [$make, 'install', $makeflags]; + my $cmd = [$make, 'install', @makeflags]; my $sudo = $conf->get_program('sudo'); unshift @$cmd, $sudo if $sudo and $>; @@ -1016,6 +1020,17 @@ sub dist_dir { return $distdir; } +sub _split_like_shell { + my ($self, $string) = @_; + + return () unless defined($string); + return @$string if ref $string eq 'ARRAY'; + $string =~ s/^\s+|\s+$//g; + return () unless length($string); + + require Text::ParseWords; + return Text::ParseWords::shellwords($string); +} 1; diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Internals.pm b/cpan/CPANPLUS/lib/CPANPLUS/Internals.pm index e9f97bfa2a..37b8596cde 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.9121"; +$VERSION = "0.9130"; =pod @@ -79,7 +79,7 @@ Get/set the id =cut ### autogenerate accessors ### -for my $key ( qw[_conf _id _modules _hosts _methods _status +for my $key ( qw[_conf _id _modules _hosts _methods _status _path _callbacks _selfupdate _mtree _atree] ) { no strict 'refs'; @@ -139,6 +139,7 @@ Returns the object on success, or dies on failure. _methods => { default => {}, no_override => 1 }, _status => { default => '<empty>', no_override => 1 }, _callbacks => { default => '<empty>', no_override => 1 }, + _path => { default => $ENV{PATH} || '', no_override => 1 }, }; sub _init { @@ -254,6 +255,7 @@ be flushed. if( $what eq 'lib' ) { $ENV{PERL5LIB} = $conf->_perl5lib || ''; @INC = @{$conf->_lib}; + $ENV{PATH} = $self->_path || ''; ### give all modules a new status object -- this is slightly ### costly, but the best way to make sure all statuses are @@ -440,6 +442,45 @@ sub _add_to_includepath { =pod +=head2 $bool = $internals->_add_to_path( directories => \@dirs ) + +Adds a list of directories to the PATH, but only if they actually +contain anything. + +Returns true on success, false on failure. + +=cut + +sub _add_to_path { + my $self = shift; + my %hash = @_; + + my $dirs; + my $tmpl = { + directories => { required => 1, default => [], store => \$dirs, + strict_type => 1 }, + }; + + check( $tmpl, \%hash ) or return; + + my $s = $Config{'path_sep'}; + + require File::Glob; + + ### only add if it's not added yet + for my $dir (@$dirs) { + $dir =~ s![\\/]*$!!g; + next if $ENV{PATH} =~ qr|\Q$dir\E|; + next unless -d $dir; + next unless File::Glob::bsd_glob( $dir . q{/*} ); + $ENV{PATH} = join $s, $dir, $ENV{PATH}; + } + + return 1; +} + +=pod + =head2 $id = CPANPLUS::Internals->_last_id Return the id of the last object stored. diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm index bd48a1db8c..c874a57917 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm @@ -195,6 +195,10 @@ use constant BLIB_LIBDIR => sub { return @_ : File::Spec->catdir( BLIB->(), LIB ); }; +use constant BIN => 'bin'; + +use constant SCRIPT => 'script'; + use constant CONFIG_USER_LIB_DIR => sub { require CPANPLUS::Internals::Utils; LIB_DIR->( diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Source.pm b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Source.pm index 1f75535fa6..1017383d8f 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Source.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Source.pm @@ -551,13 +551,12 @@ sub __create_author_tree { my ($tot,$prce,$prc,$idx); - $args->{verbose} - and local $|=1, - $tot = scalar(split /\n/, $cont), - ($prce, $prc, $idx) = (int $tot / 25, 0, 0); - - $args->{verbose} - and print "\t0%"; + if ( $args->{verbose} and local $|=1 ) { + no warnings; + $tot = scalar(split /\n/, $cont); + ($prce, $prc, $idx) = (int $tot / 25, 0, 0); + print "\t0%"; + } for ( split /\n/, $cont ) { my($id, $name, $email) = m/^alias \s+ @@ -630,7 +629,7 @@ sub _create_mod_tree { my $self = shift; my %hash = @_; my $conf = $self->configure_object; - + my $base = $conf->_get_mirror('base'); my $tmpl = { path => { default => $conf->get_conf('base') }, @@ -647,6 +646,8 @@ sub _create_mod_tree { my $dslip_tree = $self->__create_dslip_tree( %$args ); + my $author_tree = $self->author_tree; + ### extract the file ### my $ae = Archive::Extract->new( archive => $file ) or return; my $out = STRIP_GZ_SUFFIX->($file); @@ -664,48 +665,47 @@ sub _create_mod_tree { my($past_header, $count, $tot, $prce, $prc, $idx); - $args->{verbose} - and local $|=1, - $tot = scalar(split /\n/, $content), - ($prce, $prc, $idx) = (int $tot / 25, 0, 0); - - $args->{verbose} - and print "\t0%"; + if ( $args->{verbose} and local $|=1 ) { + no warnings; + $tot = scalar(split /\n/, $content); + ($prce, $prc, $idx) = (int $tot / 25, 0, 0); + print "\t0%"; + } for ( split /\n/, $content ) { - ### quick hack to read past the header of the file ### - ### this is still rather evil... fix some time - Kane - 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 ) { + ### header has ended -- did we get the line count? + if( m|^\s*$| ) { + unless( $count ) { + error(loc("Could not determine line count from %1", $file)); + return; + } + $past_header = 1; + ### 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; + } else { + $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; - my @data = split /\s+/; + ### three fields expected on each line + next unless @data == 3; ### filter out the author and filename as well ### ### authors can apparently have digits in their names, @@ -720,7 +720,7 @@ sub _create_mod_tree { ### remove file name from the path $data[2] =~ s|/[^/]+$||; - my $aobj = $self->author_tree($author); + my $aobj = $author_tree->{$author}; unless( $aobj ) { error( loc( "No such author '%1' -- can't make module object " . "'%2' that is supposed to belong to this author", @@ -728,15 +728,14 @@ sub _create_mod_tree { next; } + my $dslip_mod = $dslip_tree->{ $data[0] }; + ### adding the dslip info - ### probably can use some optimization my $dslip; for my $item ( qw[ statd stats statl stati statp ] ) { ### checking if there's an entry in the dslip info before ### catting it on. appeasing warnings this way - $dslip .= $dslip_tree->{ $data[0] }->{$item} - ? $dslip_tree->{ $data[0] }->{$item} - : ' '; + $dslip .= $dslip_mod->{$item} || ' '; } ### XXX this could be sped up if we used author names, not author @@ -751,7 +750,7 @@ sub _create_mod_tree { ? '0.0' : $data[1]), path => File::Spec::Unix->catfile( - $conf->_get_mirror('base'), + $base, $data[2], ), # extended path on the cpan mirror, # like /A/AB/ABIGAIL @@ -759,7 +758,7 @@ sub _create_mod_tree { author => $aobj, package => $package, # package name, like # 'foo-bar-baz-1.03.tar.gz' - description => $dslip_tree->{ $data[0] }->{'description'}, + description => $dslip_mod->{'description'}, dslip => $dslip, mtime => '', ) or error( loc( "Could not add module '%1'", $data[0] ) ); diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Source/Memory.pm b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Source/Memory.pm index d589bbd1d8..2929f43dfe 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Source/Memory.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Source/Memory.pm @@ -122,28 +122,31 @@ sub _add_author_object { return $obj; } -sub _add_module_object { - my $self = shift; - my %hash = @_; - - my $class; +{ my $tmpl = { - class => { default => 'CPANPLUS::Module', store => \$class }, - map { $_ => { required => 1 } } - qw[ module version path comment author package description dslip mtime ] + class => { default => 'CPANPLUS::Module' }, + map { $_ => { required => 1 } } qw[ + module version path comment author package description dslip mtime + ], }; - my $href = do { - local $Params::Check::NO_DUPLICATES = 1; - check( $tmpl, \%hash ) or return; - }; + sub _add_module_object { + my $self = shift; + my %hash = @_; - my $obj = $class->new( %$href, _id => $self->_id ); + my $href = do { + local $Params::Check::SANITY_CHECK_TEMPLATE = 0; + check( $tmpl, \%hash ) or return; + }; + my $class = delete $href->{class}; - ### Every module get's stored as a module object ### - $self->module_tree->{ $href->{module} } = $obj or return; + my $obj = $class->new( %$href, _id => $self->_id ); - return $obj; + ### Every module get's stored as a module object ### + $self->module_tree->{ $href->{module} } = $obj or return; + + return $obj; + } } { my %map = ( diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Utils.pm b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Utils.pm index e9651ed45f..7e6a362311 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Internals/Utils.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Internals/Utils.pm @@ -392,6 +392,15 @@ Returns the user's homedir, or C<cwd> if it could not be found =cut sub _home_dir { + + if ( can_load( modules => { 'File::HomeDir' => 0.0 } ) ) { + if ( defined $ENV{APPDATA} && length $ENV{APPDATA} && !ON_WIN32 ) { + msg("'APPDATA' env var is set and not on MSWin32, " . + "please use 'PERL5_CPANPLUS_HOME' instead to change .cpanplus location", 1 ); + } + return File::HomeDir->my_home if -d File::HomeDir->my_home; + } + my @os_home_envs = qw( APPDATA HOME USERPROFILE WINDIR SYS$LOGIN ); for my $env ( @os_home_envs ) { diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Module.pm b/cpan/CPANPLUS/lib/CPANPLUS/Module.pm index 4d470c6a71..14efe3a5b8 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Module.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Module.pm @@ -1697,7 +1697,10 @@ sub _extutils_installed { Adds the current modules path to C<@INC> and C<$PERL5LIB>. This allows you to add the module from its build dir to your path. -You can reset C<@INC> and C<$PERL5LIB> to its original state when you +It also adds the current modules C<bin> and/or C<script> paths to +the PATH. + +You can reset C<$PATH>, C<@INC> and C<$PERL5LIB> to their original state when you started the program, by calling: $self->parent->flush('lib'); @@ -1718,6 +1721,13 @@ sub add_to_includepath { ] ) or return; + $cb->_add_to_path( + directories => [ + File::Spec->catdir(BLIB->($dir), SCRIPT), + File::Spec->catdir(BLIB->($dir), BIN), + ] + ) or return; + } else { error(loc( "No extract dir registered for '%1' -- can not add ". "add builddir to search path!", $self->module )); diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Module/Checksums.pm b/cpan/CPANPLUS/lib/CPANPLUS/Module/Checksums.pm index 8dde1cc055..faeb4f08aa 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Module/Checksums.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Module/Checksums.pm @@ -142,7 +142,14 @@ sub _get_checksums_file { my $clone = $self->clone; $clone->package( CHECKSUMS ); - my $file = $clone->fetch( ttl => 3600, %hash ) or return; + # If the user specified a fetchdir, then every CHECKSUMS file will always + # be stored there, not in an author-specific subdir. Thus, in this case, + # we need to always re-fetch the CHECKSUMS file and hence need to set the + # TTL to something small. + my $have_fetchdir = + $self->parent->configure_object->get_conf('fetchdir') ne ''; + my $ttl = $have_fetchdir ? 0.001 : 3600; + my $file = $clone->fetch( ttl => $ttl, %hash ) or return; return $file; } diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Selfupdate.pm b/cpan/CPANPLUS/lib/CPANPLUS/Selfupdate.pm index 26d3dc81f5..b54a892389 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Selfupdate.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Selfupdate.pm @@ -47,13 +47,13 @@ CPANPLUS::Selfupdate - self-updating for CPANPLUS 'Locale::Maketext::Simple' => '0.01', 'Log::Message' => '0.01', 'Module::Load' => '0.10', - 'Module::Load::Conditional' => '0.38', # returns dir for loaded + 'Module::Load::Conditional' => '0.50', # returns dir for loaded # modules 'version' => '0.77', # needed for M::L::C # addresses #24630 and # #24675 # Address ~0 overflow issue - 'Params::Check' => '0.22', + 'Params::Check' => '0.36', 'Package::Constants' => '0.01', 'Term::UI' => '0.18', # option parsing 'Test::Harness' => '2.62', # due to bug #19505 @@ -62,7 +62,7 @@ CPANPLUS::Selfupdate - self-updating for CPANPLUS 'Archive::Extract' => '0.16', # ./Dir bug fix 'Archive::Tar' => '1.23', 'IO::Zlib' => '1.04', # needed for Archive::Tar - 'Object::Accessor' => '0.34', # mk_aliases support + 'Object::Accessor' => '0.44', # mk_aliases support 'Module::CoreList' => '2.22', # deprecated core modules 'Module::Pluggable' => '2.4', 'Module::Loaded' => '0.01', diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Shell/Classic.pm b/cpan/CPANPLUS/lib/CPANPLUS/Shell/Classic.pm index 089d3de16b..a65eb49567 100644 --- a/cpan/CPANPLUS/lib/CPANPLUS/Shell/Classic.pm +++ b/cpan/CPANPLUS/lib/CPANPLUS/Shell/Classic.pm @@ -97,6 +97,20 @@ sub new { code => \&__ask_about_test_report, ); + if (my $histfile = $self->configure_object->get_conf( 'histfile' )) { + my $term = $self->term; + if ($term->can('AddHistory')) { + if (open my $fh, '<', $histfile) { + local $/ = "\n"; + while (my $line = <$fh>) { + chomp($line); + $term->AddHistory($line); + } + close($fh); + } + } + } + return $self; } @@ -194,6 +208,24 @@ sub _dispatch_on_input { ### displays quit message sub _quit { + my $self = shift; + my $term = $self->term; + + if ($term->can('GetHistory')) { + my @history = $term->GetHistory; + + my $histfile = $self->configure_object->get_conf('histfile'); + + if (open my $fh, '>', $histfile) { + foreach my $line (@history) { + print {$fh} "$line\n"; + } + close($fh); + } + else { + warn "Cannot open history file '$histfile' - $!"; + } + } ### well, that's what CPAN.pm says... print "Lockfile removed\n"; diff --git a/cpan/CPANPLUS/lib/CPANPLUS/Shell/Default.pm b/cpan/CPANPLUS/lib/CPANPLUS/Shell/Default.pm index 56dce061ae..abed7cbb1f 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.9121"; + $VERSION = "0.9130"; } load CPANPLUS::Shell; @@ -213,6 +213,20 @@ sub new { ### load all the plugins $self->_plugins_init; + if (my $histfile = $cb->configure_object->get_conf( 'histfile' )) { + my $term = $self->term; + if ($term->can('AddHistory')) { + if (open my $fh, '<', $histfile) { + local $/ = "\n"; + while (my $line = <$fh>) { + chomp($line); + $term->AddHistory($line); + } + close($fh); + } + } + } + return $self; } @@ -511,10 +525,27 @@ sub __display_results { sub _quit { my $self = shift; + my $term = $self->term; $self->dispatch_on_input( input => $rc->{'logout'} ) if defined $rc->{'logout'}; + if ($term->can('GetHistory')) { + my @history = $term->GetHistory; + + my $histfile = $self->backend->configure_object->get_conf('histfile'); + + if (open my $fh, '>', $histfile) { + foreach my $line (@history) { + print {$fh} "$line\n"; + } + close($fh); + } + else { + warn "Cannot open history file '$histfile' - $!"; + } + } + $self->__print( loc("Exiting CPANPLUS shell"), "\n" ); return 1; diff --git a/cpan/CPANPLUS/t/inc/conf.pl b/cpan/CPANPLUS/t/inc/conf.pl index 66087077e0..4cce0efcb4 100644 --- a/cpan/CPANPLUS/t/inc/conf.pl +++ b/cpan/CPANPLUS/t/inc/conf.pl @@ -131,6 +131,8 @@ sub gimme_conf { ### don't load any other configs than the heuristic one ### during tests. They might hold broken/incorrect data ### for our test suite. Bug [perl #43629] showed this. + local $ENV{PERL5_CPANPLUS_HOME} = ''; + my $conf = CPANPLUS::Configure->new( load_configs => 0 ); my $dummy_cpan = dummy_cpan_dir(); diff --git a/lib/.gitignore b/lib/.gitignore index 97e99c99b2..31f5c9839b 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -59,6 +59,7 @@ /CPANPLUS/Backend.pm /CPANPLUS/Backend/RV.pm /CPANPLUS/Config.pm +/CPANPLUS/Config/HomeEnv.pm /CPANPLUS/Configure.pm /CPANPLUS/Configure/Setup.pm /CPANPLUS/Dist.pm |