Re: copyright years: mass-update every January 1

2009-08-14 Thread Jim Meyering
Joel E. Denny wrote:
 On Thu, 13 Aug 2009, Eric Blake wrote:
...
 According to Akim Demaille on 8/13/2009 1:59 AM:
  -   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
  -   Foundation, Inc.
  +   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
  Foundation, Inc.
 
  While at it, why not standardize everything to 4 digits (I don't think
  we need to address the Y10k issues yet :), and to introduce intervals
  where applicable?  Is there some legal thingy that forbids it?  It might
  help making some lines smaller.

 Yes - see this post:
 http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00184.html

 I'm not personally opposed to compressed years, but if you want the tool
 to output compressed years instead of longhand, it should be an option
 (and more importantly, we should also fix the tool to allow longhand years
 for maintainers that want longhand).

 Below are some patches to implement that.
...
 +2009-08-14  Joel E. Denny  jde...@clemson.edu
 +
 + update-copyright: convert 2-digit to 4-digit years
 + * build-aux/update-copyright: Implement and document.
 + * tests/test-update-copyright.sh: Update.
...
 + update-copyright: much ado about intervals
 + * build-aux/update-copyright: Implement and document
 + UPDATE_COPYRIGHT_USE_INTERVALS to control expansion and collapse
 + of copyright year intervals.
 + Also, document UPDATE_COPYRIGHT_YEAR.
 + * tests/test-update-copyright.sh: Test it.

Thanks for all of that.
Pushed.




Re: copyright years: mass-update every January 1

2009-08-14 Thread Joel E. Denny
On Fri, 14 Aug 2009, Jim Meyering wrote:

  Below are some patches to implement that.
 ...
  +2009-08-14  Joel E. Denny  jde...@clemson.edu
  +
  +   update-copyright: convert 2-digit to 4-digit years
  +   * build-aux/update-copyright: Implement and document.
  +   * tests/test-update-copyright.sh: Update.
 ...
  +   update-copyright: much ado about intervals
  +   * build-aux/update-copyright: Implement and document
  +   UPDATE_COPYRIGHT_USE_INTERVALS to control expansion and collapse
  +   of copyright year intervals.
  +   Also, document UPDATE_COPYRIGHT_YEAR.
  +   * tests/test-update-copyright.sh: Test it.
 
 Thanks for all of that.
 Pushed.

Thanks.  Here's a patch to help those who don't want to wait until January 
to reformat.

From 39a10be68cc3f2a46b97db97123ed0217192c917 Mon Sep 17 00:00:00 2001
From: Joel E. Denny jde...@clemson.edu
Date: Fri, 14 Aug 2009 13:12:54 -0400
Subject: [PATCH] update-copyright: implement forced reformatting

* build-aux/update-copyright: Implement and document
UPDATE_COPYRIGHT_FORCE.
* tests/test-update-copyright.sh: Test it.
---
 ChangeLog  |7 +++
 build-aux/update-copyright |   40 ++--
 tests/test-update-copyright.sh |   22 +++---
 3 files changed, 44 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3c0089b..eaa5549 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-08-14  Joel E. Denny  jde...@clemson.edu
+
+   update-copyright: implement forced reformatting
+   * build-aux/update-copyright: Implement and document
+   UPDATE_COPYRIGHT_FORCE.
+   * tests/test-update-copyright.sh: Test it.
+
 2009-08-14  Eric Blake  e...@byu.net
and Bruno Haible  br...@clisp.org
 
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index d8445fe..bd0dda5 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-14.05:03'; # UTC
+my $VERSION = '2009-08-14.18:56'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation, Inc.
 #
@@ -25,12 +25,17 @@ my $VERSION = '2009-08-14.05:03'; # UTC
 # use the update-copyright target rule in maint.mk from gnulib's
 # maintainer-makefile module.
 #
-# Iff an FSF copyright statement is discovered in a file and the final
+# Iff an FSF copyright statement is recognized in a file and the final
 # 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.
+# new year and it is reformatted to:
+#
+#   1. Fit within 72 columns.
+#   2. Convert 2-digit years to 4-digit years by prepending 19.
+#   3. Expand copyright year intervals.  (See Environment variables
+#  below.)
+#
+# A warning is printed for every file for which no FSF copyright
+# statement is recognized.
 #
 # Each file's FSF copyright statement must be formated correctly in
 # order to be recognized.  For example, each of these is fine:
@@ -91,16 +96,21 @@ my $VERSION = '2009-08-14.05:03'; # UTC
 #   6. Blank lines, even if preceded by the prefix, do not appear
 #  within the FSF copyright statement.
 #   7. Each copyright year is 2 or 4 digits, and years are separated by
-#  commas or dashes.  Whitespace may occur after commas.
+#  commas or dashes.  Whitespace may appear after commas.
 #
 # Environment variables:
 #
-#   1. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
-#  copyright years (such as 90, 1991, 1992-2007, 2008) in an updated
-#  FSF copyright statement is collapsed to a single interval (such
-#  as 1990-2008).  If unset or set to 0, all existing copyright year
-#  intervals are expanded.
-#   2. For testing purposes, you can set the assumed current year in
+#   1. If UPDATE_COPYRIGHT_FORCE=1, a recognized FSF copyright statement
+#  is reformatted even if it does not need updating for the new
+#  year.  If unset or set to 0, only updated FSF copyright
+#  statements are reformatted.
+#   2. If UPDATE_COPYRIGHT_USE_INTERVALS=1, every series of consecutive
+#  copyright years (such as 90, 1991, 1992-2007, 2008) in a
+#  reformatted FSF copyright statement is collapsed to a single
+#  interval (such as 1990-2008).  If unset or set to 0, all existing
+#  copyright year intervals in a reformatted FSF copyright statement
+#  are expanded instead.
+#   3. For testing purposes, you can set the assumed current year in
 #  UPDATE_COPYRIGHT_YEAR.
 
 use strict;
@@ -172,7 +182,9 @@ if (defined $stmt_re)
   {
 # Update the year.
 $stmt =~ s/$final_year_orig/$final_year, $this_year/;
-
+  }
+if ($final_year != $this_year || 

Re: copyright years: mass-update every January 1

2009-08-14 Thread Jim Meyering
Joel E. Denny wrote:
 On Fri, 14 Aug 2009, Jim Meyering wrote:
  Below are some patches to implement that.
 ...
  +2009-08-14  Joel E. Denny  jde...@clemson.edu
  +
  +  update-copyright: convert 2-digit to 4-digit years
  +  * build-aux/update-copyright: Implement and document.
  +  * tests/test-update-copyright.sh: Update.
 ...
  +  update-copyright: much ado about intervals
  +  * build-aux/update-copyright: Implement and document
  +  UPDATE_COPYRIGHT_USE_INTERVALS to control expansion and collapse
  +  of copyright year intervals.
  +  Also, document UPDATE_COPYRIGHT_YEAR.
  +  * tests/test-update-copyright.sh: Test it.

 Thanks for all of that.
 Pushed.

 Thanks.  Here's a patch to help those who don't want to wait until January
 to reformat.

Heh ;-)

