mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Imported update-copyright; set build-aux in cfg.mk.
This commit is contained in:
parent
02e5f41670
commit
35fe2bcefd
@ -1,3 +1,9 @@
|
|||||||
|
2009-09-04 Micah Cowan <micah@cowan.name>
|
||||||
|
|
||||||
|
* update-copyright: Imported from gnulib.
|
||||||
|
* lib/Makefile.am, m4/gnulib-cache.m4, m4/gnulib-comp.m4: Adjusted
|
||||||
|
for update-copyright.
|
||||||
|
|
||||||
2009-09-03 Micah Cowan <micah@cowan.name>
|
2009-09-03 Micah Cowan <micah@cowan.name>
|
||||||
|
|
||||||
* NEWS: Give credit to jff for SSL security fix, call attention to
|
* NEWS: Give credit to jff for SSL security fix, call attention to
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# the same distribution terms as the rest of that program.
|
# the same distribution terms as the rest of that program.
|
||||||
#
|
#
|
||||||
# Generated by gnulib-tool.
|
# Generated by gnulib-tool.
|
||||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg strcasestr
|
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg strcasestr update-copyright
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = 1.5 gnits
|
AUTOMAKE_OPTIONS = 1.5 gnits
|
||||||
|
|
||||||
@ -870,6 +870,13 @@ EXTRA_DIST += unistd.in.h
|
|||||||
|
|
||||||
## end gnulib module unistd
|
## end gnulib module unistd
|
||||||
|
|
||||||
|
## begin gnulib module update-copyright
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += $(top_srcdir)/./update-copyright
|
||||||
|
|
||||||
|
## end gnulib module update-copyright
|
||||||
|
|
||||||
## begin gnulib module useless-if-before-free
|
## begin gnulib module useless-if-before-free
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# Specification in the form of a command-line invocation:
|
# Specification in the form of a command-line invocation:
|
||||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg strcasestr
|
# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl alloca c-ctype getopt getpass-gnu maintainer-makefile quote quotearg strcasestr update-copyright
|
||||||
|
|
||||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||||
gl_LOCAL_DIR([])
|
gl_LOCAL_DIR([])
|
||||||
@ -28,6 +28,7 @@ gl_MODULES([
|
|||||||
quote
|
quote
|
||||||
quotearg
|
quotearg
|
||||||
strcasestr
|
strcasestr
|
||||||
|
update-copyright
|
||||||
])
|
])
|
||||||
gl_AVOID([])
|
gl_AVOID([])
|
||||||
gl_SOURCE_BASE([lib])
|
gl_SOURCE_BASE([lib])
|
||||||
|
@ -242,6 +242,7 @@ AC_DEFUN([gltests_LIBSOURCES], [
|
|||||||
# gnulib-tool and may be removed by future gnulib-tool invocations.
|
# gnulib-tool and may be removed by future gnulib-tool invocations.
|
||||||
AC_DEFUN([gl_FILE_LIST], [
|
AC_DEFUN([gl_FILE_LIST], [
|
||||||
build-aux/link-warning.h
|
build-aux/link-warning.h
|
||||||
|
build-aux/update-copyright
|
||||||
build-aux/useless-if-before-free
|
build-aux/useless-if-before-free
|
||||||
build-aux/vc-list-files
|
build-aux/vc-list-files
|
||||||
lib/alloca.c
|
lib/alloca.c
|
||||||
|
258
update-copyright
Executable file
258
update-copyright
Executable file
@ -0,0 +1,258 @@
|
|||||||
|
#!/usr/bin/perl -0777 -pi
|
||||||
|
# Update an FSF copyright year list to include the current year.
|
||||||
|
|
||||||
|
my $VERSION = '2009-08-14.18:56'; # UTC
|
||||||
|
|
||||||
|
# Copyright (C) 2009 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
|
||||||
|
# the Free Software Foundation; either version 3, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# Written by Jim Meyering and Joel E. Denny
|
||||||
|
|
||||||
|
# The arguments to this script should be names of files that contain FSF
|
||||||
|
# copyright statements to be updated. For example, you might wish to
|
||||||
|
# use the update-copyright target rule in maint.mk from gnulib's
|
||||||
|
# maintainer-makefile module.
|
||||||
|
#
|
||||||
|
# Iff an FSF copyright statement is recognized in a file and the final
|
||||||
|
# year is not the current year, then the statement is updated for the
|
||||||
|
# new year and it is reformatted to:
|
||||||
|
#
|
||||||
|
# 1. Fit within 72 columns.
|
||||||
|
# 2. Convert 2-digit years to 4-digit years by prepending "19".
|
||||||
|
# 3. Expand copyright year intervals. (See "Environment variables"
|
||||||
|
# below.)
|
||||||
|
#
|
||||||
|
# A warning is printed for every file for which no FSF copyright
|
||||||
|
# statement is recognized.
|
||||||
|
#
|
||||||
|
# Each file's FSF copyright statement must be formated correctly in
|
||||||
|
# order to be recognized. For example, each of these is fine:
|
||||||
|
#
|
||||||
|
# Copyright @copyright{} 1990-2005, 2007-2009 Free Software
|
||||||
|
# Foundation, Inc.
|
||||||
|
#
|
||||||
|
# # Copyright (C) 1990-2005, 2007-2009 Free Software
|
||||||
|
# # Foundation, Inc.
|
||||||
|
#
|
||||||
|
# /*
|
||||||
|
# * Copyright © 90,2005,2007-2009
|
||||||
|
# * Free Software Foundation, Inc.
|
||||||
|
# */
|
||||||
|
#
|
||||||
|
# However, the following format is not recognized because the line
|
||||||
|
# prefix changes after the first line:
|
||||||
|
#
|
||||||
|
# ## Copyright (C) 1990-2005, 2007-2009 Free Software
|
||||||
|
# # Foundation, Inc.
|
||||||
|
#
|
||||||
|
# The following copyright statement is not recognized because the
|
||||||
|
# copyright holder is not the FSF:
|
||||||
|
#
|
||||||
|
# Copyright (C) 1990-2005, 2007-2009 Acme, Inc.
|
||||||
|
#
|
||||||
|
# However, any correctly formatted FSF copyright statement following
|
||||||
|
# either of the previous two copyright statements would be recognized.
|
||||||
|
#
|
||||||
|
# The exact conditions that a file's FSF copyright statement must meet
|
||||||
|
# to be recognized are:
|
||||||
|
#
|
||||||
|
# 1. It is the first FSF copyright statement that meets all of the
|
||||||
|
# following conditions. Subsequent FSF copyright statements are
|
||||||
|
# ignored.
|
||||||
|
# 2. Its format is "Copyright (C)", then a list of copyright years,
|
||||||
|
# and then the name of the copyright holder, which is "Free
|
||||||
|
# Software Foundation, Inc.".
|
||||||
|
# 3. The "(C)" takes one of the following forms or is omitted
|
||||||
|
# entirely:
|
||||||
|
#
|
||||||
|
# A. (C)
|
||||||
|
# B. (c)
|
||||||
|
# C. @copyright{}
|
||||||
|
# D. ©
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# 5 characters.
|
||||||
|
# 5. Iff such a prefix is present, the same prefix appears at the
|
||||||
|
# beginning of each remaining line within the FSF copyright
|
||||||
|
# statement. There is one exception in order to support C-style
|
||||||
|
# comments: if the first line's prefix contains nothing but
|
||||||
|
# whitespace surrounding a "/*", then the prefix for all subsequent
|
||||||
|
# lines is the same as the first line's prefix except with each of
|
||||||
|
# "/" and possibly "*" replaced by a " ". The replacement of "*"
|
||||||
|
# by " " is consistent throughout all subsequent lines.
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# Environment variables:
|
||||||
|
#
|
||||||
|
# 1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
|
||||||
|
# is reformatted even if it does not need updating for the new
|
||||||
|
# year. If unset or set to 0, only updated FSF copyright
|
||||||
|
# statements are reformatted.
|
||||||
|
# 2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
|
||||||
|
# copyright years (such as 90, 1991, 1992-2007, 2008) in a
|
||||||
|
# reformatted FSF copyright statement is collapsed to a single
|
||||||
|
# interval (such as 1990-2008). If unset or set to 0, all existing
|
||||||
|
# copyright year intervals in a reformatted FSF copyright statement
|
||||||
|
# are expanded instead.
|
||||||
|
# 3. For testing purposes, you can set the assumed current year in
|
||||||
|
# UPDATE_COPYRIGHT_YEAR.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $copyright_re = 'Copyright';
|
||||||
|
my $circle_c_re = '(?:\([cC]\)|@copyright{}|©)';
|
||||||
|
my $holder = 'Free Software Foundation, Inc.';
|
||||||
|
my $prefix_max = 5;
|
||||||
|
my $margin = 72;
|
||||||
|
my $tab_width = 8;
|
||||||
|
|
||||||
|
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
|
||||||
|
if (!$this_year || $this_year !~ m/^\d{4}$/)
|
||||||
|
{
|
||||||
|
my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
|
||||||
|
$this_year = $year + 1900;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Unless the file consistently uses "\r\n" as the EOL, use "\n" instead.
|
||||||
|
my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n";
|
||||||
|
|
||||||
|
my $leading;
|
||||||
|
my $prefix;
|
||||||
|
my $ws_re;
|
||||||
|
my $stmt_re;
|
||||||
|
while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
|
||||||
|
{
|
||||||
|
$leading = "$1$2";
|
||||||
|
$prefix = $2;
|
||||||
|
if ($prefix =~ /^(\s*\/)\*(\s*)$/)
|
||||||
|
{
|
||||||
|
$prefix =~ s,/, ,;
|
||||||
|
my $prefix_ws = $prefix;
|
||||||
|
$prefix_ws =~ s/\*/ /; # Only whitespace.
|
||||||
|
if (/\G(?:[^*\n]|\*[^\/\n])*\*?\n$prefix_ws/)
|
||||||
|
{
|
||||||
|
$prefix = $prefix_ws;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ws_re = '[ \t\r\f]'; # \s without \n
|
||||||
|
$ws_re =
|
||||||
|
"(?:$ws_re*(?:$ws_re|\\n" . quotemeta($prefix) . ")$ws_re*)";
|
||||||
|
my $holder_re = $holder;
|
||||||
|
$holder_re =~ s/\s/$ws_re/g;
|
||||||
|
my $stmt_remainder_re =
|
||||||
|
"(?:$ws_re$circle_c_re)?"
|
||||||
|
. "$ws_re(?:(?:\\d\\d)?\\d\\d(?:,$ws_re?|-))*"
|
||||||
|
. "((?:\\d\\d)?\\d\\d)$ws_re$holder_re";
|
||||||
|
if (/\G$stmt_remainder_re/)
|
||||||
|
{
|
||||||
|
$stmt_re =
|
||||||
|
quotemeta($leading) . "($copyright_re$stmt_remainder_re)";
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (defined $stmt_re)
|
||||||
|
{
|
||||||
|
/$stmt_re/ or die; # Should never die.
|
||||||
|
my $stmt = $1;
|
||||||
|
my $final_year_orig = $2;
|
||||||
|
|
||||||
|
# Handle two-digit year numbers like "98" and "99".
|
||||||
|
my $final_year = $final_year_orig;
|
||||||
|
$final_year <= 99
|
||||||
|
and $final_year += 1900;
|
||||||
|
|
||||||
|
if ($final_year != $this_year)
|
||||||
|
{
|
||||||
|
# Update the year.
|
||||||
|
$stmt =~ s/$final_year_orig/$final_year, $this_year/;
|
||||||
|
}
|
||||||
|
if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
|
||||||
|
{
|
||||||
|
# Normalize all whitespace including newline-prefix sequences.
|
||||||
|
$stmt =~ s/$ws_re/ /g;
|
||||||
|
|
||||||
|
# Put spaces after commas.
|
||||||
|
$stmt =~ s/, ?/, /g;
|
||||||
|
|
||||||
|
# Convert 2-digit to 4-digit years.
|
||||||
|
$stmt =~ s/(\b\d\d\b)/19$1/g;
|
||||||
|
|
||||||
|
# Make the use of intervals consistent.
|
||||||
|
if (!$ENV{UPDATE_COPYRIGHT_USE_INTERVALS})
|
||||||
|
{
|
||||||
|
$stmt =~ s/(\d{4})-(\d{4})/join(', ', $1..$2)/eg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$stmt =~
|
||||||
|
s/
|
||||||
|
(\d{4})
|
||||||
|
(?:
|
||||||
|
(,\ |-)
|
||||||
|
((??{
|
||||||
|
if ($2 eq '-') { '\d{4}'; }
|
||||||
|
elsif (!$3) { $1 + 1; }
|
||||||
|
else { $3 + 1; }
|
||||||
|
}))
|
||||||
|
)+
|
||||||
|
/$1-$3/gx;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Format within margin.
|
||||||
|
my $stmt_wrapped;
|
||||||
|
my $text_margin = $margin - length($prefix);
|
||||||
|
if ($prefix =~ /^(\t+)/)
|
||||||
|
{
|
||||||
|
$text_margin -= length($1) * ($tab_width - 1);
|
||||||
|
}
|
||||||
|
while (length $stmt)
|
||||||
|
{
|
||||||
|
if (($stmt =~ s/^(.{1,$text_margin})(?: |$)//)
|
||||||
|
|| ($stmt =~ s/^([\S]+)(?: |$)//))
|
||||||
|
{
|
||||||
|
my $line = $1;
|
||||||
|
$stmt_wrapped .= $stmt_wrapped ? "$eol$prefix" : $leading;
|
||||||
|
$stmt_wrapped .= $line;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# Should be unreachable, but we don't want an infinite
|
||||||
|
# loop if it can be reached.
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Replace the old copyright statement.
|
||||||
|
s/$stmt_re/$stmt_wrapped/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print STDERR "$ARGV: warning: FSF copyright statement not found\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# indent-tabs-mode: nil
|
||||||
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
# time-stamp-start: "my $VERSION = '"
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H:%02M"
|
||||||
|
# time-stamp-time-zone: "UTC"
|
||||||
|
# time-stamp-end: "'; # UTC"
|
||||||
|
# End:
|
Loading…
Reference in New Issue
Block a user