Udate CPAN to CPAN version 1.99_51
authorCraig A. Berry <craigberry@mac.com>
Fri, 19 Oct 2012 20:09:16 +0000 (15:09 -0500)
committerCraig A. Berry <craigberry@mac.com>
Fri, 19 Oct 2012 20:38:47 +0000 (15:38 -0500)
  * release 1.99_51

  * RT #79969: fix incompatibilities with VMS (Craig Berry)

  * bugfix: distroprefs of type pl/args were dropped for 'perl Build.PL'

  * RT #73742: watch build_dirs and react calmly when one has gone lost

13 files changed:
cpan/CPAN/Changes
cpan/CPAN/lib/App/Cpan.pm
cpan/CPAN/lib/CPAN.pm
cpan/CPAN/lib/CPAN/Bundle.pm
cpan/CPAN/lib/CPAN/Debug.pm
cpan/CPAN/lib/CPAN/Distribution.pm
cpan/CPAN/lib/CPAN/FirstTime.pm
cpan/CPAN/lib/CPAN/HandleConfig.pm
cpan/CPAN/lib/CPAN/Index.pm
cpan/CPAN/lib/CPAN/Mirrors.pm
cpan/CPAN/lib/CPAN/Queue.pm
cpan/CPAN/lib/CPAN/Tarzip.pm
t/porting/known_pod_issues.dat

index 7c4e56e..897ecdf 100644 (file)
@@ -1,3 +1,13 @@
+2012-10-16  Andreas Koenig  <andreas.koenig.7os6VVqR@franz.ak.mind.de>
+
+       * release 1.99_51
+
+       * RT #79969: fix incompatibilities with VMS (Craig Berry)
+
+  * bugfix: distroprefs of type pl/args were dropped for 'perl Build.PL'
+
+       * RT #73742: watch build_dirs and react calmly when one has gone lost
+
 2011-08-07  Andreas J. Koenig  <andk@cpan.org>
 
        * release 1.9800
index 0fce3d3..b2caae2 100644 (file)
@@ -833,16 +833,17 @@ sub _show_Details
        foreach my $arg ( @$args )
                {
                my $module = CPAN::Shell->expand( "Module", $arg );
-               my $author = CPAN::Shell->expand( "Author", $module->userid );
+               next unless $module;
 
-               next unless $module->userid;
+               my $author = CPAN::Shell->expand( "Author", $module->userid );
+               next unless $author;
 
                print "$arg\n", "-" x 73, "\n\t";
                print join "\n\t",
                        $module->description ? $module->description : "(no description)",
                        $module->cpan_file,
                        $module->inst_file,
-                       'Installed: ' . $module->inst_version,
+                       'Installed: ' . (defined($module->inst_version) ? $module->inst_version : '(not installed)'),
                        'CPAN:      ' . $module->cpan_version . '  ' .
                                ($module->uptodate ? "" : "Not ") . "up to date",
                        $author->fullname . " (" . $module->userid . ")",
index 4e1f2a3..64d2000 100644 (file)
@@ -2,7 +2,7 @@
 # vim: ts=4 sts=4 sw=4:
 use strict;
 package CPAN;
-$CPAN::VERSION = '1.9800';
+$CPAN::VERSION = '1.99_51';
 $CPAN::VERSION =~ s/_//;
 
 # we need to run chdir all over and we would get at wrong libraries
@@ -1316,9 +1316,28 @@ sub is_installed {
 
 sub _list_sorted_descending_is_tested {
     my($self) = @_;
-    sort
+    my $foul = 0;
+    my @sorted = sort
         { ($self->{is_tested}{$b}||0) <=> ($self->{is_tested}{$a}||0) }
-            keys %{$self->{is_tested}}
+            grep
+                { if ($foul){ 0 } elsif (-e) { 1 } else { $foul = $_; 0 } }
+                    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")) {
+                if ($d->{build_dir} && $d->{build_dir} eq $dbd) {
+                    $CPAN::Frontend->mywarn(sprintf "Flushing cache for %s\n", $d->pretty_id);
+                    $d->fforce("");
+                    last SEARCH;
+                }
+            }
+            delete $self->{is_tested}{$dbd};
+        }
+        return ();
+    } else {
+        return @sorted;
+    }
 }
 
 #-> sub CPAN::set_perl5lib
