Subject: | Add support for VMS Unix and extended character set modes |
Update MakeMaker and recurs.t test for VMS in either Unix compatible
mode, or filenames using Extended character sets.
Note: MakeMaker was still using the eliminate_macros() and fixpath() in
File::Spec::VMS before this patch.
Subject: | extutils_mm.patch |
--- /rsync_root/perl/lib/Extutils/MM_Unix.pm Sat Dec 20 10:29:08 2008
+++ lib/Extutils/MM_Unix.pm Sun Jan 4 11:14:37 2009
@@ -26,6 +26,10 @@
$Is{Win32} = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare';
$Is{Dos} = $^O eq 'dos';
$Is{VMS} = $^O eq 'VMS';
+ $Is{VMS_mode} = $Is{VMS}; # VMS returning file specs in VMS format;
+ $Is{VMS_unix} = 0; # VMS returning file specs in UNIX format;
+ $Is{VMS_lc} = $Is{VMS}; # VMS returning lower case file specs.
+ $Is{VMS_noefs} = $Is{VMS}; # VMS not using extended character set
$Is{OSF} = $^O eq 'dec_osf';
$Is{IRIX} = $^O eq 'irix';
$Is{NetBSD} = $^O eq 'netbsd';
@@ -43,6 +47,26 @@
# For things like vmsify()
require VMS::Filespec;
VMS::Filespec->import;
+ my $vms_unix_rpt;
+ my $vms_efs;
+ my $vms_case;
+
+ if (eval { local $SIG{__DIE__}; require VMS::Feature; }) {
+ $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
+ $vms_efs = VMS::Feature::current("efs_charset");
+ $vms_case = VMS::Feature::current("efs_case_preserve");
+ } else {
+ my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+ my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
+ my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || '';
+ $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i;
+ $vms_efs = $efs_charset =~ /^[ET1]/i;
+ $vms_case = $efs_case =~ /^[ET1]/i;
+ }
+ $Is{VMS_mode} = 0 if $vms_unix_rpt;
+ $Is{VMS_unix} = 1 if $vms_unix_rpt;
+ $Is{VMS_lc} = 0 if ($vms_case);
+ $Is{VMS_noefs} = 0 if ($vms_efs);
}
}
@@ -1179,9 +1203,13 @@
my($old, $new) = @_;
foreach my $file ($old, $new) {
- if( $Is{VMS} and basename($file) !~ /\./ ) {
+ if( $Is{VMS_noefs} and basename($file) !~ /\./ ) {
# rename() in 5.8.0 on VMS will not rename a file if it
# does not contain a dot yet it returns success.
+
+ # Do not do this if extended file specifications active.
+ # As this will break some translations and rename() does not
+ # have this problem on versions that support efs.
$file = "$file.";
}
}
@@ -1260,10 +1288,10 @@
my %ignore = map {( $_ => 1 )} qw(Makefile.PL Build.PL test.pl t);
# ignore the distdir
- $Is{VMS} ? $ignore{"$self->{DISTVNAME}.dir"} = 1
- : $ignore{$self->{DISTVNAME}} = 1;
+ $Is{VMS_mode} ? $ignore{"$self->{DISTVNAME}.dir"} = 1
+ : $ignore{$self->{DISTVNAME}} = 1;
- @ignore{map lc, keys %ignore} = values %ignore if $Is{VMS};
+ @ignore{map lc, keys %ignore} = values %ignore if $Is{VMS_lc};
foreach my $name ($self->lsdir($Curdir)){
next if $name =~ /\#/;
@@ -1291,7 +1319,7 @@
if ($txt =~ /Extracting \S+ \(with variable substitutions/) {
($pl_files{$name} = $name) =~ s/[._]pl\z//i ;
}
- else {
+ else {
$pm{$name} = $self->catfile($self->{INST_LIBDIR},$name);
}
} elsif ($name =~ /\.(p[ml]|pod)\z/){
@@ -1461,7 +1489,7 @@
# that's important for nested modules.
unless( $self->{PMLIBDIRS} ) {
- if( $Is{VMS} ) {
+ if( $Is{VMS_mode} ) {
# Avoid logical name vs directory collisions
$self->{PMLIBDIRS} = ['./lib', "./$self->{BASEEXT}"];
}
@@ -1661,14 +1689,14 @@
# uninstalled Perl outside of Perl build tree
my $lib;
for my $dir (@INC) {
- $lib = $dir, last if -e $self->catdir($dir, "Config.pm");
+ $lib = $dir, last if -e $self->catfile($dir, "Config.pm");
}
if ($lib) {
# Win32 puts its header files in /perl/src/lib/CORE.
# Unix leaves them in /perl/src.
my $inc = $Is{Win32} ? $self->catdir($lib, "CORE" )
: dirname $lib;
- if (-e $self->catdir($inc, "perl.h")) {
+ if (-e $self->catfile($inc, "perl.h")) {
$self->{PERL_LIB} = $lib;
$self->{PERL_ARCHLIB} = $lib;
$self->{PERL_INC} = $inc;
@@ -1981,7 +2009,22 @@
$self->{ABSPERL} = $self->quote_literal($self->{ABSPERL})
if $self->{ABSPERL} =~ /\s/;
- $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr;
+
+ # TODO - should be VMS + MMK or MMS.
+ # If make is being used, then UNIX format should be used.
+ if ($Is{VMS}) {
+ # Make sure the file spec is in VMS format
+ $self->{ABSPERL} = VMS::Filespec::vmsify($self->{ABSPERL})
+ if ($self->{ABSPERL} =~ m#/#);
+
+ # rmsexpand makes sure that the filespec fits the DCL token
+ # limitations.
+ if (length($self->{ABSPERL}) > 200) {
+ $self->{ABSPERL} = VMS::Filespec::rmsexpand($self->{ABSPERL});
+ }
+
+ $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr;
+ }
}
# Are we building the core?
@@ -2224,7 +2267,17 @@
my %fromto;
for my $from (@exefiles) {
- my($path)= $self->catfile('$(INST_SCRIPT)', basename($from));
+ my $xfrom;
+ if ($Is{VMS}) {
+ # catfile that expands macros must have the input in UNIX format,
+ # basename(vmsformat) is not the same as basename(unixformat)
+ # when expanded character sets are being used.
+ $xfrom = unixify($from);
+ } else {
+ $xfrom = $from;
+ }
+
+ my($path)= $self->catfile('$(INST_SCRIPT)', basename($xfrom));
local($_) = $path; # for backwards compatibility
my $to = $self->libscan($path);
--- /rsync_root/perl/lib/Extutils/MM_VMS.pm Mon Oct 20 15:29:57 2008
+++ lib/Extutils/MM_VMS.pm Thu Dec 25 00:44:56 2008
@@ -372,7 +372,7 @@
# Expand DEST variables.
foreach my $var ($self->installvars) {
my $destvar = 'DESTINSTALL'.$var;
- $self->{$destvar} = File::Spec->eliminate_macros($self->{$destvar});
+ $self->{$destvar} = $self->eliminate_macros($self->{$destvar});
}
}
@@ -1813,6 +1813,46 @@
$self->{PERL_ARCHIVE_AFTER} ||= '';
}
+
+=item catdir (override)
+
+Overload catdir to eliminate the macros in the output to the MMS/MMK file.
+
+=cut
+
+sub catdir {
+ my $self = shift;
+
+ # Process the macros on VMS MMS/MMK
+ @_ = map { ($_ =~ /\$\(/ ) ? $self->eliminate_macros($_) : $_ } @_;
+
+ my $dir = $self->SUPER::catdir(@_);
+
+ # Fix up the directory and force it to VMS format.
+ $dir = $self->fixpath($dir, 1);
+
+ return $dir
+}
+
+=item catfile (override)
+
+Overload catfile to eliminate the macros in the output to the MMS/MMK file.
+
+=cut
+
+sub catfile {
+ my $self = shift;
+
+ # Process the macros on VMS MMS/MMK
+ @_ = map { ($_ =~ /\$\(/ ) ? $self->eliminate_macros($_) : $_ } @_;
+
+ my $file = $self->SUPER::catfile(@_);
+
+ $file = vmsify($file);
+
+ return $file
+}
+
=item eliminate_macros
--- /rsync_root/perl/lib/ExtUtils/t/recurs.t Mon Jul 2 10:44:48 2007
+++ lib/ExtUtils/t/recurs.t Fri Dec 26 09:26:46 2008
@@ -105,6 +105,7 @@
ok( -e $submakefile, 'sub Makefile written' );
my $inst_script = File::Spec->catdir(File::Spec->updir, 'cgi');
+$inst_script = VMS::Filespec::vmspath($inst_script) if $Is_VMS;
ok( open(MAKEFILE, $submakefile) ) || diag("Can't open $submakefile: $!");
{ local $/;
like( <MAKEFILE>, qr/^\s*INST_SCRIPT\s*=\s*\Q$inst_script\E/m,
@@ -119,4 +120,4 @@
my $test_out = run("$make test");
isnt $?, 0, 'test failure in a subdir causes make to fail';
-}
\ No newline at end of file
+}