From 75046b50a1b0efea921a9354445e2fac09ba378f Mon Sep 17 00:00:00 2001 From: "John E. Malmberg" Date: Sun, 11 Nov 2007 16:08:08 -0600 Subject: [PATCH] Re: CPANPLUS conf.pl fixes for VMS From: "John E. Malmberg" Message-id: <4737D1A8.8010601@qsl.net> p4raw-id: //depot/perl@32284 --- lib/CPANPLUS/Config.pm | 13 +++++++++---- lib/CPANPLUS/Dist/Build/t/inc/conf.pl | 28 ++++++++++++++++------------ lib/CPANPLUS/t/inc/conf.pl | 8 ++++---- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/lib/CPANPLUS/Config.pm b/lib/CPANPLUS/Config.pm index f9f5391..89de280 100644 --- a/lib/CPANPLUS/Config.pm +++ b/lib/CPANPLUS/Config.pm @@ -555,17 +555,17 @@ with CPANPLUS, which is used to enable autoflushing in spawned processes. my $path; BIN: for my $bin (@bins) { - + ### parallel to your cpanp/cpanp-boxed my $maybe = File::Spec->rel2abs( - File::Spec->catdir( dirname($0), $bin ) + File::Spec->catfile( 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( + File::Spec->catfile( dirname($INC{'CPANPLUS.pm'}), '..', # lib dir 'bin', # bin dir @@ -580,7 +580,7 @@ with CPANPLUS, which is used to enable autoflushing in spawned processes. ### CPANPLUS.pm in ### /tmp/cp/lib/perl5/site_perl/5.8.8 $maybe = File::Spec->rel2abs( - File::Spec->catdir( + File::Spec->catfile( dirname( $INC{'CPANPLUS.pm'} ), '..', '..', '..', '..', # 4x updir 'bin', # bin dir @@ -599,6 +599,11 @@ with CPANPLUS, which is used to enable autoflushing in spawned processes. split(/\Q$Config::Config{path_sep}\E/, $ENV{PATH}), File::Spec->curdir, ) { + + ### On VMS the path could be in UNIX format, and we + ### currently need it to be in VMS format + $dir = VMS::Filespec::vmspath($dir) if ON_VMS; + $maybe = File::Spec->catfile( $dir, $bin ); $path = $maybe and last BIN if -f $maybe; } diff --git a/lib/CPANPLUS/Dist/Build/t/inc/conf.pl b/lib/CPANPLUS/Dist/Build/t/inc/conf.pl index f7179e0..bd75428 100644 --- a/lib/CPANPLUS/Dist/Build/t/inc/conf.pl +++ b/lib/CPANPLUS/Dist/Build/t/inc/conf.pl @@ -31,7 +31,7 @@ BEGIN { ### 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, @@ -62,10 +62,10 @@ END { ### 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; + $ENV{PATH} = $old_env_path; - if (defined $old_perl5lib) { - $ENV{PERL5LIB} = $old_perl5lib; + if (defined $old_env_perl5lib) { + $ENV{PERL5LIB} = $old_env_perl5lib; } else { delete $ENV{PERL5LIB}; } @@ -127,16 +127,20 @@ sub _clean_test_dir { ### 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 ); - + ### according to John. M. + ### 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 $@; + + $file =~ s/\.dir$//i if $^O eq 'VMS'; + + ### Need a path specification here, not a file. + my $dirpath = File::Spec->catdir( $dir, $file ); + + print "# Deleting directory '$dirpath'\n" if $verbose; + eval { rmtree( $dirpath ) }; + warn "Could not delete '$dirpath' while cleaning up '$dir'" + if $@; ### regular file } else { diff --git a/lib/CPANPLUS/t/inc/conf.pl b/lib/CPANPLUS/t/inc/conf.pl index fe6a20f..ba1b002 100644 --- a/lib/CPANPLUS/t/inc/conf.pl +++ b/lib/CPANPLUS/t/inc/conf.pl @@ -62,10 +62,10 @@ END { ### 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; + $ENV{PATH} = $old_env_path; - if (defined $old_perl5lib) { - $ENV{PERL5LIB} = $old_perl5lib; + if (defined $old_env_perl5lib) { + $ENV{PERL5LIB} = $old_env_perl5lib; } else { delete $ENV{PERL5LIB}; } @@ -272,7 +272,7 @@ sub _clean_test_dir { ### 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'; + $file =~ s/\.dir$//i if $^O eq 'VMS'; my $dirpath = File::Spec->catdir( $dir, $file ); -- 2.7.4