[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: updating copyright years
From: |
Joel E. Denny |
Subject: |
Re: updating copyright years |
Date: |
Wed, 5 Aug 2009 21:44:36 -0400 (EDT) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
On Tue, 4 Aug 2009, Karl Berry wrote:
> It definitely would be nice, and I've contemplated doing so from time to
> time, but it never seemed like a big enough deal with which to occupy
> rms's time discussing.
I understand.
> So, the consensus is that we should make (C) completely optional?
>
> That is the reality. There are a lot of files without the (C), and even
> more files with the (C).
The following patch adds support.
> little worried that this increases the changes of update-copyright
> matching incorrect text.
>
> As long as Copyright is the first word on the line, and it's followed by
> at least one four-digit number, a false positive doesn't seem likely to
> me. But what do I know.
After the recent cleanup in update-copyright, it should be safe.
>From 909fbf122f97e02687e77814e5ebfb38e063f1cf Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Wed, 5 Aug 2009 20:51:27 -0400
Subject: [PATCH] update-copyright: support omitted "(C)"
* build-aux/update-copyright: Implement and document. Also,
allow variable whitespace before "(C)".
* tests/test-update-copyright.sh: Test.
---
ChangeLog | 7 ++++++
build-aux/update-copyright | 45 ++++++++++++++++++++++++----------------
tests/test-update-copyright.sh | 21 ++++++++++++++++++
3 files changed, 55 insertions(+), 18 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 996baca..602f69d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2009-08-05 Joel E. Denny <address@hidden>
+ update-copyright: support omitted "(C)"
+ * build-aux/update-copyright: Implement and document. Also,
+ allow variable whitespace before "(C)".
+ * tests/test-update-copyright.sh: Test.
+
+2009-08-05 Joel E. Denny <address@hidden>
+
update-copyright: don't trip on non-FSF copyright statements
* build-aux/update-copyright: Fix so that the first correctly
formatted FSF copyright statement is recognized no matter what
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index dd0d758..b124bb9 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,7 @@
#!/usr/bin/perl -0777 -pi
# Update an FSF copyright year list to include the current year.
-my $VERSION = '2009-08-05.20:47'; # UTC
+my $VERSION = '2009-08-06.01:08'; # UTC
# Copyright (C) 2009 Free Software Foundation, Inc.
#
@@ -72,28 +72,36 @@ my $VERSION = '2009-08-05.20:47'; # UTC
# The exact conditions that a file's FSF copyright statement must meet
# to be recognized are:
#
-# 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. The "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.
-# 3. Iff such a prefix is present, the same prefix appears at the
+# 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.
-# 4. Blank lines, even if preceded by the prefix, do not appear
+# 6. Blank lines, even if preceded by the prefix, do not appear
# within the FSF copyright statement.
-# 5. Each copyright year is 2 or 4 digits, and years are separated by
+# 7. Each copyright year is 2 or 4 digits, and years are separated by
# commas or dashes. Whitespace may occur after commas.
-# 6. It is the first FSF copyright statement that meets all of the
-# above conditions. Subsequent FSF copyright statements are
-# ignored.
use strict;
use warnings;
-my $copyright_re = 'Copyright (?:\([cC]\)|@copyright{}|©)';
+my $copyright_re = 'Copyright';
+my $circle_c_re = '(?:\([cC]\)|@copyright{}|©)';
my $holder = 'Free Software Foundation, Inc.';
my $prefix_max = 5;
my $margin = 72;
@@ -123,13 +131,14 @@ while (/(^|\n)(.{0,$prefix_max})$copyright_re/g)
my $holder_re = $holder;
$holder_re =~ s/\s/$ws_re/g;
my $stmt_remainder_re =
- "$ws_re(?:(?:\\d\\d)?\\d\\d(,$ws_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$prefix")
- . "($copyright_re$stmt_remainder_re)";
+ quotemeta("$leading$prefix")
+ . "($copyright_re$stmt_remainder_re)";
last;
}
}
diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh
index 0f5de4b..69dadbf 100755
--- a/tests/test-update-copyright.sh
+++ b/tests/test-update-copyright.sh
@@ -334,4 +334,25 @@ EOF
compare $TMP-exp $TMP || exit 1
rm $TMP*
+## --------------- ##
+## Omitted "(C)". ##
+## --------------- ##
+
+TMP=$TMP_BASE-omitted-circle-c
+cat > $TMP <<EOF
+ Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+ 2009 Free Software Foundation, Inc.
+EOF
+UPDATE_COPYRIGHT_YEAR=2010 \
+ update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr
+compare /dev/null $TMP-stdout || exit 1
+compare /dev/null $TMP-stderr || exit 1
+compare - $TMP <<EOF || exit 1
+ Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98, 1999,
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009-2010 Free
+ Software Foundation, Inc.
+EOF
+rm $TMP*
+
exit 0
--
1.5.4.3
- Re: updating copyright years, (continued)
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Jim Meyering, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: ChangeLog patches, Bruno Haible, 2009/08/04
- Re: ChangeLog patches, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Matthew Woehlke, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Karl Berry, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Karl Berry, 2009/08/04
- Re: updating copyright years,
Joel E. Denny <=
- Re: updating copyright years, Jim Meyering, 2009/08/06
- Re: updating copyright years, Karl Berry, 2009/08/04
- Re: updating copyright years, Karl Berry, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/05
- Re: updating copyright years, Jim Meyering, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Jim Meyering, 2009/08/04
- Re: updating copyright years, Jim Meyering, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04