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

An alternative to .patch and fix_pl

Thread Next
From:
andreas.koenig
Date:
January 8, 2001 04:38
Subject:
An alternative to .patch and fix_pl
Message ID:
m3r92e1anz.fsf@ak-71.mind.de
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

fix-patchlevel.h-with-dot-patch:
        ./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:
+
+#!perl
+die "Usage: perl -x patchlevel.h comment ..." unless @ARGV;
+open PLIN, "patchlevel.h" or die "Couldn't open patchlevel.h : $!";
+open PLOUT, ">patchlevel.new" or die "Couldn't write on patchlevel.new : $!";
+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.new", "patchlevel.h" or die "Couldn't rename: $!";
+__END__
+
+Please keep empty lines below so patching of this file doesn't
+interfere with the following lines.
+
  */
+
+
+
+
+
+
+
 #if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT)
 static	char	*local_patches[] = {
         NULL


-- 
andreas

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