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

Commit 1a5aade

Browse files
committed
CPAN-2.20_01
From 5.28.0c See L<andk/cpanpm#109>
1 parent dcebcb8 commit 1a5aade

File tree

11 files changed

+135
-51
lines changed

11 files changed

+135
-51
lines changed

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ package Maintainers;
334334
},
335335

336336
'CPAN' => {
337-
'DISTRIBUTION' => 'ANDK/CPAN-2.16.tar.gz',
337+
'DISTRIBUTION' => 'ANDK/CPAN-2.20-TRIAL.tar.gz',
338338
'FILES' => q[cpan/CPAN],
339339
'EXCLUDED' => [
340340
qr{^distroprefs/},

cpan/CPAN/lib/CPAN.pm

Lines changed: 15 additions & 8 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
@@ -14,8 +14,6 @@ BEGIN {
1414
$inc = File::Spec->rel2abs($inc) unless ref $inc;
1515
}
1616
}
17-
# make sure we can install any modules from CPAN without patching them
18-
$ENV{PERL_USE_UNSAFE_INC} = 1;
1917
$SIG{WINCH} = 'IGNORE' if exists $SIG{WINCH};
2018
}
2119
use CPAN::Author;
@@ -580,7 +578,10 @@ sub _yaml_loadfile {
580578
}
581579
} elsif ($code = UNIVERSAL::can($yaml_module, "Load")) {
582580
local *FH;
583-
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+
}
584585
local $/;
585586
my $ystream = <FH>;
586587
eval { @yaml = $code->($ystream); };
@@ -879,11 +880,12 @@ this variable in either a CPAN/MyConfig.pm or a CPAN/Config.pm in your
879880
}
880881
my $sleep = 1;
881882
while (!CPAN::_flock($fh, LOCK_EX|LOCK_NB)) {
882-
if ($sleep>10) {
883-
$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");
884886
}
885-
$CPAN::Frontend->mysleep($sleep++);
886-
$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");
887889
}
888890

