In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/254707bab30ecd998e4212fd4873ff2f5879fd0d?hp=4587a8b8029eb8b4f87d595d56fba3c439e72620>
- Log ----------------------------------------------------------------- commit 254707bab30ecd998e4212fd4873ff2f5879fd0d Author: Andreas Koenig <[email protected]> Date: Tue Jan 17 09:27:49 2017 +0100 Updates CPAN.pm to ANDK/CPAN-2.16-TRIAL2.tar.gz ----------------------------------------------------------------------- Summary of changes: Porting/Maintainers.pl | 8 +--- cpan/CPAN/lib/App/Cpan.pm | 21 ++++++---- cpan/CPAN/lib/CPAN.pm | 15 ++++++- cpan/CPAN/lib/CPAN/Bundle.pm | 9 +++- cpan/CPAN/lib/CPAN/Distribution.pm | 49 ++++++++++++++++++---- .../CPAN/lib/CPAN/Exception/RecursiveDependency.pm | 40 +++++++++++++++--- cpan/CPAN/lib/CPAN/FTP.pm | 4 +- cpan/CPAN/lib/CPAN/FirstTime.pm | 11 ++++- cpan/CPAN/lib/CPAN/HandleConfig.pm | 5 ++- cpan/CPAN/lib/CPAN/Module.pm | 9 +++- 10 files changed, 132 insertions(+), 39 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index b6fed8b15a..5e94e19b63 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -251,7 +251,7 @@ use File::Glob qw(:case); }, 'CPAN' => { - 'DISTRIBUTION' => 'ANDK/CPAN-2.14.tar.gz', + 'DISTRIBUTION' => 'ANDK/CPAN-2.16-TRIAL2.tar.gz', 'FILES' => q[cpan/CPAN], 'EXCLUDED' => [ qr{^distroprefs/}, @@ -286,12 +286,6 @@ use File::Glob qw(:case); t/yaml_code.yml ), ], - 'CUSTOMIZED' => [ - # CVE-2016-1238 - qw( - lib/App/Cpan.pm lib/CPAN.pm scripts/cpan - ) - ], }, # Note: When updating CPAN-Meta the META.* files will need to be regenerated diff --git a/cpan/CPAN/lib/App/Cpan.pm b/cpan/CPAN/lib/App/Cpan.pm index 4856018c9c..3ddcbe8ac5 100644 --- a/cpan/CPAN/lib/App/Cpan.pm +++ b/cpan/CPAN/lib/App/Cpan.pm @@ -6,7 +6,7 @@ use vars qw($VERSION); use if $] < 5.008 => 'IO::Scalar'; -$VERSION = '1.64_01'; +$VERSION = '1.66'; =head1 NAME @@ -552,12 +552,12 @@ sub DESTROY { 1 } # load a module without searching the default entry for the current # directory sub _safe_load_module { - my $name = shift; + my $name = shift; - local @INC = @INC; - pop @INC if $INC[-1] eq '.'; + local @INC = @INC; + pop @INC if $INC[-1] eq '.'; - eval "require $name; 1"; + eval "require $name; 1"; } sub _init_logger @@ -1033,7 +1033,7 @@ sub _load_local_lib # -I my $rc = _safe_load_module("local::lib"); unless( $rc ) { - $logger->die( "Could not load local::lib" ); + $logger->logdie( "Could not load local::lib" ); } local::lib->import; @@ -1045,7 +1045,7 @@ sub _use_these_mirrors # -M { $logger->debug( "Setting per session mirrors" ); unless( $_[0] ) { - $logger->die( "The -M switch requires a comma-separated list of mirrors" ); + $logger->logdie( "The -M switch requires a comma-separated list of mirrors" ); } $CPAN::Config->{urllist} = [ split /,/, $_[0] ]; @@ -1347,7 +1347,8 @@ sub _show_out_of_date foreach my $module ( @$modules ) { - next unless $module->inst_file; + next unless $module = _expand_module($module); + next unless $module->inst_file; next if $module->uptodate; printf "%-40s %.4f %.4f\n", $module->id, @@ -1491,7 +1492,9 @@ sub _expand_module { my( $module ) = @_; - my $expanded = CPAN::Shell->expand( "Module", $module ); + my $expanded = CPAN::Shell->expandany( $module ); + return $expanded if $expanded; + $expanded = CPAN::Shell->expand( "Module", $module ); unless( defined $expanded ) { $logger->error( "Could not expand [$module]. Check the module name." ); my $threshold = ( diff --git a/cpan/CPAN/lib/CPAN.pm b/cpan/CPAN/lib/CPAN.pm index 49e335249c..1fba5c155f 100644 --- a/cpan/CPAN/lib/CPAN.pm +++ b/cpan/CPAN/lib/CPAN.pm @@ -2,7 +2,7 @@ # vim: ts=4 sts=4 sw=4: use strict; package CPAN; -$CPAN::VERSION = '2.14_01'; +$CPAN::VERSION = '2.16'; $CPAN::VERSION =~ s/_//; # we need to run chdir all over and we would get at wrong libraries @@ -1064,6 +1064,16 @@ sub has_usable { }, ], 'Net::FTP' => [ + sub { + my $var = $CPAN::Config->{ftp_proxy} || $ENV{ftp_proxy}; + if ($var and $var =~ /^http:/i) { + # rt #110833 + for ("Net::FTP cannot handle http proxy") { + $CPAN::Frontend->mywarn($_); + die $_; + } + } + }, sub {require Net::FTP}, sub {require Net::Config}, ], @@ -2111,6 +2121,9 @@ currently defined: bzip2 path to external prg cache_metadata use serializer to cache metadata check_sigs if signatures should be verified + cleanup_after_install + remove build directory immediately after a + successful install colorize_debug Term::ANSIColor attributes for debugging output colorize_output boolean if Term::ANSIColor should colorize output colorize_print Term::ANSIColor attributes for normal output diff --git a/cpan/CPAN/lib/CPAN/Bundle.pm b/cpan/CPAN/lib/CPAN/Bundle.pm index 1525dde5e3..3f17b540dd 100644 --- a/cpan/CPAN/lib/CPAN/Bundle.pm +++ b/cpan/CPAN/lib/CPAN/Bundle.pm @@ -8,7 +8,7 @@ use CPAN::Module; use vars qw( $VERSION ); -$VERSION = "5.5001"; +$VERSION = "5.5002"; sub look { my $self = shift; @@ -39,7 +39,12 @@ sub color_cmd_tmps { && $color==1 && $self->{incommandcolor}==$color; if ($depth>=$CPAN::MAX_RECURSION) { - die(CPAN::Exception::RecursiveDependency->new($ancestors)); + my $e = CPAN::Exception::RecursiveDependency->new($ancestors); + if ($e->is_resolvable) { + return $self->{incommandcolor}=2; + } else { + die $e; + } } # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1; diff --git a/cpan/CPAN/lib/CPAN/Distribution.pm b/cpan/CPAN/lib/CPAN/Distribution.pm index 1ec84a7ce6..b5744fd873 100644 --- a/cpan/CPAN/lib/CPAN/Distribution.pm +++ b/cpan/CPAN/lib/CPAN/Distribution.pm @@ -8,7 +8,7 @@ use CPAN::InfoObj; use File::Path (); @CPAN::Distribution::ISA = qw(CPAN::InfoObj); use vars qw($VERSION); -$VERSION = "2.12"; +$VERSION = "2.16"; # no prepare, because prepare is not a command on the shell command line # TODO: clear instance cache on reload @@ -207,7 +207,12 @@ sub color_cmd_tmps { && $self->{incommandcolor}==$color; $CPAN::MAX_RECURSION||=0; # silence 'once' warnings if ($depth>=$CPAN::MAX_RECURSION) { - die(CPAN::Exception::RecursiveDependency->new($ancestors)); + my $e = CPAN::Exception::RecursiveDependency->new($ancestors); + if ($e->is_resolvable) { + return $self->{incommandcolor}=2; + } else { + die $e; + } } # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1; my $prereq_pm = $self->prereq_pm; @@ -569,7 +574,14 @@ See also http://rt.cpan.org/Ticket/Display.html?id=38932\n"); unless (File::Copy::move($from,$to)) { my $err = $!; $from = File::Spec->rel2abs($from); - $CPAN::Frontend->mydie("Couldn't move $from to $to: $err"); + $CPAN::Frontend->mydie( + "Couldn't move $from to $to: $err; #82295? ". + "CPAN::VERSION=$CPAN::VERSION; ". + "File::Copy::VERSION=$File::Copy::VERSION; ". + "$from " . (-e $from ? "exists; " : "does not exist; "). + "$to " . (-e $to ? "exists; " : "does not exist; "). + "cwd=" . CPAN::anycwd() . ";" + ); } } $self->{build_dir} = $packagedir; @@ -2826,9 +2838,23 @@ sub unsat_prereq { $CPAN::SQLite->search("CPAN::Module",$need_module); } $nmo = $CPAN::META->instance("CPAN::Module",$need_module); - next if $nmo->uptodate; $inst_file = $nmo->inst_file || ''; $available_file = $nmo->available_file || ''; + $available_version = $nmo->available_version; + if ($nmo->uptodate) { + my $accepts = eval { + $merged->accepts_module($need_module, $available_version); + }; + unless ($accepts) { + my $rq = $merged->requirements_for_module( $need_module ); + $CPAN::Frontend->mywarn( + "Warning: Version '$available_version' of ". + "'$need_module' is up to date but does not ". + "fulfill requirements ($rq). I will continue, ". + "but chances to succeed are low.\n"); + } + next NEED; + } # if they have not specified a version, we accept any installed one if ( $available_file @@ -2841,8 +2867,6 @@ sub unsat_prereq { next NEED; } } - - $available_version = $nmo->available_version; } # We only want to install prereqs if either they're not installed @@ -3950,6 +3974,15 @@ sub install { $CPAN::Frontend->myprint(" $system -- OK\n"); $CPAN::META->is_installed($self->{build_dir}); $self->{install} = CPAN::Distrostatus->new("YES"); + if ($CPAN::Config->{'cleanup_after_install'}) { + my $parent = File::Spec->catdir( $self->{build_dir}, File::Spec->updir ); + chdir $parent or $CPAN::Frontend->mydie("Couldn't chdir to $parent: $!\n"); + File::Path::rmtree($self->{build_dir}); + my $yml = "$self->{build_dir}.yml"; + if (-e $yml) { + unlink $yml or $CPAN::Frontend->mydie("Couldn't unlink $yml: $!\n"); + } + } } else { $self->{install} = CPAN::Distrostatus->new("NO"); $CPAN::Frontend->mywarn(" $system -- NOT OK\n"); @@ -3976,7 +4009,9 @@ sub install { } } delete $self->{force_update}; - $self->store_persistent_state; + unless ($CPAN::Config->{'cleanup_after_install'}) { + $self->store_persistent_state; + } $self->post_install(); diff --git a/cpan/CPAN/lib/CPAN/Exception/RecursiveDependency.pm b/cpan/CPAN/lib/CPAN/Exception/RecursiveDependency.pm index b928ad74e3..82e82346ef 100644 --- a/cpan/CPAN/lib/CPAN/Exception/RecursiveDependency.pm +++ b/cpan/CPAN/lib/CPAN/Exception/RecursiveDependency.pm @@ -7,7 +7,16 @@ use overload '""' => "as_string"; use vars qw( $VERSION ); -$VERSION = "5.5"; +$VERSION = "5.5001"; + +{ + package CPAN::Exception::RecursiveDependency::na; + use overload '""' => "as_string"; + sub new { bless {}, shift }; + sub as_string { "N/A" }; +} + +my $NA = CPAN::Exception::RecursiveDependency::na->new; # a module sees its distribution (no version) # a distribution sees its prereqs (which are module names) (usually with versions) @@ -25,12 +34,13 @@ sub new { } } my $in_loop = 0; - for my $i (0..$#deps) { + my %mark; + DWALK: for my $i (0..$#deps) { my $x = $deps[$i]{name}; $in_loop ||= $loop_starts_with && $x eq $loop_starts_with; my $xo = CPAN::Shell->expandany($x) or next; if ($xo->isa("CPAN::Module")) { - my $have = $xo->inst_version || "N/A"; + my $have = $xo->inst_version || $NA; my($want,$d,$want_type); if ($i>0 and $d = $deps[$i-1]{name}) { my $do = CPAN::Shell->expandany($d); @@ -54,13 +64,27 @@ sub new { $deps[$i]{want_type} = $want_type; $deps[$i]{want} = $want; $deps[$i]{display_as} = "$x (have: $have; $want_type$want)"; + if ((! ref $have || !$have->isa('CPAN::Exception::RecursiveDependency::na')) + && CPAN::Version->vge($have, $want)) { + # https://rt.cpan.org/Ticket/Display.html?id=115340 + undef $loop_starts_with; + last DWALK; + } } elsif ($xo->isa("CPAN::Distribution")) { - $deps[$i]{display_as} = $xo->pretty_id; + my $pretty = $deps[$i]{display_as} = $xo->pretty_id; + my $mark_as; if ($in_loop) { - $xo->{make} = CPAN::Distrostatus->new("NO cannot resolve circular dependency"); + $mark_as = CPAN::Distrostatus->new("NO cannot resolve circular dependency"); } else { - $xo->{make} = CPAN::Distrostatus->new("NO one dependency ($loop_starts_with) is a circular dependency"); + $mark_as = CPAN::Distrostatus->new("NO one dependency ($loop_starts_with) is a circular dependency"); } + $mark{$pretty} = { xo => $xo, mark_as => $mark_as }; + } + } + if ($loop_starts_with) { + while (my($k,$v) = each %mark) { + my $xo = $v->{xo}; + $xo->{make} = $v->{mark_as}; $xo->store_persistent_state; # otherwise I will not reach # all involved parties for # the next session @@ -69,6 +93,10 @@ sub new { bless { deps => \@deps, loop_starts_with => $loop_starts_with }, $class; } +sub is_resolvable { + ! defined shift->{loop_starts_with}; +} + sub as_string { my($self) = shift; my $deps = $self->{deps}; diff --git a/cpan/CPAN/lib/CPAN/FTP.pm b/cpan/CPAN/lib/CPAN/FTP.pm index 0c338c51f4..a43ea02e9e 100644 --- a/cpan/CPAN/lib/CPAN/FTP.pm +++ b/cpan/CPAN/lib/CPAN/FTP.pm @@ -14,7 +14,7 @@ use vars qw($connect_to_internet_ok $Ua $Thesite $ThesiteURL $Themethod); use vars qw( $VERSION ); -$VERSION = "5.5007"; +$VERSION = "5.5008"; #-> sub CPAN::FTP::ftp_statistics # if they want to rewrite, they need to pass in a filehandle @@ -665,7 +665,7 @@ sub hostdleasy { #called from hostdlxxx # Net::FTP can still succeed where LWP fails. So we do not # skip Net::FTP anymore when LWP is available. } - } elsif ($url =~ /^http:/ && $CPAN::META->has_usable('HTTP::Tiny')) { + } elsif ($url =~ /^http:/i && $CPAN::META->has_usable('HTTP::Tiny')) { require CPAN::HTTP::Client; my $chc = CPAN::HTTP::Client->new( proxy => $CPAN::Config->{http_proxy} || $ENV{http_proxy}, diff --git a/cpan/CPAN/lib/CPAN/FirstTime.pm b/cpan/CPAN/lib/CPAN/FirstTime.pm index fb6b7eb493..531c1152a8 100644 --- a/cpan/CPAN/lib/CPAN/FirstTime.pm +++ b/cpan/CPAN/lib/CPAN/FirstTime.pm @@ -10,7 +10,7 @@ use File::Path (); use File::Spec (); use CPAN::Mirrors (); use vars qw($VERSION $auto_config); -$VERSION = "5.5309"; +$VERSION = "5.5310"; =head1 NAME @@ -124,6 +124,14 @@ checks will be performed at all. Always try to check and verify signatures if a SIGNATURE file is in the package and Module::Signature is installed (yes/no)? +=item cleanup_after_install + +Users who install modules and do not intend to look back, can free +occupied disk space quickly by letting CPAN.pm cleanup each build +directory immediately after a successful install. + +Remove build directory after a successful install? (yes/no)? + =item colorize_output When you have Term::ANSIColor installed, you can turn on colorized @@ -881,6 +889,7 @@ sub init { my_dflt_prompt(index_expire => 1, $matcher); my_prompt_loop(scan_cache => 'atstart', $matcher, 'atstart|atexit|never'); + my_yn_prompt(cleanup_after_install => 0, $matcher); # #= cache_metadata diff --git a/cpan/CPAN/lib/CPAN/HandleConfig.pm b/cpan/CPAN/lib/CPAN/HandleConfig.pm index bd28948e32..c72439f92c 100644 --- a/cpan/CPAN/lib/CPAN/HandleConfig.pm +++ b/cpan/CPAN/lib/CPAN/HandleConfig.pm @@ -12,7 +12,7 @@ CPAN::HandleConfig - internal configuration handling for CPAN.pm =cut -$VERSION = "5.5007"; # see also CPAN::Config::VERSION at end of file +$VERSION = "5.5008"; # see also CPAN::Config::VERSION at end of file %can = ( commit => "Commit changes to disk", @@ -42,6 +42,7 @@ $VERSION = "5.5007"; # see also CPAN::Config::VERSION at end of file "bzip2", "cache_metadata", "check_sigs", + "cleanup_after_install", "colorize_debug", "colorize_output", "colorize_print", @@ -769,7 +770,7 @@ sub prefs_lookup { use strict; use vars qw($AUTOLOAD $VERSION); - $VERSION = "5.5007"; + $VERSION = "5.5008"; # formerly CPAN::HandleConfig was known as CPAN::Config sub AUTOLOAD { ## no critic diff --git a/cpan/CPAN/lib/CPAN/Module.pm b/cpan/CPAN/lib/CPAN/Module.pm index bf1226c0f0..62ca42caf0 100644 --- a/cpan/CPAN/lib/CPAN/Module.pm +++ b/cpan/CPAN/lib/CPAN/Module.pm @@ -7,7 +7,7 @@ use strict; use vars qw( $VERSION ); -$VERSION = "5.5002"; +$VERSION = "5.5003"; BEGIN { # alarm() is not implemented in perl 5.6.x and earlier under Windows @@ -104,7 +104,12 @@ sub color_cmd_tmps { # so we can break it } if ($depth>=$CPAN::MAX_RECURSION) { - die(CPAN::Exception::RecursiveDependency->new($ancestors)); + my $e = CPAN::Exception::RecursiveDependency->new($ancestors); + if ($e->is_resolvable) { + return $self->{incommandcolor}=2; + } else { + die $e; + } } # warn "color_cmd_tmps $depth $color " . $self->id; # sleep 1; -- Perl5 Master Repository
