vmsperl  

[EMAIL PROTECTED] fixes for cpanplus on VMS

John E. Malmberg
Sun, 02 Sep 2007 15:23:37 -0700

While there are still some CPANPLUS tests that are not working on VMS, these patches improve things.

Note that the tests require that the symbol "PERL" be set up as a foreign command for the non-debug perl image from blead.

In lib/Module/Build/Base.pm, catfile is needed for merging files with directories,.

In lib/CPANPLUS/Dist/Build/t/02_CPANPLUS-Dist-Build.t, catfile is needed for merging files with directories. Also need to look for the C<.packlist> in $Config{archname} . 'auto'.


In lib/CPANPLUS/Dist/Build.pm, On VMS, the command arguments need to be quoted, and ".com" needs to be appended to match the filename created by module build.

In lib/CPANPLUS/Internals/Extract.pm, catdir on VMS can not deal with directory components with dots in them. Need to translate them as VMS.C in the default mode expects them. This is a temporary hack that will need to be revised as ODS-5 support is integrated in to Perl.

Currently the following CPANPLUS tests are failing for me:

08_CPANPLUS-Backend.t

not ok 230

20_CPANPLUS-Dist-MM.t
Tests start failing at 9.

Currently the CPANPLUS tests are appending a new UNIX path to the PATH and PERL5LIB logical names each time they are run. I have not figured out how to stop that.

-John
[EMAIL PROTECTED]
Personal Opinion Only



--- /rsync_root/perl/lib/CPANPLUS/Dist/Build/t/02_CPANPLUS-Dist-Build.t Mon May 
28 08:24:25 2007
+++ lib/CPANPLUS/Dist/Build/t/02_CPANPLUS-Dist-Build.t  Sun Sep  2 16:14:52 2007
@@ -98,7 +98,7 @@
                 
     ### set the fetch location -- it's local
     {   my $where = File::Spec->rel2abs(
-                            File::Spec->catdir( $Src, $path, $mod->package )
+                            File::Spec->catfile( $Src, $path, $mod->package )
                         );
                         
         $mod->status->fetch( $where );
@@ -232,13 +232,19 @@
   my $file = File::Spec->catfile( split m/::/, $module );
   my $candidate;
   foreach (@INC) {
-    if (-e ($candidate = File::Spec->catdir($_, $file))
+    if (-e ($candidate = File::Spec->catfile($_, $file))
         or
-        -e ($candidate = File::Spec->catdir($_, "$file.pm"))
+        -e ($candidate = File::Spec->catfile($_, "$file.pm"))
         or
-        -e ($candidate = File::Spec->catdir($_, 'auto', $file))
+        -e ($candidate = File::Spec->catfile($_, 'auto', $file))
         or
-        -e ($candidate = File::Spec->catdir($_, 'auto', "$file.pm"))) {
+        -e ($candidate = File::Spec->catfile($_, 'auto', "$file.pm"))
+        or
+        -e ($candidate = File::Spec->catfile($_, $Config{archname},
+                                             'auto', $file))
+        or
+        -e ($candidate = File::Spec->catfile($_, $Config{archname},
+                                             'auto', "$file.pm"))) {
       return $candidate;
     }
   }
--- /rsync_root/perl/lib/CPANPLUS/Dist/Build.pm Thu May 24 10:13:33 2007
+++ lib/CPANPLUS/Dist/Build.pm  Sun Sep  2 00:51:01 2007
@@ -640,7 +640,13 @@
         ### don't worry about loading the right version of M::B anymore
         ### the 'new_from_context' already added the 'right' path to
         ### M::B at the top of the build.pl
-        my $cmd     = [$perl, BUILD->($dir), 'install', $buildflags];
+        my $cmd;
+        if ($^O eq 'VMS') {
+            $cmd = [$perl, BUILD->($dir) . ".com",
+                    '"install"', "\"$buildflags\""];
+        } else {
+            $cmd = [$perl, BUILD->($dir), 'install', $buildflags];
+        }
         my $sudo    = $conf->get_program('sudo');
         unshift @$cmd, $sudo if $sudo;
 
--- /rsync_root/perl/lib/CPANPLUS/Internals/Extract.pm  Fri Aug 31 17:43:18 2007
+++ lib/CPANPLUS/Internals/Extract.pm   Sat Sep  1 15:52:49 2007
@@ -199,8 +199,17 @@
     ### well, then we really don't know.
 
     my $dir;
-    for my $try ( File::Spec->rel2abs( File::Spec->catdir(   
-                    $to, $mod->package_name .'-'. $mod->package_version ) ),
+    my $pkg_namver = $mod->package_name .'-'. $mod->package_version;
+
+       # catdir on VMS can not currently deal with directory components
+       # with dots in them.  In the default mode, VMS.C internally
+       # converts these to '_'.  This will need to be fixed again here
+       # when EFS character support is enabled, and that may require
+       # testing for that.
+
+    $pkg_namver =~ tr/\./_/ if $^O eq 'VMS';
+
+    for my $try ( File::Spec->rel2abs( File::Spec->catdir( $to, $pkg_namver ) 
),
                   File::Spec->rel2abs( $ae->extract_path ),
     ) {
         ($dir = $try) && last if -d $try;
--- /rsync_root/perl/lib/Module/Build/Base.pm   Mon Jul 16 22:38:20 2007
+++ lib/Module/Build/Base.pm    Sun Sep  2 14:43:57 2007
@@ -3796,7 +3796,7 @@
   if ($self->create_packlist and my $module_name = $self->module_name) {
     my $archdir = $self->install_destination('arch');
     my @ext = split /::/, $module_name;
-    $map{write} = File::Spec->catdir($archdir, 'auto', @ext, '.packlist');
+    $map{write} = File::Spec->catfile($archdir, 'auto', @ext, '.packlist');
   }
 
   # Handle destdir