summaryrefslogtreecommitdiff
path: root/build-aux/update-copyright
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/update-copyright')
-rwxr-xr-xbuild-aux/update-copyright53
1 files changed, 39 insertions, 14 deletions
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index f2fc97e..4f79b56 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,11 +1,9 @@
-eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" "$@"'
- & eval 'exec perl -wS -0777 -pi "$0" $argv:q'
- if 0;
-# Update an FSF copyright year list to include the current year.
+#!/bin/sh
+#! -*-perl-*-
-my $VERSION = '2018-03-07.03:47'; # UTC
+# Update an FSF copyright year list to include the current year.
-# Copyright (C) 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2009-2020 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,9 +17,12 @@ my $VERSION = '2018-03-07.03:47'; # UTC
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-
+#
# Written by Jim Meyering and Joel E. Denny
+# This script updates an FSF copyright year list to include the current year.
+# Usage: update-copyright [FILE...]
+#
# The arguments to this script should be names of files that contain
# copyright statements to be updated. The copyright holder's name
# defaults to "Free Software Foundation, Inc." but may be changed to
@@ -97,7 +98,7 @@ my $VERSION = '2018-03-07.03:47'; # UTC
# 6. Blank lines, even if preceded by the prefix, do not appear
# within the FSF copyright statement.
# 7. Each copyright year is 2 or 4 digits, and years are separated by
-# commas or dashes. Whitespace may appear after commas.
+# commas, "-", or "--". Whitespace may appear after commas.
#
# Environment variables:
#
@@ -121,6 +122,27 @@ my $VERSION = '2018-03-07.03:47'; # UTC
# 5. Set UPDATE_COPYRIGHT_HOLDER if the copyright holder is other
# than "Free Software Foundation, Inc.".
+# This is a prologue that allows to run a perl script as an executable
+# on systems that are compliant to a POSIX version before POSIX:2017.
+# On such systems, the usual invocation of an executable through execlp()
+# or execvp() fails with ENOEXEC if it is a script that does not start
+# with a #! line. The script interpreter mentioned in the #! line has
+# to be /bin/sh, because on GuixSD systems that is the only program that
+# has a fixed file name. The second line is essential for perl and is
+# also useful for editing this file in Emacs. The next two lines below
+# are valid code in both sh and perl. When executed by sh, they re-execute
+# the script through the perl program found in $PATH. The '-x' option
+# is essential as well; without it, perl would re-execute the script
+# through /bin/sh. When executed by perl, the next two lines are a no-op.
+eval 'exec perl -wSx -0777 -pi "$0" "$@"'
+ if 0;
+
+my $VERSION = '2018-03-07.03:47'; # UTC
+# The definition above must lie within the first 8 lines in order
+# for the Emacs time-stamp write hook (at end) to update it.
+# If you change this file with Emacs, please let the write hook
+# do its job. Otherwise, update this string manually.
+
use strict;
use warnings;
@@ -170,7 +192,7 @@ while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
$holder_re =~ s/\s/$ws_re/g;
my $stmt_remainder_re =
"(?:$ws_re$circle_c_re)?"
- . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*"
+ . "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|--?))*"
. "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
if (/\G$stmt_remainder_re/)
{
@@ -209,26 +231,28 @@ if (defined $stmt_re)
# Make the use of intervals consistent.
if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
{
- $stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg;
+ $stmt =~ s/(\d{4})--?(\d{4})/join(', ', $1..$2)/eg;
}
else
{
+ my $ndash = $ARGV =~ /\.tex(i(nfo)?)?$/ ? "--" : "-";
+
$stmt =~
s/
(\d{4})
(?:
- (,\ |-)
+ (,\ |--?)
((??{
- if ($2 eq '-') { '\d{4}'; }
+ if ($2 ne ', ') { '\d{4}'; }
elsif (!$3) { $1 + 1; }
else { $3 + 1; }
}))
)+
- /$1-$3/gx;
+ /$1$ndash$3/gx;
# When it's 2, emit a single range encompassing all year numbers.
$ENV{UPDATE_COPYRIGHT_USE_INTERVALS} == 2
- and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1-$2/;
+ and $stmt =~ s/\b(\d{4})\b.*\b(\d{4})\b/$1$ndash$2/;
}
# Format within margin.
@@ -270,6 +294,7 @@ else
# mode: perl
# indent-tabs-mode: nil
# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-line-limit: 200
# time-stamp-start: "my $VERSION = '"
# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
# time-stamp-time-zone: "UTC0"