develooper Front page | perl.perl5.porters | Postings from January 2001

An alternative to .patch and fix_pl

Thread Next
January 8, 2001 04:38
An alternative to .patch and fix_pl
Message ID:
When I send a 'make ok' I want to have my perl built with a helpful
patchlevel.h file.

We seem to agree that Makefile rules for self-modifying files are a
NONO. The .patch idea didn't fly and if an extra perl script is added,
you again have to remember the name of it. So what about the -x
switch? Put the script into patchlevel.h itself! No rule for the
Makefile is added for now as I want to see if this is accepted. If it
is, we could make a rule

        ./miniperl -x patchlevel.h `cat .patch`

or something like that. How's that?

--- patchlevel.h@8366	Mon Jan  8 13:06:41 2001
+++ patchlevel.h	Mon Jan  8 13:17:19 2001
@@ -66,7 +66,40 @@
 	(Note changes to line numbers as well as removal of context lines.)
 	This will prevent patch from choking if someone has previously
 	applied different patches than you.
+        History has shown that nobody distributes patches that also
+        modify patchlevel.h. Do it yourself. The following perl
+        program can be used to add a comment to patchlevel.h:
+die "Usage: perl -x patchlevel.h comment ..." unless @ARGV;
+open PLIN, "patchlevel.h" or die "Couldn't open patchlevel.h : $!";
+open PLOUT, ">" or die "Couldn't write on : $!";
+my $seen=0;
+while (<PLIN>) {
+    if (/\t,NULL/ and $seen) {
+       while (my $c = shift @ARGV){
+            print PLOUT qq{\t,"$c"\n};
+       }
+    }
+    $seen++ if /local_patches\[\]/;
+    print PLOUT;
+close PLOUT; close PLIN;
+rename "", "patchlevel.h" or die "Couldn't rename: $!";
+Please keep empty lines below so patching of this file doesn't
+interfere with the following lines.
 static	char	*local_patches[] = {


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About