@@ -8,7 +8,7 @@ use CPAN::InfoObj;
8
8
use File::Path ();
9
9
@CPAN::Distribution::ISA = qw( CPAN::InfoObj) ;
10
10
use vars qw( $VERSION) ;
11
- $VERSION = " 2.18_01 " ; # with cperl support
11
+ $VERSION = " 2.19_01 " ; # with cperl support
12
12
13
13
# no prepare, because prepare is not a command on the shell command line
14
14
# TODO: clear instance cache on reload
@@ -660,8 +660,11 @@ sub satisfy_requires {
660
660
my ($self ) = @_ ;
661
661
$self -> debug(" Entering satisfy_requires" ) if $CPAN::DEBUG ;
662
662
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
+ }
665
668
if ($prereq [0][0] eq " perl" ) {
666
669
my $need = " requires perl '$prereq [0][1]'" ;
667
670
my $id = $self -> pretty_id;
@@ -1656,7 +1659,7 @@ sub force {
1656
1659
my $methodmatch = 0;
1657
1660
my $ldebug = 0;
1658
1661
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 ) ;
1660
1663
next unless $methodmatch ;
1661
1664
ATTRIBUTE: for my $att (@{$phase_map {$phase }}) {
1662
1665
if ($phase eq " get" ) {
@@ -1718,18 +1721,21 @@ sub isa_perl {
1718
1721
my ($self ) = @_ ;
1719
1722
my $file = File::Basename::basename($self -> id);
1720
1723
if ($file =~ m { ^ perl
1721
- -?
1722
- (5)
1723
- ([._-])
1724
1724
(
1725
- \d {3}(_[0-4][0-9])?
1725
+ -(5 \.\d + \.\d +)
1726
1726
|
1727
- \d + \.\d +
1727
+ (5)[._-](00[0-5](?:_[0-4][0-9])?)
1728
1728
)
1729
1729
\. tar[._-](?:gz|bz2)
1730
1730
(?!\n )\Z
1731
1731
} 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 ;
1733
1739
} elsif ($self -> cpan_comment
1734
1740
&&
1735
1741
$self -> cpan_comment =~ / isa_perl\( .+?\) / ) {
@@ -1983,7 +1989,12 @@ sub prepare {
1983
1989
}
1984
1990
}
1985
1991
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
+ }
1987
1998
CPAN::Reporter::grade_PL( $self , $system , $output , $ret );
1988
1999
}
1989
2000
else {
@@ -2085,7 +2096,7 @@ is part of the perl-%s distribution. To install that, you need to run
2085
2096
$self -> called_for,
2086
2097
$self -> isa_perl,
2087
2098
$self -> called_for,
2088
- $self -> id ,
2099
+ $self -> pretty_id ,
2089
2100
));
2090
2101
$self -> {make } = CPAN::Distrostatus-> new(" NO isa perl" );
2091
2102
$CPAN::Frontend -> mysleep(1);
@@ -2611,9 +2622,19 @@ sub _make_install_make_command {
2611
2622
sub is_locally_optional {
2612
2623
my ($self , $prereq_pm , $prereq ) = @_ ;
2613
2624
$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;
2617
2638
}
2618
2639
2619
2640
# -> sub CPAN::Distribution::follow_prereqs ;
@@ -2627,7 +2648,7 @@ sub follow_prereqs {
2627
2648
# e.g. $p = ['Devel::PartialDump', 'r', 1]
2628
2649
# skip builtins without .pm
2629
2650
if ($Config::Config {usecperl }
2630
- and $p -> [0] =~ / ^(DynaLoader|XSLoader|strict|coretypes)$ / ) {
2651
+ and $p -> [0] =~ / ^(DynaLoader|XSLoader|strict|coretypes)$ / ) {
2631
2652
CPAN-> debug(" $p ->[0] builtin" ) if $CPAN::DEBUG ;
2632
2653
next ;
2633
2654
}
@@ -2769,8 +2790,29 @@ sub _feature_depends {
2769
2790
sub prereqs_for_slot {
2770
2791
my ($self ,$slot ) = @_ ;
2771
2792
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
+ }
2774
2816
my $merged = CPAN::Meta::Requirements-> new;
2775
2817
my $prefs_depends = $self -> prefs-> {depends }||{};
2776
2818
my $feature_depends = $self -> _feature_depends();
@@ -2833,12 +2875,19 @@ sub unsat_prereq {
2833
2875
my ($self ,$slot ) = @_ ;
2834
2876
my ($merged_hash ,$prereq_pm ) = $self -> prereqs_for_slot($slot );
2835
2877
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
+ }
2838
2882
my $merged = CPAN::Meta::Requirements-> from_string_hash($merged_hash );
2839
2883
my @merged = sort $merged -> required_modules;
2840
2884
CPAN-> debug(" all merged_prereqs[@merged ]" ) if $CPAN::DEBUG ;
2841
2885
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
+ }
2842
2891
my $need_version = $merged -> requirements_for_module($need_module );
2843
2892
my ($available_version ,$inst_file ,$available_file ,$nmo );
2844
2893
if ($need_module eq " perl" ) {
@@ -3055,6 +3104,10 @@ sub unsat_prereq {
3055
3104
}
3056
3105
# here need to flag as optional for recommends/suggests
3057
3106
# -- xdg, 2012-04-01
3107
+ $self -> debug(sprintf " %s manadory?[%s ]" ,
3108
+ $self -> pretty_id,
3109
+ $self -> {mandatory })
3110
+ if $CPAN::DEBUG ;
3058
3111
my $optional = !$self -> {mandatory }
3059
3112
|| $self -> is_locally_optional($prereq_pm , $need_module );
3060
3113
push @need , [$need_module ,$needed_as ,$optional ];
@@ -3977,7 +4030,15 @@ sub install {
3977
4030
local $ENV {PERL_MM_USE_DEFAULT } = 1 if $CPAN::Config -> {use_prompt_default };
3978
4031
local $ENV {NONINTERACTIVE_TESTING } = 1 if $CPAN::Config -> {use_prompt_default };
3979
4032
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
+ }
3981
4042
my ($makeout ) = " " ;
3982
4043
while (<$pipe >) {
3983
4044
print $_ ; # intentionally NOT use Frontend->myprint because it
@@ -3992,7 +4053,8 @@ sub install {
3992
4053
$CPAN::Frontend -> myprint(" $system -- OK\n " );
3993
4054
$CPAN::META -> is_installed($self -> {build_dir });
3994
4055
$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) {
3996
4058
my $parent = File::Spec-> catdir( $self -> {build_dir }, File::Spec-> updir );
3997
4059
chdir $parent or $CPAN::Frontend -> mydie(" Couldn't chdir to $parent : $! \n " );
3998
4060
File::Path::rmtree($self -> {build_dir });
0 commit comments