On Mon, 3 Aug 2009, Joel E. Denny wrote: > I just ran update-copyright on gnulib. It warns about a long list of > files. There are various problems: > > 1. "@copyright{}" or "©" instead of "(C)".
> In my opinion, update-copyright should be extended to handle #1. The following patch implements that. >From e1295037485637515e510c918fbf586df3b715fd Mon Sep 17 00:00:00 2001 From: Joel E. Denny <jde...@clemson.edu> Date: Mon, 3 Aug 2009 23:06:24 -0400 Subject: [PATCH] update-copyright: support @copyright{} and © * build-aux/update-copyright: Implement and document. * tests/test-update-copyright.sh: Test. --- ChangeLog | 6 ++++++ build-aux/update-copyright | 19 ++++++++++--------- tests/test-update-copyright.sh | 27 ++++++++++++++------------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba72930..9591fdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,12 @@ 2009-08-03 Joel E. Denny <jde...@clemson.edu> + update-copyright: support @copyright{} and © + * build-aux/update-copyright: Implement and document. + * tests/test-update-copyright.sh: Test. + +2009-08-03 Joel E. Denny <jde...@clemson.edu> + update-copyright: fix bug for 2-digit last year and add tests * build-aux/update-copyright: Fix bug. Use UPDATE_COPYRIGHT_YEAR from environment as current year if diff --git a/build-aux/update-copyright b/build-aux/update-copyright index 4a70333..b14dc50 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -46,15 +46,15 @@ my $VERSION = '2009-08-04.07:25'; # UTC # looks like the start of a copyright statement. For example, each of # these by itself is fine: # -# Copyright (C) 1990-2005, 2007-2009 Free Software Foundation, -# Inc. +# Copyright @copyright{} 1990-2005, 2007-2009 Free Software +# Foundation, Inc. # -# # Copyright (c) 1990-2005, 2007-2009 Free Software +# # Copyright (C) 1990-2005, 2007-2009 Free Software # # Foundation, Inc. # # /* -# * Copyright (C) 90,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 @@ -77,9 +77,10 @@ my $VERSION = '2009-08-04.07:25'; # UTC # breaks one. The worst that can happen is that a file is not updated # and a warning is issued. # -# 1. The format is "Copyright (C)" (where "(C)" can be "(c)"), then a -# list of copyright years, and then the name of the copyright -# holder, which is "Free Software Foundation, Inc.". +# 1. The format is "Copyright (C)" (where "(C)" can also be "(c)", +# "@copyright{}", or "©"), then a list of copyright years, and +# then the name of the copyright holder, which is "Free Software +# Foundation, Inc.". # 2. "Copyright (C)" 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. @@ -105,7 +106,7 @@ if (!$this_year || $this_year !~ m/^\d\d(\d\d)?$/) { my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ()); $this_year = $year + 1900; } -my $copyright = 'Copyright \([cC]\)'; +my $copyright = 'Copyright (?:\([cC]\)|@copyright{}|©)'; my $holder = 'Free Software Foundation, Inc.'; my $prefix_max = 5; my $margin = 72; diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index 4abc6f1..bb65c7e 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -24,17 +24,17 @@ TMP_BASE=update-copyright.test TMP=$TMP_BASE-ex cat > $TMP.1 <<EOF -Copyright (C) 1990-2005, 2007-2009 Free Software Foundation, -Inc. +Copyright @copyright{} 1990-2005, 2007-2009 Free Software +Foundation, Inc. EOF cat > $TMP.2 <<EOF -# Copyright (c) 1990-2005, 2007-2009 Free Software +# Copyright (C) 1990-2005, 2007-2009 Free Software # Foundation, Inc. EOF cat > $TMP.3 <<EOF /* - * Copyright (C) 90,2005,2007-2009 Free Software - * Foundation, Inc. + * Copyright © 90,2005,2007-2009 + * Free Software Foundation, Inc. */ EOF cat > $TMP.4 <<EOF @@ -59,17 +59,17 @@ $TMP.4: warning: FSF copyright statement not found $TMP.5: warning: FSF copyright statement not found EOF diff -u - $TMP.1 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Free Software Foundation, -Inc. +Copyright @copyright{} 1990-2005, 2007-2009 Free Software +Foundation, Inc. EOF diff -u - $TMP.2 <<EOF || exit 1 -# Copyright (c) 1990-2005, 2007-2009 Free Software +# Copyright (C) 1990-2005, 2007-2009 Free Software # Foundation, Inc. EOF diff -u - $TMP.3 <<EOF || exit 1 /* - * Copyright (C) 90,2005,2007-2009 Free Software - * Foundation, Inc. + * Copyright © 90,2005,2007-2009 + * Free Software Foundation, Inc. */ EOF diff -u - $TMP.4 <<EOF || exit 1 @@ -94,14 +94,15 @@ $TMP.4: warning: FSF copyright statement not found $TMP.5: warning: FSF copyright statement not found EOF diff -u - $TMP.1 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc. +Copyright @copyright{} 1990-2005, 2007-2010 Free Software Foundation, +Inc. EOF diff -u - $TMP.2 <<EOF || exit 1 -# Copyright (c) 1990-2005, 2007-2010 Free Software Foundation, Inc. +# Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc. EOF diff -u - $TMP.3 <<EOF || exit 1 /* - * Copyright (C) 90, 2005, 2007-2010 Free Software Foundation, Inc. + * Copyright © 90, 2005, 2007-2010 Free Software Foundation, Inc. */ EOF diff -u - $TMP.4 <<EOF || exit 1 -- 1.5.4.3