On 10/27/07, John E. Malmberg <[EMAIL PROTECTED]> wrote: > These patches actually get VMS beyond where it was before by a little > bit. Compat.t was not being run on VMS because it could not determine > if the <Config{make}> image was present. > > It still can not, but assumes that it is on VMS now.
Sounds promising. Couldn't we do a test to determine whether our make or make equivalent is present? > In Module/Build.pm : > > It is vmsish if OS is VMS and the make program is one of MMK or MMS. That seems wrong to me because it assumes we'd only need to do some things natively when run in compatibility mode. I think we should leave it as a general property and if compatibility mode needs something else as well, then do the something else there. > Overriding localize_file_path and localize_dir_path in Platform/VMS.pm > now, so do not need is_vmsish here. Makes sense. > A catdir() should be a catfile(). Since what we're concatenating is 'blib' which is a directory, why shouldn't it be catdir? > Add the filenames generated on VMS to the Manifest skip list. Good, I've been meaning to do that for awhile. Did you get .OPT and .LIS? > In Compat.pm : > > glob on VMS will not handle tildes, so use the Module::Build->_detildefy > to help. > > Generated Makefile - Descrip.mms needs some changes for MMS/MMK. > > 1. Perl image needs to be preceded by MCR. We can probably get away with doing that in our find_perl_interpreter override. A spawned Perl will add that on its own, but it should hurt if it's already there. Spawning other things, like MMS or MMK, obviously does need it. > 2. It is Build.COM instead of just Build. > > 3. Unlink of the makefile is done differently for realclean target. > > 4. MMS/MMK do not support .EXPORT. > > > Set the makefile to be Descrip.MMS when building for MMS/MMK on VMS. > > MMS/MMK will use 'Makefile', but that could confuse things. > > Note: Do not use 'Makefile.vms' for a MMS/MMK style makefile. It > breaks GNU make in the GNV kit, as it chooses Makefile.vms over a plain > Makefile when searching. > > > In Compat.t : > > If using VMS and MMK/MMS assume that MMS or MMK is present. The only > practical way to test to see if an program is present on VMS is to try > to run it. > > find_in_path simply will not work on VMS, so not fixing the issues in it > where it is not handling VMS format file specifications correctly and > emitting diagnostics, just not using it on VMS. > > If on VMS and using MMK or MMS, assume that the makefile is 'Descrip.MMS'. > > TEST_VERBOSE = 0, must be done by setting and restoring the environment > variable on VMS. This is because Perl on VMS is using logical names for > environment variables, and this is incompatible with MMS/MMK macros. > > The non-verbose output on VMS is apparently slightly different, as there > appears to be extra newlines inserted. > > > In VMS.pm : > > Do not quote "/qualifiers" which are already in VMS syntax. > > Add localize_file_path and localize_dir_path to use VMS::Filespec > routines, and so will handle most VMS and UNIX format names. The > existing ones were just passing through the VMS format names with out > changing them, which was good enough for the tests, but would have > mangled the UNIX format names on VMS. > > Probably have to revise those two when implementing support for gnu make > on VMS, as then the result should be in LINUX format. > > > With this patch, compat.t now passes all tests. All sounds very promising, except for the nits I've noted above. > > We still have two issues with Module build on VMS: > > 1. ppm.t fails because it is apparently creating a corrupt compressed > tarball.. > > 2. xs.t is failing because it is mis-interpreting how to lookup blib. > It is not failing when run in the Perl debugger. > > -John > [EMAIL PROTECTED] > Personal Opinion Only > > --- /rsync_root/perl/lib/Module/Build.pm Thu Oct 25 04:50:40 2007 > +++ lib/Module/Build.pm Sat Oct 27 01:16:39 2007 > @@ -96,7 +96,9 @@ > > sub os_type { $OSTYPES{$^O} } > > -sub is_vmsish { return ((os_type() || '') eq 'VMS') } > +sub is_vmsish { > + return ((os_type() || '') eq 'VMS' && $Config::Config{make} =~ > /MM[K|S]/i) > +} > sub is_windowsish { return ((os_type() || '') eq 'Windows') } > sub is_unixish { return ((os_type() || '') eq 'Unix') } > > --- /rsync_root/perl/lib/Module/Build/Base.pm Thu Oct 25 04:50:40 2007 > +++ lib/Module/Build/Base.pm Sat Oct 27 22:53:33 2007 > @@ -2392,7 +2392,6 @@ > > sub localize_file_path { > my ($self, $path) = @_; > - $path =~ s/\.\z// if $self->is_vmsish; > return File::Spec->catfile( split m{/}, $path ); > } > > @@ -2879,7 +2878,7 @@ > File::Spec->abs2rel( File::Spec->rel2abs( $file ), > File::Spec->rel2abs( $dir ) ); > my $to_file = > - File::Spec->catdir( $ppm, 'blib', > + File::Spec->catfile( $ppm, 'blib', > exists( $types{$type} ) ? $types{$type} : $type, > $rel_file ); > $self->copy_if_modified( from => $file, to => $to_file ); > @@ -3179,10 +3178,18 @@ > \bblibdirs$ > ^MANIFEST\.SKIP$ > > +# Avoid VMS specific Makmaker generated files > +\bDescrip.MMS$ > +\bDESCRIP.MMS$ > +\bdescrip.mms$ > + > # Avoid Module::Build generated and utility files. > \bBuild$ > \bBuild.bat$ > \b_build > +\bBuild.COM$ > +\bBUILD.COM$ > +\bbuild.com$ > > # Avoid Devel::Cover generated files > \bcover_db > --- /rsync_root/perl/lib/Module/Build/Compat.pm Thu Oct 25 04:50:40 2007 > +++ lib/Module/Build/Compat.pm Sat Oct 27 22:57:27 2007 > @@ -171,7 +171,18 @@ > die "Malformed argument '$arg'"); > > # Do tilde-expansion if it looks like a tilde prefixed path > - ( $val ) = glob( $val ) if $val =~ /^~/; > + if ($val =~ /^~/) { > + if ($^O ne 'VMS') { > + ( $val ) = glob( $val ); > + } else { > + # TODO Home grown glob for Perl/VMS can not handle ~ yet. > + # Can not use is_vmsish because this is for all instances > + # of perl on VMS, not just when MMS/MMK is being used. > + > + my $class = 'Module::Build'; > + ( $val ) = $class->_detildefy($val); > + } > + } > > if (exists $makefile_to_build{$key}) { > my $trans = $makefile_to_build{$key}; > @@ -216,18 +227,32 @@ > my $class = $args{build_class}; > > my $perl = $class->find_perl_interpreter; > + > + # VMS MMS/MMK need to use MCR to run the Perl image. > + $perl = 'MCR ' . $perl if $class->is_vmsish; > + > my $noop = ($class->is_windowsish ? 'rem>nul' : > $class->is_vmsish ? 'Continue' : > 'true'); > - my $Build = 'Build --makefile_env_macros 1'; > + > + # VMS has different file type. > + my $filetype = $class->is_vmsish ? '.COM' : ''; > + > + my $Build = 'Build' . $filetype . ' --makefile_env_macros 1'; > > # Start with a couple special actions > + my $unlink_makefile = "unlink -e shift $args{makefile}"; > + > + # VMS MMS/MMK and DCL needs different syntax. > + $unlink_makefile = "\"1 while unlink \'$args{makefile}\'\"" > + if $class->is_vmsish; > + > my $maketext = <<"EOF"; > all : force_do_it > $perl $Build > realclean : force_do_it > $perl $Build realclean > - $perl -e unlink -e shift $args{makefile} > + $perl -e $unlink_makefile > > force_do_it : > @ $noop > @@ -240,8 +265,12 @@ > $perl $Build $action > EOF > } > + > + # MMS/MMK on VMS do not support .EXPORT > > - $maketext .= "\n.EXPORT : " . join(' ', keys %makefile_to_build) . "\n\n"; > + $maketext .= "\n.EXPORT : " . join(' ', keys %makefile_to_build) . "\n\n" > + unless $class->is_vmsish; > + > > return $maketext; > } > @@ -267,7 +296,14 @@ > > sub write_makefile { > my ($pack, %in) = @_; > - $in{makefile} ||= 'Makefile'; > + > + unless (exists $in{build_class}) { > + warn "Unknown 'build_class', defaulting to 'Module::Build'\n"; > + $in{build_class} = 'Module::Build'; > + } > + my $class = $in{build_class}; > + $in{makefile} ||= $class->is_vmsish ? 'Descrip.MMS' : 'Makefile'; > + > open MAKE, "> $in{makefile}" or die "Cannot write $in{makefile}: $!"; > print MAKE $pack->fake_prereqs; > print MAKE $pack->fake_makefile(%in); > --- /rsync_root/perl/lib/Module/Build/t/Compat.t Thu Oct 25 04:50:40 > 2007 > +++ lib/Module/Build/t/Compat.t Sat Oct 27 19:34:01 2007 > @@ -14,7 +14,10 @@ > > my @makefile_types = qw(small passthrough traditional); > my $tests_per_type = 14; > -if ( $Config{make} && find_in_path($Config{make}) ) { > + > +#find_in_path does not understand VMS. > + > +if ( $Config{make} && $^O ne 'VMS' ? find_in_path($Config{make}) : 1 ) { > plan tests => 38 + @makefile_types*$tests_per_type*2; > } else { > plan skip_all => "Don't know how to invoke 'make'"; > @@ -45,6 +48,15 @@ > > my @make = $Config{make} eq 'nmake' ? ('nmake', '-nologo') : ($Config{make}); > > +my $makefile = 'Makefile'; > + > +# VMS MMK/MMS by convention use Descrip.MMS > + > +if ($^O eq 'VMS' && $Config::Config{make} =~ /MM[K|S]/i) { > + $makefile = 'Descrip.MMS'; > +} > + > + > ######################### > > # Test without requires > @@ -95,7 +107,8 @@ > # in older-generated Makefile.PLs > my $warning = ''; > local $SIG{__WARN__} = sub { $warning = shift; }; > - my $maketext = eval { Module::Build::Compat->fake_makefile(makefile => > 'Makefile') }; > + > + my $maketext = eval { Module::Build::Compat->fake_makefile(makefile => > $makefile) }; > is $@, '', "fake_makefile lived"; > like $maketext, qr/^realclean/m, "found 'realclean' in fake_makefile > output"; > like $warning, qr/build_class/, "saw warning about 'build_class'"; > @@ -171,17 +184,41 @@ > like $output, qr/(?:# ok \d+\s+)+/, 'Should be verbose'; > > # Make sure various Makefile arguments are supported > - $output = stdout_of( sub { $ran_ok = $mb->do_system(@make, 'test', > 'TEST_VERBOSE=0') } ); > + my $make_macro = 'TEST_VERBOSE=0'; > + > + # VMS MMK/MMS macros use different syntax. > + # and this is not really a MMK/MMS macro, but one expected > + # to be inherited by the child process running Perl. > + my $old_test_verbose = $ENV{TEST_VERBOSE}; > + if ($^O eq 'VMS' && $Config::Config{make} =~ /MM[K|S]/i) { > + $make_macro = ''; > + $ENV{TEST_VERBOSE} = 0; > + } > + > + $output = stdout_of( sub { > + $ran_ok = $mb->do_system(@make, 'test', $make_macro) > + } ); > + > + # Clean up on VMS > + if ($^O eq 'VMS' && $Config::Config{make} =~ /MM[K|S]/i) { > + if (defined $old_test_verbose) { > + $ENV{TEST_VERBOSE} = $old_test_verbose; > + } else { > + delete $ENV{TEST_VERBOSE}; > + } > + } > + > ok $ran_ok, "make test without verbose ran ok"; > $output =~ s/^/# /gm; # Don't confuse our own test output > - like $output, qr/(?:# .+basic\.+ok\s+(?:[\d.]+\s*m?s\s*)?)# All tests/, > - 'Should be non-verbose'; > + like $output, > + qr/(?s:# .+basic\.+(?:.*#\s)ok\s+(?:[\d.]+\s*m?s\s*)?)# All tests/, > + 'Should be non-verbose'; > > $mb->delete_filetree($libdir); > ok ! -e $libdir, "Sample installation directory should be cleaned up"; > > stdout_of( sub { $mb->do_system(@make, 'realclean'); } ); > - ok ! -e 'Makefile', "Makefile shouldn't exist"; > + ok ! -e $makefile, "$makefile shouldn't exist"; > > 1 while unlink 'Makefile.PL'; > ok ! -e 'Makefile.PL', "Makefile.PL cleaned up"; > @@ -202,7 +239,7 @@ > unlike $b2->install_base, qr/^~/, "Tildes should be expanded"; > > stdout_of( sub { $mb->do_system(@make, 'realclean'); } ); > - ok ! -e 'Makefile', "Makefile shouldn't exist"; > + ok ! -e $makefile, "$makefile shouldn't exist"; > > 1 while unlink 'Makefile.PL'; > ok ! -e 'Makefile.PL', "Makefile.PL cleaned up"; > @@ -269,13 +306,14 @@ > $label .= " (postargs: $postargs)"; > } > ok $result, $label; > - ok -e 'Makefile', "Makefile exists"; > + > + ok -e $makefile, "$makefile exists"; > > if ($cleanup) { > $output = stdout_of( sub { > $build->do_system(@make, 'realclean'); > }); > - ok ! -e 'Makefile', "Makefile cleaned up"; > + ok ! -e $makefile, "$makefile cleaned up"; > } > else { > pass '(skipping cleanup)'; # keep test count constant > @@ -286,10 +324,10 @@ > my %requires = %{ $_[0] }; > delete $requires{perl}; # until EU::MM supports this > SKIP: { > - skip 'Makefile not found', 1 unless -e 'Makefile'; > + skip "$makefile not found", 1 unless -e $makefile; > my $prereq_pm = find_makefile_prereq_pm(); > is_deeply $prereq_pm, \%requires, > - "Makefile has correct PREREQ_PM line"; > + "$makefile has correct PREREQ_PM line"; > } > } > > @@ -312,8 +350,8 @@ > # Following subroutine adapted from code in CPAN.pm > # by Andreas Koenig and A. Speer. > sub find_makefile_prereq_pm { > - my $fh = IO::File->new( 'Makefile', 'r' ) > - or die "Can't read Makefile: $!"; > + my $fh = IO::File->new( $makefile, 'r' ) > + or die "Can't read $makefile: $!"; > my $req = {}; > local($/) = "\n"; > while (<$fh>) { > --- /rsync_root/perl/lib/Module/Build/Platform/VMS.pm Thu Oct 25 04:50:40 > 2007 > +++ lib/Module/Build/Platform/VMS.pm Sat Oct 27 18:40:35 2007 > @@ -136,7 +136,9 @@ > ? 1 > : 0; > > - map { $_ = q(").$_.q(") if !/^\"/ && length($_) > 0 } > + # Do not quote qualifiers that begin with '/' or already > + # quoted arguments. > + map { $_ = q(").$_.q(") if !/^[\"|\/]/ && length($_) > 0 } > ($got_arrayref ? @{$args[0]} > : @args > ); > @@ -356,6 +358,29 @@ > =cut > > sub find_perl_interpreter { return $^X; } > + > +=item localize_file_path > + > +Convert the file path to the local syntax > + > +=cut > + > +sub localize_file_path { > + my ($self, $path) = @_; > + $path =~ s/\.\z//; > + return VMS::Filespec::vmsify($path); > +} > + > +=item localize_dir_path > + > +Convert the directory path to the local syntax > + > +=cut > + > +sub localize_dir_path { > + my ($self, $path) = @_; > + return VMS::Filespec::vmspath($path); > +} > > =back > > >