In 20_CPANPLUS-Dist-MM.t fix to unlink calls to unlink all versions of a
file.
In CPANPLUS/Dist/Build/t/inc/conf.pl and CPANPLUS/t/inc/conf.pl,
save and restore PATH and PERL5LIB settings on VMS.
PATH can not be completely restored on VMS if it did not exist due to
limitations in the current interface.
Fix directory cleanup to use catdir() for concatenating directories so
that it works on VMS.
Fix unlink where needed to unlink all versions.
This leaves me with only 08_cpanplus-backend.t with a failing test on VMS.
-John
[EMAIL PROTECTED]
Personal Opinion Only
--- /rsync_root/perl/lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t Sun Jun 17
07:53:30 2007
+++ lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t Sat Sep 8 23:41:09 2007
@@ -255,9 +255,11 @@
" Prior existance noted" );
### ok, unlink the makefile.pl, now really write one
- unlink $makefile;
+ 1 while unlink $makefile;
- ok( unlink($makefile_pl), "Deleting Makefile.PL");
+ my $unlink_sts = unlink($makefile_pl);
+ 1 while unlink $makefile_pl;
+ ok( $unlink_sts, "Deleting Makefile.PL");
ok( !-s $makefile_pl, " Makefile.PL deleted" );
ok( !-s $makefile, " Makefile deleted" );
ok($dist->write_makefile_pl," Makefile.PL written" );
@@ -298,8 +300,8 @@
{ local $^W;
local *CPANPLUS::Dist::MM::write_makefile_pl = sub { 1 };
- unlink $makefile_pl;
- unlink $makefile;
+ 1 while unlink $makefile_pl;
+ 1 while unlink $makefile;
ok(!-s $makefile_pl, "Makefile.PL deleted" );
ok(!-s $makefile, "Makefile deleted" );
@@ -331,7 +333,9 @@
}
### clean up afterwards ###
- ok( unlink($makefile_pl), "Deleting Makefile.PL");
+ $unlink_sts = unlink($makefile_pl);
+ 1 while unlink $makefile_pl;
+ ok( $unlink_sts, "Deleting Makefile.PL");
$dist->status->mk_flush;
}
--- /rsync_root/perl/lib/CPANPLUS/Dist/Build/t/inc/conf.pl Thu May 24
10:13:33 2007
+++ lib/CPANPLUS/Dist/Build/t/inc/conf.pl Sun Sep 9 00:11:29 2007
@@ -1,4 +1,7 @@
### XXX copied from cpanplus's t/inc/conf.pl
+
+my ($old_path, $old_perl5lib);
+
BEGIN {
use FindBin;
use File::Spec;
@@ -21,11 +24,13 @@
use Config;
### and add them to the environment, so shellouts get them
+ $old_perl5lib = $ENV{'PERL5LIB'};
$ENV{'PERL5LIB'} = join ':',
grep { defined } $ENV{'PERL5LIB'}, @paths, @rel2abs;
### add our own path to the front of $ENV{PATH}, so that cpanp-run-perl
### and friends get picked up
+ $old_path = $ENV{PATH};
$ENV{'PATH'} = join $Config{'path_sep'},
grep { defined } "$FindBin::Bin/../../../bin",
$ENV{'PATH'};
@@ -41,6 +46,23 @@
chdir "$FindBin::Bin" if -d "$FindBin::Bin"
}
+END {
+ if ($^O eq 'VMS') {
+ # VMS environment variables modified by this test need to be put back
+ # path is "magic" on VMS, we can not tell if it really existed before
+ # this was run, because VMS will magically pretend that a PATH
+ # environment variable exists set to the current working directory
+ $ENV{PATH} = $old_path;
+
+
+ if (defined $old_perl5lib) {
+ $ENV{PERL5LIB} = $old_perl5lib;
+ } else {
+ delete $ENV{PERL5LIB};
+ }
+ }
+}
+
BEGIN {
use IPC::Cmd;
@@ -91,12 +113,15 @@
next if $file =~ /^\./; # skip dot files
my $path = File::Spec->catfile( $dir, $file );
+ $file =~ s/\.dir//i if $^O eq 'VMS';
+ my $dirpath = File::Spec->catdir( $dir, $file );
### directory, rmtree it
- if( -d $path ) {
- print "Deleting directory '$path'\n" if $verbose;
- eval { rmtree( $path ) };
- warn "Could not delete '$path' while cleaning up '$dir'" if $@;
+ if( -d $dirpath ) {
+ print "Deleting directory '$dirpath'\n" if $verbose;
+ eval { rmtree( $dirpath ) };
+ warn "Could not delete '$dirpath' while cleaning up '$dir'"
+ if $@;
### regular file
} else {
@@ -228,12 +253,15 @@
next if $file =~ /^\./; # skip dot files
my $path = File::Spec->catfile( $dir, $file );
+ $file =~ s/\.dir//i if $^O eq 'VMS';
+ my $dirpath = File::Spec->catdir( $dir, $file );
### directory, rmtree it
- if( -d $path ) {
- print "Deleting directory '$path'\n" if $verbose;
- eval { rmtree( $path ) };
- warn "Could not delete '$path' while cleaning up '$dir'" if $@;
+ if( -d $dirpath ) {
+ print "Deleting directory '$dirpath'\n" if $verbose;
+ eval { rmtree( $dirpath ) };
+ warn "Could not delete '$dirpath' while cleaning up '$dir'"
+ if $@;
### regular file
} else {
--- /rsync_root/perl/lib/CPANPLUS/t/inc/conf.pl Wed Aug 15 11:20:35 2007
+++ lib/CPANPLUS/t/inc/conf.pl Sun Sep 9 00:44:01 2007
@@ -1,3 +1,5 @@
+my ($old_path, $old_perl5lib);
+
BEGIN {
use FindBin;
use File::Spec;
@@ -20,11 +22,13 @@
use Config;
### and add them to the environment, so shellouts get them
+ $old_perl5lib = $ENV{'PERL5LIB'};
$ENV{'PERL5LIB'} = join ':',
grep { defined } $ENV{'PERL5LIB'}, @paths, @rel2abs;
### add our own path to the front of $ENV{PATH}, so that cpanp-run-perl
### and friends get picked up
+ $old_path = $ENV{PATH};
$ENV{'PATH'} = join $Config{'path_sep'},
grep { defined } "$FindBin::Bin/../bin", $ENV{'PATH'};
@@ -40,6 +44,22 @@
chdir "$FindBin::Bin" if -d "$FindBin::Bin"
}
+END {
+ if ($^O eq 'VMS') {
+ # VMS environment variables modified by this test need to be put back
+ # path is "magic" on VMS, we can not tell if it really existed before
+ # this was run, because VMS will magically pretend that a PATH
+ # environment variable exists set to the current working directory
+ $ENV{PATH} = $old_path;
+
+ if (defined $old_perl5lib) {
+ $ENV{PERL5LIB} = $old_perl5lib;
+ } else {
+ delete $ENV{PERL5LIB};
+ }
+ }
+}
+
BEGIN {
use IPC::Cmd;
@@ -164,7 +184,7 @@
print "# To run tests in verbose mode, set ".
"\$ENV{PERL5_CPANPLUS_TEST_VERBOSE} = 1\n" unless
$ENV{PERL_CORE};
- unlink $file; # just in case
+ 1 while unlink $file; # just in case
$CPANPLUS::Error::ERROR_FH =
$CPANPLUS::Error::ERROR_FH = output_handle();
@@ -211,12 +231,15 @@
next if $file =~ /^\./; # skip dot files
my $path = File::Spec->catfile( $dir, $file );
+ $file =~ s/\.dir//i if $^O eq 'VMS';
+ my $dirpath = File::Spec->catdir( $dir, $file );
### directory, rmtree it
- if( -d $path ) {
- print "# Deleting directory '$path'\n" if $verbose;
- eval { rmtree( $path ) };
- warn "Could not delete '$path' while cleaning up '$dir'" if $@;
+ if( -d $dirpath ) {
+ print "# Deleting directory '$dirpath'\n" if $verbose;
+ eval { rmtree( $dirpath ) };
+ warn "Could not delete '$dirpath' while cleaning up '$dir'"
+ if $@;
### regular file
} else {