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: Wed, 29 Jul 2009 10:27:31 +0200

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 <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.

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




reply via email to

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