From: Steve Peters Date: Mon, 12 Mar 2007 15:12:39 +0000 (+0000) Subject: Upgrade to CPAN-1.88_78 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b3bde2ad9294c4485b66964767449c3e28d218b;p=p5sagit%2Fp5-mst-13.2.git Upgrade to CPAN-1.88_78 p4raw-id: //depot/perl@30551 --- diff --git a/lib/CPAN.pm b/lib/CPAN.pm index 6f128d4..cd668bc 100644 --- a/lib/CPAN.pm +++ b/lib/CPAN.pm @@ -1,7 +1,7 @@ # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- use strict; package CPAN; -$CPAN::VERSION = '1.88_77'; +$CPAN::VERSION = '1.88_78'; $CPAN::VERSION = eval $CPAN::VERSION; use CPAN::HandleConfig; @@ -34,7 +34,7 @@ use Text::Wrap (); BEGIN { if (File::Spec->can("rel2abs")) { for my $inc (@INC) { - $inc = File::Spec->rel2abs($inc); + $inc = File::Spec->rel2abs($inc) unless ref $inc; } } } @@ -42,6 +42,7 @@ no lib "."; require Mac::BuildTools if $^O eq 'MacOS'; $ENV{PERL5_CPAN_IS_RUNNING}=1; +$ENV{PERL5_CPANPLUS_IS_RUNNING}=1; # https://rt.cpan.org/Ticket/Display.html?id=23735 END { $CPAN::End++; &cleanup; } @@ -66,6 +67,7 @@ use vars qw( $CONFIG_DIRTY $Defaultdocs $Defaultrecent + $Echo_readline $Frontend $GOTOSHELL $HAS_USABLE @@ -222,8 +224,15 @@ ReadLine support %s my $last_term_ornaments; SHELLCOMMAND: while () { if ($Suppress_readline) { + if ($Echo_readline) { + $|=1; + } print $prompt; last SHELLCOMMAND unless defined ($_ = <> ); + if ($Echo_readline) { + # backdoor: I could not find a way to record sessions + print $_; + } chomp; } else { last SHELLCOMMAND unless @@ -1421,17 +1430,21 @@ sub disk_usage { return if $CPAN::Signal; my($Du) = 0; 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; + if (-d $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; + } } + } elsif (-f $dir) { + # nothing to say, no matter what the permissions } } else { - $CPAN::Frontend->mywarn("Directory '$dir' has gone. Cannot continue.\n"); + $CPAN::Frontend->mywarn("File or directory '$dir' has gone, ignoring\n"); return; } find( @@ -3002,8 +3015,9 @@ to find objects with matching identifiers. # but maybe we get a solution from the first user who hits # this unfortunate exception? $CPAN::Frontend->mywarn("Warning: Could not expand string '$s' ". - "to an object. Skipping."); + "to an object. Skipping.\n"); $CPAN::Frontend->mysleep(5); + CPAN::Queue->delete_first($s); next; } $obj->{reqtype} ||= ""; @@ -5709,10 +5723,6 @@ EOF } else { $self->{was_uncompressed}++ unless $ct->gtest(); $local_file = $self->handle_singlefile($local_file); -# } else { -# $self->{archived} = "NO"; -# $self->safe_chdir($sub_wd); -# return; } # we are still in the tmp directory! @@ -5846,6 +5856,11 @@ EOF return unless $self->patch; if (lc($prefer_installer) eq "mb") { $self->{modulebuild} = 1; + } elsif ($self->{archived} eq "patch") { + # not an edge case, nothing to install for sure + my $why = "A patch file cannot be installed"; + $CPAN::Frontend->mywarn("Refusing to handle this file: $why\n"); + $self->{writemakefile} = CPAN::Distrostatus->new("NO $why"); } elsif (! $mpl_exists) { $self->_edge_cases($mpl,$packagedir,$local_file); } @@ -6194,6 +6209,8 @@ sub handle_singlefile { if ( $local_file =~ /\.pm(\.(gz|Z))?(?!\n)\Z/ ){ $self->{archived} = "pm"; + } elsif ( $local_file =~ /\.patch(\.(gz|bz2))?(?!\n)\Z/ ) { + $self->{archived} = "patch"; } else { $self->{archived} = "maybe_pl"; } @@ -6206,8 +6223,11 @@ sub handle_singlefile { $self->{unwrapped} = CPAN::Distrostatus->new("NO -- uncompressing failed"); } } else { - File::Copy::cp($local_file,"."); - $self->{unwrapped} = CPAN::Distrostatus->new("NO -- copying failed"); + if (File::Copy::cp($local_file,".")) { + $self->{unwrapped} = CPAN::Distrostatus->new("YES"); + } else { + $self->{unwrapped} = CPAN::Distrostatus->new("NO -- copying failed"); + } } return $to; } @@ -7235,8 +7255,10 @@ sub _find_prefs { my $ok = 1; # do not take the order of C because # "module" is by far the slowest - for my $sub_attribute (qw(distribution perl module)) { + my $saw_valid_subkeys = 0; + for my $sub_attribute (qw(distribution perl perlconfig module)) { next unless exists $match->{$sub_attribute}; + $saw_valid_subkeys++; my $qr = eval "qr{$distropref->{match}{$sub_attribute}}"; if ($sub_attribute eq "module") { my $okm = 0; @@ -7254,6 +7276,14 @@ sub _find_prefs { } elsif ($sub_attribute eq "perl") { my $okp = $^X =~ /$qr/; $ok &&= $okp; + } elsif ($sub_attribute eq "perlconfig") { + for my $perlconfigkey (keys %{$match->{perlconfig}}) { + my $perlconfigval = $match->{perlconfig}->{$perlconfigkey}; + # XXX should probably warn if Config does not exist + my $okpc = $Config::Config{$perlconfigkey} =~ /$perlconfigval/; + $ok &&= $okpc; + last if $ok == 0; + } } else { $CPAN::Frontend->mydie("Nonconforming .$thisexte file '$abs': ". "unknown sub_attribut '$sub_attribute'. ". @@ -7262,6 +7292,12 @@ sub _find_prefs { } last if $ok == 0; # short circuit } + unless ($saw_valid_subkeys) { + $CPAN::Frontend->mydie("Nonconforming .$thisexte file '$abs': ". + "missing match/* subattribute. ". + "Please ". + "remove, cannot continue."); + } #CPAN->debug(sprintf "ok[%d]", $ok) if $CPAN::DEBUG; if ($ok) { return { @@ -10178,6 +10214,8 @@ C. module: "Dancing::Queen" distribution: "^CHACHACHA/Dancing-" perl: "/usr/local/cariba-perl/bin/perl" + perlconfig: + archname: "freebsd" disabled: 1 cpanconfig: make: gmake @@ -10266,9 +10304,9 @@ CPAN mantra. See below under I. =item match [hash] -A hashref with one or more of the keys C, C, or -C that specify if a document is targeted at a specific CPAN -distribution. +A hashref with one or more of the keys C, C, +C, and C that specify if a document is targeted at a +specific CPAN distribution or installation. The corresponding values are interpreted as regular expressions. The C related one will be matched against the canonical @@ -10279,6 +10317,10 @@ contained in the distribution until one module matches. The C related one will be matched against C<$^X>. +The value associated with C is itself a hashref that is +matched against corresponding values in the C<%Config::Config> hash +living in the C< Config.pm > module. + If more than one restriction of C, C, and C is specified, the results of the separately computed match values must all match. If this is the case then the hashref diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm index 06fe076..0600939 100644 --- a/lib/CPAN/FirstTime.pm +++ b/lib/CPAN/FirstTime.pm @@ -19,7 +19,7 @@ use File::Basename (); use File::Path (); use File::Spec (); use vars qw($VERSION $urllist); -$VERSION = sprintf "%.6f", substr(q$Rev: 1536 $,4)/1000000 + 5.4; +$VERSION = sprintf "%.6f", substr(q$Rev: 1612 $,4)/1000000 + 5.4; =head1 NAME @@ -387,10 +387,30 @@ Shall we use it as the general CPAN build and cache directory? } $path ||= find_exe($progcall,\@path); - { + unless ($path){ # not -e $path, because find_exe already checked that local $"=";"; - $CPAN::Frontend->mywarn("Warning: $progcall not found in PATH[@path]\n") unless - $path; # not -e $path, because find_exe already checked that + $CPAN::Frontend->mywarn("Warning: $progcall not found in PATH[@path]\n"); + if ($progname eq "make") { + $CPAN::Frontend->mywarn("ALERT: 'make' is an essential tool for ". + "building perl Modules. Please make sure you ". + "have 'make' (or some equivalent) ". + "working.\n" + ); + if ($^O eq "MSWin32") { + $CPAN::Frontend->mywarn(" +Windows users may want to follow this procedure when back in the CPAN shell: + + look YVES/scripts/alien_nmake.pl + perl alien_nmake.pl + +This will install nmake on your system which can be used as a 'make' +substitute. You can then revisit this dialog with + + o conf init make + +"); + } + } } $ans = prompt("Where is your $progname program?",$path) || $path; $CPAN::Config->{$progname} = $ans; diff --git a/lib/CPAN/Kwalify.pm b/lib/CPAN/Kwalify.pm index b2dfcf6..c64236a 100644 --- a/lib/CPAN/Kwalify.pm +++ b/lib/CPAN/Kwalify.pm @@ -103,6 +103,10 @@ sub _validate { } } +sub _clear_cache { + %vcache = (); +} + sub yaml { my($schema_name) = @_; my $content = do { diff --git a/lib/CPAN/Kwalify/distroprefs.dd b/lib/CPAN/Kwalify/distroprefs.dd index 480e7d9..2da6d63 100644 --- a/lib/CPAN/Kwalify/distroprefs.dd +++ b/lib/CPAN/Kwalify/distroprefs.dd @@ -63,21 +63,17 @@ $VAR1 = { "type" => "map" }, "make" => {}, - "cpan_config" => { - "mapping" => { - "prefer_installer" => { - "enum" => [ - "EUMM", - "MB" - ], - "type" => "text" - } - }, - "type" => "map" - }, "install" => {}, "match" => { "mapping" => { + "perlconfig" => { + "mapping" => { + "=" => { + "type" => "text" + } + }, + "type" => "map" + }, "perl" => { "type" => "text" }, diff --git a/lib/CPAN/Kwalify/distroprefs.yml b/lib/CPAN/Kwalify/distroprefs.yml index 234bdb0..60a4372 100644 --- a/lib/CPAN/Kwalify/distroprefs.yml +++ b/lib/CPAN/Kwalify/distroprefs.yml @@ -12,14 +12,11 @@ mapping: type: text perl: type: text - cpan_config: - type: map - mapping: - prefer_installer: - type: text - enum: - - EUMM - - MB + perlconfig: + type: map + mapping: + =: + type: text install: &args_env_expect type: map diff --git a/lib/CPAN/bin/cpan b/lib/CPAN/bin/cpan index 83044ae..861d90f 100644 --- a/lib/CPAN/bin/cpan +++ b/lib/CPAN/bin/cpan @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $Id: cpan,v 1.7 2006/01/11 06:22:32 comdog Exp $ +# $Id: cpan,v 1.9 2006/11/01 21:49:31 comdog Exp $ use strict; =head1 NAME @@ -14,7 +14,7 @@ cpan - easily interact with CPAN from the command line # with switches, installs modules with extra behavior cpan [-cfimt] module_name [ module_name ... ] - # without arguments, starts CPAN shell + # without arguments, starts CPAN.pm shell cpan # without arguments, but some switches @@ -22,7 +22,9 @@ cpan - easily interact with CPAN from the command line =head1 DESCRIPTION -This script provides a command interface (not a shell) to CPAN.pm. +This script provides a command interface (not a shell) to CPAN. At the +moment it uses CPAN.pm to do the work, but it is not a one-shot command +runner for CPAN.pm. =head2 Meta Options @@ -152,6 +154,9 @@ Japheth Cleaver added the bits to allow a forced install (-f). Jim Brandt suggest and provided the initial implementation for the up-to-date and Changes features. +Adam Kennedy pointed out that exit() causes problems on Windows +where this script ends up with a .bat extension + =head1 AUTHOR brian d foy, C<< >> @@ -168,8 +173,25 @@ use CPAN (); use Getopt::Std; my $VERSION = - sprintf "%d.%d", q$Revision: 403 $ =~ m/ (\d+) \. (\d+) /xg; + sprintf "%d.%d", q$Revision: 1.9 $ =~ m/ (\d+) \. (\d+) /xg; + +if( $ARGV[0] eq 'install' ) + { + my @args = @ARGV; + shift @args; + + die <<"HERE"; +It looks like you specified 'install' as an argument to cpan(1). This +script is not the CPAN.pm prompt and doesn't understand the same commands. +In fact, doesn't require the extra typing. You probably just want to +list the modules you want to install: + cpan @args + +See the documentation for more details on using this script. +HERE + } + if( 0 == @ARGV ) { CPAN::shell(); exit 0 } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -279,7 +301,7 @@ sub _default # 2. with no switches and no args, start the shell # 3. With a switch but no args, die! These switches need arguments. if( not $switch and @$args ) { $switch = $Default; } - elsif( not $switch and not @$args ) { CPAN::shell(); exit 0; } + elsif( not $switch and not @$args ) { CPAN::shell(); return } elsif( $switch and not @$args ) { die "Nothing to $CPAN_METHODS{$switch}!\n"; } @@ -316,7 +338,7 @@ sub _create_autobundle CPAN::Shell->autobundle; } -sub _recompiling +sub _recompile { print "Recompiling dynamically-loaded extensions\n";