Update CPANPLUS to 0.79_01
Jos I. Boumans [Sun, 22 Apr 2007 10:18:10 +0000 (12:18 +0200)]
From: "Jos I. Boumans" <kane@xs4all.nl>
Message-Id: <BDAACA85-8D3E-4104-9B03-9DB247EDA080@xs4all.nl>

p4raw-id: //depot/perl@31020

20 files changed:
lib/CPANPLUS.pm
lib/CPANPLUS/Config.pm
lib/CPANPLUS/Dist/MM.pm
lib/CPANPLUS/Internals.pm
lib/CPANPLUS/Internals/Constants.pm
lib/CPANPLUS/Selfupdate.pm
lib/CPANPLUS/Shell.pm
lib/CPANPLUS/Shell/Default.pm
lib/CPANPLUS/t/15_CPANPLUS-Shell.t [new file with mode: 0644]
lib/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t
lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz.packed
lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed
lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Foo-Bar-0.01.tar.gz.packed
lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz.packed
lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUXS/Foo-Bar-0.01.tar.gz.packed
lib/CPANPLUS/t/dummy-CPAN/authors/id/M/MB/MBNOXS/Foo-Bar-0.01.tar.gz.packed
lib/CPANPLUS/t/dummy-CPAN/authors/id/M/MB/MBXS/Foo-Bar-0.01.tar.gz.packed
lib/CPANPLUS/t/dummy-CPAN/modules/02packages.details.txt.gz.packed
lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz.packed
lib/CPANPLUS/t/inc/conf.pl

index b30aa7f..16650a7 100644 (file)
@@ -13,7 +13,7 @@ BEGIN {
     use vars        qw( @EXPORT @ISA $VERSION );
     @EXPORT     =   qw( shell fetch get install );
     @ISA        =   qw( Exporter );
-    $VERSION = "0.78";     #have to hardcode or cpan.org gets unhappy
+    $VERSION = "0.79_01";     #have to hardcode or cpan.org gets unhappy
 }
 
 ### purely for backward compatibility, so we can call it from the commandline:
index 2516559..90cc6d3 100644 (file)
@@ -114,80 +114,90 @@ my $Conf = {
                             : can_run('sudo')
                         ),
         ### perlwrapper that allows us to turn on autoflushing                        
-        'perlwrapper'   => (    ### parallel to your cpanp/cpanp-boxed
-                                do { my $f = File::Spec->rel2abs(
-                                        File::Spec->catdir( 
-                                            dirname($0), 'cpanp-run-perl' 
-                                        )
-                                     );
-                                    -e $f ? $f : undef
-                                } ||
-                                
-                                ### parallel to your CPANPLUS.pm:
-                                ### $INC{cpanplus}/../bin/cpanp-run-perl
-                                do { my $f = File::Spec->rel2abs(
-                                        File::Spec->catdir( 
-                                            dirname( $INC{'CPANPLUS.pm'} ),
-                                            '..',   # lib dir
-                                            'bin',  # bin dir
-                                            'cpanp-run-perl' 
-                                        )
-                                     );
-                                    -e $f ? $f : undef
-                                } ||
-                                ### you installed CPANPLUS in a custom prefix,
-                                ### so go paralel to /that/. PREFIX=/tmp/cp
-                                ### would put cpanp-run-perl in /tmp/cp/bin and
-                                ### CPANPLUS.pm in
-                                ### /tmp/cp/lib/perl5/site_perl/5.8.8
-                                do { my $f = File::Spec->rel2abs(
-                                        File::Spec->catdir( 
-                                            dirname( $INC{'CPANPLUS.pm'} ),
-                                            '..', '..', '..', '..', # 4x updir
-                                            'bin',                  # bin dir
-                                            'cpanp-run-perl' 
-                                        )
-                                     );
-                                    -e $f ? $f : undef
-                                } ||
+        'perlwrapper'   => sub{ 
+            my $name = 'cpanp-run-perl';
 
-                                ### in your path -- take this one last, the
-                                ### previous two assume extracted tarballs
-                                ### or user installs
-                                ### note that we don't use 'can_run' as it's
-                                ### not an executable, just a wrapper...
-                                do { my $rv;
-                                     for (split(/\Q$Config::Config{path_sep}\E/, 
-                                                $ENV{PATH}), File::Spec->curdir
-                                     ) {           
-                                        my $path = File::Spec->catfile(
-                                                    $_, 'cpanp-run-perl' );
-                                        if( -e $path ) {
-                                            $rv = $path;
-                                            last;
-                                        }     
-                                    }
-                                    
-                                    $rv || undef;
-                                } ||       
+            my @bins = do{
+                require Config;
+                my $ver  = $Config::Config{version};
+                
+                ### if we are running with 'versiononly' enabled,
+                ### all binaries will have the perlversion appended
+                ### ie, cpanp will become cpanp5.9.5
+                ### so prefer the versioned binary in that case
+                $Config::Config{versiononly}
+                        ? ($name.$ver, $name)
+                        : ($name, $name.$ver);
+            };
+                                
+            my $path;
+            BIN: for my $bin (@bins) {
+                
+                ### parallel to your cpanp/cpanp-boxed
+                my $maybe = File::Spec->rel2abs(
+                                File::Spec->catdir( dirname($0), $bin )
+                            );        
+                $path = $maybe and last BIN if -f $maybe;
+        
+                ### parallel to your CPANPLUS.pm:
+                ### $INC{cpanplus}/../bin/cpanp-run-perl
+                $maybe = File::Spec->rel2abs(
+                            File::Spec->catdir( 
+                                dirname($INC{'CPANPLUS.pm'}),
+                                '..',   # lib dir
+                                'bin',  # bin dir
+                                $bin,   # script
+                            )
+                         );
+                $path = $maybe and last BIN if -f $maybe;
+                         
+                ### you installed CPANPLUS in a custom prefix,
+                ### so go paralel to /that/. PREFIX=/tmp/cp
+                ### would put cpanp-run-perl in /tmp/cp/bin and
+                ### CPANPLUS.pm in
+                ### /tmp/cp/lib/perl5/site_perl/5.8.8
+                $maybe = File::Spec->rel2abs(
+                            File::Spec->catdir( 
+                                dirname( $INC{'CPANPLUS.pm'} ),
+                                '..', '..', '..', '..', # 4x updir
+                                'bin',                  # bin dir
+                                $bin,                   # script
+                            )
+                         );
+                $path = $maybe and last BIN if -f $maybe;
 
-                                ### XXX try to be a no-op instead then.. 
-                                ### cross your fingers...
-                                ### pass '-P' to perl: "run program through C 
-                                ### preprocessor before compilation"
-                                do { 
-                                    error(loc(
-                                        "Could not find the '%1' in your path".
-                                        "--this may be a problem.\n".
-                                        "Please locate this program and set ".
-                                        "your '%1' config entry to its path.\n".                
-                                        "Attempting to provide a reasonable ".
-                                        "fallback...",
-                                        'cpanp-run-perl', 'perlwrapper'
-                                     ));                                        
-                                    '-P'
-                                },   
-                        ),         
+                ### in your path -- take this one last, the
+                ### previous two assume extracted tarballs
+                ### or user installs
+                ### note that we don't use 'can_run' as it's
+                ### not an executable, just a wrapper...
+                for my $dir (split(/\Q$Config::Config{path_sep}\E/, $ENV{PATH}),
+                             File::Spec->curdir
+                ) {             
+                    $maybe = File::Spec->catfile( $dir, $bin );
+                    $path = $maybe and last BIN if -f $maybe;
+                }
+            }          
+                
+            ### we should have a $path by now ideally, if so return it
+            return $path if defined $path;
+            
+            ### if not, warn about it and give sensible default.
+            ### XXX try to be a no-op instead then.. 
+            ### cross your fingers...
+            ### pass '-P' to perl: "run program through C 
+            ### preprocessor before compilation"
+            error(loc(
+                "Could not find the '%1' in your path".
+                "--this may be a problem.\n".
+                "Please locate this program and set ".
+                "your '%1' config entry to its path.\n".                
+                "Attempting to provide a reasonable ".
+                "fallback...",
+                $name, 'perlwrapper'
+             ));                                        
+             return '-P'
+        }->(),         
     },
 
     ### _source, _build and _mirror are supposed to be static
index f61cfc8..86c04dc 100644 (file)
@@ -217,8 +217,7 @@ sub prepare {
         error( loc( "No dir found to operate on!" ) );
         return;
     }
-$DB::single = 1; 
+    
     my $args;
     my( $force, $verbose, $perl, $mmflags );
     {   local $Params::Check::ALLOW_UNKNOWN = 1;
index 0ba2529..17760cb 100644 (file)
@@ -40,7 +40,7 @@ use vars qw[@ISA $VERSION];
             CPANPLUS::Internals::Report
         ];
 
-$VERSION = "0.78";
+$VERSION = "0.79_01";
 
 =pod
 
index 0961e25..4c666ea 100644 (file)
@@ -27,6 +27,9 @@ use constant INSTALLER_SAMPLE
                             => 'CPANPLUS::Dist::Sample';
 use constant INSTALLER_BASE => 'CPANPLUS::Dist::Base';                            
 
+use constant SHELL_DEFAULT  => 'CPANPLUS::Shell::Default';
+use constant SHELL_CLASSIC  => 'CPANPLUS::Shell::Classic';
+
 use constant CONFIG         => 'CPANPLUS::Config';
 use constant CONFIG_USER    => 'CPANPLUS::Config::User';
 use constant CONFIG_SYSTEM  => 'CPANPLUS::Config::System';
