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

Re: An alternative to .patch and fix_pl

Thread Previous | Thread Next
From:
andreas.koenig
Date:
January 8, 2001 05:39
Subject:
Re: An alternative to .patch and fix_pl
Message ID:
m3hf3a17tr.fsf@ak-71.mind.de
>>>>> On Mon, 8 Jan 2001 12:51:20 +0000, Nicholas Clark <nick@ccl4.org> said:

 > On Mon, Jan 08, 2001 at 01:38:24PM +0100, Andreas J. Koenig wrote:
>> +close PLOUT; close PLIN;

 > Warn on close failure? At least 1 common NFS implmentation is unable to tell
 > you that you've gone over quota and writes have failed until you close the
 > file.

Good point. Better safe than sorry. Revised patch appended.

 > Also, I presume that $0 is "patchlevel.h" and you could read the 
 > embedded script by seeking DATA, but I'm not sure if either helps.

What for? I cannot follow. Did you miss the -x switch?

-- 
andreas


--- patchlevel.h@8366	Mon Jan  8 13:06:41 2001
+++ patchlevel.h	Mon Jan  8 14:35:27 2001
@@ -66,7 +66,42 @@
 	(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 or warn "Could not close filehandle writing to patchlevel.new : $!";
+close PLIN or warn "Could not close filehandle reading from patchlevel.h : $!";
+rename "patchlevel.new", "patchlevel.h" or
+  die "Couldn't rename patchlevel.new to patchlevel.h : $!";
+__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

Thread Previous | 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