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.
(cherry picked from commit a1a9422d4a)
This commit is contained in:
Joel E. Denny
2009-08-06 11:34:09 -04:00
parent d0caad01ab
commit 642f240e22
4 changed files with 27 additions and 11 deletions

View File

@@ -1,3 +1,12 @@
2009-08-06 Joel E. Denny <jdenny@clemson.edu>
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.
2009-08-05 Joel E. Denny <jdenny@clemson.edu> 2009-08-05 Joel E. Denny <jdenny@clemson.edu>
maint: clean up update-b4-copyright code maint: clean up update-b4-copyright code

View File

@@ -117,29 +117,34 @@ while (/($old_re)/gx)
while (/(\bb4_copyright\()/g) while (/(\bb4_copyright\()/g)
{ {
my $pos = pos (); my $start = pos () - length ($1);
pos () -= length ($1); my $end = pos ();
my $re = $old_re; my $re = $old_re;
pos () = $start;
$re =~ s/\#BEFORE/\\G/; $re =~ s/\#BEFORE/\\G/;
if (!/$re/x) if (!/$re/x)
{ {
my $line = (substr ($_, 0, $start) =~ s/\n/\n/g) + 1;
print STDERR print STDERR
"$ARGV: warning: failed to update a b4_copyright before char" "$ARGV:$line: warning: failed to update a b4_copyright\n";
. " $pos\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; my $re = $old_re;
$re =~ s/\#AFTER/\\G/; $re =~ s/\#AFTER/\\G/;
if (!/$re/x) 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 print STDERR
"$ARGV: warning: failed to update a b4_copyright_years before" "$ARGV:$line: warning: failed to update a"
. " char $pos\n"; . " b4_copyright_years\n";
} }
pos () = $pos; pos () = $end;
} }

2
cfg.mk
View File

@@ -42,3 +42,5 @@ local-checks-to-skip = changelog-check
gnulib_dir = $(srcdir)/../../gnulib gnulib_dir = $(srcdir)/../../gnulib
bootstrap-tools = autoconf,automake,flex,gnulib bootstrap-tools = autoconf,automake,flex,gnulib
update-copyright-local = update-b4-copyright

2
gnulib

Submodule gnulib updated: 8bdaa78f31...109f294207