index 2271dd4..339d982 100644 (file)
@@ -119,6 +119,13 @@ CPANPLUS::Selfupdate
                 sub { 
                     my $cb      = shift;
                     my $dist    = $cb->configure_object->get_conf('shell');
+                    
+                    ### we bundle these shells, so don't bother having a dep
+                    ### on them... If we don't do this, CPAN.pm actually detects
+                    ### a recursive dependency and breaks (see #26077).
+                    ### This is not an issue for CPANPLUS itself, it handles
+                    ### it smartly.
+                    return if $dist eq SHELL_DEFAULT or $dist eq SHELL_CLASSIC;
                     return { $dist => '0.0' } if $dist;
                     return;
                 },            
index 4128e03..13cb051 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 
 use CPANPLUS::Error;
 use CPANPLUS::Configure;
-
+use CPANPLUS::Internals::Constants;
 
 use Module::Load                qw[load];
 use Params::Check               qw[check];
@@ -14,7 +14,7 @@ $Params::Check::VERBOSE = 1;
 
 use vars qw[@ISA $SHELL $DEFAULT];
 
-$DEFAULT    = 'CPANPLUS::Shell::Default';
+$DEFAULT    = SHELL_DEFAULT;
 
 =pod
 
index c65cb88..c153e73 100644 (file)
@@ -26,7 +26,7 @@ local $Data::Dumper::Indent     = 1; # for dumpering from !
 BEGIN {
     use vars        qw[ $VERSION @ISA ];
     @ISA        =   qw[ CPANPLUS::Shell::_Base::ReadLine ];
-    $VERSION = "0.78";
+    $VERSION = "0.79_01";
 }
 
 load CPANPLUS::Shell;
diff --git a/lib/CPANPLUS/t/15_CPANPLUS-Shell.t b/lib/CPANPLUS/t/15_CPANPLUS-Shell.t
new file mode 100644 (file)
index 0000000..c1e9fbf
--- /dev/null
@@ -0,0 +1,22 @@
+### make sure we can find our conf.pl file
+BEGIN { 
+    use FindBin; 
+    require "$FindBin::Bin/inc/conf.pl";
+}
+
+use strict;
+use Test::More      'no_plan';
+
+use CPANPLUS::Internals::Constants;
+
+
+my $Class = 'CPANPLUS::Shell';
+my $Conf  = gimme_conf();
+
+$Conf->set_conf( shell => SHELL_DEFAULT );
+
+### basic load tests
+use_ok( $Class );
+is( $Class->which,  SHELL_DEFAULT,
+                                "Default shell loaded" );
+
index 79df1df..00b0c45 100644 (file)
@@ -7,6 +7,7 @@ BEGIN {
 use strict;
 
 use CPANPLUS::Backend;
+use CPANPLUS::Internals::Constants;
 use Test::More 'no_plan';
 use Data::Dumper;
 
@@ -33,6 +34,36 @@ my $Prereq      = { $Dep => 0 };
     isa_ok( $su,                $Class );
 }
 