Good addition.  Pushed.




Re: copyright years: mass-update every January 1

2009-08-14 Thread Jim Meyering
Joel E. Denny wrote:
 I just realized I don't know how to configure update-copyright permanently
 for a project.  The following patch gives me a way.

Pushed.  I'll certainly be using that.




Re: copyright years: mass-update every January 1

2009-08-13 Thread Akim Demaille

Hi All!

Le 28 juil. 09 à 02:36, Joel E. Denny a écrit :


diff --git a/src/head.c b/src/head.c
index c96f910..89b6ef9 100644
--- a/src/head.c
+++ b/src/head.c
@@ -1,6 +1,5 @@
/* head -- output first part of file(s)
-   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
-   Foundation, Inc.
+   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software  
Foundation, Inc.


While at it, why not standardize everything to 4 digits (I don't think  
we need to address the Y10k issues yet :), and to introduce intervals  
where applicable?  Is there some legal thingy that forbids it?  It  
might help making some lines smaller.


+   Copyright (C) 1989-1991, 1995-2006, 2008-2009 Free Software  
Foundation, Inc.






Re: copyright years: mass-update every January 1

2009-08-13 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Akim Demaille on 8/13/2009 1:59 AM:
 -   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
 -   Foundation, Inc.
 +   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
 Foundation, Inc.
 
 While at it, why not standardize everything to 4 digits (I don't think
 we need to address the Y10k issues yet :), and to introduce intervals
 where applicable?  Is there some legal thingy that forbids it?  It might
 help making some lines smaller.

Yes - see this post:
http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00184.html

I'm not personally opposed to compressed years, but if you want the tool
to output compressed years instead of longhand, it should be an option
(and more importantly, we should also fix the tool to allow longhand years
for maintainers that want longhand).

- --
Don't work too hard, make some time for fun as well!

Eric Blake e...@byu.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqEBmoACgkQ84KuGfSFAYBOiQCeL/zuVk4tSfeK2C9XgRMofxSN
qL0An3rSH71mhpvvJeqwKGOs76hxvnCz
=qAzZ
-END PGP SIGNATURE-




Re: copyright years: mass-update every January 1

2009-08-13 Thread Karl Berry
 While at it, why not standardize everything to 4 digits

Sounds like a good idea to me FWIW.

The 2-digit years came about because rms optimized it with lawyers
umpteen years ago.  When I questioned him about it more recently (maybe
only .3umpteen years :), he went back to the lawyers and this time the
advice was to always use four-digit years.

As usual with these matters, there is no pressing need to go back and
change all the existing notices, but the more that get converted to the
currently-standard form, the better.

k




Re: copyright years: mass-update every January 1

2009-08-13 Thread Joel E. Denny
On Thu, 13 Aug 2009, Eric Blake wrote:

 According to Akim Demaille on 8/13/2009 1:59 AM:
  -   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
  -   Foundation, Inc.
  +   Copyright (C) 89, 90, 91, 1995-2006, 2008-2009 Free Software
  Foundation, Inc.
  
  While at it, why not standardize everything to 4 digits (I don't think
  we need to address the Y10k issues yet :), and to introduce intervals
  where applicable?  Is there some legal thingy that forbids it?  It might
  help making some lines smaller.
 
 Yes - see this post:
 http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00184.html
 
 I'm not personally opposed to compressed years, but if you want the tool
 to output compressed years instead of longhand, it should be an option
 (and more importantly, we should also fix the tool to allow longhand years
 for maintainers that want longhand).

Below are some patches to implement that.

From 75dd6c0c64ee03ebb4eb7b0b14cf8905b9ad65ad Mon Sep 17 00:00:00 2001
From: Joel E. Denny jde...@clemson.edu
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 d6c3670..8ceadbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-14  Joel E. Denny  jde...@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-13  Eric Blake  e...@byu.net
 
test-dup2: fix bad assumption
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 68440f8..fb1c7d2 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 9997df4..d0e3083 100755
--- a/tests/test-update-copyright.sh
+++ b/tests/test-update-copyright.sh
@@ -123,7 +123,7 @@ compare - $TMP.2 EOF || exit 1
 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 @@ UPDATE_COPYRIGHT_YEAR=2010 \
 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 @@ UPDATE_COPYRIGHT_YEAR=2010 \
 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, 

Re: new module: update-copyright [Re: copyright years: mass-update every January 1

2009-08-12 Thread Akim Demaille


Le 31 juil. 09 à 15:52, Joel E. Denny a écrit :

Hi Joel,


+# Format within margin.
+my $new_wrapped;
+my $text_margin = $margin - length($prefix);
+while (length($new))
+  {
+if (($new =~ s/^(.{1,$text_margin})(?: |$)//)
+|| ($new =~ s/^([\S]+)(?: |$)//))
+  {
+my $line = $1;
+$new_wrapped .= $new_wrapped ? \n : $leading;
+$new_wrapped .= $prefix$line;
+  }
+else
+  {
+# Should be unreachable, but we don't want an  
infinite

+# loop if it can be reached.
+die;
+  }
+  }


You might want to have a look at Text::Wrap.



Re: new module: update-copyright [Re: copyright years: mass-update every January 1

2009-07-31 Thread Joel E. Denny
On Thu, 30 Jul 2009, Joel E. Denny wrote:

 On Thu, 30 Jul 2009, Jim Meyering wrote:

  There remains at least one infelicity: if someone discusses
  the Copyright (C) notation (e.g., as on this line), and later
  has the copyright-with-dates line, the prefixes may not match.
  We could require that the Copyright...holder (and hence prefix)
  are all in proximity, but that may not be worth the trouble.

In the first patch below, I ended up documenting that limitation instead 
of fixing it.  It should be very straightforward to add a proximity check 
in the initial search for the copyright.  However, I haven't yet found a 
real-world test case, so I'm waiting.  For now, the worst case is that an 
affected file just won't be updated, and we'll be warned.

 The current behavior is a little unintuitive in other similar ways as 
 well.  For example, if Copyright (C) isn't recognized anywhere and thus 
 no comment sequence is recognized, the script still looks for an 
 occurrence of the copyright year and holder to adjust.  Thus, the script 
 handles Copyright @copyright{} only when it's not in comments.  I'd 
 rather it be consistent by not handling it at all or handling it 
 completely.

Also, it bothered me that 2009 might be added to the phrase  98 Free 
Software Foundation, for example, even if it had nothing to do with a 
copyright statement.  I've fixed this in the first patch below.

 I'm working on a patch to fix all of the above and to automatically format 
 the result to 72 columns.  I'll try to post a patch soon.

I've also implemented reformatting in the first patch.

In the next two patches below, I've added handling for DOS EOLs and for 
leading tabs in, for example, ChangeLogs.  These are helpful in Bison, at 
least.

From 2727188acb1f45b83f5072bfdac740715c78444c Mon Sep 17 00:00:00 2001
From: Joel E. Denny jde...@clemson.edu
Date: Fri, 31 Jul 2009 09:11:53 -0400
Subject: [PATCH] update-copyright: automatically format copyright statements

* build-aux/update-copyright: Implement that.
Also, be a little more predictable and safer by always failing
when the full copyright format is not perfectly recognized as an
unbroken whole.  Discussed at
http://lists.gnu.org/archive/html/bug-gnulib/2009-07/msg00131.html.
Rewrite documentation.
---
 ChangeLog  |   10 +++
 build-aux/update-copyright |  160 +---
 2 files changed, 130 insertions(+), 40 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 239faa6..a9e8cfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-07-31  Joel E. Denny  jde...@clemson.edu
+
+   update-copyright: automatically format copyright statements
+   * build-aux/update-copyright: Implement that.
+   Also, be a little more predictable and safer by always failing
+   when the full copyright format is not perfectly recognized as an
+   unbroken whole.  Discussed at
+   http://lists.gnu.org/archive/html/bug-gnulib/2009-07/msg00131.html.
+   Rewrite documentation.
+
 2009-07-29  Matt Kraai  mkr...@beckman.com
 
getloadavg: check whether n_name is a pointer, for QNX 6.4.1
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index e35d51b..59ce6b6 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-07-30.13:24'; # UTC
+my $VERSION = '2009-07-31.12:44'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation
 #
@@ -20,63 +20,114 @@ my $VERSION = '2009-07-30.13:24'; # UTC
 
 # Written by Jim Meyering
 
-# In the copyright statement in each file, Copyright (C) must appear
-# at the beginning of the line except that it may be preceded by any
-# sequence (e.g., a comment) of no more than 5 characters.  Iff that
-# prefix is present, the same prefix should appear at the beginning
-# of each remaining line within the copyright statement so that it
-# can be parsed correctly.
+# The arguments to this script should be names of files that contain FSF
+# copyright statements to be updated.  For example, you may wish to
+# place a target like the following in your top-level makefile in your
+# project:
 #
-# For example, these are fine:
+#   .PHONY: update-copyright
+#   update-copyright:
+#   if test -d .git; then   \
+# git grep -l -w Copyright  \
+#   | grep -v -E '(^|/)(COPYING|ChangeLog)' \
+#   | xargs $(srcdir)/build-aux/$@; \
+#   fi
+#
+# In the second grep, you can build a list of files to skip within your
+# project.
+#
+# 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.
+#

Re: new module: update-copyright [Re: copyright years: mass-update every January 1

2009-07-30 Thread Jim Meyering
Joel E. Denny wrote:

 On Wed, 29 Jul 2009, Jim Meyering wrote:

 Joel E. Denny wrote:

  On Wed, 29 Jul 2009, Jim Meyering wrote:
 
  Joel E. Denny wrote:
 
   I'd like to use this in Bison.  Would you consider contributing
   build-aux/update-copyright to gnulib so we don't maintain separate 
   copies?
 
  Sure.
 
  Thanks.  I'll watch for that.  In the meantime, I'll probably import a
  copy into Bison.

 I've just pushed it to gnulib:

 Thanks.  I didn't notice this before I posted that last patch to
 bug-coreutils:

   http://lists.gnu.org/archive/html/bug-coreutils/2009-07/msg00213.html

 Here it is again, rewritten for gnulib.  I've also made some improvements
 to the documentation.

Thank you!

Here's an incremental change I'm about to fold into yours.
It changes comment to prefix and adjusts syntax.

There remains at least one infelicity: if someone discusses
the Copyright (C) notation (e.g., as on this line), and later
has the copyright-with-dates line, the prefixes may not match.
We could require that the Copyright...holder (and hence prefix)
are all in proximity, but that may not be worth the trouble.

diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index c4419b5..e35d51b 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-07-29.19:13'; # UTC
+my $VERSION = '2009-07-30.13:24'; # UTC

 # Copyright (C) 2009 Free Software Foundation
 #
@@ -22,10 +22,10 @@ my $VERSION = '2009-07-29.19:13'; # UTC

 # In the copyright statement in each file, Copyright (C) must appear
 # at the beginning of the line except that it may be preceded by any
-# comment sequence of no more than 5 characters.  Iff that comment
-# sequence is present, the same comment sequence should appear at the
-# beginning of each remaining line within the copyright statement so
-# that it can be parsed correctly.
+# sequence (e.g., a comment) of no more than 5 characters.  Iff that
+# prefix is present, the same prefix should appear at the beginning
+# of each remaining line within the copyright statement so that it
+# can be parsed correctly.
 #
 # For example, these are fine:
 #
@@ -52,11 +52,11 @@ my $VERSION = '2009-07-29.19:13'; # UTC
 #
 #   .PHONY: update-copyright
 #   update-copyright:
-#  if test -d .git; then   \
-#git grep -l -w Copyright  \
-#  | grep -v -E '(^|/)(COPYING|ChangeLog)' \
-#  | xargs $(srcdir)/build-aux/$@; \
-#  fi
+#   if test -d .git; then   \
+# git grep -l -w Copyright  \
+#   | grep -v -E '(^|/)(COPYING|ChangeLog)' \
+#   | xargs $(srcdir)/build-aux/$@; \
+#   fi
 #
 # You can build a list of files to skip in the second grep.

@@ -67,12 +67,12 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime 
(time());
 my $this_year = $year + 1900;
 my $holder = 'Free Software Foundation';

-my $comment = ;
+my $prefix = '';
 if (/(?:^|\n)(.{0,5})Copyright \([cC]\)/) {
-  $comment = quotemeta($1);
+  $prefix = quotemeta $1;
 }
 $holder =  $holder;
-$holder =~ s/\s/\\s*(?:\\s|\\n$comment)\\s*/g;
+$holder =~ s/\s/\\s*(?:\\s|\\n$prefix)\\s*/g;

 if (/([- ])((?:\d\d)?\d\d)($holder)/s)
   {


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: new module: update-copyright [Re: copyright years: mass-update every January 1

2009-07-30 Thread Joel E. Denny
On Thu, 30 Jul 2009, Jim Meyering wrote:

 Thank you!

Thank you.  :)

 Here's an incremental change I'm about to fold into yours.
 It changes comment to prefix and adjusts syntax.

Makes sense.

 There remains at least one infelicity: if someone discusses
 the Copyright (C) notation (e.g., as on this line), and later
 has the copyright-with-dates line, the prefixes may not match.
 We could require that the Copyright...holder (and hence prefix)
 are all in proximity, but that may not be worth the trouble.

The current behavior is a little unintuitive in other similar ways as 
well.  For example, if Copyright (C) isn't recognized anywhere and thus 
no comment sequence is recognized, the script still looks for an 
occurrence of the copyright year and holder to adjust.  Thus, the script 
handles Copyright @copyright{} only when it's not in comments.  I'd 
rather it be consistent by not handling it at all or handling it 
completely.

I'm working on a patch to fix all of the above and to automatically format 
the result to 72 columns.  I'll try to post a patch soon.



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-07-29 Thread Jim Meyering
Joel E. Denny wrote:

 Hi Jim.

 On Fri, 26 Jun 2009, Jim Meyering wrote:

 From 85dd41402048603c977f49c5d1ea349b1c724531 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Fri, 26 Jun 2009 13:33:59 +0200
 Subject: [PATCH] maint: add a rule to automate the annual 
 copyright-year-update process

 * build-aux/update-copyright: New file.
 * Makefile.am (changelog_etc): Add update-copyright.
 (update-copyright): New rule.

Hi Joel,

 I'd like to use this in Bison.  Would you consider contributing
 build-aux/update-copyright to gnulib so we don't maintain separate copies?

Sure.
First, here's a change to catch the extra cases you noted,
but without concatenating lines.

From 9d87a45b2fb0fcf5239227b71345a507933636c0 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 29 Jul 2009 10:25:24 +0200
Subject: [PATCH] maint: make update-copyright handle more cases

* build-aux/update-copyright: Handle cases in which the final
year number and copyright holder are on separate lines.
Prompted by a report from Joel E. Denny.
Also, do not invoke localtime for each line we process.
---
 build-aux/update-copyright |   26 +++---
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 42579c2..9039b7c 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -1,7 +1,7 @@
-#!/usr/bin/perl -w -pi
+#!/usr/bin/perl -0777 -pi
 # Update an FSF copyright year list to include the current year.

-my $VERSION = '2009-06-04 08:53'; # UTC
+my $VERSION = '2009-07-29.08:18'; # UTC

 # Copyright (C) 2009 Free Software Foundation
 #
@@ -21,15 +21,19 @@ my $VERSION = '2009-06-04 08:53'; # UTC
 # Written by Jim Meyering

 use strict;
+use warnings;

-my ($sec, $min, $hour, $mday, $month, $this_year) = localtime (time());
-$this_year += 1900;
-
+my $this_year;
 my $holder = 'Free Software Foundation';

-if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
+BEGIN {
+  my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
+  $this_year = $year + 1900;
+}
+
+if (/([- ])((?:\d\d)?\d\d)(\s+$holder)/s)
   {
-my ($sep, $last_c_year) = ($1, $2);
+my ($sep, $last_c_year, $rest) = ($1, $2, $3);

 # Handle two-digit year numbers like 98 and 99.
 $last_c_year = 99
@@ -39,15 +43,15 @@ if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
   {
 if ($sep eq '-'  $last_c_year + 1 == $this_year)
   {
-s//-$this_year $holder/;
+s//-$this_year$rest/;
   }
 elsif ($sep eq ' '  $last_c_year + 1 == $this_year)
   {
-s// $last_c_year-$this_year $holder/;
+s// $last_c_year-$this_year$rest/;
   }
 else
   {
-s//$sep$last_c_year, $this_year $holder/;
+s//$sep$last_c_year, $this_year$rest/;
   }
   }
   }
@@ -56,7 +60,7 @@ if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
 # indent-tabs-mode: nil
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: my $VERSION = '
-# time-stamp-format: %:y-%02m-%02d.%02H
+# time-stamp-format: %:y-%02m-%02d.%02H:%02M
 # time-stamp-time-zone: UTC
 # time-stamp-end: '; # UTC
 # End:
--
1.6.4.rc3.201.gd9d59


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-07-29 Thread Jim Meyering
Jim Meyering wrote:

 Joel E. Denny wrote:

 Hi Jim.

 On Fri, 26 Jun 2009, Jim Meyering wrote:

 From 85dd41402048603c977f49c5d1ea349b1c724531 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Fri, 26 Jun 2009 13:33:59 +0200
 Subject: [PATCH] maint: add a rule to automate the annual 
 copyright-year-update process

 * build-aux/update-copyright: New file.
 * Makefile.am (changelog_etc): Add update-copyright.
 (update-copyright): New rule.

 Hi Joel,

 I'd like to use this in Bison.  Would you consider contributing
 build-aux/update-copyright to gnulib so we don't maintain separate copies?

 Sure.
 First, here's a change to catch the extra cases you noted,
 but without concatenating lines.

Whoops.
I didn't test well enough.
That worked only for a single file, so I've just pushed this
additional change:

From c91c85647c4dc98ea43b2b368f9be2ecf1855eba Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 29 Jul 2009 10:56:10 +0200
Subject: [PATCH] maint: update-copyright: fix just-introduced bug

* build-aux/update-copyright: ... and revert-for-now the
change that made this script invoke localtime only once.
---
 build-aux/update-copyright |   10 +++---
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 9039b7c..23d8f38 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-07-29.08:18'; # UTC
+my $VERSION = '2009-07-29.08:43'; # UTC

 # Copyright (C) 2009 Free Software Foundation
 #
@@ -23,14 +23,10 @@ my $VERSION = '2009-07-29.08:18'; # UTC
 use strict;
 use warnings;

-my $this_year;
+my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
+my $this_year = $year + 1900;
 my $holder = 'Free Software Foundation';

-BEGIN {
-  my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
-  $this_year = $year + 1900;
-}
-
 if (/([- ])((?:\d\d)?\d\d)(\s+$holder)/s)
   {
 my ($sep, $last_c_year, $rest) = ($1, $2, $3);
--
1.6.4.rc3.201.gd9d59


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-07-29 Thread Joel E. Denny
On Wed, 29 Jul 2009, Jim Meyering wrote:

 Joel E. Denny wrote:

  I'd like to use this in Bison.  Would you consider contributing
  build-aux/update-copyright to gnulib so we don't maintain separate copies?
 
 Sure.

Thanks.  I'll watch for that.  In the meantime, I'll probably import a 
copy into Bison.

 First, here's a change to catch the extra cases you noted,
 but without concatenating lines.

 diff --git a/build-aux/update-copyright b/build-aux/update-copyright
 index 42579c2..9039b7c 100755
 --- a/build-aux/update-copyright
 +++ b/build-aux/update-copyright
 @@ -1,7 +1,7 @@
 -#!/usr/bin/perl -w -pi
 +#!/usr/bin/perl -0777 -pi

You're still missing copyrights containing newline followed by a comment 
sequence.  For example, m4/lib-check.m4.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


new module: update-copyright [Re: copyright years: mass-update every January 1

2009-07-29 Thread Jim Meyering
Joel E. Denny wrote:

 On Wed, 29 Jul 2009, Jim Meyering wrote:

 Joel E. Denny wrote:

  I'd like to use this in Bison.  Would you consider contributing
  build-aux/update-copyright to gnulib so we don't maintain separate copies?

 Sure.

 Thanks.  I'll watch for that.  In the meantime, I'll probably import a
 copy into Bison.

I've just pushed it to gnulib:

From 8dc0e5d63e272095754e3144e64dc6b1c8791d9e Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Wed, 29 Jul 2009 16:22:21 +0200
Subject: [PATCH] update-copyright: new module

* modules/update-copyright: New file.
* build-aux/update-copyright: New file.
* MODULES.html.sh (maint+release support): Add update-copyright.
---
 ChangeLog  |7 +
 MODULES.html.sh|1 +
 build-aux/update-copyright |   62 
 modules/update-copyright   |   19 +
 4 files changed, 89 insertions(+), 0 deletions(-)
 create mode 100755 build-aux/update-copyright
 create mode 100644 modules/update-copyright

diff --git a/ChangeLog b/ChangeLog
index fa9a76b..2be276a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-07-29  Jim Meyering  meyer...@redhat.com
+
+   update-copyright: new module
+   * modules/update-copyright: New file.
+   * build-aux/update-copyright: New file.
+   * MODULES.html.sh (maint+release support): Add update-copyright.
+
 2009-07-27  Bruno Haible  br...@clisp.org

Fix compilation error when ctime is used and mktime is replaced.
diff --git a/MODULES.html.sh b/MODULES.html.sh
index 6adef20..ef48ec5 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -3179,6 +3179,7 @@ func_all_modules ()
   func_module gnupload
   func_module maintainer-makefile
   func_module mktempd
+  func_module update-copyright
   func_module useless-if-before-free
   func_module vc-list-files
   func_end_table
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
new file mode 100755
index 000..1ceaf8a
--- /dev/null
+++ b/build-aux/update-copyright
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -0777 -pi
+# Update an FSF copyright year list to include the current year.
+
+my $VERSION = '2009-07-29.13:34'; # UTC
+
+# Copyright (C) 2009 Free Software Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/.
+
+# Written by Jim Meyering
+
+use strict;
+use warnings;
+
+my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
+my $this_year = $year + 1900;
+my $holder = 'Free Software Foundation';
+
+if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
+  {
+my ($sep, $last_c_year, $rest) = ($1, $2, $3);
+
+# Handle two-digit year numbers like 98 and 99.
+$last_c_year = 99
+  and $last_c_year += 1900;
+
+if ($last_c_year != $this_year)
+  {
+if ($sep eq '-'  $last_c_year + 1 == $this_year)
+  {
+s//-$this_year$rest/;
+  }
+elsif ($sep eq ' '  $last_c_year + 1 == $this_year)
+  {
+s// $last_c_year-$this_year$rest/;
+  }
+else
+  {
+s//$sep$last_c_year, $this_year$rest/;
+  }
+  }
+  }
+
+# Local variables:
+# indent-tabs-mode: nil
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: my $VERSION = '
+# time-stamp-format: %:y-%02m-%02d.%02H:%02M
+# time-stamp-time-zone: UTC
+# time-stamp-end: '; # UTC
+# End:
diff --git a/modules/update-copyright b/modules/update-copyright
new file mode 100644
index 000..c703c68
--- /dev/null
+++ b/modules/update-copyright
@@ -0,0 +1,19 @@
+Description:
+Update an FSF copyright year list to include the current year.
+
+Files:
+build-aux/update-copyright
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+
+Include:
+
+License:
+GPLed build tool
+
+Maintainer:
+Jim Meyering
--
1.6.4.rc3.201.gd9d59


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-07-29 Thread Joel E. Denny
On Wed, 29 Jul 2009, Jim Meyering wrote:

  You're still missing copyrights containing newline followed by a comment
  sequence.  For example, m4/lib-check.m4.
 
 You're right.  Thanks.
 This new version catches those, too.
 It doesn't allow trailing blanks between the final number
 and \n#, but that's not a possibility here.

 @@ -27,7 +27,7 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime 
 (time());
  my $this_year = $year + 1900;
  my $holder = 'Free Software Foundation';
 
 -if (/([- ])((?:\d\d)?\d\d)(\s+$holder)/s)
 +if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
{
  my ($sep, $last_c_year, $rest) = ($1, $2, $3);

This isn't general enough: (1) # is not the only comment style, and (2) 
newlines plus comments could occur within $holder.  The following patch 
against coreutils implements a more general approach and fixes one 
coreutils file from case #1.  I haven't tested it very well yet, so I've 
added a diagnostic to help us catch files it can't parse.

Now that the comment style is extracted, it should be possible to extend 
this further to automatically format the added text.  I might work on that 
some other time.

From ed7de5b95ddc6888592dbe8f38f77b2a6fd83bc9 Mon Sep 17 00:00:00 2001
From: Joel E. Denny jde...@clemson.edu
Date: Wed, 29 Jul 2009 09:59:34 -0400
Subject: [PATCH] maint: generalize update-copyright's comment handling some

* build-aux/update-copyright: Handle copyright statements within some
comment styles, and document limitations.
Report any file with an external copyright holder or parse failure.
* m4/check-decl.m4: Update copyright.

diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 1ceaf8a..aedad96 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-07-29.13:34'; # UTC
+my $VERSION = '2009-07-29.08:43'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation
 #
@@ -27,7 +27,40 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime 
(time());
 my $this_year = $year + 1900;
 my $holder = 'Free Software Foundation';
 
-if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
+# In the copyright statement, Copyright (C) must appear at the
+# beginning of the line except for any comment sequence of no more than
+# 5 characters.  Iff that comment sequence is present, the same comment
+# sequence should appear at the beginning of every line within the
+# copyright statement so that it can be parsed and wrapped correctly.
+#
+# For example, these are fine:
+#
+#   # Copyright (C) 1990-2005, 2007-2009 Free Software
+#   # Foundation, Inc.
+#
+#   /*
+#* Copyright (C) 1990-2005, 2007-2009 Free Software
+#* Foundation, Inc.
+#*/
+#
+# This will not be parsed correctly:
+#
+#   /* Copyright (C) 1990-2005, 2007-2009 Free Software
+#* Foundation, Inc.  */
+#
+# A warning is printed for any file for which the last copyright year
+# cannot be discovered.  The culprit may be simply that the copyright
+# holder is not the expected one, or it may be that the above
+# preconditions are not obeyed.
+
+my $comment = ;
+if (/(?:^|\n)(.{0,5})Copyright \([cC]\)/) {
+  $comment = quotemeta($1);
+}
+$holder =  $holder;
+$holder =~ s/\s/\\s*(?:\\s|\\n$comment)\\s*/g;
+
+if (/([- ])((?:\d\d)?\d\d)($holder)/s)
   {
 my ($sep, $last_c_year, $rest) = ($1, $2, $3);
 
@@ -51,6 +84,11 @@ if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
   }
   }
   }
+else
+  {
+print STDERR
+  $ARGV: warning: external copyright holder or parse failure\n;
+  }
 
 # Local variables:
 # indent-tabs-mode: nil
diff --git a/m4/check-decl.m4 b/m4/check-decl.m4
index e2d20f3..028b855 100644
--- a/m4/check-decl.m4
+++ b/m4/check-decl.m4
@@ -1,7 +1,7 @@
 #serial 24
 # Check declarations for this package.
 
-dnl Copyright (C) 1997-2001, 2003-2006, 2008
+dnl Copyright (C) 1997-2001, 2003-2006, 2008-2009
 dnl Free Software Foundation, Inc.
 
 dnl This file is free software; the Free Software Foundation
-- 
1.5.4.3



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: new module: update-copyright [Re: copyright years: mass-update every January 1

2009-07-29 Thread Joel E. Denny
On Wed, 29 Jul 2009, Jim Meyering wrote:

 Joel E. Denny wrote:
 
  On Wed, 29 Jul 2009, Jim Meyering wrote:
 
  Joel E. Denny wrote:
 
   I'd like to use this in Bison.  Would you consider contributing
   build-aux/update-copyright to gnulib so we don't maintain separate 
   copies?
 
  Sure.
 
  Thanks.  I'll watch for that.  In the meantime, I'll probably import a
  copy into Bison.
 
 I've just pushed it to gnulib:

Thanks.  I didn't notice this before I posted that last patch to 
bug-coreutils:

  http://lists.gnu.org/archive/html/bug-coreutils/2009-07/msg00213.html

Here it is again, rewritten for gnulib.  I've also made some improvements 
to the documentation.

From 009b660dd28dfbb2b289b367d243d08d7ef01588 Mon Sep 17 00:00:00 2001
From: Joel E. Denny jde...@clemson.edu
Date: Wed, 29 Jul 2009 15:17:53 -0400
Subject: [PATCH] update-copyright: generalize comment handling

* build-aux/update-copyright: Handle copyright statements
within more comment styles.
Document usage.
Report any file with an external copyright holder or parse failure.
---
 ChangeLog  |8 ++
 build-aux/update-copyright |   56 ++-
 2 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9c386f5..5f1c812 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-29  Joel E. Denny  jde...@clemson.edu
+
+   update-copyright: generalize comment handling
+   * build-aux/update-copyright: Handle copyright statements
+   within more comment styles.
+   Document usage.
+   Report any file with an external copyright holder or parse failure.
+
 2009-07-29  Jim Meyering  meyer...@redhat.com
 
mktime: correct setting of REPLACE_MKTIME
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 1ceaf8a..c4419b5 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-07-29.13:34'; # UTC
+my $VERSION = '2009-07-29.19:13'; # UTC
 
 # Copyright (C) 2009 Free Software Foundation
 #
@@ -20,6 +20,46 @@ my $VERSION = '2009-07-29.13:34'; # UTC
 
 # Written by Jim Meyering
 
+# In the copyright statement in each file, Copyright (C) must appear
+# at the beginning of the line except that it may be preceded by any
+# comment sequence of no more than 5 characters.  Iff that comment
+# sequence is present, the same comment sequence should appear at the
+# beginning of each remaining line within the copyright statement so
+# that it can be parsed correctly.
+#
+# For example, these are fine:
+#
+#   # Copyright (C) 1990-2005, 2007-2009 Free Software
+#   # Foundation, Inc.
+#
+#   /*
+#* Copyright (C) 1990-2005, 2007-2009 Free Software
+#* Foundation, Inc.
+#*/
+#
+# The following format is not recognized:
+#
+#   /* Copyright (C) 1990-2005, 2007-2009 Free Software
+#* Foundation, Inc.  */
+#
+# A warning is printed for every file for which the copyright format is
+# not recognized.  The culprit may be that the above preconditions are
+# not obeyed as in the previous example, or it may simply be that the
+# stated copyright holder is not the Free Software Foundation.
+#
+# You may wish to place a target like the following in your top-level
+# makefile in your project:
+#
+#   .PHONY: update-copyright
+#   update-copyright:
+#  if test -d .git; then   \
+#git grep -l -w Copyright  \
+#  | grep -v -E '(^|/)(COPYING|ChangeLog)' \
+#  | xargs $(srcdir)/build-aux/$@; \
+#  fi
+#
+# You can build a list of files to skip in the second grep.
+
 use strict;
 use warnings;
 
@@ -27,7 +67,14 @@ my ($sec, $min, $hour, $mday, $month, $year) = localtime 
(time());
 my $this_year = $year + 1900;
 my $holder = 'Free Software Foundation';
 
-if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
+my $comment = ;
+if (/(?:^|\n)(.{0,5})Copyright \([cC]\)/) {
+  $comment = quotemeta($1);
+}
+$holder =  $holder;
+$holder =~ s/\s/\\s*(?:\\s|\\n$comment)\\s*/g;
+
+if (/([- ])((?:\d\d)?\d\d)($holder)/s)
   {
 my ($sep, $last_c_year, $rest) = ($1, $2, $3);
 
@@ -51,6 +98,11 @@ if (/([- ])((?:\d\d)?\d\d)((?:\n\#)?\s+$holder)/s)
   }
   }
   }
+else
+  {
+print STDERR
+  $ARGV: warning: external copyright holder or parse failure\n;
+  }
 
 # Local variables:
 # indent-tabs-mode: nil
-- 
1.5.4.3



___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-07-27 Thread Joel E. Denny
Hi Jim.

On Fri, 26 Jun 2009, Jim Meyering wrote:

 From 85dd41402048603c977f49c5d1ea349b1c724531 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Fri, 26 Jun 2009 13:33:59 +0200
 Subject: [PATCH] maint: add a rule to automate the annual 
 copyright-year-update process
 
 * build-aux/update-copyright: New file.
 * Makefile.am (changelog_etc): Add update-copyright.
 (update-copyright): New rule.

I'd like to use this in Bison.  Would you consider contributing 
build-aux/update-copyright to gnulib so we don't maintain separate copies?

 +.PHONY: update-copyright
 +update-copyright:
 + if test -d .git; then   \
 +   git grep -l -E '2[0-9]{3} +Free'  \
 + | grep -v -E '^(COPYING|ChangeLog)' \
 + | xargs $(srcdir)/build-aux/$@; \
 + fi

For coreutils, the above misses a few files with copyrights (listed in the 
patch below) and includes a few ChangeLogs:

  build-aux/ChangeLog-2007
  doc/ChangeLog-2007
  lib/ChangeLog-2007
  m4/ChangeLog-2007
  old/fileutils/ChangeLog
  old/textutils/ChangeLog
  po/ChangeLog-2007

Moreover, build-aux/update-copyright ignores files that have all or part 
of Free Software Foundation on a separate line from the last copyright 
year.  Instead of trying to make that script clever enough to handle line 
wrapping and all possible comment styles, the following patch manually 
concatenates the copyright statement lines in the affected files. 
Unfortunately, after many years, copyright statements might wrap around 
the margin several times, but I guess that's a small price.

From 4773a2257e67950f9a0713f7a1cde16f12a06f66 Mon Sep 17 00:00:00 2001
From: Joel E. Denny jde...@clemson.edu
Date: Mon, 27 Jul 2009 16:51:27 -0400
Subject: [PATCH] maint: be more careful with automatic copyright updates

* Makefile.am (update-copyright): Don't skip files whose last copyright
year is before 2000.
* build-aux/update-copyright: Document restrictions on copyright
statement format.
* tests/other-fs-tmpdir: Meet those restrictions.
* man/help2man: Likewise.
* src/dircolors.hin: Likewise.
* src/chroot.c: Likewise.
* src/echo.c: Likewise.
* src/head.c: Likewise.
* src/hostid.c: Likewise.
* src/tail.c: Likewise.
* src/touch.c: Likewise.
* m4/check-decl.m4: Likewise and update year.
* m4/lib-check.m4: Likewise.
* src/sleep.c: Likewise.
* tests/sort-time/README: Likewise.
* tests/sort-time/rand-gen: Likewise.

diff --git a/Makefile.am b/Makefile.am
index 87e4545..eb94dad 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -148,7 +148,7 @@ check-ls-dircolors:
 .PHONY: update-copyright
 update-copyright:
if test -d .git; then   \
- git grep -l -E '2[0-9]{3} +Free'  \
-   | grep -v -E '^(COPYING|ChangeLog)' \
+ git grep -l -E '[0-9]{4} +Free'   \
+   | grep -v -E '(^|/)(COPYING|ChangeLog)' \
| xargs $(srcdir)/build-aux/$@; \
fi
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 42579c2..82125a9 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -27,6 +27,9 @@ $this_year += 1900;
 
 my $holder = 'Free Software Foundation';
 
+# The last year of the existing copyright statement must appear on the
+# same line as the copyright holder or the year will not be updated.
+
 if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
   {
 my ($sep, $last_c_year) = ($1, $2);
diff --git a/m4/check-decl.m4 b/m4/check-decl.m4
index e2d20f3..7ea9fcc 100644
--- a/m4/check-decl.m4
+++ b/m4/check-decl.m4
@@ -1,8 +1,7 @@
 #serial 24
 # Check declarations for this package.
 
-dnl Copyright (C) 1997-2001, 2003-2006, 2008
-dnl Free Software Foundation, Inc.
+dnl Copyright (C) 1997-2001, 2003-2006, 2008-2009 Free Software Foundation, 
Inc.
 
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/lib-check.m4 b/m4/lib-check.m4
index b2d8d96..41680b3 100644
--- a/m4/lib-check.m4
+++ b/m4/lib-check.m4
@@ -2,8 +2,7 @@
 
 dnl Misc lib-related macros for coreutils.
 
-# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1993-1997, 2000-2001, 2003-2006, 2008-2009 Free Software 
Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/man/help2man b/man/help2man
index 7b7ce7a..c8c557b 100755
--- a/man/help2man
+++ b/man/help2man
@@ -1,8 +1,7 @@
 #!/usr/bin/perl -w
 
 # Generate a short man page from --help and --version output.
-# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2008, 2009 
Free Software Foundation, Inc.
 
 # This 

Re: copyright years: mass-update every January 1

2009-06-26 Thread Jim Meyering
Eric Blake wrote:

 Jim Meyering jim at meyering.net writes:

 I prefer to have one change set per year updating all copyright year lists,
 rather than having a copyright-list update as part of the first
 change of the year for files modified in the normal course of development.

 Sounds fine.

 So I did the mass-update in coreutils.

 Except I think you did too much.  COPYING should probably remain verbatim from
 upstream (you are not changing upstream COPYING as part of including it in the
 coreutils VCS, so much as silencing an automake warning).  And there were lots
 of ChangeLog files in the mix; even though they belong to coreutils, it just
 seems weird to see a copyright date of 2009 on a file named 'ChangeLog-2005'.

Good point about COPYING.  I'll back that out.

I'll add a rule to update copyright dates and exclude it
as well as all ChangeLog files.

Here's what I expect to use for the update rule:

From 85dd41402048603c977f49c5d1ea349b1c724531 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Fri, 26 Jun 2009 13:33:59 +0200
Subject: [PATCH] maint: add a rule to automate the annual copyright-year-update 
process

* build-aux/update-copyright: New file.
* Makefile.am (changelog_etc): Add update-copyright.
(update-copyright): New rule.
---
 Makefile.am|9 ++
 build-aux/update-copyright |   62 
 2 files changed, 71 insertions(+), 0 deletions(-)
 create mode 100755 build-aux/update-copyright

diff --git a/Makefile.am b/Makefile.am
index 99fc937..87e4545 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,6 +25,7 @@ changelog_etc =   \
   ChangeLog-2007   \
   ChangeLog-2008   \
   build-aux/ChangeLog-2007 \
+  build-aux/update-copyright   \
   doc/ChangeLog-2007   \
   lib/ChangeLog-2007   \
   m4/ChangeLog-2007\
@@ -143,3 +144,11 @@ check-ls-dircolors:
  |sed -n '/^  */p'|tr , '\n'|sed 's/^  *//'   \
  |sed -n 's/^\(..\)/\1/p'|sort -u);  \
test $$dc = $$ls
+
+.PHONY: update-copyright
+update-copyright:
+   if test -d .git; then   \
+ git grep -l -E '2[0-9]{3} +Free'  \
+   | grep -v -E '^(COPYING|ChangeLog)' \
+   | xargs $(srcdir)/build-aux/$@; \
+   fi
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
new file mode 100755
index 000..42579c2
--- /dev/null
+++ b/build-aux/update-copyright
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -w -pi
+# Update an FSF copyright year list to include the current year.
+
+my $VERSION = '2009-06-04 08:53'; # UTC
+
+# Copyright (C) 2009 Free Software Foundation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/.
+
+# Written by Jim Meyering
+
+use strict;
+
+my ($sec, $min, $hour, $mday, $month, $this_year) = localtime (time());
+$this_year += 1900;
+
+my $holder = 'Free Software Foundation';
+
+if (/([- ])((?:\d\d)?\d\d)\s+$holder/)
+  {
+my ($sep, $last_c_year) = ($1, $2);
+
+# Handle two-digit year numbers like 98 and 99.
+$last_c_year = 99
+  and $last_c_year += 1900;
+
+if ($last_c_year != $this_year)
+  {
+if ($sep eq '-'  $last_c_year + 1 == $this_year)
+  {
+s//-$this_year $holder/;
+  }
+elsif ($sep eq ' '  $last_c_year + 1 == $this_year)
+  {
+s// $last_c_year-$this_year $holder/;
+  }
+else
+  {
+s//$sep$last_c_year, $this_year $holder/;
+  }
+  }
+  }
+
+# Local variables:
+# indent-tabs-mode: nil
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: my $VERSION = '
+# time-stamp-format: %:y-%02m-%02d.%02H
+# time-stamp-time-zone: UTC
+# time-stamp-end: '; # UTC
+# End:
--
1.6.3.3.420.gd4b46


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-06-26 Thread Jim Meyering
Philip Rowlands wrote:
 On Thu, 25 Jun 2009, Alfred M. Szmidt wrote:

 It doesn't affect it at all, if you use a version of coreutils from
 1980, then the copyright term will be from that date.  If you use a
 version from 2100 then it will be from that date.

 OK, but taken separately the files have/had dates to indicate the most
 recent amendment. I'm curious whether the slavish copying (to use a
 phrase from a relevant case) of old to new file, updating only the
 date, contributes sufficient originality to defend the change in
 public-domain date.

It's trivial to determine via git when the last non-copyright-update
change was for a given file, so I think this doesn't change anything.

 Just trying to illustrate the point here; I don't intend to start a
 long thread, merely taking an interest in clarity of copyright
 terms/expiry in general.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


copyright years: mass-update every January 1

2009-06-25 Thread Jim Meyering
Karl Berry just mentioned that it's now considered fine (recommended,
even) to update all copyright lists to include the new year on January 1.
Before, it was recommended not to do that, but rather to update each
list only upon modifying the corresponding file in the course of development.

This is documented:

   maintain(Copyright Notices), specifically:
  
   To update the list of year numbers, ...  It is recommended and
   simpler to add the new year to all files in the package, and be done
   with it for the rest of the year.

I prefer to have one change set per year updating all copyright year lists,
rather than having a copyright-list update as part of the first
change of the year for files modified in the normal course of development.

So I did the mass-update in coreutils.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-06-25 Thread Philip Rowlands

On Thu, 25 Jun 2009, Jim Meyering wrote:


Karl Berry just mentioned that it's now considered fine (recommended,
even) to update all copyright lists to include the new year on January 1.


I realise this list may not be the right place for GNU policy 
discussion, but how will this affect the eventual migration of coreutils 
works into the public domain?



Cheers,
Phil


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-06-25 Thread Jim Meyering
Philip Rowlands wrote:
 On Thu, 25 Jun 2009, Jim Meyering wrote:

 Karl Berry just mentioned that it's now considered fine (recommended,
 even) to update all copyright lists to include the new year on January 1.

 I realise this list may not be the right place for GNU policy
 discussion, but how will this affect the eventual migration of
 coreutils works into the public domain?

