Change 33675 by [EMAIL PROTECTED] on 2008/04/14 14:38:34

        Move all the logic ot print the "Changed" message into regen_lib.pl,
        which removes the need for any checksums. Arrange fr regen.pl to run
        autodoc.pl last, as it wants to open files generated by reentry.pl.

Affected files ...

... //depot/perl/regen.pl#10 edit
... //depot/perl/regen_lib.pl#6 edit

Differences ...

==== //depot/perl/regen.pl#10 (text) ====
Index: perl/regen.pl
--- perl/regen.pl#9~33646~      2008-04-04 01:28:11.000000000 -0700
+++ perl/regen.pl       2008-04-14 07:38:34.000000000 -0700
@@ -15,6 +15,9 @@
 # changes.  Um, what ?
 # safer_unlink ("warnings.h", "lib/warnings.pm");
 
+# We no longer need the values on this mapping, as the "changed" message is
+# now generated by regen_lib.pl, so should we just drop them?
+
 my %gen = (
           'autodoc.pl'  => [qw[pod/perlapi.pod pod/perlintern.pod]],
           'embed.pl'    => [qw[proto.h embed.h embedvar.h global.sym
@@ -43,20 +46,9 @@
     return %cksum;
 }
 
-foreach my $pl (keys %gen) {
+# this puts autodoc.pl last, which can be useful as it reads reentr.c
+foreach my $pl (reverse sort keys %gen) {
   my @command =  ($^X, $pl, @ARGV);
   print "@command\n";
-  my %cksum0;
-  %cksum0 = do_cksum($pl) unless $pl eq 'warnings.pl'; # the files were removed
   system @command;
-  next if $pl eq 'warnings.pl'; # the files were removed
-  my %cksum1 = do_cksum($pl);
-  my @chg;
-  for my $f (@{ $gen{$pl} }) {
-      push(@chg, $f)
-         if !defined($cksum0{$f}) ||
-            !defined($cksum1{$f}) ||
-            $cksum0{$f} ne $cksum1{$f};
-  }
-  print "Changed: @chg\n" if @chg;
 }

==== //depot/perl/regen_lib.pl#6 (text) ====
Index: perl/regen_lib.pl
--- perl/regen_lib.pl#5~33608~  2008-03-30 08:48:08.000000000 -0700
+++ perl/regen_lib.pl   2008-04-14 07:38:34.000000000 -0700
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 use strict;
-use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write $Verbose);
+use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write $Verbose
+           @Changed);
 use Config; # Remember, this is running using an existing perl
 use File::Compare;
 use Symbol;
@@ -17,7 +18,13 @@
 
 $Needs_Write = $Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare;
 
[EMAIL PROTECTED] = grep { not($_ eq '-v' and $Verbose = 1) } @ARGV;
+$Verbose = 0;
[EMAIL PROTECTED] = grep { not($_ eq '-q' and $Verbose = -1) }
+  grep { not($_ eq '-v' and $Verbose = 1) } @ARGV;
+
+END {
+  print STDOUT "Changed: @Changed\n" if @Changed;
+}
 
 sub safer_unlink {
   my @names = @_;
@@ -46,11 +53,12 @@
   my ($from, $to) = @_;
 
   if (compare($from, $to) == 0) {
-      warn "no changes between '$from' & '$to'\n" if $Verbose;
+      warn "no changes between '$from' & '$to'\n" if $Verbose > 0;
       safer_unlink($from);
       return;
   }
-  warn "changed '$from' to '$to'\n";
+  warn "changed '$from' to '$to'\n" if $Verbose > 0;
+  push @Changed, $to unless $Verbose < 0;
   safer_rename_silent($from, $to) or die "renaming $from to $to: $!";
 }
 
End of Patch.

Reply via email to