summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-01-23 14:35:52 +0000
committerSteve Peters <steve@fisharerojo.org>2006-01-23 14:35:52 +0000
commitc9869e1c0cac4f243c84d27552ad981d5363e0f7 (patch)
tree0cf2b7f0e8580f493b9790ea534ea319ab1cf7ad /lib
parentf5a22bee2f0219400ae1a034d612824b40d53944 (diff)
downloadperl-c9869e1c0cac4f243c84d27552ad981d5363e0f7.tar.gz
Upgrade to CPAN-1.83_58
p4raw-id: //depot/perl@26923
Diffstat (limited to 'lib')
-rw-r--r--lib/CPAN.pm289
-rw-r--r--lib/CPAN/Debug.pm3
-rw-r--r--lib/CPAN/FirstTime.pm89
-rw-r--r--lib/CPAN/HandleConfig.pm36
-rw-r--r--lib/CPAN/SIGNATURE32
-rw-r--r--lib/CPAN/Version.pm15
-rw-r--r--lib/CPAN/t/vcmp.t25
7 files changed, 329 insertions, 160 deletions
diff --git a/lib/CPAN.pm b/lib/CPAN.pm
index 487b6377ca..8f89b9b80f 100644
--- a/lib/CPAN.pm
+++ b/lib/CPAN.pm
@@ -1,6 +1,5 @@
-# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
package CPAN;
-$VERSION = '1.83_55';
+$VERSION = '1.83_58';
$VERSION = eval $VERSION;
use strict;
@@ -582,7 +581,8 @@ sub checklock {
$otherhost ne '' && $thishost ne '' &&
$otherhost ne $thishost) {
$CPAN::Frontend->mydie(sprintf("CPAN.pm panic: Lockfile '$lockfile'\n".
- "reports other host $otherhost and other process $otherpid.\n".
+ "reports other host $otherhost and other ".
+ "process $otherpid.\n".
"Cannot proceed.\n"));
}
elsif (defined $otherpid && $otherpid) {
@@ -1049,14 +1049,20 @@ sub disk_usage {
return if exists $self->{SIZE}{$dir};
return if $CPAN::Signal;
my($Du) = 0;
- unless (-x $dir) {
- unless (chmod 0755, $dir) {
- $CPAN::Frontend->mywarn("I have neither the -x permission nor the permission ".
- "to change the permission; cannot estimate disk usage ".
- "of '$dir'\n");
- sleep 5;
+ if (-e $dir) {
+ unless (-x $dir) {
+ unless (chmod 0755, $dir) {
+ $CPAN::Frontend->mywarn("I have neither the -x permission nor the ".
+ "permission to change the permission; cannot ".
+ "estimate disk usage of '$dir'\n");
+ $CPAN::Frontend->mysleep(5);
+ return;
+ }
+ }
+ } else {
+ $CPAN::Frontend->mywarn("Directory '$dir' has gone. Cannot continue.\n");
+ $CPAN::Frontend->mysleep(2);
return;
- }
}
find(
sub {
@@ -1455,33 +1461,8 @@ sub reload {
my $failed;
MFILE: for my $f (qw(CPAN.pm CPAN/HandleConfig.pm CPAN/FirstTime.pm CPAN/Tarzip.pm
CPAN/Debug.pm CPAN/Version.pm)) {
- next unless $INC{$f};
- my $pwd = CPAN::anycwd();
- CPAN->debug("reloading the whole '$f' from '$INC{$f}' while pwd='$pwd'")
- if $CPAN::DEBUG;
- my $read;
- for my $inc (@INC) {
- $read = File::Spec->catfile($inc,split /\//, $f);
- last if -f $read;
- }
- unless (-f $read) {
- $failed++;
- $CPAN::Frontend->mywarn("Found no file to reload for '$f'\n");
- next MFILE;
- }
- my $fh = FileHandle->new($read) or
- $CPAN::Frontend->mydie("Could not open $read: $!");
- local($/);
- local $^W = 1;
local($SIG{__WARN__}) = paintdots_onreload(\$redef);
- my $eval = <$fh>;
- CPAN->debug(sprintf("evaling [%s...]\n",substr($eval,0,64)))
- if $CPAN::DEBUG;
- eval $eval;
- if ($@){
- $failed++;
- warn $@;
- }
+ $self->reload_this($f) or $failed++;
}
$CPAN::Frontend->myprint("\n$redef subroutines redefined\n");
$failed++ unless $redef;
@@ -1497,6 +1478,39 @@ index re-reads the index files\n});
}
}
+sub reload_this {
+ my($self,$f) = @_;
+ return 1 unless $INC{$f};
+ my $pwd = CPAN::anycwd();
+ CPAN->debug("reloading the whole '$f' from '$INC{$f}' while pwd='$pwd'")
+ if $CPAN::DEBUG;
+ my $read;
+ for my $inc (@INC) {
+ $read = File::Spec->catfile($inc,split /\//, $f);
+ last if -f $read;
+ }
+ unless (-f $read) {
+ $read = $INC{$f};
+ }
+ unless (-f $read) {
+ $CPAN::Frontend->mywarn("Found no file to reload for '$f'\n");
+ return;
+ }
+ my $fh = FileHandle->new($read) or
+ $CPAN::Frontend->mydie("Could not open $read: $!");
+ local($/);
+ local $^W = 1;
+ my $eval = <$fh>;
+ CPAN->debug(sprintf("evaling [%s...]\n",substr($eval,0,64)))
+ if $CPAN::DEBUG;
+ eval $eval;
+ if ($@){
+ warn $@;
+ return;
+ }
+ return 1;
+}
+
#-> sub CPAN::Shell::_binary_extensions ;
sub _binary_extensions {
my($self) = shift @_;
@@ -1670,11 +1684,10 @@ sub u {
shift->_u_r_common("u",@_);
}
-# XXX intentionally undocumented because not considered enough
#-> sub CPAN::Shell::failed ;
sub failed {
my($self,$only_id,$silent) = @_;
- my $print = "";
+ my @failed;
DIST: for my $d ($CPAN::META->all_objects("CPAN::Distribution")) {
my $failed = "";
for my $nosayer (qw(signature_verify make make_test install)) {
@@ -1687,22 +1700,29 @@ sub failed {
next DIST if $only_id && $only_id != $d->{$failed}->commandid;
my $id = $d->id;
$id =~ s|^./../||;
- $print .= sprintf(
- " %-45s: %s %s\n",
- $id,
- $failed,
- $d->{$failed}->text,
- );
+ #$print .= sprintf(
+ # " %-45s: %s %s\n",
+ push @failed, [
+ $d->{$failed}->commandid,
+ $id,
+ $failed,
+ $d->{$failed}->text,
+ ];
}
my $scope = $only_id ? "command" : "session";
- if ($print) {
- $CPAN::Frontend->myprint("Failed installations in this $scope:\n$print");
+ if (@failed) {
+ my $print = join "",
+ map { sprintf " %-45s: %s %s\n", @$_[1,2,3] }
+ sort { $a->[0] <=> $b->[0] } @failed;
+ $CPAN::Frontend->myprint("Failed during this $scope:\n$print");
} elsif (!$only_id || !$silent) {
- $CPAN::Frontend->myprint("No installations failed in this $scope\n");
+ $CPAN::Frontend->myprint("Nothing failed in this $scope\n");
}
}
-# XXX intentionally undocumented because not considered enough
+# XXX intentionally undocumented because completely bogus, unportable,
+# useless, etc.
+
#-> sub CPAN::Shell::status ;
sub status {
my($self) = @_;
@@ -2020,6 +2040,31 @@ sub mydie {
die "\n";
}
+# use this only for unrecoverable errors!
+sub unrecoverable_error {
+ my($self,$what) = @_;
+ my @lines = split /\n/, $what;
+ my $longest = 0;
+ for my $l (@lines) {
+ $longest = length $l if length $l > $longest;
+ }
+ $longest = 62 if $longest > 62;
+ for my $l (@lines) {
+ if ($l =~ /^\s*$/){
+ $l = "\n";
+ next;
+ }
+ $l = "==> $l";
+ if (length $l < 66) {
+ $l = pack "A66 A*", $l, "<==";
+ }
+ $l .= "\n";
+ }
+ unshift @lines, "\n";
+ $self->mydie(join "", @lines);
+ die "\n";
+}
+
sub mysleep {
my($self, $sleep) = @_;
sleep $sleep;
@@ -3888,6 +3933,7 @@ sub cpan_comment {
$ro->{CPAN_COMMENT}
}
+# CPAN::Distribution::undelay
sub undelay {
my $self = shift;
delete $self->{later};
@@ -4015,16 +4061,20 @@ sub safe_chdir {
$self->debug(sprintf "changed directory to %s", CPAN::anycwd())
if $CPAN::DEBUG;
} else {
- unless (-x $todir) {
- unless (chmod 0755, $todir) {
- my $cwd = CPAN::anycwd();
- $CPAN::Frontend->mywarn("I have neither the -x permission nor the permission ".
- "to change the permission; cannot chdir ".
- "to '$todir'\n");
- sleep 5;
- $CPAN::Frontend->mydie(qq{Could not chdir from cwd[$cwd] }.
- qq{to todir[$todir]: $!});
- }
+ if (-e $todir) {
+ unless (-x $todir) {
+ unless (chmod 0755, $todir) {
+ my $cwd = CPAN::anycwd();
+ $CPAN::Frontend->mywarn("I have neither the -x permission nor the ".
+ "permission to change the permission; cannot ".
+ "chdir to '$todir'\n");
+ $CPAN::Frontend->mysleep(5);
+ $CPAN::Frontend->mydie(qq{Could not chdir from cwd[$cwd] }.
+ qq{to todir[$todir]: $!});
+ }
+ }
+ } else {
+ $CPAN::Frontend->mydie("Directory '$todir' has gone. Cannot continue.\n");
}
if (chdir $todir) {
$self->debug(sprintf "changed directory to %s", CPAN::anycwd())
@@ -4095,7 +4145,17 @@ sub get {
$self->safe_chdir($builddir);
$self->debug("Removing tmp") if $CPAN::DEBUG;
File::Path::rmtree("tmp");
- mkdir "tmp", 0755 or Carp::croak "Couldn't mkdir tmp: $!";
+ unless (mkdir "tmp", 0755) {
+ $CPAN::Frontend->unrecoverable_error(<<EOF);
+Couldn't mkdir '$builddir/tmp': $!
+
+Cannot continue: Please find the reason why I cannot make the
+directory
+$builddir/tmp
+and fix the problem, then retry.
+
+EOF
+ }
if ($CPAN::Signal){
$self->safe_chdir($sub_wd);
return;
@@ -4137,8 +4197,18 @@ sub get {
-d $packagedir and $CPAN::Frontend->myprint("Removing previously used ".
"$packagedir\n");
File::Path::rmtree($packagedir);
- File::Copy::move($distdir,$packagedir) or
- Carp::confess("Couldn't move $distdir to $packagedir: $!");
+ unless (File::Copy::move($distdir,$packagedir)) {
+ $CPAN::Frontend->unrecoverable_error(<<EOF);
+Couldn't move '$distdir' to '$packagedir': $!
+
+Cannot continue: Please find the reason why I cannot move
+$builddir/tmp/$distdir
+to
+$packagedir
+and fix the problem, then retry
+
+EOF
+ }
$self->debug(sprintf("moved distdir[%s] to packagedir[%s] -e[%s]-d[%s]",
$distdir,
$packagedir,
@@ -4241,7 +4311,7 @@ and there run
}
}
if (lc($prefer_installer) eq "mb") {
- $self->{modulebuild} = "YES";
+ $self->{modulebuild} = 1;
} elsif (! $mpl_exists) {
$self->debug(sprintf("makefilepl[%s]anycwd[%s]",
$mpl,
@@ -4768,8 +4838,13 @@ or
defined $self->{'make'} and push @e,
"Has already been processed within this session";
- exists $self->{later} and length($self->{later}) and
- push @e, $self->{later};
+ if (exists $self->{later} and length($self->{later})) {
+ if ($self->unsat_prereq) {
+ push @e, $self->{later};
+ } else {
+ delete $self->{later};
+ }
+ }
$CPAN::Frontend->myprint(join "", map {" $_\n"} @e) and return if @e;
}
@@ -4834,7 +4909,7 @@ or
} else {
$ret = system($system);
if ($ret != 0) {
- $self->{writemakefile} = "NO Makefile.PL returned status $ret";
+ $self->{writemakefile} = "NO '$system' returned status $ret";
return;
}
}
@@ -4843,7 +4918,7 @@ or
delete $self->{make_clean}; # if cleaned before, enable next
} else {
$self->{writemakefile} =
- qq{NO Makefile.PL refused to write a Makefile.};
+ qq{NO -- Unknown reason.};
# It's probably worth it to record the reason, so let's retry
# local $/;
# my $fh = IO::File->new("$system |"); # STDERR? STDIN?
@@ -4876,6 +4951,7 @@ sub _make_command {
return $CPAN::Config->{'make'} || $Config::Config{make} || 'make';
}
+#-> sub CPAN::Distribution::follow_prereqs ;
sub follow_prereqs {
my($self) = shift;
my(@prereq) = grep {$_ ne "perl"} @_;
@@ -5008,7 +5084,7 @@ sub prereq_pm {
exists $self->{prereq_pm_detected} && $self->{prereq_pm_detected};
return unless $self->{writemakefile} # no need to have succeeded
# but we must have run it
- || $self->{mudulebuild};
+ || $self->{modulebuild};
my $req;
if (my $yaml = $self->read_yaml) {
$req = $yaml->{requires};
@@ -5081,6 +5157,15 @@ sub prereq_pm {
}
}
}
+ if (-f "Build.PL" && ! -f "Makefile.PL" && ! exists $req->{"Module::Build"}) {
+ $CPAN::Frontend->mywarn(" Warning: CPAN.pm discovered Module::Build as ".
+ "undeclared prerequisite.\n".
+ " Adding it now as a prerequisite.\n"
+ );
+ $CPAN::Frontend->mysleep(5);
+ $req->{"Module::Build"} = 0;
+ delete $self->{writemakefile};
+ }
$self->{prereq_pm_detected}++;
return $self->{prereq_pm} = $req;
}
@@ -5845,6 +5930,12 @@ sub description {
$ro->{description}
}
+sub distribution {
+ my($self) = @_;
+ CPAN::Shell->expand("Distribution",$self->cpan_file);
+}
+
+# sub CPAN::Module::undelay
sub undelay {
my $self = shift;
delete $self->{later};
@@ -5897,12 +5988,13 @@ sub as_glimpse {
$color_on = Term::ANSIColor::color("green");
$color_off = Term::ANSIColor::color("reset");
}
- push @m, sprintf("%-15s %s%-15s%s (%s)\n",
+ push @m, sprintf("%-8s %s%-22s%s (%s)\n",
$class,
$color_on,
$self->id,
$color_off,
- $self->cpan_file);
+ $self->distribution->pretty_id,
+ );
join "", @m;
}
@@ -6058,6 +6150,10 @@ sub manpage_headline {
close $fh;
last if @result;
}
+ for (@result) {
+ s/^\s+//;
+ s/\s+$//;
+ }
join " ", @result;
}
@@ -6322,7 +6418,23 @@ Batch mode:
use CPAN;
- autobundle, clean, install, make, recompile, test
+ # modules:
+
+ $mod = "Acme::Meta";
+ install $mod;
+ CPAN::Shell->install($mod); # same thing
+ CPAN::Shell->expandany($mod)->install; # same thing
+ CPAN::Shell->expand("Module",$mod)->install; # same thing
+ CPAN::Shell->expand("Module",$mod)
+ ->distribution->install; # same thing
+
+ # distributions:
+
+ $distro = "NWCLARK/Acme-Meta-0.01.tar.gz";
+ install $distro; # same thing
+ CPAN::Shell->install($distro); # same thing
+ CPAN::Shell->expandany($distro)->install; # same thing
+ CPAN::Shell->expand("Module",$distro)->install; # same thing
=head1 STATUS
@@ -6337,9 +6449,9 @@ stalled.
=head1 DESCRIPTION
The CPAN module is designed to automate the make and install of perl
-modules and extensions. It includes some primitive searching capabilities and
-knows how to use Net::FTP or LWP (or lynx or an external ftp client)
-to fetch the raw data from the net.
+modules and extensions. It includes some primitive searching
+capabilities and knows how to use Net::FTP or LWP (or some external
+download clients) to fetch the raw data from the net.
Modules are fetched from one or more of the mirrored CPAN
(Comprehensive Perl Archive Network) sites and unpacked in a dedicated
@@ -6356,15 +6468,7 @@ session. The cache manager keeps track of the disk space occupied by
the make processes and deletes excess space according to a simple FIFO
mechanism.
-For extended searching capabilities there's a plugin for CPAN available,
-L<C<CPAN::WAIT>|CPAN::WAIT>. C<CPAN::WAIT> is a full-text search engine
-that indexes all documents available in CPAN authors directories. If
-C<CPAN::WAIT> is installed on your system, the interactive shell of
-CPAN.pm will enable the C<wq>, C<wr>, C<wd>, C<wl>, and C<wh> commands
-which send queries to the WAIT server that has been configured for your
-installation.
-
-All other methods provided are accessible in a programmer style and in an
+All methods provided are accessible in a programmer style and in an
interactive shell style.
=head2 Interactive Mode
@@ -6405,7 +6509,7 @@ The principle is that the number of found objects influences how an
item is displayed. If the search finds one item, the result is
displayed with the rather verbose method C<as_string>, but if we find
more than one, we display each object with the terse method
-<as_glimpse>.
+C<as_glimpse>.
=item make, test, install, clean modules or distributions
@@ -6415,7 +6519,7 @@ file name (recognized by embedded slashes), it is processed. If it is
a module, CPAN determines the distribution file in which this module
is included and processes that, following any dependencies named in
the module's META.yml or Makefile.PL (this behavior is controlled by
-I<prerequisites_policy>.)
+the configuration parameter C<prerequisites_policy>.)
Any C<make> or C<test> are run unconditionally. An
@@ -6433,7 +6537,7 @@ CPAN also keeps track of what it has done within the current session
and doesn't try to build a package a second time regardless if it
succeeded or not. The C<force> pragma may precede another command
(currently: C<make>, C<test>, or C<install>) and executes the
-command from scratch.
+command from scratch and tries to continue in case of some errors.
Example:
@@ -6491,6 +6595,20 @@ The C<failed> command reports all distributions that failed on one of
C<make>, C<test> or C<install> for some reason in the currently
running shell session.
+=item Lockfile
+
+Interactive sessions maintain a lockfile, per default C<~/.cpan/.lock>
+(but the directory can be configured via the C<cpan_home> config
+variable). The shell is a bit picky if you try to start another CPAN
+session. It dies immediately if there is a lockfile and the lock seems
+to belong to a running process. In case you want to run a second shell
+session, it is probably safest to maintain another directory, say
+C<~/.cpan-for-X/> and a C<~/.cpan-for-X/CPAN/MyConfig.pm> that
+contains the configuration options. Then you can start the second
+shell with
+
+ perl -I ~/.cpan-for-X -MCPAN::MyConfig -MCPAN -e shell
+
=item Signals
CPAN.pm installs signal handlers for SIGINT and SIGTERM. While you are
@@ -7595,6 +7713,7 @@ cpan(1), CPAN::Nox(3pm), CPAN::Version(3pm)
=cut
# Local Variables:
+# coding: utf-8;
# mode: cperl
# cperl-indent-level: 4
# End:
diff --git a/lib/CPAN/Debug.pm b/lib/CPAN/Debug.pm
index a560630943..823ad73200 100644
--- a/lib/CPAN/Debug.pm
+++ b/lib/CPAN/Debug.pm
@@ -2,7 +2,7 @@ package CPAN::Debug;
use strict;
use vars qw($VERSION);
-$VERSION = sprintf "%.2f", substr(q$Rev: 299 $,4)/100;
+$VERSION = sprintf "%.2f", substr(q$Rev: 444 $,4)/100;
# module is internal to CPAN.pm
%CPAN::DEBUG = qw[
@@ -22,6 +22,7 @@ $VERSION = sprintf "%.2f", substr(q$Rev: 299 $,4)/100;
Tarzip 8192
Version 16384
Queue 32768
+ FirstTime 65536
];
$CPAN::DEBUG ||= 0;
diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm
index e4ab30a872..e6ea5708a6 100644
--- a/lib/CPAN/FirstTime.pm
+++ b/lib/CPAN/FirstTime.pm
@@ -2,7 +2,7 @@
package CPAN::Mirrored::By;
use strict;
use vars qw($VERSION);
-$VERSION = sprintf "%.2f", substr(q$Rev: 399 $,4)/100;
+$VERSION = sprintf "%.2f", substr(q$Rev: 450 $,4)/100;
sub new {
my($self,@arg) = @_;
@@ -21,7 +21,7 @@ use File::Basename ();
use File::Path ();
use File::Spec;
use vars qw($VERSION);
-$VERSION = sprintf "%.2f", substr(q$Rev: 399 $,4)/100;
+$VERSION = sprintf "%.2f", substr(q$Rev: 450 $,4)/100;
=head1 NAME
@@ -33,8 +33,9 @@ CPAN::FirstTime::init()
=head1 DESCRIPTION
-The init routine asks a few questions and writes a CPAN::Config
-file. Nothing special.
+The init routine asks a few questions and writes a CPAN/Config.pm or
+CPAN/MyConfig.pm file (depending on what it is currently using).
+
=cut
@@ -45,6 +46,7 @@ sub init {
use Config;
# extra arg in 'o conf init make' selects only $item =~ /make/
my $matcher = $args{args} && @{$args{args}} ? $args{args}[0] : '';
+ CPAN->debug("matcher[$matcher]") if $CPAN::DEBUG;
unless ($CPAN::VERSION) {
require CPAN::Nox;
@@ -61,9 +63,6 @@ sub init {
# Files, directories
#
- # not just yet
- # if (!@sections or grep /^(files|dirs)$/, @sections) {
-
print $prompts{manual_config};
my $manual_conf;
@@ -96,26 +95,25 @@ sub init {
};
}
}
- # if ('config_intro' ~= $matcher) {
-
- $CPAN::Frontend->myprint($prompts{config_intro});
-
- #}
+ $CPAN::Frontend->myprint($prompts{config_intro})
+ if !$matcher or 'config_intro' =~ /$matcher/;
my $cpan_home = $CPAN::Config->{cpan_home}
|| File::Spec->catdir($ENV{HOME}, ".cpan");
if (-d $cpan_home) {
- $CPAN::Frontend->myprint(qq{
+ if (!$matcher or 'config_intro' =~ /$matcher/) {
+ $CPAN::Frontend->myprint(qq{
I see you already have a directory
$cpan_home
Shall we use it as the general CPAN build and cache directory?
});
-
+ }
} else {
+ # no cpan-home, must prompt and get one
$CPAN::Frontend->myprint($prompts{cpan_home_where});
}
@@ -155,7 +153,8 @@ Shall we use it as the general CPAN build and cache directory?
# Cache size, Index expire
#
- $CPAN::Frontend->myprint($prompts{build_cache_intro});
+ $CPAN::Frontend->myprint($prompts{build_cache_intro})
+ if !$matcher or 'build_cache_intro' =~ /$matcher/;
# large enough to build large dists like Tk
my_dflt_prompt(build_cache => 100, $matcher);
@@ -163,26 +162,31 @@ Shall we use it as the general CPAN build and cache directory?
# XXX This the time when we refetch the index files (in days)
$CPAN::Config->{'index_expire'} = 1;
- $CPAN::Frontend->myprint($prompts{scan_cache_intro});
+ $CPAN::Frontend->myprint($prompts{scan_cache_intro})
+ if !$matcher or 'build_cache_intro' =~ /$matcher/;
+
my_prompt_loop(scan_cache => 'atstart', $matcher, 'atstart|never');
#
# cache_metadata
#
- $CPAN::Frontend->myprint($prompts{cache_metadata});
+ if (!$matcher or 'build_cache_intro' =~ /$matcher/) {
- defined($default = $CPAN::Config->{cache_metadata}) or $default = 1;
- do {
- $ans = prompt("Cache metadata (yes/no)?", ($default ? 'yes' : 'no'));
- } while ($ans !~ /^[yn]/i);
- $CPAN::Config->{cache_metadata} = ($ans =~ /^y/i ? 1 : 0);
+ $CPAN::Frontend->myprint($prompts{cache_metadata});
+ defined($default = $CPAN::Config->{cache_metadata}) or $default = 1;
+ do {
+ $ans = prompt("Cache metadata (yes/no)?", ($default ? 'yes' : 'no'));
+ } while ($ans !~ /^[yn]/i);
+ $CPAN::Config->{cache_metadata} = ($ans =~ /^y/i ? 1 : 0);
+ }
#
# term_is_latin
#
- $CPAN::Frontend->myprint($prompts{term_is_latin});
+ $CPAN::Frontend->myprint($prompts{term_is_latin})
+ if !$matcher or 'term_is_latin' =~ /$matcher/;
defined($default = $CPAN::Config->{term_is_latin}) or $default = 1;
do {
@@ -192,10 +196,10 @@ Shall we use it as the general CPAN build and cache directory?
$CPAN::Config->{term_is_latin} = ($ans =~ /^y/i ? 1 : 0);
#
- # save history in file histfile
+ # save history in file 'histfile'
#
- $CPAN::Frontend->myprint($prompts{histfile});
+ $CPAN::Frontend->myprint($prompts{histfile_intro});
defined($default = $CPAN::Config->{histfile}) or
$default = File::Spec->catfile($CPAN::Config->{cpan_home},"histfile");
@@ -227,7 +231,8 @@ Shall we use it as the general CPAN build and cache directory?
# Do we follow PREREQ_PM?
#
- $CPAN::Frontend->myprint($prompts{prerequisites_policy_intro});
+ $CPAN::Frontend->myprint($prompts{prerequisites_policy_intro})
+ if !$matcher or 'prerequisites_policy_intro' =~ /$matcher/;
my_prompt_loop(prerequisites_policy => 'ask', $matcher,
'follow|ask|ignore');
@@ -237,7 +242,8 @@ Shall we use it as the general CPAN build and cache directory?
# External programs
#
- $CPAN::Frontend->myprint($prompts{external_progs});
+ $CPAN::Frontend->myprint($prompts{external_progs})
+ if !$matcher or 'external_progs' =~ /$matcher/;
my $old_warn = $^W;
local $^W if $^O eq 'MacOS';
@@ -292,9 +298,7 @@ Shall we use it as the general CPAN build and cache directory?
$path = "";
}
$path ||= $ENV{SHELL};
- if (!$path && $^O eq 'MSWin32') {
- $path = Win32::IsWinNT() ? "cmd.exe" : "command.com";
- }
+ $path ||= $ENV{COMSPEC} if $^O eq "MSWin32";
if ($^O eq 'MacOS') {
$CPAN::Config->{'shell'} = 'not_here';
} else {
@@ -307,12 +311,14 @@ Shall we use it as the general CPAN build and cache directory?
# Arguments to make etc.
#
- $CPAN::Frontend->myprint($prompts{prefer_installer_intro});
+ $CPAN::Frontend->myprint($prompts{prefer_installer_intro})
+ if !$matcher or 'prerequisites_policy_intro' =~ /$matcher/;
my_prompt_loop(prefer_installer => 'EUMM', $matcher, 'MB|EUMM');
- $CPAN::Frontend->myprint($prompts{makepl_arg_intro});
+ $CPAN::Frontend->myprint($prompts{makepl_arg_intro})
+ if !$matcher or 'makepl_arg_intro' =~ /$matcher/;
my_dflt_prompt(makepl_arg => "", $matcher);
@@ -324,7 +330,8 @@ Shall we use it as the general CPAN build and cache directory?
my_dflt_prompt(make_install_arg => $CPAN::Config->{make_arg} || "",
$matcher);
- $CPAN::Frontend->myprint($prompts{mbuildpl_arg_intro});
+ $CPAN::Frontend->myprint($prompts{mbuildpl_arg_intro})
+ if !$matcher or 'mbuildpl_arg_intro' =~ /$matcher/;
my_dflt_prompt(mbuildpl_arg => "", $matcher);
@@ -338,7 +345,8 @@ Shall we use it as the general CPAN build and cache directory?
# Alarm period
#
- $CPAN::Frontend->myprint($prompts{inactivity_timeout_intro});
+ $CPAN::Frontend->myprint($prompts{inactivity_timeout_intro})
+ if !$matcher or 'inactivity_timeout_intro' =~ /$matcher/;
# my_dflt_prompt(inactivity_timeout => 0);
@@ -348,9 +356,12 @@ Shall we use it as the general CPAN build and cache directory?
# Proxies
- $CPAN::Frontend->myprint($prompts{proxies});
+ $CPAN::Frontend->myprint($prompts{proxy_intro})
+ if !$matcher or 'proxy_intro' =~ /$matcher/;
for (qw/ftp_proxy http_proxy no_proxy/) {
+ next if $matcher and $_ =~ /$matcher/;
+
$default = $CPAN::Config->{$_} || $ENV{$_};
$CPAN::Config->{$_} = prompt("Your $_?",$default);
}
@@ -752,7 +763,7 @@ anyway. If you answer no, names will be output in UTF-8.
},
-histfile => qq{
+histfile_intro => qq{
If you have one of the readline packages (Term::ReadLine::Perl,
Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN
@@ -762,6 +773,8 @@ set this variable, please hit SPACE RETURN to the following question.
},
+histfile => qq{File to save your history?},
+
show_upload_date_intro => qq{
The 'd' and the 'm' command normally only show you information they
@@ -787,7 +800,7 @@ policy to one of the three values.
},
prerequisites_policy =>
- qq{Policy on building prerequisites (follow, ask or ignore)?},
+"Policy on building prerequisites (follow, ask or ignore)?",
external_progs => qq{
@@ -921,7 +934,7 @@ inactivity_timeout =>
qq{Timeout for inactivity during {Makefile,Build}.PL? },
-proxies => qq{
+proxy_intro => qq{
If you\'re accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
diff --git a/lib/CPAN/HandleConfig.pm b/lib/CPAN/HandleConfig.pm
index 8c50d41169..e9859e5844 100644
--- a/lib/CPAN/HandleConfig.pm
+++ b/lib/CPAN/HandleConfig.pm
@@ -2,7 +2,7 @@ package CPAN::HandleConfig;
use strict;
use vars qw(%can %keys $dot_cpan $VERSION);
-$VERSION = sprintf "%.2f", substr(q$Rev: 423 $,4)/100;
+$VERSION = sprintf "%.2f", substr(q$Rev: 431 $,4)/100;
%can = (
'commit' => "Commit changes to disk",
@@ -179,8 +179,11 @@ EOF
*default = \&defaults;
sub defaults {
my($self) = @_;
- $self->unload;
- $self->load;
+ my $done;
+ for my $config (qw(CPAN/MyConfig.pm CPAN/Config.pm)) {
+ CPAN::Shell->reload_this($config) and $done++;
+ last if $done;
+ }
1;
}
@@ -255,20 +258,26 @@ sub load {
my($path_to_cpan) = File::Basename::dirname($INC{"CPAN.pm"});
my($configpmdir) = File::Spec->catdir($path_to_cpan,"CPAN");
my($configpmtest) = File::Spec->catfile($configpmdir,"Config.pm");
+ my $inc_key;
if (-d $configpmdir or File::Path::mkpath($configpmdir)) {
- $configpm = _configpmtest($configpmdir,$configpmtest);
+ $configpm = _configpmtest($configpmdir,$configpmtest);
+ $inc_key = "CPAN/Config.pm";
}
unless ($configpm) {
$configpmdir = File::Spec->catdir($ENV{HOME},".cpan","CPAN");
File::Path::mkpath($configpmdir);
$configpmtest = File::Spec->catfile($configpmdir,"MyConfig.pm");
- $configpm = _configpmtest($configpmdir,$configpmtest);
- unless ($configpm) {
- my $text = qq{WARNING: CPAN.pm is unable to } .
- qq{create a configuration file.};
- output($text, 'confess');
- }
+ $configpm = _configpmtest($configpmdir,$configpmtest);
+ $inc_key = "CPAN/MyConfig.pm";
}
+ if ($configpm) {
+ $INC{$inc_key} = $configpm;
+ } else {
+ my $text = qq{WARNING: CPAN.pm is unable to } .
+ qq{create a configuration file.};
+ output($text, 'confess');
+ }
+
}
local($") = ", ";
$CPAN::Frontend->myprint(<<END) if $redo && ! $theycalled;
@@ -319,11 +328,6 @@ sub missing_config_data {
return @miss;
}
-sub unload {
- delete $INC{'CPAN/MyConfig.pm'};
- delete $INC{'CPAN/Config.pm'};
-}
-
sub help {
$CPAN::Frontend->myprint(q[
Known options:
@@ -385,7 +389,7 @@ package ####::###### #hide from indexer
use strict;
use vars qw($AUTOLOAD $VERSION);
-$VERSION = sprintf "%.2f", substr(q$Rev: 423 $,4)/100;
+$VERSION = sprintf "%.2f", substr(q$Rev: 431 $,4)/100;
# formerly CPAN::HandleConfig was known as CPAN::Config
sub AUTOLOAD {
diff --git a/lib/CPAN/SIGNATURE b/lib/CPAN/SIGNATURE
index 045e79308f..b33fdc8f20 100644
--- a/lib/CPAN/SIGNATURE
+++ b/lib/CPAN/SIGNATURE
@@ -14,43 +14,43 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 1dd6639dee1773639e5e22cf785d9f6b0efeff2f ChangeLog
+SHA1 d73dfb45123f36ff3e574eff09b95847c5d085be ChangeLog
SHA1 9b97524a7a91c815e46b19302a33829d3c26bbbf ChangeLog.old
-SHA1 14cb7a05a3d6ee722c47566e3eefdfc652732e83 Changes
+SHA1 abe9c38d6e83d5e51c9138cbc1b716080a8746a7 Changes
SHA1 a029ffa2f2252bb8914eb658666244710994d256 Changes.old
SHA1 b3fc1dfd25885b80d144cf817b9f0b1c88fe41d6 MANIFEST
SHA1 6abf20ed9cb6c55d6c8062841522a5b6b784f074 MANIFEST.SKIP
-SHA1 29d220942dfa9ec0e41a63037c6ba3995c85e30b META.yml
-SHA1 23b8305cc0883f6163b52a673838dbab9961399c Makefile.PL
+SHA1 793e2950ccefbe8e29d9560d287649e3cd2d310e META.yml
+SHA1 69ee10278f731ff4dc2d8538613d8d7cf929872c Makefile.PL
SHA1 37e858c51409a297ef5d3fb35dc57cd3b57f9a4d PAUSE2003.pub
SHA1 af016003ad503ed078c5f8254521d13a3e0c494f PAUSE2005.pub
-SHA1 86d4b26821f12425dfafa2a149ed7a89a0b358d5 README
-SHA1 9b2b49def457c50b3dd05be10c944ea6d569122e Todo
+SHA1 92942e97152224fced7e6185571bc6199f29ff80 README
+SHA1 e1f7de588d0b1426a7a32c54995a0a00274bb01e Todo
SHA1 efbe8e6882a2caa0d741b113959a706830ab5882 inc/Test/Builder.pm
SHA1 ae1d68262bedc2475e2c6fd478d99b259b4fb109 inc/Test/More.pm
SHA1 06a0406535e8ae4057e374d4ea8cd5b105483803 lib/Bundle/CPAN.pm
-SHA1 58939f1928bcbad69be302c13416717d9faf7b82 lib/CPAN.pm
+SHA1 c8788190b668581d0a5a953f114153c92d957a05 lib/CPAN.pm
SHA1 104fd2b39fdba692143655b53bcf01d36c8ebf68 lib/CPAN/Admin.pm
-SHA1 0dc9b34d14c199a57f26d4d4d9ff7653ca3c5834 lib/CPAN/Debug.pm
-SHA1 add49d4be143c5fe705a96e9195d931c7c30ad52 lib/CPAN/FirstTime.pm
-SHA1 34cd91d32c05805428140a812dc3e14358a7595b lib/CPAN/HandleConfig.pm
+SHA1 82acb5a70221cd4ebc82e96f95f537018e39c79e lib/CPAN/Debug.pm
+SHA1 15ab48da83df4d3814ee7a5b6a4632a827f4d25c lib/CPAN/FirstTime.pm
+SHA1 80c55a1dd290dbd34eb7f53ad65d15a3e0d309f7 lib/CPAN/HandleConfig.pm
SHA1 4fa9695417b54fc8d4e29684ad61689bc108274b lib/CPAN/Nox.pm
SHA1 e85202a30802f3cd86e67af649ba219d97b0925c lib/CPAN/Tarzip.pm
-SHA1 174b3501753423eb90914fb5be043b79e405af28 lib/CPAN/Version.pm
+SHA1 726e924200e3e2fda54caa4eddf7029a02f43efe lib/CPAN/Version.pm
SHA1 fb08e07d8740ef36e8ab719c6a9b7e89c4fe674a scripts/cpan
SHA1 fd5431e748094972572d216dfb55c69b14433205 t/CPAN/TestConfig.pm
SHA1 67e80e1cfc3530932de7743dd0c833b2c387609d t/Nox.t
SHA1 215dace24b507de20011d36cbe2d16ddea78bcf3 t/loadme.t
SHA1 325d8a2f72d59c4cd2400c72403c05cd614c3abc t/mirroredby.t
SHA1 6a79f15a10337bd3450604abf39d4462df2a550b t/pod.t
-SHA1 50088f8e2dc36b679d73a4b55c4627f3837308c8 t/shell.t
+SHA1 274110e8c8353912bb849cec6556f2267b8c5c92 t/shell.t
SHA1 952e77e7944637eed1b5d202afa98baef8a4c64c t/signature.t
-SHA1 d773586d80dbd79605a4b08c3ef310379c4d09c5 t/vcmp.t
+SHA1 fdc0f927e3442829ab3b7d40cb63b0223c49abc6 t/vcmp.t
SHA1 b505a0db80ed4c835ad5676e9d1cbf09c86e6c34 t/version.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
-iD8DBQFDyOEB7IA58KMXwV0RAgB7AKD5n5S0ba3fjs4HCU0NqyC4kSUhXgCeOoaK
-IJBJ/2MnhVq24hvEfglqMGo=
-=4fdL
+iD8DBQFD03Q37IA58KMXwV0RAg3QAJ0TPGVcxlS+23QWCLFnigaGigOv3wCg+GS3
+091V7NyoeNk015bmr3m+HXc=
+=/DSm
-----END PGP SIGNATURE-----
diff --git a/lib/CPAN/Version.pm b/lib/CPAN/Version.pm
index f47c7c6334..3579863874 100644
--- a/lib/CPAN/Version.pm
+++ b/lib/CPAN/Version.pm
@@ -6,9 +6,13 @@ CPAN::Version - utility functions to compare CPAN versions
use CPAN::Version;
- CPAN::Version->vgt("1.1","1.1.1"); # 1
+ CPAN::Version->vgt("1.1","1.1.1"); # 1 bc. 1.1 > 1.001001
- CPAN::Version->vcmp("1.1","1.1.1"); # 1
+ CPAN::Version->vlt("1.1","1.1"); # 0 bc. 1.1 not < 1.1
+
+ CPAN::Version->vcmp("1.1","1.1.1"); # 1 bc. first is larger
+
+ CPAN::Version->vcmp("1.1.1","1.1"); # -1 bc. first is smaller
CPAN::Version->readable(v1.2.3); # "v1.2.3"
@@ -32,7 +36,7 @@ package CPAN::Version;
use strict;
use vars qw($VERSION);
-$VERSION = sprintf "%.2f", substr(q$Rev: 254 $,4)/100;
+$VERSION = "2.55";
# CPAN::Version::vcmp courtesy Jost Krieger
sub vcmp {
@@ -72,6 +76,11 @@ sub vgt {
$self->vcmp($l,$r) > 0;
}
+sub vlt {
+ my($self,$l,$r) = @_;
+ 0 + ($self->vcmp($l,$r) < 0);
+}
+
sub vstring {
my($self,$n) = @_;
$n =~ s/^v// or die "CPAN::Version::vstring() called with invalid arg [$n]";
diff --git a/lib/CPAN/t/vcmp.t b/lib/CPAN/t/vcmp.t
index a04b4238ac..9152066876 100644
--- a/lib/CPAN/t/vcmp.t
+++ b/lib/CPAN/t/vcmp.t
@@ -15,6 +15,8 @@ while (<DATA>) {
$N = scalar @$D;
print "1..$N\n";
+my $has_sort_versions = eval { require Sort::Versions; 1 };
+my $has_versionpm = eval { require version; 1 };
while (@$D) {
my($l,$r,$exp) = @{shift @$D};
my $res = CPAN::Version->vcmp($l,$r);
@@ -22,7 +24,21 @@ while (@$D) {
print "# l[$l]r[$r]exp[$exp]res[$res]\n";
print "not ";
}
- printf "ok %2d # %12s %12s %3d\n", $N-@$D, $l, $r, $res;
+ my @other = ();
+ if ($has_sort_versions) {
+ if (Sort::Versions::versioncmp($l,$r) != $res) {
+ push @other, sprintf "SV: %d", Sort::Versions::versioncmp($l,$r);
+ }
+ }
+ if ($has_versionpm) {
+ local $^W;
+ my $vres = version->new($l) cmp version->new($r);
+ if ($vres != $res) {
+ push @other, sprintf "v.pm: %d", $vres;
+ }
+ }
+ my $other = @other ? " (".join("; ", @other).")" : "";
+ printf "ok %2d # %12s %12s %3d%s\n", $N-@$D, $l, $r, $res, $other;
}
__END__
@@ -46,12 +62,15 @@ VERSION VERSION 0
0.2.10 0.2 -1
20000000.00 19990108 1
1.00 0.96 1
+0.7.2 0.7 -1
0.7.02 0.7 -1
+0.07.02 0.7 -1
1.3a5 1.3 1
undef 1.00 -1
v1.0 undef 1
v0.2.4 0.24 -1
v1.0.22 122 -1
+1.0.22 122 -1
5.00556 v5.5.560 0
5.005056 v5.5.56 0
5.00557 v5.5.560 1
@@ -63,6 +82,10 @@ v1.0.22 122 -1
0.01.04 0.001004 0
0.05.18 0.005018 0
4.08.00 4.008000 0
+0.001.004 0.001004 0
+0.005.018 0.005018 0
+4.008.000 4.008000 0
+4.008.000 4.008 1
__END__
# Local Variables: