Author: BINGOS
Date: Thu May 7 08:22:12 2009
New Revision: 12747
Removed:
CPANPLUS-Dist-Build/trunk/LICENSE
Modified:
CPANPLUS-Dist-Build/trunk/MANIFEST
CPANPLUS-Dist-Build/trunk/Makefile.PL
CPANPLUS-Dist-Build/trunk/t/02_CPANPLUS-Dist-Build.t
CPANPLUS-Dist-Build/trunk/t/inc/conf.pl
Log:
Updated tests to use conf.pl and dummy-CPAN structure from CPANPLUS to resolve an issue with running under core
Modified: CPANPLUS-Dist-Build/trunk/MANIFEST
==============================================================================
--- CPANPLUS-Dist-Build/trunk/MANIFEST (original)
+++ CPANPLUS-Dist-Build/trunk/MANIFEST Thu May 7 08:22:12 2009
@@ -1,5 +1,6 @@
Changes
inc/Module/Install.pm
+inc/Module/Install/AutoLicense.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
@@ -19,6 +20,9 @@
t/02_CPANPLUS-Dist-Build.t
t/99_pod.t
t/99_pod_coverage.t
+t/dummy-CPAN/authors/01mailrc.txt.gz
+t/dummy-CPAN/modules/02packages.details.txt.gz
+t/dummy-CPAN/modules/03modlist.data.gz
t/dummy-perl/.hidden
t/inc/conf.pl
t/src/noxs/Foo-Bar-0.01.tar.gz
Modified: CPANPLUS-Dist-Build/trunk/Makefile.PL
==============================================================================
--- CPANPLUS-Dist-Build/trunk/Makefile.PL (original)
+++ CPANPLUS-Dist-Build/trunk/Makefile.PL Thu May 7 08:22:12 2009
@@ -6,6 +6,7 @@
abstract 'CPANPLUS plugin to install packages that use Build.PL';
perl_version '5.006';
license 'perl';
+auto_license holder => 'Jos Boumans, Ken Williams, Chris Williams and David Golden';
build_requires 'Test::More' => 0.47;
requires 'Test::Harness' => '3.16';
requires 'CPANPLUS' => '0.84';
Modified: CPANPLUS-Dist-Build/trunk/t/02_CPANPLUS-Dist-Build.t
==============================================================================
--- CPANPLUS-Dist-Build/trunk/t/02_CPANPLUS-Dist-Build.t (original)
+++ CPANPLUS-Dist-Build/trunk/t/02_CPANPLUS-Dist-Build.t Thu May 7 08:22:12 2009
@@ -34,9 +34,15 @@
my $Src = File::Spec->rel2abs(File::Spec->catdir( qw[src] ));
my $Verbose = @ARGV ? 1 : 0;
-my $CB = CPANPLUS::Backend->new;
-my $Conf = $CB->configure_object;
+my $Conf = gimme_conf();
+my $CB = CPANPLUS::Backend->new( $Conf );
+#$Conf->set_conf( base => 'dummy-cpanplus' );
+#$Conf->set_conf( dist_type => '' );
+#$Conf->set_conf( verbose => $Verbose );
+#$Conf->set_conf( signature => 0 );
+### running tests will mess with the test output so skip 'm
+#$Conf->set_conf( skiptest => 1 );
### create a fake object, so we don't use the actual module tree
### make sure to add dslip data, so CPANPLUS doesn't try to find
@@ -50,13 +56,6 @@
dslip => 'RdpO?',
);
-$Conf->set_conf( base => 'dummy-cpanplus' );
-$Conf->set_conf( dist_type => '' );
-$Conf->set_conf( verbose => $Verbose );
-$Conf->set_conf( signature => 0 );
-### running tests will mess with the test output so skip 'm
-$Conf->set_conf( skiptest => 1 );
-
### dmq tells us that we should run with /nologo
### if using nmake, as it's very noise otherwise.
### XXX copied from CPANPLUS' test include file!
Modified: CPANPLUS-Dist-Build/trunk/t/inc/conf.pl
==============================================================================
--- CPANPLUS-Dist-Build/trunk/t/inc/conf.pl (original)
+++ CPANPLUS-Dist-Build/trunk/t/inc/conf.pl Thu May 7 08:22:12 2009
@@ -31,7 +31,7 @@
### and friends get picked up
$old_env_path = $ENV{PATH};
$ENV{'PATH'} = join $Config{'path_sep'},
- grep { defined } "$FindBin::Bin/../../../bin", $ENV{'PATH'};
+ grep { defined } "$FindBin::Bin/../bin", $ENV{'PATH'};
### Fix up the path to perl, as we're about to chdir
### but only under perlcore, or if the path contains delimiters,
@@ -85,16 +85,169 @@
$Locale::Maketext::Lexicon::VERSION = 0;
}
-### clean up files for PERLCORE mostly -- make clean isn't invoked
-### there... otoh, we should clean up after ourselves anyway.
-END {
- ### chdir to our own test dir, so we know all files are relative
- ### to this point, no matter whether run from perlcore tests or
- ### regular CPAN installs
- chdir "$FindBin::Bin" if -d "$FindBin::Bin";
+my $Env = 'PERL5_CPANPLUS_TEST_VERBOSE';
+
+# prereq has to be in our package file && core!
+use constant TEST_CONF_PREREQ => 'Cwd';
+use constant TEST_CONF_MODULE => 'Foo::Bar::EU::NOXS';
+use constant TEST_CONF_MODULE_SUB => 'Foo::Bar::EU::NOXS::Sub';
+use constant TEST_CONF_AUTHOR => 'EUNOXS';
+use constant TEST_CONF_INST_MODULE => 'Foo::Bar';
+use constant TEST_CONF_INVALID_MODULE => 'fnurk';
+use constant TEST_CONF_MIRROR_DIR => 'dummy-localmirror';
+use constant TEST_CONF_CPAN_DIR => 'dummy-CPAN';
+use constant TEST_CONF_CPANPLUS_DIR => 'dummy-cpanplus';
+use constant TEST_CONF_INSTALL_DIR => File::Spec->rel2abs(
+ File::Spec->catdir(
+ TEST_CONF_CPANPLUS_DIR,
+ 'install'
+ )
+ );
+
+### we might need this Some Day when we're installing into
+### our own sandbox. see t/20.t for details
+# use constant TEST_INSTALL_DIR => do {
+# my $dir = File::Spec->rel2abs( 'dummy-perl' );
+#
+# ### clean up paths if we are on win32
+# ### dirs with spaces will be.. bad :(
+# $^O eq 'MSWin32'
+# ? Win32::GetShortPathName( $dir )
+# : $dir;
+# };
+
+# use constant TEST_INSTALL_DIR_LIB
+# => File::Spec->catdir( TEST_INSTALL_DIR, 'lib' );
+# use constant TEST_INSTALL_DIR_BIN
+# => File::Spec->catdir( TEST_INSTALL_DIR, 'bin' );
+# use constant TEST_INSTALL_DIR_MAN1
+# => File::Spec->catdir( TEST_INSTALL_DIR, 'man', 'man1' );
+# use constant TEST_INSTALL_DIR_MAN3
+# => File::Spec->catdir( TEST_INSTALL_DIR, 'man', 'man3' );
+# use constant TEST_INSTALL_DIR_ARCH
+# => File::Spec->catdir( TEST_INSTALL_DIR, 'arch' );
+#
+# use constant TEST_INSTALL_EU_MM_FLAGS =>
+# ' INSTALLDIRS=site' .
+# ' INSTALLSITELIB=' . TEST_INSTALL_DIR_LIB .
+# ' INSTALLSITEARCH=' . TEST_INSTALL_DIR_ARCH . # .packlist
+# ' INSTALLARCHLIB=' . TEST_INSTALL_DIR_ARCH . # perllocal.pod
+# ' INSTALLSITEBIN=' . TEST_INSTALL_DIR_BIN .
+# ' INSTALLSCRIPT=' . TEST_INSTALL_DIR_BIN .
+# ' INSTALLSITEMAN1DIR=' . TEST_INSTALL_DIR_MAN1 .
+# ' INSTALLSITEMAN3DIR=' . TEST_INSTALL_DIR_MAN3;
+
+
+sub dummy_cpan_dir {
+ ### VMS needs this in directory format for rel2abs
+ my $test_dir = $^O eq 'VMS'
+ ? File::Spec->catdir(TEST_CONF_CPAN_DIR)
+ : TEST_CONF_CPAN_DIR;
- ### XXX hardcoded
- _clean_test_dir( [qw|dummy-perl dummy-cpanplus| ] );
+ ### Convert to an absolute file specification
+ my $abs_test_dir = File::Spec->rel2abs($test_dir);
+
+ ### According to John M: the hosts path needs to be in UNIX format.
+ ### File::Spec::Unix->rel2abs does not work at all on VMS
+ $abs_test_dir = VMS::Filespec::unixify( $abs_test_dir ) if $^O eq 'VMS';
+
+ return $abs_test_dir;
+}
+
+sub gimme_conf {
+
+ ### don't load any other configs than the heuristic one
+ ### during tests. They might hold broken/incorrect data
+ ### for our test suite. Bug [perl #43629] showed this.
+ my $conf = CPANPLUS::Configure->new( load_configs => 0 );
+
+ my $dummy_cpan = dummy_cpan_dir();
+
+ $conf->set_conf( hosts => [ {
+ path => $dummy_cpan,
+ scheme => 'file',
+ } ],
+ );
+ $conf->set_conf( base => File::Spec->rel2abs(TEST_CONF_CPANPLUS_DIR));
+ $conf->set_conf( dist_type => '' );
+ $conf->set_conf( signature => 0 );
+ $conf->set_conf( verbose => 1 ) if $ENV{ $Env };
+
+ ### never use a pager in the test suite
+ $conf->set_program( pager => '' );
+
+ ### dmq tells us that we should run with /nologo
+ ### if using nmake, as it's very noisy otherwise.
+ { my $make = $conf->get_program('make');
+ if( $make and basename($make) =~ /^nmake/i ) {
+ $conf->set_conf( makeflags => '/nologo' );
+ }
+ }
+
+ $conf->set_conf( source_engine => $ENV{CPANPLUS_SOURCE_ENGINE} )
+ if $ENV{CPANPLUS_SOURCE_ENGINE};
+
+ _clean_test_dir( [
+ $conf->get_conf('base'),
+ TEST_CONF_MIRROR_DIR,
+# TEST_INSTALL_DIR_LIB,
+# TEST_INSTALL_DIR_BIN,
+# TEST_INSTALL_DIR_MAN1,
+# TEST_INSTALL_DIR_MAN3,
+ ], ( $ENV{PERL_CORE} ? 0 : 1 ) );
+
+ return $conf;
+};
+
+{
+ 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;
+ }
+
+ sub output_file { return $file }
+
+
+
+ ### redirect output from msg() and error() output to file
+ unless( $ENV{$Env} ) {
+
+ print "# To run tests in verbose mode, set ".
+ "\$ENV{$Env} = 1\n" unless $ENV{PERL_CORE};
+
+ 1 while unlink $file; # just in case
+
+ $CPANPLUS::Error::ERROR_FH =
+ $CPANPLUS::Error::ERROR_FH = output_handle();
+
+ $CPANPLUS::Error::MSG_FH =
+ $CPANPLUS::Error::MSG_FH = output_handle();
+
+ }
+}
+
+
+### 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,
+ ], 0 ); # DO NOT be verbose under perl core -- makes tests fail
+ }
}
### whenever we start a new script, we want to clean out our
@@ -115,23 +268,23 @@
my $path = File::Spec->catfile( $dir, $file );
- ### John Malmberg reports yet another VMS issue:
- ### A directory name on VMS in VMS format ends with .dir
- ### when it is referenced as a file.
- ### In UNIX format traditionally PERL on VMS does not remove the
- ### '.dir', however the VMS C library conversion routines do remove
- ### the '.dir' and the VMS C library routines can not handle the
- ### '.dir' being present on UNIX format filenames.
- ### So code doing the fixup has on VMS has to be able to handle both
- ### UNIX format names and VMS format names.
- ### XXX See http://www.xray.mpe.mpg.de/
- ### mailing-lists/perl5-porters/2007-10/msg00064.html
- ### for details -- the below regex could use some touchups
- ### according to John. M.
-
### directory, rmtree it
if( -d $path ) {
+ ### John Malmberg reports yet another VMS issue:
+ ### A directory name on VMS in VMS format ends with .dir
+ ### when it is referenced as a file.
+ ### In UNIX format traditionally PERL on VMS does not remove the
+ ### '.dir', however the VMS C library conversion routines do
+ ### remove the '.dir' and the VMS C library routines can not
+ ### handle the '.dir' being present on UNIX format filenames.
+ ### So code doing the fixup has on VMS has to be able to handle
+ ### both UNIX format names and VMS format names.
+
+ ### XXX See http://www.xray.mpe.mpg.de/
+ ### mailing-lists/perl5-porters/2007-10/msg00064.html
+ ### for details -- the below regex could use some touchups
+ ### according to John. M.
$file =~ s/\.dir$//i if $^O eq 'VMS';
my $dirpath = File::Spec->catdir( $dir, $file );
@@ -153,5 +306,4 @@
return 1;
}
-
1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.