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:
: 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
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;
CPANPLUS::Internals::Report
];
-$VERSION = "0.78";
+$VERSION = "0.79_01";
=pod
=> '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';
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;
},
use CPANPLUS::Error;
use CPANPLUS::Configure;
-
+use CPANPLUS::Internals::Constants;
use Module::Load qw[load];
use Params::Check qw[check];
use vars qw[@ISA $SHELL $DEFAULT];
-$DEFAULT = 'CPANPLUS::Shell::Default';
+$DEFAULT = SHELL_DEFAULT;
=pod
BEGIN {
use vars qw[ $VERSION @ISA ];
@ISA = qw[ CPANPLUS::Shell::_Base::ReadLine ];
- $VERSION = "0.78";
+ $VERSION = "0.79_01";
}
load CPANPLUS::Shell;
--- /dev/null
+### 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" );
+
use strict;
use CPANPLUS::Backend;
+use CPANPLUS::Internals::Constants;
use Test::More 'no_plan';
use Data::Dumper;
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.
### 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 );
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
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_
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
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
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.;
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
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[
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$`#@=_^*
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=<@&
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
_clean_test_dir( [
$conf->get_conf('base'),
+ TEST_CONF_MIRROR_DIR,
# TEST_INSTALL_DIR_LIB,
# TEST_INSTALL_DIR_BIN,
# TEST_INSTALL_DIR_MAN1,
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..