+
+### check specifically if our bundled shells dont trigger a 
+### dependency (see #26077).
+### do this _before_ changing the built in conf!
+{   my $meth = 'modules_for_feature';
+    my $type = 'shell';
+    my $cobj = $CB->configure_object;
+    my $cur  = $cobj->get_conf( $type );
+
+    for my $shell ( SHELL_DEFAULT, SHELL_CLASSIC ) {
+        ok( $cobj->set_conf( $type => $shell ),         
+                            "Testing dependencies for '$shell'" );
+
+        my $rv = $CB->$Acc->$meth( $type => 1);
+        ok( !$rv,           "   No dependencies for '$shell' -- bundled" );
+    }            
+    
+    for my $shell ( 'CPANPLUS::Test::Shell' ) {
+        ok( $cobj->set_conf( $type => $shell ),         
+                            "Testing dependencies for '$shell'" );
+
+        my $rv = $CB->$Acc->$meth( $type => 1 );
+        ok( $rv,            "   Got prereq hash" );
+        isa_ok( $rv,        'HASH',
+                            "   Return value" );
+        is_deeply( $rv, { $shell => '0.0' },
+                            "   With the proper entries" );
+    }
+}        
+
 ### test the feature list
 {   ### start with defining our OWN type of config, as not all mentioned
     ### modules will be present in our bundled package files.
@@ -111,7 +142,7 @@ my $Prereq      = { $Dep => 0 };
         ### declare twice because warnings are hateful
         ### declare in a block to quelch 'sub redefined' warnings.
         { local *CPANPLUS::Selfupdate::Module::install = sub { 1 }; }
-        local *CPANPLUS::Selfupdate::Module::install = sub { 1 };
+          local *CPANPLUS::Selfupdate::Module::install = sub { 1 };
         
         my $meth = 'selfupdate';
         can_ok( $Class,         $meth );
index 7606c3b..b6eb10c 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL("%_EO$4``S`Q;6%I;')C+G1X=`!+S,E,+%9P#8T(5@`#)=>*DM"2S)QB
index 20d4cb2..2f3061a 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL("!1%OT4"`T)U;F1L92U&;V\M0F%R+3`N,#$N=&%R`.V7:V_:,!2&^8I_
index c58d0e1..b777538 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/Foo-Bar-0.01.tar.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL("/8X34("`T9O;RU"87(M,"XP,2YT87(`[9KQ;]I&%,?Y^?Z*1YE$(A5C
index cb93428..e5e7121 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUNOXS/perl5.005_03.tar.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL(`'3DO44``^W/,0J`,`Q`T1RE)Y"T-O4XXN"DB%2]OR(*NNC4[;_E#\F0
index fd16409..bae77dc 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/E/EU/EUXS/Foo-Bar-0.01.tar.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL("`DY34("`T9O;RU"87(M,"XP,2YT87(`[5IK3]M(%,U7YE=<H%5``A.;
index 11ada7e..c817479 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/M/MB/MBNOXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/M/MB/MBNOXS/Foo-Bar-0.01.tar.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL("-<X34(``T9O;RU"87(M,"XP,2YT87(`[9E;;]HP%,=Y]J<X+9722@-R
index 148930e..ac7ead2 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/M/MB/MBXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/M/MB/MBXS/Foo-Bar-0.01.tar.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL("-\X34(``T9O;RU"87(M,"XP,2YT87(`[5K_3QI)%/=7YZ]XU39H(BN[
index 696ae15..6a3f84a 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/modules/02packages.details.txt.gz lib/CPANPLUS/t/dummy-CPAN/modules/02packages.details.txt.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL("-%#OT4``S`R<&%C:V%G97,N9&5T86EL<RYT>'0`E=-1:]LP$`#@=_^*
index e4fb69c..905849e 100644 (file)
@@ -10,7 +10,7 @@ To recreate it use the following command:
 
      uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz.packed
 
-Created at Sat Apr  7 13:06:48 2007
+Created at Sun Apr 22 10:12:09 2007
 #########################################################################
 __UU__
 M'XL("#'FO$4``S`S;6]D;&ES="YD871A`%U3_6O;,!#].?HKCBXC"20A=<@&
index 7ca8747..50c8970 100644 (file)
@@ -66,6 +66,7 @@ use constant TEST_CONF_PREREQ           => 'Cwd';
 use constant TEST_CONF_MODULE           => 'Foo::Bar::EU::NOXS';
 use constant TEST_CONF_INST_MODULE      => 'Foo::Bar';
 use constant TEST_CONF_INVALID_MODULE   => 'fnurk';
+use constant TEST_CONF_MIRROR_DIR       => 'dummy-localmirror';
 
 ### we might need this Some Day when we're installing into
 ### our own sandbox. see t/20.t for details
@@ -114,6 +115,7 @@ sub gimme_conf {
 
     _clean_test_dir( [
         $conf->get_conf('base'),     
+        TEST_CONF_MIRROR_DIR,
 #         TEST_INSTALL_DIR_LIB,
 #         TEST_INSTALL_DIR_BIN,
 #         TEST_INSTALL_DIR_MAN1, 
@@ -123,19 +125,40 @@ sub gimme_conf {
     return $conf;
 };
 
-my $fh;
-my $file = ".".basename($0).".output";
-sub output_handle {
-    return $fh if $fh;
+{
+    my $fh;
+    my $file = ".".basename($0).".output";
+    sub output_handle {
+        return $fh if $fh;
+        
+        $fh = FileHandle->new(">$file")
+                    or warn "Could not open output file '$file': $!";
+       
+        $fh->autoflush(1);
+        return $fh;
+    }
     
-    $fh = FileHandle->new(">$file")
-                or warn "Could not open output file '$file': $!";
-   
-    $fh->autoflush(1);
-    return $fh;
+    sub output_file { return $file }
 }
 
-sub output_file { return $file }
+
+### clean these files if we're under perl core
+END { 
+    if ( $ENV{PERL_CORE} ) {
+        close output_handle(); 1 while unlink output_file();
+
+        _clean_test_dir( [
+            gimme_conf->get_conf('base'),   
+            TEST_CONF_MIRROR_DIR,
+    #         TEST_INSTALL_DIR_LIB,
+    #         TEST_INSTALL_DIR_BIN,
+    #         TEST_INSTALL_DIR_MAN1, 
+    #         TEST_INSTALL_DIR_MAN3,
+        ], 1 );
+    }
+}
+
+
 
 ### whenever we start a new script, we want to clean out our
 ### old files from the test '.cpanplus' dir..