889891
seek $fh, 0, 0;
@@ -1061,6 +1063,11 @@ sub has_usable {
10611063

10621064
'CPAN::Meta::Requirements' => [
10631065
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+
}
10641071
require CPAN::Meta::Requirements;
10651072
unless (CPAN::Version->vge(CPAN::Meta::Requirements->VERSION, 2.120920)) {
10661073
for ("Will not use CPAN::Meta::Requirements, need version 2.120920\n") {

cpan/CPAN/lib/CPAN/Bundle.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use CPAN::Module;
88
use vars qw(
99
$VERSION
1010
);
11-
$VERSION = "5.5002";
11+
$VERSION = "5.5003";
1212

1313
sub look {
1414
my $self = shift;
@@ -21,6 +21,11 @@ sub undelay {
2121
delete $self->{later};
2222
for my $c ( $self->contains ) {
2323
my $obj = CPAN::Shell->expandany($c) or next;
24+
if ($obj->id eq $self->id){
25+
my $id = $obj->id;
26+
$CPAN::Frontend->mywarn("$id seems to contain itself, skipping\n");
27+
next;
28+
}
2429
$obj->undelay;
2530
}
2631
}

cpan/CPAN/lib/CPAN/Distribution.pm

Lines changed: 84 additions & 22 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 ;
@@ -2627,7 +2648,7 @@ sub follow_prereqs {
26272648
# e.g. $p = ['Devel::PartialDump', 'r', 1]
26282649
# skip builtins without .pm
26292650
if ($Config::Config{usecperl}
2630-
and $p->[0] =~ /^(DynaLoader|XSLoader|strict|coretypes)$/) {
2651+
and $p->[0] =~ /^(DynaLoader|XSLoader|strict|coretypes)$/) {
26312652
CPAN->debug("$p->[0] builtin") if $CPAN::DEBUG;
26322653
next;
26332654
}
@@ -2769,8 +2790,29 @@ sub _feature_depends {
27692790
sub prereqs_for_slot {
27702791
my($self,$slot) = @_;
27712792
my($prereq_pm);
2772-
$CPAN::META->has_usable("CPAN::Meta::Requirements")
2773-
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+
}
27742816
my $merged = CPAN::Meta::Requirements->new;
27752817
my $prefs_depends = $self->prefs->{depends}||{};
27762818
my $feature_depends = $self->_feature_depends();
@@ -2833,12 +2875,19 @@ sub unsat_prereq {
28332875
my($self,$slot) = @_;
28342876
my($merged_hash,$prereq_pm) = $self->prereqs_for_slot($slot);
28352877
my(@need);
2836-
$CPAN::META->has_usable("CPAN::Meta::Requirements")
2837-
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+
}
28382882
my $merged = CPAN::Meta::Requirements->from_string_hash($merged_hash);
28392883
my @merged = sort $merged->required_modules;
28402884
CPAN->debug("all merged_prereqs[@merged]") if $CPAN::DEBUG;
28412885
NEED: for my $need_module ( @merged ) {
2886+
# skip builtins without .pm
2887+
if ($^V =~ /c$/ and $need_module =~ /^(DynaLoader|XSLoader|strict|coretypes)$/) {
2888+
CPAN->debug("$need_module builtin") if $CPAN::DEBUG;
2889+
next NEED;
2890+
}
28422891
my $need_version = $merged->requirements_for_module($need_module);
28432892
my($available_version,$inst_file,$available_file,$nmo);
28442893
if ($need_module eq "perl") {
@@ -3055,6 +3104,10 @@ sub unsat_prereq {
30553104
}
30563105
# here need to flag as optional for recommends/suggests
30573106
# -- xdg, 2012-04-01
3107+
$self->debug(sprintf "%s manadory?[%s]",
3108+
$self->pretty_id,
3109+
$self->{mandatory})
3110+
if $CPAN::DEBUG;
30583111
my $optional = !$self->{mandatory}
30593112
|| $self->is_locally_optional($prereq_pm, $need_module);
30603113
push @need, [$need_module,$needed_as,$optional];
@@ -3977,7 +4030,15 @@ sub install {
39774030
local $ENV{PERL_MM_USE_DEFAULT} = 1 if $CPAN::Config->{use_prompt_default};
39784031
local $ENV{NONINTERACTIVE_TESTING} = 1 if $CPAN::Config->{use_prompt_default};
39794032

3980-
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+
}
39814042
my($makeout) = "";
39824043
while (<$pipe>) {
39834044
print $_; # intentionally NOT use Frontend->myprint because it
@@ -3992,7 +4053,8 @@ sub install {
39924053
$CPAN::Frontend->myprint(" $system -- OK\n");
39934054
$CPAN::META->is_installed($self->{build_dir});
39944055
$self->{install} = CPAN::Distrostatus->new("YES");
3995-
if ($CPAN::Config->{'cleanup_after_install'}) {
4056+
if ($CPAN::Config->{'cleanup_after_install'}
4057+
&& ! $self->is_dot_dist) {
39964058
my $parent = File::Spec->catdir( $self->{build_dir}, File::Spec->updir );
39974059
chdir $parent or $CPAN::Frontend->mydie("Couldn't chdir to $parent: $!\n");
39984060
File::Path::rmtree($self->{build_dir});

cpan/CPAN/lib/CPAN/FirstTime.pm

Lines changed: 4 additions & 8 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
@@ -973,9 +973,7 @@ sub init {
973973

974974
my_yn_prompt(trust_test_report_history => 0, $matcher);
975975

976-
#
977-
#= YAML::Syck, YAML::XS, YAML, YAML::Tiny. CPAN::Meta::YAML not yet
978-
#
976+
#= YAML module
979977
if (!$matcher or "yaml_module" =~ /$matcher/) {
980978
_yaml_init($matcher);
981979
}
@@ -2141,6 +2139,4 @@ sub prompt_no_strip ($;$) {
21412139
return _real_prompt(@_);
21422140
}
21432141

2144-
2145-
21462142
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");

cpan/CPAN/lib/CPAN/Version.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package CPAN::Version;
22

33
use strict;
44
use vars qw($VERSION);
5-
$VERSION = "5.5003";
5+
$VERSION = "5.5003_01"; # with cperl support
66

77
# CPAN::Version::vcmp courtesy Jost Krieger
88
sub vcmp {
@@ -18,6 +18,7 @@ sub vcmp {
1818

1919
for ($l,$r) {
2020
s/_//g;
21+
s/c$//;
2122
}
2223
CPAN->debug("l[$l] r[$r]") if $CPAN::DEBUG;
2324
for ($l,$r) {

0 commit comments

Comments
 (0)