diff options
author | Karl Berry <karl@freefriends.org> | 2018-03-08 00:16:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-03-08 00:16:42 +0000 |
commit | 34a8597760ab5740abd49b6d8be10e1876f5ce98 (patch) | |
tree | 099a794912a28b3ebbc857961643ba29b28e674a /Master/tlpkg/tlperl/lib/CPAN/Exception/RecursiveDependency.pm | |
parent | 2ca3610031316a7312d046d3ae4c783452831216 (diff) |
(tl)perl 5.26.1 from siep
git-svn-id: svn://tug.org/texlive/trunk@46882 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CPAN/Exception/RecursiveDependency.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/CPAN/Exception/RecursiveDependency.pm | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/Master/tlpkg/tlperl/lib/CPAN/Exception/RecursiveDependency.pm b/Master/tlpkg/tlperl/lib/CPAN/Exception/RecursiveDependency.pm index b928ad74e31..82e82346efa 100644 --- a/Master/tlpkg/tlperl/lib/CPAN/Exception/RecursiveDependency.pm +++ b/Master/tlpkg/tlperl/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}; |