bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: package-wide copyright year updates


From: Joel E. Denny
Subject: Re: package-wide copyright year updates
Date: Thu, 6 Aug 2009 20:44:15 -0400 (EDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Tue, 4 Aug 2009, Joel E. Denny wrote:

> I'd like for update-copyright to invoke 
> update-b4-copyright, but I haven't yet looked into how to make that 
> happen.

I pushed the following patch to master, branch-2.5, and branch-2.4.2 to 
implement that and another minor improvement.

Attached are three more patches that I pushed.  Each applies the effect of 
running "make update-copyright" on one of those branches.

>From a1a9422d4a2f70ff89e06318ba154851c3700f60 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Thu, 6 Aug 2009 11:34:09 -0400
Subject: [PATCH] maint: make update-b4-copyright easier to use

* build-aux/update-b4-copyright: In warnings, report line
numbers rather than character positions.
* cfg.mk (update-copyright-local): Set to update-b4-copyright so
that update-copyright runs it.
* gnulib: Update.

diff --git a/build-aux/update-b4-copyright b/build-aux/update-b4-copyright
index 06d3cb7..af43407 100755
--- a/build-aux/update-b4-copyright
+++ b/build-aux/update-b4-copyright
@@ -117,29 +117,34 @@ while (/($old_re)/gx)
 
 while (/(\bb4_copyright\()/g)
   {
-    my $pos = pos ();
-    pos () -= length ($1);
+    my $start = pos () - length ($1);
+    my $end = pos ();
     my $re = $old_re;
+    pos () = $start;
     $re =~ s/\#BEFORE/\\G/;
     if (!/$re/x)
       {
+        my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
         print STDERR
-          "$ARGV: warning: failed to update a b4_copyright before char"
-          . " $pos\n";
+          "$ARGV:$line: warning: failed to update a b4_copyright\n";
       }
-    pos () = $pos;
+    pos () = $end;
   }
 
-while (/\[b4_copyright_years]/g)
+while (/(\[b4_copyright_years])/g)
   {
-    my $pos = pos ();
+    my $start = pos () - length ($1);
+    my $end = pos ();
     my $re = $old_re;
     $re =~ s/\#AFTER/\\G/;
     if (!/$re/x)
       {
+        # The substr operation blows away pos (), so restoring pos ()
+        # at the end is necessary.
+        my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
         print STDERR
-          "$ARGV: warning: failed to update a b4_copyright_years before"
-          . " char $pos\n";
+          "$ARGV:$line: warning: failed to update a"
+          . " b4_copyright_years\n";
       }
-    pos () = $pos;
+    pos () = $end;
   }
diff --git a/cfg.mk b/cfg.mk
index 2b6041a..66a2bc6 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -42,3 +42,5 @@ local-checks-to-skip = changelog-check
 gnulib_dir = $(srcdir)/../../gnulib
 
 bootstrap-tools = autoconf,automake,flex,gnulib
+
+update-copyright-local = update-b4-copyright
diff --git a/gnulib b/gnulib
index 8bdaa78..109f294 160000
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit 8bdaa78f311ff9e5e03ff37ee5f546af14913802
+Subproject commit 109f2942075bba4454bd92141b1803cf1b79684c
-- 
1.5.4.3

Attachment: run-make-update-copyright-master
Description: Text document

Attachment: run-make-update-copyright-branch-2.5
Description: Text document

Attachment: run-make-update-copyright-branch-2.4.2
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]