Craig A. Berry wrote:
> In article 
> <[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] ("Craig A. Berry") wrote:
> 
>> On Dec 6, 2007 7:43 PM, Craig A. Berry <[EMAIL PROTECTED]> wrote:
>> I'm afraid we need nicetext
>> back, at least on VMS, and we'll just have to tune up the regex 
> 
> The attached patch does those things and gets all of the core 
> extensions to build with YAML generation intact on VMS.  So except for 
> version bumps and a changelog entry, this could become 6.41.  I didn't 
> restore the MM_Unix.t test for nicetext if that's important.  Sorry for 
> the churn.

Thanks, Craig.  I decided to fix a few things as long as we were at it.  I
changed the name to be more accurate and also fixed it so it won't give up
when it sees a macro declaration.

Could you try out the attached patch?


--- t/maketext_filter.t (revision 41142)
+++ t/maketext_filter.t (revision 41143)
@@ -0,0 +1,65 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+    if( $ENV{PERL_CORE} ) {
+        chdir 't' if -d 't';
+        @INC = '../lib';
+    }
+    else {
+        unshift @INC, 't/lib';
+    }
+}
+chdir 't';
+
+use Test::More tests => 6;
+
+use ExtUtils::MakeMaker;
+use ExtUtils::MM_VMS;
+
+sub test_filter {
+    my($text, $vms_text) = @_;
+    
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+    is( MM->maketext_filter($text),               $text,     'default filter' 
);
+    is( ExtUtils::MM_VMS->maketext_filter($text), $vms_text, 'VMS filter' );
+}
+
+
+# VMS filter puts a space after the target
+test_filter(<<'END', <<'VMS');
+foo: bar
+    thing: splat
+END
+foo : bar
+    thing: splat
+VMS
+
+
+# And it does it for all targets
+test_filter(<<'END', <<'VMS');
+foo: bar
+    thing: splat
+
+up: down
+    yes
+END
+foo : bar
+    thing: splat
+
+up : down
+    yes
+VMS
+
+
+# And it doesn't mess with macros
+test_filter(<<'END', <<'VMS');
+CLASS=Foo: Bar
+
+target: stuff
+    $(PROGRAM) And::Stuff
+END
+CLASS=Foo: Bar
+
+target : stuff
+    $(PROGRAM) And::Stuff
+VMS
--- MANIFEST    (revision 41142)
+++ MANIFEST    (revision 41143)
@@ -69,6 +69,7 @@
 t/lib/TieOut.pm
 t/Liblist.t
 t/make.t
+t/maketext_filter.t
 t/Mkbootstrap.t
 t/MM_Any.t
 t/MM_BeOS.t
--- lib/ExtUtils/MM_Any.pm      (revision 41142)
+++ lib/ExtUtils/MM_Any.pm      (revision 41143)
@@ -236,6 +236,24 @@
 }
 
 
+=head3 maketext_filter
+
+    my $filter_make_text = $mm->maketext_filter($make_text);
+
+The text of the Makefile is run through this method before writing to
+disk.  It allows systems a chance to make portability fixes to the
+Makefile.
+
+By default it does nothing.
+
+This method is protected and not intended to be called outside of
+MakeMaker.
+
+=cut
+
+sub maketext_filter { return $_[1] }
+
+
 =head3 cd  I<Abstract>
 
   my $subdir_cmd = $MM->cd($subdir, @cmds);
--- lib/ExtUtils/MakeMaker.pm   (revision 41142)
+++ lib/ExtUtils/MakeMaker.pm   (revision 41143)
@@ -637,7 +637,9 @@
             my(%a) = %{$self->{$section} || {}};
             push @{$self->{RESULT}}, "\n# --- MakeMaker $section section:";
             push @{$self->{RESULT}}, "# " . join ", ", %a if $Verbose && %a;
-            push @{$self->{RESULT}}, $self->$method( %a );
+            push @{$self->{RESULT}}, $self->maketext_filter(
+                $self->$method( %a )
+            );
         }
     }
 
--- lib/ExtUtils/MM_VMS.pm      (revision 41142)
+++ lib/ExtUtils/MM_VMS.pm      (revision 41143)
@@ -1572,6 +1572,22 @@
     join '', @m;
 }
 
+# --- Output postprocessing section ---
+
+=item maketext_filter (override)
+
+Insure that colons marking targets are preceded by space, in order
+to distinguish the target delimiter from a colon appearing as
+part of a filespec.
+
+=cut
+
+sub maketext_filter {
+    my($self, $text) = @_;
+
+    $text =~ s/^([^\s:=]+)(:+\s)/$1 $2/mg;
+    return $text;
+}
 
 =item prefixify (override)
 
--- Changes     (revision 41142)
+++ Changes     (revision 41143)
@@ -3,6 +3,10 @@
     - 6.33 moved PREREQ_FATAL to happen after CONFIGURE.  This meant if
       your CONFIGURE use a prereq it would fail and no PREREQ_FATAL
       message would be displayed.
+    - Put the "nicetext" functionality back, VMS needs it to deal with
+      other people's custom make.  But rename it to the more
+      accurate maketext_filter(), test it and fix a bug where it would
+      stop processing if it saw a macro declaration.
 
 6.40  Thu Dec  6 03:00:47 PST 2007
     Bug Fixes

Reply via email to