Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 0f5b639

Browse files
committed
CPAN-2.20_01
Updated andk/cpanpm#109
1 parent 1160402 commit 0f5b639

File tree

9 files changed

+122
-44
lines changed

9 files changed

+122
-44
lines changed

Porting/Maintainers.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ package Maintainers;
341341
},
342342

343343
'CPAN' => {
344-
'DISTRIBUTION' => 'ANDK/CPAN-2.18-TRIAL.tar.gz',
344+
'DISTRIBUTION' => 'ANDK/CPAN-2.20-TRIAL.tar.gz',
345345
'FILES' => q[cpan/CPAN],
346346
'EXCLUDED' => [
347347
qr{^distroprefs/},
@@ -379,6 +379,7 @@ package Maintainers;
379379
# https://github.com/andk/cpanpm/pull/109
380380
'CUSTOMIZED' => [
381381
qw( lib/CPAN.pm lib/CPAN/FirstTime.pm lib/CPAN/Distribution.pm
382+
lib/CPAN/Mirrors.pm
382383
lib/CPAN/Version.pm lib/App/Cpan.pm ),
383384
],
384385
},

cpan/CPAN/lib/CPAN.pm

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# vim: ts=4 sts=4 sw=4:
33
use strict;
44
package CPAN;
5-
$CPAN::VERSION = '2.18_01'; # with cperl support
5+
$CPAN::VERSION = '2.20_01'; # with cperl support
66
$CPAN::VERSION =~ s/_//;
77

88
# we need to run chdir all over and we would get at wrong libraries
@@ -578,7 +578,10 @@ sub _yaml_loadfile {
578578
}
579579
} elsif ($code = UNIVERSAL::can($yaml_module, "Load")) {
580580
local *FH;
581-
open FH, $local_file or die "Could not open '$local_file': $!";
581+
unless (open FH, $local_file) {
582+
$CPAN::Frontend->mywarn("Could not open '$local_file': $!");
583+
return +[];
584+
}
582585
local $/;
583586
my $ystream = <FH>;
584587
eval { @yaml = $code->($ystream); };
@@ -877,11 +880,12 @@ this variable in either a CPAN/MyConfig.pm or a CPAN/Config.pm in your
877880
}
878881
my $sleep = 1;
879882
while (!CPAN::_flock($fh, LOCK_EX|LOCK_NB)) {
880-
if ($sleep>10) {
881-
$CPAN::Frontend->mydie("Giving up\n");
883+
my $err = $! || "unknown error";
884+
if ($sleep>3) {
885+
$CPAN::Frontend->mydie("Could not lock '$lockfile' with flock: $err; giving up\n");
882886
}
883-
$CPAN::Frontend->mysleep($sleep++);
884-
$CPAN::Frontend->mywarn("Could not lock lockfile with flock: $!; retrying\n");
887+
$CPAN::Frontend->mysleep($sleep+=0.1);
888+
$CPAN::Frontend->mywarn("Could not lock '$lockfile' with flock: $err; retrying\n");
885889
}
886890

887891
seek $fh, 0, 0;
@@ -1059,6 +1063,11 @@ sub has_usable {
10591063

10601064
'CPAN::Meta::Requirements' => [
10611065
sub {
1066+
if (defined $CPAN::Meta::Requirements::VERSION
1067+
&& CPAN::Version->vlt($CPAN::Meta::Requirements::VERSION, "2.120920")
1068+
) {
1069+
delete $INC{"CPAN/Meta/Requirements.pm"};
1070+
}
10621071
require CPAN::Meta::Requirements;
10631072
unless (CPAN::Version->vge(CPAN::Meta::Requirements->VERSION, 2.120920)) {
10641073
for ("Will not use CPAN::Meta::Requirements, need version 2.120920\n") {

cpan/CPAN/lib/CPAN/Distribution.pm

Lines changed: 85 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use CPAN::InfoObj;
88
use File::Path ();
99
@CPAN::Distribution::ISA = qw(CPAN::InfoObj);
1010
use vars qw($VERSION);
11-
$VERSION = "2.18_01"; # with cperl support
11+
$VERSION = "2.19_01"; # with cperl support
1212

1313
# no prepare, because prepare is not a command on the shell command line
1414
# TODO: clear instance cache on reload
@@ -660,8 +660,11 @@ sub satisfy_requires {
660660
my ($self) = @_;
661661
$self->debug("Entering satisfy_requires") if $CPAN::DEBUG;
662662
if (my @prereq = $self->unsat_prereq("later")) {
663-
$self->debug("unsatisfied[@prereq]") if $CPAN::DEBUG;
664-
$self->debug(@prereq) if $CPAN::DEBUG && @prereq;
663+
if ($CPAN::DEBUG){
664+
require Data::Dumper;
665+
my $prereq = Data::Dumper->new(\@prereq)->Terse(1)->Indent(0)->Dump;
666+
$self->debug("unsatisfied[$prereq]");
667+
}
665668
if ($prereq[0][0] eq "perl") {
666669
my $need = "requires perl '$prereq[0][1]'";
667670
my $id = $self->pretty_id;
@@ -1656,7 +1659,7 @@ sub force {
16561659
my $methodmatch = 0;
16571660
my $ldebug = 0;
16581661
PHASE: for my $phase (qw(unknown get make test install)) { # order matters
1659-
$methodmatch = 1 if $fforce || $phase eq $method;
1662+
$methodmatch = 1 if $fforce || ($method && $phase eq $method);
16601663
next unless $methodmatch;
16611664
ATTRIBUTE: for my $att (@{$phase_map{$phase}}) {
16621665
if ($phase eq "get") {
@@ -1718,18 +1721,21 @@ sub isa_perl {
17181721
my($self) = @_;
17191722
my $file = File::Basename::basename($self->id);
17201723
if ($file =~ m{ ^ perl
1721-
-?
1722-
(5)
1723-
([._-])
17241724
(
1725-
\d{3}(_[0-4][0-9])?
1725+
-(5\.\d+\.\d+)
17261726
|
1727-
\d+\.\d+
1727+
(5)[._-](00[0-5](?:_[0-4][0-9])?)
17281728
)
17291729
\.tar[._-](?:gz|bz2)
17301730
(?!\n)\Z
17311731
}xs) {
1732-
return "$1.$3";
1732+
my $perl_version;
1733+
if ($2) {
1734+
$perl_version = $2;
1735+
} else {
1736+
$perl_version = "$3.$4";
1737+
}
1738+
return $perl_version;
17331739
} elsif ($self->cpan_comment
17341740
&&
17351741
$self->cpan_comment =~ /isa_perl\(.+?\)/) {
@@ -1983,7 +1989,12 @@ sub prepare {
19831989
}
19841990
}
19851991
elsif ( $self->_should_report('pl') ) {
1986-
($output, $ret) = CPAN::Reporter::record_command($system);
1992+
($output, $ret) = eval { CPAN::Reporter::record_command($system) };
1993+
if (! defined $output or $@) {
1994+
my $err = $@ || "Unknown error";
1995+
$CPAN::Frontend->mywarn("Error while running PL phase: $err");
1996+
return $self->goodbye("$system -- NOT OK");
1997+
}
19871998
CPAN::Reporter::grade_PL( $self, $system, $output, $ret );
19881999
}
19892000
else {
@@ -2085,7 +2096,7 @@ is part of the perl-%s distribution. To install that, you need to run
20852096
$self->called_for,
20862097
$self->isa_perl,
20872098
$self->called_for,
2088-
$self->id,
2099+
$self->pretty_id,
20892100
));
20902101
$self->{make} = CPAN::Distrostatus->new("NO isa perl");
20912102
$CPAN::Frontend->mysleep(1);
@@ -2611,9 +2622,19 @@ sub _make_install_make_command {
26112622
sub is_locally_optional {
26122623
my($self, $prereq_pm, $prereq) = @_;
26132624
$prereq_pm ||= $self->{prereq_pm};
2614-
exists $prereq_pm->{opt_requires}{$prereq}
2615-
||
2616-
exists $prereq_pm->{opt_build_requires}{$prereq};
2625+
my($nmo,$opt);
2626+
for my $rt (qw(requires build_requires)) {
2627+
if (exists $prereq_pm->{$rt}{$prereq}) {
2628+
# rt 121914
2629+
$nmo ||= $CPAN::META->instance("CPAN::Module",$prereq);
2630+
my $av = $nmo->available_version;
2631+
return 0 if !$av || CPAN::Version->vlt($av,$prereq_pm->{$rt}{$prereq});
2632+
}
2633+
if (exists $prereq_pm->{"opt_$rt"}{$prereq}) {
2634+
$opt = 1;
2635+
}
2636+
}
2637+
return $opt||0;
26172638
}
26182639

26192640
#-> sub CPAN::Distribution::follow_prereqs ;
@@ -2625,7 +2646,12 @@ sub follow_prereqs {
26252646
my(@good_prereq_tuples);
26262647
for my $p (@prereq_tuples) {
26272648
# e.g. $p = ['Devel::PartialDump', 'r', 1]
2628-
2649+
# skip builtins without .pm
2650+
if ($Config::Config{usecperl}
2651+
and $p->[0] =~ /^(DynaLoader|XSLoader|strict|coretypes)$/) {
2652+
CPAN->debug("$p->[0] builtin") if $CPAN::DEBUG;
2653+
next;
2654+
}
26292655
# promote if possible
26302656
if ($p->[1] =~ /^(r|c)$/) {
26312657
push @good_prereq_tuples, $p;
@@ -2764,8 +2790,29 @@ sub _feature_depends {
27642790
sub prereqs_for_slot {
27652791
my($self,$slot) = @_;
27662792
my($prereq_pm);
2767-
$CPAN::META->has_usable("CPAN::Meta::Requirements")
2768-
or die "CPAN::Meta::Requirements not available";
2793+
unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) {
2794+
my $whynot = "not available";
2795+
if (defined $CPAN::Meta::Requirements::VERSION) {
2796+
$whynot = "version $CPAN::Meta::Requirements::VERSION not sufficient";
2797+
}
2798+
$CPAN::Frontend->mywarn("CPAN::Meta::Requirements $whynot\n");
2799+
my $before = "";
2800+
if ($self->{CALLED_FOR}){
2801+
if ($self->{CALLED_FOR} =~
2802+
/^(
2803+
CPAN::Meta::Requirements
2804+
|version
2805+
|parent
2806+
|ExtUtils::MakeMaker
2807+
|Test::Harness
2808+
)$/x) {
2809+
$CPAN::Frontend->mywarn("Setting requirements to nil as a workaround\n");
2810+
return;
2811+
}
2812+
$before = " before $self->{CALLED_FOR}";
2813+
}
2814+
$CPAN::Frontend->mydie("Please install CPAN::Meta::Requirements manually$before");
2815+
}
27692816
my $merged = CPAN::Meta::Requirements->new;
27702817
my $prefs_depends = $self->prefs->{depends}||{};
27712818
my $feature_depends = $self->_feature_depends();
@@ -2828,15 +2875,16 @@ sub unsat_prereq {
28282875
my($self,$slot) = @_;
28292876
my($merged_hash,$prereq_pm) = $self->prereqs_for_slot($slot);
28302877
my(@need);
2831-
$CPAN::META->has_usable("CPAN::Meta::Requirements")
2832-
or die "CPAN::Meta::Requirements not available";
2878+
unless ($CPAN::META->has_usable("CPAN::Meta::Requirements")) {
2879+
$CPAN::Frontend->mywarn("CPAN::Meta::Requirements not available, please install as soon as possible, trying to continue with severly limited capabilities\n");
2880+
return;
2881+
}
28332882
my $merged = CPAN::Meta::Requirements->from_string_hash($merged_hash);
28342883
my @merged = sort $merged->required_modules;
28352884
CPAN->debug("all merged_prereqs[@merged]") if $CPAN::DEBUG;
28362885
NEED: for my $need_module ( @merged ) {
28372886
# skip builtins without .pm
2838-
if ($Config::Config{usecperl}
2839-
and $need_module =~ /^(DynaLoader|XSLoader|strict|coretypes)$/) {
2887+
if ($^V =~ /c$/ and $need_module =~ /^(DynaLoader|XSLoader|strict|coretypes)$/) {
28402888
CPAN->debug("$need_module builtin") if $CPAN::DEBUG;
28412889
next NEED;
28422890
}
@@ -3056,6 +3104,10 @@ sub unsat_prereq {
30563104
}
30573105
# here need to flag as optional for recommends/suggests
30583106
# -- xdg, 2012-04-01
3107+
$self->debug(sprintf "%s manadory?[%s]",
3108+
$self->pretty_id,
3109+
$self->{mandatory})
3110+
if $CPAN::DEBUG;
30593111
my $optional = !$self->{mandatory}
30603112
|| $self->is_locally_optional($prereq_pm, $need_module);
30613113
push @need, [$need_module,$needed_as,$optional];
@@ -3978,7 +4030,15 @@ sub install {
39784030
local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default};
39794031
local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default};
39804032

3981-
my($pipe) = FileHandle->new("$system $stderr |") || Carp::croak("Can't execute $system: $!");
4033+
my($pipe) = FileHandle->new("$system $stderr |");
4034+
unless ($pipe) {
4035+
$CPAN::Frontend->mywarn("Can't execute $system: $!");
4036+
$self->introduce_myself;
4037+
$self->{install} = CPAN::Distrostatus->new("NO");
4038+
$CPAN::Frontend->mywarn(" $system -- NOT OK\n");
4039+
delete $self->{force_update};
4040+
return;
4041+
}
39824042
my($makeout) = "";
39834043
while (<$pipe>) {
39844044
print $_; # intentionally NOT use Frontend->myprint because it
@@ -3993,7 +4053,8 @@ sub install {
39934053
$CPAN::Frontend->myprint(" $system -- OK\n");
39944054
$CPAN::META->is_installed($self->{build_dir});
39954055
$self->{install} = CPAN::Distrostatus->new("YES");
3996-
if ($CPAN::Config->{'cleanup_after_install'}) {
4056+
if ($CPAN::Config->{'cleanup_after_install'}
4057+
&& ! $self->is_dot_dist) {
39974058
my $parent = File::Spec->catdir( $self->{build_dir}, File::Spec->updir );
39984059
chdir $parent or $CPAN::Frontend->mydie("Couldn't chdir to $parent: $!\n");
39994060
File::Path::rmtree($self->{build_dir});

cpan/CPAN/lib/CPAN/FirstTime.pm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use File::Spec ();
1111
use CPAN::Mirrors ();
1212
use Config ();
1313
use vars qw($VERSION $auto_config);
14-
$VERSION = "5.5310_01";
14+
$VERSION = "5.5311_01";
1515

1616
=head1 NAME
1717
@@ -440,7 +440,7 @@ Randomize parameter
440440
generally be installed except in resource constrained environments. When this
441441
policy is true, recommended modules will be included with required modules.
442442
443-
Included recommended modules?
443+
Include recommended modules?
444444
445445
=item scan_cache
446446
@@ -490,7 +490,7 @@ Show all individual modules that have a $VERSION of zero?
490490
dependencies provide enhanced operation. When this policy is true, suggested
491491
modules will be included with required modules.
492492
493-
Included suggested modules?
493+
Include suggested modules?
494494
495495
=item tar_verbosity
496496
@@ -2139,6 +2139,4 @@ sub prompt_no_strip ($;$) {
21392139
return _real_prompt(@_);
21402140
}
21412141

2142-
2143-
21442142
1;

cpan/CPAN/lib/CPAN/Mirrors.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CPAN::Mirrors - Get CPAN mirror information and select a fast one
3434
package CPAN::Mirrors;
3535
use strict;
3636
use vars qw($VERSION $urllist $silent);
37-
$VERSION = "2.12";
37+
$VERSION = "2.12_01";
3838

3939
use Carp;
4040
use FileHandle;
@@ -390,7 +390,7 @@ sub find_best_continents {
390390
RANDOM: while ( @mirrors && @tests < $n && $tries++ < 15 ) {
391391
my $m = splice( @mirrors, int(rand(@mirrors)), 1 );
392392
if( $self->_try_a_ping( $args{seen}, $m, $args{ping_cache_limit} ) ) {
393-
$self->get_mirrors_timings( [ $m ], @args{qw(seen callback)} );
393+
$self->get_mirrors_timings( [ $m ], $args{seen}, $args{callback} );
394394
next RANDOM unless defined $args{seen}{$m->hostname}->rtt;
395395
}
396396
printf "\t%s -> %0.2f ms\n",

cpan/CPAN/lib/CPAN/Shell.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ use vars qw(
4747
"CPAN/Tarzip.pm",
4848
"CPAN/Version.pm",
4949
);
50-
$VERSION = "5.5006";
50+
$VERSION = "5.5007";
5151
# record the initial timestamp for reload.
5252
$reload = { map {$INC{$_} ? ($_,(stat $INC{$_})[9]) : ()} @relo };
5353
@CPAN::Shell::ISA = qw(CPAN::Debug);
@@ -1023,7 +1023,7 @@ CPAN_VERSION: %s %s
10231023
$need{$module->id}++;
10241024
}
10251025
unless (%need) {
1026-
if ($what eq "u") {
1026+
if (!@expand || $what eq "u") {
10271027
$CPAN::Frontend->myprint("No modules found for @args\n");
10281028
} elsif ($what eq "r") {
10291029
$CPAN::Frontend->myprint("All modules are up to date for @args\n");

dist/Module-CoreList/lib/Module/CoreList.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17167,6 +17167,12 @@ for my $version ( sort { version_sort($a, $b) } keys %released ) {
1716717167
'B::C' => '1.55_08',
1716817168
'B::CC' => '1.16_02',
1716917169
'ByteLoader' => '1.12',
17170+
'CPAN' => '2.20_01',
17171+
'CPAN::Bundle' => '5.5002',
17172+
'CPAN::Distribution' => '2.19_01',
17173+
'CPAN::FirstTime' => '5.5311_01',
17174+
'CPAN::Mirrors' => '2.12_01',
17175+
'CPAN::Shell' => '5.5007',
1717017176
'Cpanel::JSON::XS' => '4.06',
1717117177
'Compress::Raw::Bzip2' => '2.081',
1717217178
'Compress::Raw::Zlib' => '2.081',

pod/perlcdelta.pod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,9 @@ use vars => our
11841184

11851185
Each coretype is now a class.
11861186

1187-
=item L<CPAN> 2.20
1187+
=item L<CPAN> 2.20_01
1188+
1189+
See L<https://github.com/andk/cpanpm/pull/109>
11881190

11891191
=item L<Cpanel::JSON::XS> 4.06
11901192

t/porting/customized.dat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
Archive::Tar cpan/Archive-Tar/t/90_symlink.t 66a29edeff869c6569051aaecfc59b6624477be9
44
B::C cpan/B-C/t/test10 0b3ab672868ee49e8539649aad1ad8c940c4c420
55
CPAN cpan/CPAN/lib/App/Cpan.pm fcfc8800fa3dbff061da3688ad6a6fdd3716fbc8
6-
CPAN cpan/CPAN/lib/CPAN.pm 0eb7416798046db5d8f923de1861280698e96634
7-
CPAN cpan/CPAN/lib/CPAN/Distribution.pm 504ffb6195ec4f60e3146b83f4ebb2cd7155d1f4
8-
CPAN cpan/CPAN/lib/CPAN/FirstTime.pm f65d8af479f6737abca6aace1dacdfbcfdc0fadc
6+
CPAN cpan/CPAN/lib/CPAN.pm 2d0604a53a0683e25a9af033e4325e6889cd8ae5
7+
CPAN cpan/CPAN/lib/CPAN/Distribution.pm 6bba9acd376ca75910f16c9336d538f01e9fbad1
8+
CPAN cpan/CPAN/lib/CPAN/FirstTime.pm 8ebb8653b0e5a9675a7b629daecbda935f2507b2
9+
CPAN cpan/CPAN/lib/CPAN/Mirrors.pm 189e1eca88916725d1e1ee59f064308bd56b7169
910
CPAN cpan/CPAN/lib/CPAN/Version.pm 8f5144fc8c46a1eb9c1b87e5050fc2c2b3506ea4
1011
CPAN::Meta dist/CPAN-Meta/lib/CPAN/Meta.pm b0f88791eb04e1d0071dbd89f2773fd2a1a14df1
1112
CPAN::Meta dist/CPAN-Meta/lib/CPAN/Meta/History/Meta_1_4.pod 3a1ae20933b955b5f1e538ea35b502517a3ae391

0 commit comments

Comments
 (0)