Hi Phil,

   migration of coreutils works into the public domain

I know of no such plan.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-06-25 Thread Philip Rowlands

On Thu, 25 Jun 2009, Jim Meyering wrote:


  migration of coreutils works into the public domain

I know of no such plan.


I'm refering to the copyright term limits which apply to all works, not 
a specific plan for coreutils.



Cheers,
Phil


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-06-25 Thread Alfred M. Szmidt
  migration of coreutils works into the public domain
   
I know of no such plan.

   I'm refering to the copyright term limits which apply to all works,
   not a specific plan for coreutils.

It doesn't affect it at all, if you use a version of coreutils from
1980, then the copyright term will be from that date.  If you use a
version from 2100 then it will be from that date.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-06-25 Thread Eric Blake
Jim Meyering jim at meyering.net writes:

 I prefer to have one change set per year updating all copyright year lists,
 rather than having a copyright-list update as part of the first
 change of the year for files modified in the normal course of development.

Sounds fine.

 So I did the mass-update in coreutils.

Except I think you did too much.  COPYING should probably remain verbatim from 
upstream (you are not changing upstream COPYING as part of including it in the 
coreutils VCS, so much as silencing an automake warning).  And there were lots 
of ChangeLog files in the mix; even though they belong to coreutils, it just 
seems weird to see a copyright date of 2009 on a file named 'ChangeLog-2005'.

-- 
Eric Blake




___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: copyright years: mass-update every January 1

2009-06-25 Thread Philip Rowlands

On Thu, 25 Jun 2009, Alfred M. Szmidt wrote:


It doesn't affect it at all, if you use a version of coreutils from
1980, then the copyright term will be from that date.  If you use a
version from 2100 then it will be from that date.


OK, but taken separately the files have/had dates to indicate the most 
recent amendment. I'm curious whether the slavish copying (to use a 
phrase from a relevant case) of old to new file, updating only the date, 
contributes sufficient originality to defend the change in public-domain 
date.


Just trying to illustrate the point here; I don't intend to start a long 
thread, merely taking an interest in clarity of copyright terms/expiry 
in general.



Cheers,
Phil


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils