From bde528ccc0614e7df112e1e1d9f08843741e8321 Mon Sep 17 00:00:00 2001 From: "Joel E. Denny" Date: Thu, 13 Aug 2009 22:40:34 -0400 Subject: [PATCH] update-copyright: convert 2-digit to 4-digit years * build-aux/update-copyright: Implement and document. * tests/test-update-copyright.sh: Update. --- ChangeLog | 6 ++++++ build-aux/update-copyright | 13 ++++++++---- tests/test-update-copyright.sh | 36 +++++++++++++++++----------------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab455e1397..9d5187a0d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-08-14 Joel E. Denny + + 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 test-exclude: avoid coreutils "make check" failure diff --git a/build-aux/update-copyright b/build-aux/update-copyright index 68440f86c5..fb1c7d2b79 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-06.01:08'; # UTC +my $VERSION = '2009-08-14.02:23'; # UTC # Copyright (C) 2009 Free Software Foundation, Inc. # @@ -26,9 +26,11 @@ my $VERSION = '2009-08-06.01:08'; # UTC # 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 @@ if (defined $stmt_re) # 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); diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index 9997df488e..d0e30833d9 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -123,7 +123,7 @@ compare - $TMP.2 < $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 @@ UPDATE_COPYRIGHT_YEAR=2010 \ compare /dev/null $TMP-stdout || exit 1 compare /dev/null $TMP-stderr || exit 1 compare - $TMP < $TMP.space < $TMP.single-line < $TMP.single-line-wrapped <