bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copyright years: mass-update every January 1


From: Jim Meyering
Subject: Re: copyright years: mass-update every January 1
Date: Fri, 26 Jun 2009 14:02:06 +0200

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 <address@hidden>
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 0000000..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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]