develooper Front page | perl.perl5.porters | Postings from March 2008

[PATCH] add -v to regen.pl and friends

Thread Next
From:
Robin Barker
Date:
March 19, 2008 03:56
Subject:
[PATCH] add -v to regen.pl and friends
Message ID:
46A0F33545E63740BC7563DE59CA9C6D093AA6@exchsvr2.npl.ad.local
This is another take on my earlier patch to remove verbosity (chattiness) from C<make regen>.
In this version C<make regen> is terse and C<make regen_headers> is verbose.

regen.pl and all the *.pl scripts the C<require regen_lib.pl> have had added a -v (verbose) option.

Robin Barker

--- ../perl-current/Makefile.SH.orig	2008-03-18 18:54:48.000000000 +0000
+++ Makefile.SH
@@ -1033,9 +1033,12 @@
 
 .PHONY: regen_headers regen_pods regen_all
 
-regen regen_headers:	FORCE
+regen:	FORCE
 	-perl regen.pl
 
+regen_headers:	FORCE
+	-perl regen.pl -v
+
 regen_pods:	FORCE
 	-cd pod; $(LDLIBPTH) $(MAKE) regen_pods
 
--- ../perl-current/regen.pl	2008-03-15 17:32:47.000000000 +0000
+++ regen.pl
@@ -11,7 +11,6 @@
 use strict;
 my $perl = $^X;
 
-require 'regen_lib.pl';
 # keep warnings.pl in sync with the CPAN distribution by not requiring core
 # changes.  Um, what ?
 # safer_unlink ("warnings.h", "lib/warnings.pm");
@@ -46,10 +45,11 @@
 
 foreach my $pl (qw (keywords.pl opcode.pl embed.pl
 		    regcomp.pl warnings.pl autodoc.pl reentr.pl)) {
-  print "$^X $pl\n";
+  my @command =  ($^X, $pl, @ARGV);
+  print "@command\n";
   my %cksum0;
   %cksum0 = do_cksum($pl) unless $pl eq 'warnings.pl'; # the files were removed
-  system "$^X $pl";
+  system @command;
   next if $pl eq 'warnings.pl'; # the files were removed
   my %cksum1 = do_cksum($pl);
   my @chg;
--- ../perl-current/regen_lib.pl	2008-03-17 00:19:43.000000000 +0000
+++ regen_lib.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 use strict;
-use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write);
+use vars qw($Is_W32 $Is_OS2 $Is_Cygwin $Is_NetWare $Needs_Write $Verbose);
 use Config; # Remember, this is running using an existing perl
 use File::Compare;
 use Symbol;
@@ -17,6 +17,8 @@
 
 $Needs_Write = $Is_OS2 || $Is_W32 || $Is_Cygwin || $Is_NetWare;
 
+@ARGV = grep { not($_ eq '-v' and $Verbose = 1) } @ARGV;
+
 sub safer_unlink {
   my @names = @_;
   my $cnt = 0;
@@ -44,7 +46,7 @@
   my ($from, $to) = @_;
 
   if (compare($from, $to) == 0) {
-      warn "no changes between '$from' & '$to'\n";
+      warn "no changes between '$from' & '$to'\n" if $Verbose;
       safer_unlink($from);
       return;
   }
End of patch
 <<regen_headers_verbose-v2.patch>> 


-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.

NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.

NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Serco House, 16 Bartley Wood Business Park,
                   Hook, Hampshire, United Kingdom  RG27 9UY
-------------------------------------------------------------------

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About