Add some tools to handle yearly copyright notice updates.
We are now following the GNU guidelines: A new release automatically means that the copyright year of all affected files gets updated; it is no longer used to track years of modification changes. * src/tools/update-copyright-year: New Perl script. * src/tools/update-copyright: New shell script that calls `update-copyright-year' on all files. * src/tools/no-copyright: Exceptions that should not be handled by `update-copyright'
This commit is contained in:
parent
f796cf6c6b
commit
50be00d3b3
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2015-01-17 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
|
Add some tools to handle yearly copyright notice updates.
|
||||||
|
|
||||||
|
We are now following the GNU guidelines: A new release automatically
|
||||||
|
means that the copyright year of all affected files gets updated; it
|
||||||
|
is no longer used to track years of modification changes.
|
||||||
|
|
||||||
|
* src/tools/update-copyright-year: New Perl script.
|
||||||
|
* src/tools/update-copyright: New shell script that calls
|
||||||
|
`update-copyright-year' on all files.
|
||||||
|
* src/tools/no-copyright: Exceptions that should not be handled by
|
||||||
|
`update-copyright'
|
||||||
|
|
||||||
2015-01-14 Werner Lemberg <wl@gnu.org>
|
2015-01-14 Werner Lemberg <wl@gnu.org>
|
||||||
|
|
||||||
* docs/CHANGES: Updated, using a description from Behdad.
|
* docs/CHANGES: Updated, using a description from Behdad.
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
# Files that don't get a copyright, or which are taken from elsewhere.
|
||||||
|
#
|
||||||
|
# All lines in this file are patterns, including the comment lines; this
|
||||||
|
# means that e.g. `FTL.TXT' matches all files that have this string in
|
||||||
|
# the file name (including the path relative to the current directory,
|
||||||
|
# always starting with `./').
|
||||||
|
#
|
||||||
|
# Don't put empty lines into this file!
|
||||||
|
#
|
||||||
|
.gitignore
|
||||||
|
#
|
||||||
|
builds/unix/pkg.m4
|
||||||
|
#
|
||||||
|
docs/FTL.TXT
|
||||||
|
docs/GPLv2.TXT
|
||||||
|
#
|
||||||
|
src/base/md5.c
|
||||||
|
src/base/md5.h
|
||||||
|
#
|
||||||
|
src/bdf/bdf.c
|
||||||
|
src/bdf/bdf.h
|
||||||
|
src/bdf/bdfdrivr.c
|
||||||
|
src/bdf/bdfdrivr.h
|
||||||
|
src/bdf/bdferror.h
|
||||||
|
src/bdf/bdflib.c
|
||||||
|
src/bdf/module.mk
|
||||||
|
src/bdf/README
|
||||||
|
src/bdf/rules.mk
|
||||||
|
README
|
||||||
|
#
|
||||||
|
src/pcf/module.mk
|
||||||
|
src/pcf/pcf.c
|
||||||
|
src/pcf/pcf.h
|
||||||
|
src/pcf/pcfdrivr.c
|
||||||
|
src/pcf/pcfdrivr.h
|
||||||
|
src/pcf/pcferror.h
|
||||||
|
src/pcf/pcfread.c
|
||||||
|
src/pcf/pcfread.h
|
||||||
|
src/pcf/pcfutil.c
|
||||||
|
src/pcf/pcfutil.h
|
||||||
|
src/pcf/README
|
||||||
|
src/pcf/rules.mk
|
||||||
|
#
|
||||||
|
src/gzip/adler32.c
|
||||||
|
src/gzip/infblock.c
|
||||||
|
src/gzip/infblock.h
|
||||||
|
src/gzip/infcodes.c
|
||||||
|
src/gzip/infcodes.h
|
||||||
|
src/gzip/inffixed.h
|
||||||
|
src/gzip/inflate.c
|
||||||
|
src/gzip/inftrees.c
|
||||||
|
src/gzip/inftrees.h
|
||||||
|
src/gzip/infutil.c
|
||||||
|
src/gzip/infutil.h
|
||||||
|
src/gzip/zconf.h
|
||||||
|
src/gzip/zlib.h
|
||||||
|
src/gzip/zutil.c
|
||||||
|
src/gzip/zutil.h
|
||||||
|
#
|
||||||
|
src/tools/ftrandom/ftrandom.c
|
||||||
|
#
|
||||||
|
# EOF
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Run the `update-copyright-year' script on all files in the git repository,
|
||||||
|
# taking care of exceptions stored in file `no-copyright'.
|
||||||
|
|
||||||
|
topdir=`git rev-parse --show-toplevel`
|
||||||
|
toolsdir=$topdir/src/tools
|
||||||
|
|
||||||
|
git ls-files $topdir \
|
||||||
|
| sed 's|^|./|' \
|
||||||
|
| grep -vFf $toolsdir/no-copyright \
|
||||||
|
| xargs $toolsdir/update-copyright-year
|
||||||
|
|
||||||
|
# EOF
|
|
@ -0,0 +1,135 @@
|
||||||
|
eval '(exit $?0)' && eval 'exec perl -wS -i "$0" ${1+"$@"}'
|
||||||
|
& eval 'exec perl -wS -i "$0" $argv:q'
|
||||||
|
if 0;
|
||||||
|
|
||||||
|
# Copyright 2015 by
|
||||||
|
# Werner Lemberg.
|
||||||
|
#
|
||||||
|
# This file is part of the FreeType project, and may only be used, modified,
|
||||||
|
# and distributed under the terms of the FreeType project license,
|
||||||
|
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
||||||
|
# indicate that you have read the license and understand and accept it
|
||||||
|
# fully.
|
||||||
|
|
||||||
|
# [Note: This script is expected to be called by the shell, which in turn
|
||||||
|
# calls perl automatically. The nifty start-up code above is based on
|
||||||
|
# gnulib's `update-copyright' script; it is a more portable replacement for
|
||||||
|
# the shebang, using the first `perl' program in the shell's path instead.]
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# update-copyright-year file1 [file2 ...]
|
||||||
|
|
||||||
|
|
||||||
|
# This script handles copyright entries like
|
||||||
|
#
|
||||||
|
# Copyright 2000 by
|
||||||
|
# foobar
|
||||||
|
#
|
||||||
|
# or
|
||||||
|
#
|
||||||
|
# /* Copyright 2000, 2001, 2004-2007 by */
|
||||||
|
# /* foobar */
|
||||||
|
#
|
||||||
|
# and replaces them uniformly with
|
||||||
|
#
|
||||||
|
# Copyright 2000-2015
|
||||||
|
# foobar
|
||||||
|
#
|
||||||
|
# and
|
||||||
|
#
|
||||||
|
# /* Copyright 2000-2015 by */
|
||||||
|
# /* foobar */
|
||||||
|
#
|
||||||
|
# (assuming that the current year is 2015). As can be seen, the line length
|
||||||
|
# is retained if there is non-whitespace after the word `by' on the same
|
||||||
|
# line.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
|
||||||
|
my (undef, undef, undef,
|
||||||
|
undef, undef, $year,
|
||||||
|
undef, undef, undef) = localtime(time);
|
||||||
|
$year += 1900;
|
||||||
|
|
||||||
|
my $replaced = 0;
|
||||||
|
|
||||||
|
|
||||||
|
# Loop over all input files; option `-i' (issued at the very beginning of
|
||||||
|
# this script) makes perl edit them in-place.
|
||||||
|
while (<>)
|
||||||
|
{
|
||||||
|
# Only handle the first copyright notice in a file.
|
||||||
|
if (!$replaced)
|
||||||
|
{
|
||||||
|
# First try: Search multiple copyright years.
|
||||||
|
s {
|
||||||
|
(?<begin>.*)
|
||||||
|
Copyright
|
||||||
|
(?<space1>\ +)
|
||||||
|
(?<first>[12][0-9][0-9][0-9])
|
||||||
|
(?<middle>.+)
|
||||||
|
(?<last>[12][0-9][0-9][0-9])
|
||||||
|
(?<space2>\ +)
|
||||||
|
by
|
||||||
|
(?<space3>\ *)
|
||||||
|
(?<end>.*)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Fill line to the same length (if appropriate); we skip the middle
|
||||||
|
# part but insert two spaces and `-'.
|
||||||
|
my $space = length($+{space1}) - 1
|
||||||
|
+ length($+{middle}) - 1
|
||||||
|
+ length($+{space2}) - 1
|
||||||
|
+ length($+{space3});
|
||||||
|
|
||||||
|
print "$+{begin}";
|
||||||
|
print "Copyright\ $+{first}-$year\ by";
|
||||||
|
print ' ' x $space if length($+{end});
|
||||||
|
print "$+{end}\n";
|
||||||
|
$replaced = 1;
|
||||||
|
}ex
|
||||||
|
||
|
||||||
|
# Second try: Search a single copyright year.
|
||||||
|
s {
|
||||||
|
(?<begin>.*)
|
||||||
|
Copyright
|
||||||
|
(?<space1>\ +)
|
||||||
|
(?<first>[12][0-9][0-9][0-9])
|
||||||
|
(?<space2>\ +)
|
||||||
|
by
|
||||||
|
(?<space3>\ *)
|
||||||
|
(?<end>.*)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
# Fill line to the same length (if appropriate); we insert two
|
||||||
|
# spaces, a `-', and the current year.
|
||||||
|
my $space = length($+{space1}) - 1
|
||||||
|
+ length($+{space2}) - 1
|
||||||
|
+ length($+{space3})
|
||||||
|
- (length($year) + 1);
|
||||||
|
|
||||||
|
print "$+{begin}";
|
||||||
|
print "Copyright $+{first}-$year by";
|
||||||
|
# If $space is negative this inserts nothing.
|
||||||
|
print ' ' x $space if length($+{end});
|
||||||
|
print "$+{end}\n";
|
||||||
|
$replaced = 1;
|
||||||
|
}ex
|
||||||
|
||
|
||||||
|
# Otherwise print line unaltered.
|
||||||
|
print;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
{
|
||||||
|
# Reset $replaced before processing the next file.
|
||||||
|
$replaced = 0 if eof;
|
||||||
|
}
|
||||||
|
|
||||||
|
# EOF
|
Loading…
Reference in New Issue