[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: updating copyright years
From: |
Jim Meyering |
Subject: |
Re: updating copyright years |
Date: |
Tue, 04 Aug 2009 09:31:11 +0200 |
Joel E. Denny wrote:
> On Sat, 1 Aug 2009, Joel E. Denny wrote:
>
>> > No objection on principle, from me. The 'update-copyright' module
>> > works fine for me in most cases. But it has no testsuite, therefore it
>> > may surprise us.
>>
>> My test suite has mostly been coreutils and bison (plus a few handwritten
>> tests for quicker testing). I'll be glad to put something more formal
>> together. I'm a little busy at the moment, and I have to study how gnulib
>> does testing, but I'll try to post soon.
>
> The following patch adds a test suite. The command I've been using to run
> it is:
>
> ./gnulib-tool --test --with-tests update-copyright
>
> However, "./gnulib-tool --help" says --with-tests is meant for --import.
> Is there a better command to run the test suite?
>
>> Also, I posted some major changes to update-copyright here:
>>
>> http://lists.gnu.org/archive/html/bug-gnulib/2009-07/msg00135.html
>
> I found a bug in that code, which the following patch fixes.
>
>>From 1e91305468e96d8eea16a151fc7b63745d66b47b Mon Sep 17 00:00:00 2001
> From: Joel E. Denny <address@hidden>
> Date: Mon, 3 Aug 2009 20:05:50 -0400
> Subject: [PATCH] update-copyright: fix bug for 2-digit last year and add tests
>
> * build-aux/update-copyright: Fix bug.
> Use UPDATE_COPYRIGHT_YEAR from environment as current year if
> specified.
> * modules/update-copyright-tests: New
> * tests/test-update-copyright.sh: New.
Thanks for all of that.
I've pushed that as well as your other three change sets,
and one more change:
>From 296de1083182be81806ba8954f05377308fa3eaa Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 4 Aug 2009 09:25:12 +0200
Subject: [PATCH] update-copyright: rename some variables
* build-aux/update-copyright: Rename a few variables for clarity.
Tweak syntax. List Joel E. Denny as coauthor.
---
ChangeLog | 6 ++++++
build-aux/update-copyright | 38 +++++++++++++++++++-------------------
2 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 86b7659..435a4a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-08-04 Jim Meyering <address@hidden>
+
+ update-copyright: rename some variables
+ * build-aux/update-copyright: Rename a few variables for clarity.
+ Tweak syntax. List Joel E. Denny as coauthor.
+
2009-08-03 Joel E. Denny <address@hidden>
update-copyright: fix bug for 2-digit last year and add tests
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index 39071ab..4a70333 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-03.23:03'; # UTC
+my $VERSION = '2009-08-04.07:25'; # UTC
# Copyright (C) 2009 Free Software Foundation
#
@@ -18,7 +18,7 @@ my $VERSION = '2009-08-03.23:03'; # UTC
# 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
+# Written by Jim Meyering and Joel E. Denny
# The arguments to this script should be names of files that contain FSF
# copyright statements to be updated. For example, you may wish to
@@ -102,7 +102,7 @@ use warnings;
my $this_year = $ENV{UPDATE_COPYRIGHT_YEAR};
if (!$this_year || $this_year !~ m/^\d\d(\d\d)?$/) {
- my ($sec, $min, $hour, $mday, $month, $year) = localtime (time());
+ my ($sec, $min, $hour, $mday, $month, $year) = localtime (time ());
$this_year = $year + 1900;
}
my $copyright = 'Copyright \([cC]\)';
@@ -117,7 +117,7 @@ my $eol = /(?:^|[^\r])\n/ ? "\n" : "\r\n";
my $leading;
my $prefix;
my $ws;
-my $old;
+my $old_re;
if (/(^|\n)(.{0,$prefix_max})$copyright/)
{
$leading = $1;
@@ -125,36 +125,36 @@ if (/(^|\n)(.{0,$prefix_max})$copyright/)
$ws = '[ \t\r\f]'; # \s without \n
$ws = "(?:$ws*(?:$ws|\\n" . quotemeta($prefix) . ")$ws*)";
$holder =~ s/\s/$ws/g;
- $old =
+ $old_re =
quotemeta("$leading$prefix") . "($copyright$ws"
. "(?:(?:\\d\\d)?\\d\\d(,$ws?|-))*"
. "((?:\\d\\d)?\\d\\d)$ws$holder)";
}
-if (defined($old) && /$old/)
+if (defined $old_re && /$old_re/)
{
my $new = $1;
my $sep = $2 ? $2 : "";
- my $last_year = $3;
+ my $final_year_orig = $3;
# Handle two-digit year numbers like "98" and "99".
- my $last_c_year = $last_year;
- $last_c_year <= 99
- and $last_c_year += 1900;
+ my $final_year = $final_year_orig;
+ $final_year <= 99
+ and $final_year += 1900;
- if ($last_c_year != $this_year)
+ if ($final_year != $this_year)
{
# Update the year.
- if ($sep eq '-' && $last_c_year + 1 == $this_year)
+ if ($sep eq '-' && $final_year + 1 == $this_year)
{
- $new =~ s/$last_year/$this_year/;
+ $new =~ s/$final_year_orig/$this_year/;
}
- elsif ($sep ne '-' && $last_c_year + 1 == $this_year)
+ elsif ($sep ne '-' && $final_year + 1 == $this_year)
{
- $new =~ s/$last_year/$last_c_year-$this_year/;
+ $new =~ s/$final_year_orig/$final_year-$this_year/;
}
else
{
- $new =~ s/$last_year/$last_c_year, $this_year/;
+ $new =~ s/$final_year_orig/$final_year, $this_year/;
}
# Normalize all whitespace including newline-prefix sequences.
@@ -167,9 +167,9 @@ if (defined($old) && /$old/)
my $new_wrapped;
my $text_margin = $margin - length($prefix);
if ($prefix =~ /^(\t+)/) {
- $text_margin -= length($1) * ($tab_width-1);
+ $text_margin -= length($1) * ($tab_width - 1);
}
- while (length($new))
+ while (length $new)
{
if (($new =~ s/^(.{1,$text_margin})(?: |$)//)
|| ($new =~ s/^([\S]+)(?: |$)//))
@@ -187,7 +187,7 @@ if (defined($old) && /$old/)
}
# Replace the old copyright statement.
- s/$old/$new_wrapped/;
+ s/$old_re/$new_wrapped/;
}
}
else
--
1.6.4.212.g4719
- Re: updating copyright years, (continued)
- Re: updating copyright years, Matthew Woehlke, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Karl Berry, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Karl Berry, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/05
- Re: updating copyright years, Jim Meyering, 2009/08/06
- Re: updating copyright years, Karl Berry, 2009/08/04
- Re: updating copyright years, Karl Berry, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/05
- Re: updating copyright years,
Jim Meyering <=
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Jim Meyering, 2009/08/04
- Re: updating copyright years, Jim Meyering, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/04
- Re: updating copyright years, Joel E. Denny, 2009/08/05
- Re: updating copyright years, Eric Blake, 2009/08/05
- Re: updating copyright years, Joel E. Denny, 2009/08/05
- Re: updating copyright years, Jim Meyering, 2009/08/05