summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny@clemson.edu>2009-08-14 17:05:06 -0400
committerJoel E. Denny <jdenny@clemson.edu>2009-08-14 18:48:36 -0400
commit314542f905b5429efb42d32651366dee8af87772 (patch)
tree41d6020e93962c761f69ae340ddc1fbe1a5c9c51 /build-aux
parent24985964740b3b28ebfa2fe1de05c0e483947fbf (diff)
downloadbison-314542f905b5429efb42d32651366dee8af87772.tar.gz
maint: fix use of copyright year intervals.
* gnulib: Update. * bootstrap.conf (gnulib_modules): Update getopt to getopt-gnu as now recommended in gnulib/NEWS. * build-aux/update-b4-copyright: Fix. * cfg.mk (update-copyright-env): Configure update-copyright. (cherry picked from commit 75ac158b82be1fab5157b140287368165a50ec82)
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/update-b4-copyright32
1 files changed, 17 insertions, 15 deletions
diff --git a/build-aux/update-b4-copyright b/build-aux/update-b4-copyright
index af43407d..30c38013 100755
--- a/build-aux/update-b4-copyright
+++ b/build-aux/update-b4-copyright
@@ -42,7 +42,7 @@ my $old_re = <<'EOF'
(?:
,\s*
(
- \[\s* (?:\d{4}(,\s*|-))* (\d{4}) \s*]
+ \[\s* (?:\d{4}(?:,\s*|-))* (\d{4}) \s*]
)
)?
\)
@@ -54,8 +54,7 @@ while (/($old_re)/gx)
my $start = pos() - length ($1);
my $b4_copyright_line = $2;
my $year_lines = $3;
- my $sep = $4 ? $4 : "";
- my $final_year = $5;
+ my $final_year = $4;
$year_lines .= ')';
# If there was a second argument, it contains years, so update them.
@@ -65,18 +64,7 @@ while (/($old_re)/gx)
if ($final_year != $this_year)
{
# Update the year.
- if ($sep eq '-' && $final_year + 1 == $this_year)
- {
- $year_lines =~ s/$final_year/$this_year/;
- }
- elsif ($sep ne '-' && $final_year + 1 == $this_year)
- {
- $year_lines =~ s/$final_year/$final_year-$this_year/;
- }
- else
- {
- $year_lines =~ s/$final_year/$final_year, $this_year/;
- }
+ $year_lines =~ s/$final_year/$final_year, $this_year/;
}
# Normalize all whitespace.
@@ -85,6 +73,20 @@ while (/($old_re)/gx)
# Put spaces after commas.
$year_lines =~ s/, ?/, /g;
+ # Compress to intervals.
+ $year_lines =~
+ s/
+ (\d{4})
+ (?:
+ (,\ |-)
+ ((??{
+ if ($2 eq '-') { '\d{4}'; }
+ elsif (!$3) { $1 + 1; }
+ else { $3 + 1; }
+ }))
+ )+
+ /$1-$3/gx;
+
# Format within margin.
my $year_lines_new;
my $indent = index ($b4_copyright_line, '[');