diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-06-29 16:51:08 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-06-29 17:08:26 -0700 |
commit | c92f7606d6b73d4911b57f714c0cc5c64f0912bf (patch) | |
tree | c1a613a8bb019f142832420a911459f661fb7abe /build-aux/update-copyright | |
parent | b3eb40f9c9919e5c40762cab1196715bd8796af1 (diff) | |
download | autoconf-c92f7606d6b73d4911b57f714c0cc5c64f0912bf.tar.gz |
make fetch
Diffstat (limited to 'build-aux/update-copyright')
-rwxr-xr-x | build-aux/update-copyright | 60 |
1 files changed, 44 insertions, 16 deletions
diff --git a/build-aux/update-copyright b/build-aux/update-copyright index 63455c37..d9b7f683 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 = '2017-09-13.06:45'; # UTC +# Update an FSF copyright year list to include the current year. -# Copyright (C) 2009-2017 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 = '2017-09-13.06:45'; # 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 @@ -81,6 +82,7 @@ my $VERSION = '2017-09-13.06:45'; # UTC # B. (c) # C. @copyright{} # D. © +# E. © # # 4. The "Copyright" appears at the beginning of a line, except that it # may be prefixed by any sequence (e.g., a comment) of no more than @@ -96,7 +98,7 @@ my $VERSION = '2017-09-13.06:45'; # 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: # @@ -120,11 +122,32 @@ my $VERSION = '2017-09-13.06:45'; # 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 = '2020-04-04.15:07'; # 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; my $copyright_re = 'Copyright'; -my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©)'; +my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©|©)'; my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER}; $holder ||= 'Free Software Foundation, Inc.'; my $prefix_max = 5; @@ -169,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/) { @@ -208,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. @@ -263,10 +288,13 @@ else print STDERR "$ARGV: warning: copyright statement not found\n"; } +# Hey Emacs! # Local variables: +# coding: utf-8 # mode: perl # indent-tabs-mode: nil -# eval: (add-hook 'write-file-hooks 'time-stamp) +# 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" |