Skip to content

Commit

Permalink
For VMS: fixed prefix handling plus other test fixes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.perl.org/modules/Module-Build/trunk@13862 50811bd7-b8ce-0310-adc1-d9db26280581
  • Loading branch information
xdg committed Mar 16, 2010
1 parent 5e59015 commit 8734b47
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -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
Expand Down
21 changes: 20 additions & 1 deletion lib/Module/Build/Platform/VMS.pm
Expand Up @@ -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.
Expand All @@ -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) ) {
Expand Down
12 changes: 5 additions & 7 deletions t/compat.t
Expand Up @@ -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,
},
);

Expand All @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions t/properties/share_dir.t
Expand Up @@ -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',
Expand All @@ -187,6 +192,8 @@ is_deeply(
"share_dir files copied to blib"
);

}

#--------------------------------------------------------------------------#
# test installing
#--------------------------------------------------------------------------#
Expand All @@ -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",
Expand All @@ -210,6 +222,8 @@ is_deeply(
"share_dir files correctly installed"
);

}

#--------------------------------------------------------------------------#
# test with File::ShareDir
#--------------------------------------------------------------------------#
Expand Down

0 comments on commit 8734b47

Please sign in to comment.