summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/CPAN.pm
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-03-08 00:16:42 +0000
committerKarl Berry <karl@freefriends.org>2018-03-08 00:16:42 +0000
commit34a8597760ab5740abd49b6d8be10e1876f5ce98 (patch)
tree099a794912a28b3ebbc857961643ba29b28e674a /Master/tlpkg/tlperl/lib/CPAN.pm
parent2ca3610031316a7312d046d3ae4c783452831216 (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.pm')
-rw-r--r--Master/tlpkg/tlperl/lib/CPAN.pm93
1 files changed, 62 insertions, 31 deletions
diff --git a/Master/tlpkg/tlperl/lib/CPAN.pm b/Master/tlpkg/tlperl/lib/CPAN.pm
index 25bf3494a8e..4f028505f8e 100644
--- a/Master/tlpkg/tlperl/lib/CPAN.pm
+++ b/Master/tlpkg/tlperl/lib/CPAN.pm
@@ -2,7 +2,7 @@
# vim: ts=4 sts=4 sw=4:
use strict;
package CPAN;
-$CPAN::VERSION = '2.11_01';
+$CPAN::VERSION = '2.18';
$CPAN::VERSION =~ s/_//;
# we need to run chdir all over and we would get at wrong libraries
@@ -14,6 +14,7 @@ BEGIN {
$inc = File::Spec->rel2abs($inc) unless ref $inc;
}
}
+ $SIG{WINCH} = 'IGNORE' if exists $SIG{WINCH};
}
use CPAN::Author;
use CPAN::HandleConfig;
@@ -460,7 +461,7 @@ Enter 'h' for help.
}
for my $class (qw(Module Distribution)) {
# again unsafe meta access?
- for my $dm (keys %{$CPAN::META->{readwrite}{"CPAN::$class"}}) {
+ for my $dm (sort keys %{$CPAN::META->{readwrite}{"CPAN::$class"}}) {
next unless $CPAN::META->{readwrite}{"CPAN::$class"}{$dm}{incommandcolor};
CPAN->debug("BUG: $class '$dm' was in command state, resetting");
delete $CPAN::META->{readwrite}{"CPAN::$class"}{$dm}{incommandcolor};
@@ -708,13 +709,14 @@ sub checklock {
my $otherpid = <$fh>;
my $otherhost = <$fh>;
$fh->close;
- if (defined $otherpid && $otherpid) {
+ if (defined $otherpid && length $otherpid) {
chomp $otherpid;
}
- if (defined $otherhost && $otherhost) {
+ if (defined $otherhost && length $otherhost) {
chomp $otherhost;
}
my $thishost = hostname();
+ my $ask_if_degraded_wanted = 0;
if (defined $otherhost && defined $thishost &&
$otherhost ne '' && $thishost ne '' &&
$otherhost ne $thishost) {
@@ -732,31 +734,7 @@ There seems to be running another CPAN process (pid $otherpid). Contacting...
});
if (kill 0, $otherpid or $!{EPERM}) {
$CPAN::Frontend->mywarn(qq{Other job is running.\n});
- my($ans) =
- CPAN::Shell::colorable_makemaker_prompt
- (qq{Shall I try to run in downgraded }.
- qq{mode? (Y/n)},"y");
- if ($ans =~ /^y/i) {
- $CPAN::Frontend->mywarn("Running in downgraded mode (experimental).
-Please report if something unexpected happens\n");
- $RUN_DEGRADED = 1;
- for ($CPAN::Config) {
- # XXX
- # $_->{build_dir_reuse} = 0; # 2006-11-17 akoenig Why was that?
- $_->{commandnumber_in_prompt} = 0; # visibility
- $_->{histfile} = ""; # who should win otherwise?
- $_->{cache_metadata} = 0; # better would be a lock?
- $_->{use_sqlite} = 0; # better would be a write lock!
- $_->{auto_commit} = 0; # we are violent, do not persist
- $_->{test_report} = 0; # Oliver Paukstadt had sent wrong reports in degraded mode
- }
- } else {
- $CPAN::Frontend->mydie("
-You may want to kill the other job and delete the lockfile. On UNIX try:
- kill $otherpid
- rm $lockfile
-");
- }
+ $ask_if_degraded_wanted = 1;
} elsif (-w $lockfile) {
my($ans) =
CPAN::Shell::colorable_makemaker_prompt
@@ -773,10 +751,46 @@ You may want to kill the other job and delete the lockfile. On UNIX try:
qq{ and then rerun us.\n}
);
}
+ } elsif ($^O eq "MSWin32") {
+ $CPAN::Frontend->mywarn(
+ qq{
+There seems to be running another CPAN process according to '$lockfile'.
+});
+ $ask_if_degraded_wanted = 1;
} else {
$CPAN::Frontend->mydie(sprintf("CPAN.pm panic: Found invalid lockfile ".
"'$lockfile', please remove. Cannot proceed.\n"));
}
+ if ($ask_if_degraded_wanted) {
+ my($ans) =
+ CPAN::Shell::colorable_makemaker_prompt
+ (qq{Shall I try to run in downgraded }.
+ qq{mode? (Y/n)},"y");
+ if ($ans =~ /^y/i) {
+ $CPAN::Frontend->mywarn("Running in downgraded mode (experimental).
+Please report if something unexpected happens\n");
+ $RUN_DEGRADED = 1;
+ for ($CPAN::Config) {
+ # XXX
+ # $_->{build_dir_reuse} = 0; # 2006-11-17 akoenig Why was that?
+ $_->{commandnumber_in_prompt} = 0; # visibility
+ $_->{histfile} = ""; # who should win otherwise?
+ $_->{cache_metadata} = 0; # better would be a lock?
+ $_->{use_sqlite} = 0; # better would be a write lock!
+ $_->{auto_commit} = 0; # we are violent, do not persist
+ $_->{test_report} = 0; # Oliver Paukstadt had sent wrong reports in degraded mode
+ }
+ } else {
+ my $msg = "You may want to kill the other job and delete the lockfile.";
+ if (defined $otherpid) {
+ $msg .= " Something like:
+ kill $otherpid
+ rm $lockfile
+";
+ }
+ $CPAN::Frontend->mydie("\n$msg");
+ }
+ }
}
my $dotcpan = $CPAN::Config->{cpan_home};
eval { File::Path::mkpath($dotcpan);};
@@ -1050,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},
],
@@ -1356,8 +1380,8 @@ sub _list_sorted_descending_is_tested {
keys %{$self->{is_tested}};
if ($foul) {
$CPAN::Frontend->mywarn("Lost build_dir detected ($foul), giving up all cached test results of currently running session.\n");
- for my $dbd (keys %{$self->{is_tested}}) { # distro-build-dir
- SEARCH: for my $d ($CPAN::META->all_objects("CPAN::Distribution")) {
+ for my $dbd (sort keys %{$self->{is_tested}}) { # distro-build-dir
+ SEARCH: for my $d (sort { $a->id cmp $b->id } $CPAN::META->all_objects("CPAN::Distribution")) {
if ($d->{build_dir} && $d->{build_dir} eq $dbd) {
$CPAN::Frontend->mywarn(sprintf "Flushing cache for %s\n", $d->pretty_id);
$d->fforce("");
@@ -1973,6 +1997,10 @@ the form
Modulename=arg0,arg1,arg2,arg3,...
+eg:
+
+ CPAN::Plugin::Flurb=dir,/opt/pkgs/flurb/raw,verbose,1
+
At run time, each listed plugin is instantiated as a singleton object
by running the equivalent of this pseudo code:
@@ -2093,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