@@ -1702,7 +1721,9 @@ C<$CPAN::Config-E<gt>{cpan_home}/Bundle> directory. The file contains
 a list of all modules that are both available from CPAN and currently
 installed within @INC. Duplicates of each distribution are suppressed.
 The name of the bundle file is based on the current date and a
-counter.
+counter, e.g. F<Bundle/Snapshot_2012_05_21_00.pm>. This is installed
+again by running C<cpan Bundle::Snapshot_2012_05_21_00>, or installing
+C<Bundle::Snapshot_2012_05_21_00> from the CPAN shell.
 
 Return value: path to the written file.
 
@@ -1716,6 +1737,21 @@ activities. The data for this is collected in the YAML file
 C<FTPstats.yml> in your C<cpan_home> directory. If no YAML module is
 configured or YAML not installed, no stats are provided.
 
+=over
+
+=item install_tested
+
+Install all distributions that have been tested successfully but have
+not yet been installed. See also C<is_tested>.
+
+=item is_tested
+
+List all buid directories of distributions that have been tested
+successfully but have not yet been installed. See also
+C<install_tested>.
+
+=back
+
 =head2 mkmyconfig
 
 mkmyconfig() writes your own CPAN::MyConfig file into your C<~/.cpan/>
@@ -2882,11 +2918,6 @@ its dependencies, use CPAN::Shell->install.
 
 Note that install() gives no meaningful return value. See uptodate().
 
-=item CPAN::Distribution::install_tested()
-
-Install all distributions that have tested successfully but
-not yet installed. See also C<is_tested>.
-
 =item CPAN::Distribution::isa_perl()
 
 Returns 1 if this distribution file seems to be a perl distribution.
@@ -3432,7 +3463,7 @@ annoying that so many distributions need some interactive configuring. So
 what you can try to accomplish in your private bundle file is to have the
 packages that need to be configured early in the file and the gentle
 ones later, so you can go out for coffee after a few minutes and leave CPAN.pm
-to churn away untended.
+to churn away unattended.
 
 =head1 WORKING WITH CPAN.pm BEHIND FIREWALLS
 
@@ -3770,7 +3801,7 @@ yourself.
 
 =head2 OLD PERL VERSIONS
 
-CPAN.pm is regularly tested to run under 5.004, 5.005, and assorted
+CPAN.pm is regularly tested to run under 5.005 and assorted
 newer versions. It is getting more and more difficult to get the
 minimal prerequisites working on older perls. It is close to
 impossible to get the whole Bundle::CPAN working there. If you're in
@@ -3834,4 +3865,8 @@ your operating system) then typing C<cpan> in a console window will
 work for you as well. Above that the utility provides several
 commandline shortcuts.
 
+melezhik (Alexey) sent me a link where he published a chef recipe to
+work with CPAN.pm: http://community.opscode.com/cookbooks/cpan.
+
+
 =cut
index e7360f8..92f7990 100644 (file)
@@ -228,7 +228,8 @@ Going to $meth that.
         $self->debug("type[$type] s[$s]") if $CPAN::DEBUG;
         my $obj = $CPAN::META->instance($type,$s);
         $obj->{reqtype} = $self->{reqtype};
-        $obj->$meth();
+        # $obj->$meth();
+       CPAN::Queue->queue_item(qmod => $obj->id, reqtype => $self->{reqtype});
     }
 }
 
index 23c4a36..48e394b 100644 (file)
@@ -71,6 +71,10 @@ sub debug {
 
 __END__
 
+=head1 NAME
+
+CPAN::Debug - internal debugging for CPAN.pm
+
 =head1 LICENSE
 
 This program is free software; you can redistribute it and/or
index 32648ec..5a83774 100644 (file)
@@ -321,6 +321,10 @@ sub get {
                                         );
                 return 1;
             }
+            if (exists $self->{build_dir} && ! -d $self->{build_dir}){
+                # we have lost it.
+                $self->fforce(""); # no method to reset all phases but not set force (dodge)
+            }
 
             # although we talk about 'force' we shall not test on
             # force directly. New model of force tries to refrain from
@@ -516,8 +520,8 @@ See also http://rt.cpan.org/Ticket/Display.html?id=38932\n");
         chmod 0777 &~ umask, $packagedir; # may fail
         my $f;
         for $f (@dirents) { # is already without "." and ".."
-            my $from = File::Spec->catdir($from_dir,$f);
-            my $to = File::Spec->catdir($packagedir,$f);
+            my $from = File::Spec->catfile($from_dir,$f);
+            my $to = File::Spec->catfile($packagedir,$f);
             unless (File::Copy::move($from,$to)) {
                 my $err = $!;
                 $from = File::Spec->rel2abs($from);
@@ -604,7 +608,7 @@ sub pick_meta_file {
     push @choices, 'META.yml' if $has_cm || $has_pcm;
 
     for my $file ( grep { /$filter/ } @choices ) {
-        my $path = File::Spec->catdir( $build_dir, $file );
+        my $path = File::Spec->catfile( $build_dir, $file );
         return $path if -f $path
     }
 
@@ -773,6 +777,7 @@ sub choose_MM_or_MB {
     return $self;
 }
 
+# see also reanimate_build_dir
 #-> CPAN::Distribution::store_persistent_state
 sub store_persistent_state {
     my($self) = @_;
@@ -783,8 +788,8 @@ sub store_persistent_state {
                                     "will not store persistent state\n");
         return;
     }
-    unless (File::Spec->canonpath(File::Basename::dirname($dir))
-            eq File::Spec->canonpath($CPAN::Config->{build_dir})) {
+    unless (   Cwd::realpath(File::Spec->catdir($dir, File::Spec->updir()) )
+            eq Cwd::realpath($CPAN::Config->{build_dir}                  ) ) {
         $CPAN::Frontend->mywarnonce("Directory '$dir' not below $CPAN::Config->{build_dir}, ".
                                     "will not store persistent state\n");
         return;
@@ -1173,6 +1178,7 @@ sub untar_me {
     if ($result) {
         $self->{unwrapped} = CPAN::Distrostatus->new("YES");
     } else {
+        # unfortunately we have no $@ here, Tarzip is using mydie which dies with "\n"
         $self->{unwrapped} = CPAN::Distrostatus->new("NO -- untar failed");
     }
 }
@@ -1859,12 +1865,8 @@ is part of the perl-%s distribution. To install that, you need to run
         return;
     }
 
-    my %env;
-    while (my($k,$v) = each %ENV) {
-        next unless defined $v;
-        $env{$k} = $v;
-    }
-    local %ENV = %env;
+    local $ENV{PERL_AUTOINSTALL} = $ENV{PERL_AUTOINSTALL};
+    local $ENV{PERL_EXTUTILS_AUTOINSTALL} = $ENV{PERL_EXTUTILS_AUTOINSTALL};
     if ($CPAN::Config->{prerequisites_policy} eq "follow") {
         $ENV{PERL_AUTOINSTALL}          ||= "--defaultdeps";
         $ENV{PERL_EXTUTILS_AUTOINSTALL} ||= "--defaultdeps";
@@ -1874,6 +1876,8 @@ is part of the perl-%s distribution. To install that, you need to run
     if ($self->prefs->{pl}) {
         $pl_commandline = $self->prefs->{pl}{commandline};
     }
+    local $ENV{PERL} = $ENV{PERL};
+    local $ENV{PERL5_CPAN_IS_EXECUTING} = $ENV{PERL5_CPAN_IS_EXECUTING};
     if ($pl_commandline) {
         $system = $pl_commandline;
         $ENV{PERL} = $^X;
@@ -1881,7 +1885,11 @@ is part of the perl-%s distribution. To install that, you need to run
         $system = $self->{'configure'};
     } elsif ($self->{modulebuild}) {
         my($perl) = $self->perl or die "Couldn\'t find executable perl\n";
-        $system = "$perl Build.PL $CPAN::Config->{mbuildpl_arg}";
+        my $mbuildpl_arg = $self->_make_phase_arg("pl");
+        $system = sprintf("%s Build.PL%s",
+                          $perl,
+                          $mbuildpl_arg ? " $mbuildpl_arg" : "",
+                         );
     } else {
         my($perl) = $self->perl or die "Couldn\'t find executable perl\n";
         my $switch = "";
@@ -1902,11 +1910,7 @@ is part of the perl-%s distribution. To install that, you need to run
     if ($self->prefs->{pl}) {
         $pl_env = $self->prefs->{pl}{env};
     }
-    if ($pl_env) {
-        for my $e (keys %$pl_env) {
-            $ENV{$e} = $pl_env->{$e};
-        }
-    }
+    local @ENV{keys %$pl_env} = values %$pl_env if $pl_env;
     if (exists $self->{writemakefile}) {
     } else {
         local($SIG{ALRM}) = sub { die "inactivity_timeout reached\n" };
@@ -1998,7 +2002,7 @@ is part of the perl-%s distribution. To install that, you need to run
                 return $self->goodbye("$system -- NOT OK");
             }
         }
-        if (-f "Makefile" || -f "Build") {
+        if (-f "Makefile" || -f "Build" || ($^O eq 'VMS' && (-f 'descrip.mms' || -f 'Build.com'))) {
             $self->{writemakefile} = CPAN::Distrostatus->new("YES");
             delete $self->{make_clean}; # if cleaned before, enable next
         } else {
@@ -2026,12 +2030,13 @@ is part of the perl-%s distribution. To install that, you need to run
     if ($self->prefs->{make}) {
         $make_commandline = $self->prefs->{make}{commandline};
     }
+    local $ENV{PERL} = $ENV{PERL};
     if ($make_commandline) {
         $system = $make_commandline;
         $ENV{PERL} = CPAN::find_perl();
     } else {
         if ($self->{modulebuild}) {
-            unless (-f "Build") {
+            unless (-f "Build" || ($^O eq 'VMS' && -f 'Build.com')) {
                 my $cwd = CPAN::anycwd();
                 $CPAN::Frontend->mywarn("Alert: no Build file available for 'make $self->{id}'".
                                         " in cwd[$cwd]. Danger, Will Robinson!\n");
@@ -2052,12 +2057,7 @@ is part of the perl-%s distribution. To install that, you need to run
     if ($self->prefs->{make}) {
         $make_env = $self->prefs->{make}{env};
     }
-    if ($make_env) { # overriding the local ENV of PL, not the outer
-                     # ENV, but unlikely to be a risk
-        for my $e (keys %$make_env) {
-            $ENV{$e} = $make_env->{$e};
-        }
-    }
+    local @ENV{keys %$make_env} = values %$make_env if $make_env;
     my $expect_model = $self->_prefs_with_expect("make");
     my $want_expect = 0;
     if ( $expect_model && @{$expect_model->{talk}} ) {
@@ -2760,13 +2760,13 @@ sub unsat_prereq {
                             # DMAKI/DateTime-Calendar-Chinese-0.05.tar.gz
                             # in 2007-03 for 'make install'
                             # and 2008-04: #30464 (for 'make test')
-                            $CPAN::Frontend->mywarn("Warning: Prerequisite ".
-                                                    "'$need_module => $need_version' ".
-                                                    "for '$selfid' already built ".
-                                                    "but the result looks suspicious. ".
-                                                    "Skipping another build attempt, ".
-                                                    "to prevent looping endlessly.\n"
-                                                   );
+                            $CPAN::Frontend->mywarn("Warning: Prerequisite ".
+                                                    "'$need_module => $need_version' ".
+                                                    "for '$selfid' already built ".
+                                                    "but the result looks suspicious. ".
+                                                    "Skipping another build attempt, ".
+                                                    "to prevent looping endlessly.\n"
+                                                   );
                             next NEED;
                         }
                     }
@@ -3205,7 +3205,7 @@ sub test {
         $ENV{PERL} = CPAN::find_perl();
     } elsif ($self->{modulebuild}) {
         $system = sprintf "%s test", $self->_build_command();
-        unless (-e "Build") {
+        unless (-e "Build" || ($^O eq 'VMS' && -e "Build.com")) {
             my $id = $self->pretty_id;
             $CPAN::Frontend->mywarn("Alert: no 'Build' file found while trying to test '$id'");
         }
@@ -3218,21 +3218,11 @@ sub test {
                       $make_test_arg ? " $make_test_arg" : "",
                      );
     my($tests_ok);
-    my %env;
-    while (my($k,$v) = each %ENV) {
-        next unless defined $v;
-        $env{$k} = $v;
-    }
-    local %ENV = %env;
     my $test_env;
     if ($self->prefs->{test}) {
         $test_env = $self->prefs->{test}{env};
     }
-    if ($test_env) {
-        for my $e (keys %$test_env) {
-            $ENV{$e} = $test_env->{$e};
-        }
-    }
+    local @ENV{keys %$test_env} = values %$test_env if $test_env;
     my $expect_model = $self->_prefs_with_expect("test");
     my $want_expect = 0;
     if ( $expect_model && @{$expect_model->{talk}} ) {
@@ -3554,10 +3544,13 @@ sub install {
                 $CPAN::Config->{mbuild_install_build_command} ?
                     $CPAN::Config->{mbuild_install_build_command} :
                         $self->_build_command();
-        $system = sprintf("%s install %s",
+        my $install_directive = $^O eq 'VMS' ? '"install"' : 'install';
+        $system = sprintf("%s %s %s",
                           $mbuild_install_build_command,
+                          $install_directive,
                           $CPAN::Config->{mbuild_install_arg},
                          );
+        
     } else {
         my($make_install_make_command) =
             CPAN::HandleConfig->prefs_lookup($self,
@@ -3569,7 +3562,7 @@ sub install {
                          );
     }
 
-    my($stderr) = $^O eq "MSWin32" ? "" : " 2>&1 ";
+    my($stderr) = $^O eq "MSWin32" || $^O eq 'VMS' ? "" : " 2>&1 ";
     my $brip = CPAN::HandleConfig->prefs_lookup($self,
                                                 q{build_requires_install_policy});
     $brip ||="ask/yes";
@@ -3883,6 +3876,9 @@ sub _build_command {
         my($perl) = $self->perl or $CPAN::Frontend->mydie("Couldn't find executable perl\n");
         return "$perl ./Build";
     }
+    elsif ($^O eq 'VMS') {
+        return "$^X Build.com";
+    }
     return "./Build";
 }
 
index 5030ef9..8625b81 100644 (file)
@@ -1029,7 +1029,7 @@ sub init {
         and $^O ne "MSWin32") {
         # as long as Windows needs $self->_build_command, we cannot
         # support sudo on windows :-)
-        my $default = "./Build";
+        my $default = $^O eq 'VMS' ? '@Build.com' : "./Build";
         if ( $CPAN::Config->{install_help} eq 'sudo' ) {
             if ( find_exe('sudo') ) {
                 $default = "sudo $default";
index 09c42ef..2978c3b 100644 (file)
@@ -6,6 +6,12 @@ use File::Spec ();
 use File::Basename ();
 use Carp ();
 
+=head1 NAME
+
+CPAN::HandleConfig - internal configuration handling for CPAN.pm
+
+=cut 
+
 $VERSION = "5.5003"; # see also CPAN::Config::VERSION at end of file
 
 %can = (
@@ -527,7 +533,8 @@ sub cpan_home_dir_candidates {
     push @dirs, $ENV{USERPROFILE} if $ENV{USERPROFILE};
 
     $CPAN::Config->{load_module_verbosity} = $old_v;
-    @dirs = map { "$_/.cpan" } grep { defined } @dirs;
+    my $dotcpan = $^O eq 'VMS' ? '_cpan' : '.cpan';
+    @dirs = map { File::Spec->catdir($_, $dotcpan) } grep { defined } @dirs;
     return wantarray ? @dirs : $dirs[0];
 }
 
index af98d7b..c338cc7 100644 (file)
@@ -126,7 +126,7 @@ sub reanimate_build_dir {
     my @candidates = map { $_->[0] }
         sort { $b->[1] <=> $a->[1] }
             map { [ $_, -M File::Spec->catfile($d,$_) ] }
-                grep {/\.yml$/} readdir $dh;
+                grep {/(.+)\.yml$/ && -d File::Spec->catfile($d,$1)} readdir $dh;
     unless (@candidates) {
         $CPAN::Frontend->myprint("Build_dir empty, nothing to restore\n");
         return;
index daafc1d..38e0043 100644 (file)
@@ -508,7 +508,7 @@ sub url {
 sub ping {
     my $self = shift;
 
-    my $ping = Net::Ping->new("tcp",1);
+    my $ping = Net::Ping->new($^O eq 'VMS' ? 'icmp' : 'tcp', 1);
     my ($proto) = $self->url =~ m{^([^:]+)};
     my $port = $proto eq 'http' ? 80 : 21;
     return unless $port;
index e5d88ce..1222b37 100644 (file)
@@ -201,6 +201,10 @@ sub reqtype_of {
 
 __END__
 
+=head1 NAME
+
+CPAN::Queue - internal queue support for CPAN.pm
+
 =head1 LICENSE
 
 This program is free software; you can redistribute it and/or
index 972df6c..708a579 100644 (file)
@@ -343,10 +343,20 @@ Can't continue cutting file '$file'.
             }
             $system = qq{$tarcommand x${tar_verb}f "$file"};
             $CPAN::Frontend->myprint(qq{Using Tar:$system:\n});
-            if (system($system)==0) {
+            my $ret = system($system);
+            if ($ret==0) {
                 $CPAN::Frontend->myprint(qq{Untarred $file successfully\n});
             } else {
-                $CPAN::Frontend->mydie(qq{Couldn\'t untar $file\n});
+                if ($? == -1) {
+                    $CPAN::Frontend->mydie(sprintf qq{Couldn\'t untar %s: '%s'\n},
+                                           $file, $!);
+                } elsif ($? & 127) {
+                    $CPAN::Frontend->mydie(sprintf qq{Couldn\'t untar %s: child died with signal %d, %s coredump\n},
+                                           $file, ($? & 127),  ($? & 128) ? 'with' : 'without');
+                } else {
+                    $CPAN::Frontend->mydie(sprintf qq{Couldn\'t untar %s: child exited with value %d\n},
+                                           $file, $? >> 8);
+                }
             }
             return 1;
         } else {
@@ -450,6 +460,10 @@ END
 
 __END__
 
+=head1 NAME
+
+CPAN::Tarzip - internal handling of tar archives for CPAN.pm
+
 =head1 LICENSE
 
 This program is free software; you can redistribute it and/or
index 2cbcf89..7745d46 100644 (file)
@@ -304,9 +304,6 @@ lib/benchmark.pm    Verbatim line length including indents exceeds 79 by    4
 lib/class/struct.pm    Verbatim line length including indents exceeds 79 by    7
 lib/config.pod ? Should you be using L<...> instead of -1
 lib/config.pod nested commands F<...F<...>...> 3
-lib/cpan/debug.pm      There is no NAME        1
-lib/cpan/handleconfig.pm       =head2 without preceding higher level   1
-lib/cpan/handleconfig.pm       There is no NAME        1
 lib/db.pm      Verbatim line length including indents exceeds 79 by    2
 lib/dbm_filter.pm      Verbatim line length including indents exceeds 79 by    1
 lib/dbm_filter/compress.pm     Verbatim line length including indents exceeds 79 by    1