changeset 11827:d11c68bb2278

update-copyright: convert 2-digit to 4-digit years * build-aux/update-copyright: Implement and document. * tests/test-update-copyright.sh: Update.
author Joel E. Denny <jdenny@clemson.edu>
date Thu, 13 Aug 2009 22:40:34 -0400
parents 278ae60991b9
children fa729096a803
files ChangeLog build-aux/update-copyright tests/test-update-copyright.sh
diffstat 3 files changed, 33 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-14  Joel E. Denny  <jdenny@clemson.edu>
+
+	update-copyright: convert 2-digit to 4-digit years
+	* build-aux/update-copyright: Implement and document.
+	* tests/test-update-copyright.sh: Update.
+
 2009-08-14  Jim Meyering  <meyering@redhat.com>
 
 	test-exclude: avoid coreutils "make check" failure
--- 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-06.01:08'; # UTC
+my $VERSION = '2009-08-14.02:23'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation, Inc.
 #
@@ -26,9 +26,11 @@
 # maintainer-makefile module.
 #
 # Iff an FSF copyright statement is discovered in a file and the final
-# year is not the current year, the statement is updated for the new
-# year and reformatted to fit within 72 columns.  A warning is printed
-# for every file for which no FSF copyright statement is discovered.
+# year is not the current year, then the statement is updated for the
+# new year, 2-digit years are converted to 4-digit years by prepending
+# "19", and the statement is reformatted to fit within 72 columns.  A
+# warning is printed for every file for which no FSF copyright statement
+# is discovered.
 #
 # Each file's FSF copyright statement must be formated correctly in
 # order to be recognized.  For example, each of these is fine:
@@ -179,6 +181,9 @@
         # Put spaces after commas.
         $stmt =~ s/, ?/, /g;
 
+        # Convert 2-digit to 4-digit years.
+        $stmt =~ s/(\b\d\d\b)/19$1/g;
+
         # Format within margin.
         my $stmt_wrapped;
         my $text_margin = $margin - length($prefix);
--- a/tests/test-update-copyright.sh
+++ b/tests/test-update-copyright.sh
@@ -123,7 +123,7 @@
 EOF
 compare - $TMP.3 <<EOF || exit 1
 /*
- * Copyright &copy; 90, 2005, 2007-2010 Free Software Foundation, Inc.
+ * Copyright &copy; 1990, 2005, 2007-2010 Free Software Foundation, Inc.
  */
 EOF
 compare - $TMP.4 <<EOF || exit 1
@@ -284,9 +284,9 @@
 compare /dev/null $TMP-stdout || exit 1
 compare /dev/null $TMP-stderr || exit 1
 compare - $TMP <<EOF || exit 1
-	Copyright (C) 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.
+	Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996,
+	1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+	2007, 2008, 2009-2010 Free Software Foundation, Inc.
 EOF
 rm $TMP*
 
@@ -305,9 +305,9 @@
 compare /dev/null $TMP-stdout || exit 1
 compare /dev/null $TMP-stderr || exit 1
 compare - $TMP <<EOF || exit 1
-		# Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995,
-		# 1996, 1997, 98, 1999, 2000, 2001, 2002, 2003, 2004,
-		# 2005, 2006, 2007, 2008, 2009-2010 Free Software
+		# Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994,
+		# 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+		# 2004, 2005, 2006, 2007, 2008, 2009-2010 Free Software
 		# Foundation, Inc.
 EOF
 rm $TMP*
@@ -327,8 +327,8 @@
 compare /dev/null $TMP-stdout || exit 1
 compare /dev/null $TMP-stderr || exit 1
 tr @ '\015' > $TMP-exp <<\EOF
-Rem Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,@
-Rem 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@
+Rem Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@
+Rem 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@
 Rem 2009-2010 Free Software Foundation, Inc.@
 EOF
 compare $TMP-exp $TMP || exit 1
@@ -349,9 +349,9 @@
 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.
+  Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+  1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009-2010
+  Free Software Foundation, Inc.
 EOF
 rm $TMP*
 
@@ -371,7 +371,7 @@
     2009 Free Software Foundation, Inc.  */
 EOF
 cat > $TMP.single-line <<EOF
-/* Copyright 87, 88, 1991, 1992 Free Software Foundation, Inc.  */
+/*   Copyright 87, 1991, 1992 Free Software Foundation, Inc.  */
 EOF
 cat > $TMP.single-line-wrapped <<EOF
  /* Copyright 1988, 1991, 1992, 1993 Free Software Foundation, Inc.  */
@@ -389,17 +389,17 @@
 compare /dev/null $TMP-stdout || exit 1
 compare /dev/null $TMP-stderr || exit 1
 compare - $TMP.star <<EOF || exit 1
-/*  Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,
- *  1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+/*  Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ *  1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
  *  2009-2010 Free Software Foundation, Inc.  */
 EOF
 compare - $TMP.space <<EOF || exit 1
-  /*Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98,
-    1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  /*Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+    1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
     2009-2010 Free Software Foundation, Inc.  */
 EOF
 compare - $TMP.single-line <<EOF || exit 1
-/* Copyright 87, 88, 1991, 1992, 2010 Free Software Foundation, Inc.  */
+/*   Copyright 1987, 1991, 1992, 2010 Free Software Foundation, Inc.  */
 EOF
 compare - $TMP.single-line-wrapped <<EOF || exit 1
  /* Copyright 1988, 1991, 1992, 1993, 2010 Free Software Foundation,