From 8734b47d75aeb494ddcfa4de44fad58639d0862d Mon Sep 17 00:00:00 2001 From: David Golden Date: Tue, 16 Mar 2010 23:50:05 +0000 Subject: [PATCH] For VMS: fixed prefix handling plus other test fixes git-svn-id: http://svn.perl.org/modules/Module-Build/trunk@13862 50811bd7-b8ce-0310-adc1-d9db26280581 --- Changes | 2 ++ lib/Module/Build/Platform/VMS.pm | 21 ++++++++++++++++++++- t/compat.t | 12 +++++------- t/properties/share_dir.t | 14 ++++++++++++++ 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/Changes b/Changes index eee85a7d..596765bc 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ Revision history for Perl extension Module::Build. - Sets $ENV{HOME} to a temporary directory during testing [David Golden] + - For VMS: fixed prefix handling plus other test fixes [Craig Berry] + 0.3603 - Mon Jan 18 22:28:59 EST 2010 (Oops, I released the last one before I realized this should have been diff --git a/lib/Module/Build/Platform/VMS.pm b/lib/Module/Build/Platform/VMS.pm index b13c0e88..b962cde9 100644 --- a/lib/Module/Build/Platform/VMS.pm +++ b/lib/Module/Build/Platform/VMS.pm @@ -77,10 +77,29 @@ Prefixify taking into account VMS' filepath syntax. =cut # Translated from ExtUtils::MM_VMS::prefixify() + +sub _catprefix { + my($self, $rprefix, $default) = @_; + + my($rvol, $rdirs) = File::Spec->splitpath($rprefix); + if( $rvol ) { + return File::Spec->catpath($rvol, + File::Spec->catdir($rdirs, $default), + '' + ) + } + else { + return File::Spec->catdir($rdirs, $default); + } +} + + sub _prefixify { my($self, $path, $sprefix, $type) = @_; my $rprefix = $self->prefix; + return '' unless defined $path; + $self->log_verbose(" prefixify $path from $sprefix to $rprefix\n"); # Translate $(PERLPREFIX) to a real path. @@ -90,7 +109,7 @@ sub _prefixify { $self->log_verbose(" rprefix translated to $rprefix\n". " sprefix translated to $sprefix\n"); - if( length $path == 0 ) { + if( length($path) == 0 ) { $self->log_verbose(" no path to prefixify.\n") } elsif( !File::Spec->file_name_is_absolute($path) ) { diff --git a/t/compat.t b/t/compat.t index 0a820a93..bb2cc731 100644 --- a/t/compat.t +++ b/t/compat.t @@ -218,23 +218,25 @@ ok $mb, "Module::Build->new_from_context"; (my $libdir2 = $libdir) =~ s/libdir/lbiidr/; my $libarch2 = File::Spec->catdir($libdir2, 'arch'); + my $check_base = $libdir2; + $check_base =~ s/\]\z// if $^O eq 'VMS'; # trim trailing ] for appending other dirs SKIP: { my @cases = ( { label => "INSTALLDIRS=vendor", args => [ 'INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2", "INSTALLVENDORARCH=$libarch2"], - check => qr/\Q$libdir2\E .* Simple\.pm/ix, + check => qr/\Q$check_base\E .* Simple\.pm/ix, }, { label => "PREFIX=\$libdir2", args => [ "PREFIX=$libdir2"], - check => qr/\Q$libdir2\E .* Simple\.pm/ix, + check => qr/\Q$check_base\E .* Simple\.pm/ix, }, { label => "PREFIX=\$libdir2 LIB=mylib", args => [ "PREFIX=$libdir2", "LIB=mylib" ], - check => qr{\Q$libdir2\E[/\\]mylib[/\\]Simple\.pm}ix, + check => qr{\Q$check_base\E[/\\\.]mylib[/\\\]]Simple\.pm}ix, }, ); @@ -244,10 +246,6 @@ ok $mb, "Module::Build->new_from_context"; for my $c (@cases) { my @make_args = @{$c->{args}}; - if ($is_vms_mms) { # VMS MMK/MMS macros use different syntax. - $make_args[0] = '/macro=("' . join('","',@make_args) . '")'; - pop @make_args while scalar(@make_args) > 1; - } ($output) = stdout_stderr_of( sub { $result = $mb->run_perl_script('Makefile.PL', [], \@make_args); diff --git a/t/properties/share_dir.t b/t/properties/share_dir.t index 8cf961db..1d81a0aa 100644 --- a/t/properties/share_dir.t +++ b/t/properties/share_dir.t @@ -179,6 +179,11 @@ ok( -d 'blib/lib/auto/share', "blib/lib/auto/share exists" ); my $share_list = Module::Build->rscan_dir('blib/lib/auto/share', sub {-f}); +SKIP: +{ + +skip 'filename case not necessarily preserved', 1 if $^O eq 'VMS'; + is_deeply( [ sort @$share_list ], [ 'blib/lib/auto/share/dist/Simple-Share/foo.txt', @@ -187,6 +192,8 @@ is_deeply( "share_dir files copied to blib" ); +} + #--------------------------------------------------------------------------# # test installing #--------------------------------------------------------------------------# @@ -202,6 +209,11 @@ $share_list = Module::Build->rscan_dir( "$temp_install/lib/perl5/auto/share", sub {-f} ); +SKIP: +{ + +skip 'filename case not necessarily preserved', 1 if $^O eq 'VMS'; + is_deeply( [ sort @$share_list ], [ "$temp_install/lib/perl5/auto/share/dist/Simple-Share/foo.txt", @@ -210,6 +222,8 @@ is_deeply( "share_dir files correctly installed" ); +} + #--------------------------------------------------------------------------# # test with File::ShareDir #--------------------------------------------------------------------------#