From ff00dd00ea6c92ccc3d37bd982eeb26359080dd7 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 14 Aug 2009 09:09:26 -0600 Subject: [PATCH] Improve copyright updating. * build-aux/update-copyright: Resynchronize from upstream. * maint.mk (update-copyright): Simplify based on gnulib. (update-copyright-env): New variable. * cfg.mk (update-copyright-exclude-regexp): Delete. (update-copyright-env): New override. * .x-update-copyright: New file. * lib/Autom4te/Makefile.am: Add copyright. * lib/Autom4te/Channels.pm: Revert copyright update to upstream file. * lib/Autom4te/Configure_ac.pm: Likewise. * lib/Autom4te/FileUtils.pm: Likewise. * lib/Autom4te/Struct.pm: Likewise. * lib/Autom4te/XFile.pm: Likewise. Signed-off-by: Eric Blake --- .x-update-copyright | 16 +++++++++++++++ ChangeLog | 17 ++++++++++++++- build-aux/update-copyright | 40 +++++++++++++++++++++++------------- cfg.mk | 7 ++----- lib/Autom4te/Channels.pm | 3 +-- lib/Autom4te/Configure_ac.pm | 3 +-- lib/Autom4te/FileUtils.pm | 3 +-- lib/Autom4te/Makefile.am | 15 ++++++++++++++ lib/Autom4te/Struct.pm | 3 +-- maint.mk | 18 +++++++++------- 10 files changed, 90 insertions(+), 35 deletions(-) create mode 100644 .x-update-copyright diff --git a/.x-update-copyright b/.x-update-copyright new file mode 100644 index 000000000..1780d9b50 --- /dev/null +++ b/.x-update-copyright @@ -0,0 +1,16 @@ +# Prior year changelogs don't need update. +ChangeLog..* +# Upstream files that should not have copyright updated here. +COPYING.* +GNUmakefile +build-aux/.* +lib/Autom4te/Configure_ac.pm +lib/Autom4te/Channels.pm +lib/Autom4te/FileUtils.pm +lib/Autom4te/Struct.pm +lib/Autom4te/XFile.pm +doc/fdl.* +doc/gendocs_template +doc/gnu-oids.texi +doc/make-stds.texi +doc/standards.texi diff --git a/ChangeLog b/ChangeLog index 3baf7a61f..a9c837461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2009-08-14 Eric Blake + Improve copyright updating. + * build-aux/update-copyright: Resynchronize from upstream. + * maint.mk (update-copyright): Simplify based on gnulib. + (update-copyright-env): New variable. + * cfg.mk (update-copyright-exclude-regexp): Delete. + (update-copyright-env): New override. + * .x-update-copyright: New file. + * lib/Autom4te/Makefile.am: Add copyright. + * lib/Autom4te/Channels.pm: Revert copyright update to upstream + file. + * lib/Autom4te/Configure_ac.pm: Likewise. + * lib/Autom4te/FileUtils.pm: Likewise. + * lib/Autom4te/Struct.pm: Likewise. + * lib/Autom4te/XFile.pm: Likewise. + Update copyright. * AUTHORS: Include 2009 in copyright. * lib/Autom4te/C4che.pm: Likewise. @@ -38,7 +53,7 @@ Prepare to bulk update copyright years. * build-aux/update-copyright: New file. * cfg.mk (gnulib-update): Sync it from gnulib. - (update-copyright-exclude-regexp): New varialbe. + (update-copyright-exclude-regexp): New variable. (web-manual): Move... * maint.mk (web-manual): ...here, to match gnulib. (update-copyright): New target, copied from gnulib's diff --git a/build-aux/update-copyright b/build-aux/update-copyright index d8445fee0..bd0dda5dc 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 || $ENV{'UPDATE_COPYRIGHT_FORCE'}) + { # Normalize all whitespace including newline-prefix sequences. $stmt =~ s/$ws_re/ /g; diff --git a/cfg.mk b/cfg.mk index deb8c69a2..6b246d544 100644 --- a/cfg.mk +++ b/cfg.mk @@ -109,8 +109,5 @@ autom4te-update: local-checks-to-skip ?= \ changelog-check sc_unmarked_diagnostics -# Don't adjust copyright in upstream files. -update-copyright-exclude-regexp = \ -(^|/)(COPYING|build-aux/|GNUmakefile\ -|Autom4te/(Configure_ac|Channels|FileUtils|Struct|XFile)\ -|doc/(fdl|gendocs|gnu-oids|make-stds|standards)).*$$ +# Always use longhand copyrights. +update-copyright-env = UPDATE_COPYRIGHT_USE_INTERVALS=0 diff --git a/lib/Autom4te/Channels.pm b/lib/Autom4te/Channels.pm index 86723eedf..1309d204a 100644 --- a/lib/Autom4te/Channels.pm +++ b/lib/Autom4te/Channels.pm @@ -1,5 +1,4 @@ -# Copyright (C) 2002, 2004, 2006, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 2002, 2004, 2006, 2008 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/lib/Autom4te/Configure_ac.pm b/lib/Autom4te/Configure_ac.pm index fe39bc7bb..5ff8d5783 100644 --- a/lib/Autom4te/Configure_ac.pm +++ b/lib/Autom4te/Configure_ac.pm @@ -1,5 +1,4 @@ -# Copyright (C) 2003, 2005, 2006, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 2003, 2005, 2006 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/lib/Autom4te/FileUtils.pm b/lib/Autom4te/FileUtils.pm index c12498ac4..63420f6b3 100644 --- a/lib/Autom4te/FileUtils.pm +++ b/lib/Autom4te/FileUtils.pm @@ -1,5 +1,4 @@ -# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software -# Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 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/lib/Autom4te/Makefile.am b/lib/Autom4te/Makefile.am index 683215078..85667ee8f 100644 --- a/lib/Autom4te/Makefile.am +++ b/lib/Autom4te/Makefile.am @@ -1,5 +1,20 @@ ## Process this file with automake to create Makefile.in +# Copyright (C) 2001, 2003, 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 +# the Free Software Foundation, either version 3 of the License, 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 . + perllibdir = $(pkgdatadir)/Autom4te dist_perllib_DATA = \ C4che.pm \ diff --git a/lib/Autom4te/Struct.pm b/lib/Autom4te/Struct.pm index 9b511fd55..73c25ddaa 100644 --- a/lib/Autom4te/Struct.pm +++ b/lib/Autom4te/Struct.pm @@ -1,6 +1,5 @@ # autoconf -- create `configure' using m4 macros -# Copyright (C) 2001, 2002, 2006, 2008, 2009 Free Software Foundation, -# Inc. +# Copyright (C) 2001, 2002, 2006 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/maint.mk b/maint.mk index 6394508f6..868ba505f 100644 --- a/maint.mk +++ b/maint.mk @@ -590,15 +590,19 @@ web-manual: "$(PACKAGE_NAME) - $(manual_title)" @echo " *** Upload the doc/manual directory to web-cvs." -# If you have an additional project-specific rule, -# define it in cfg.mk and set this variable to its name. -update-copyright-local ?= +# If you want to set UPDATE_COPYRIGHT_* environment variables, +# put the assignments in this variable. +update-copyright-env ?= # Run this rule once per year (usually early in January) # to update all FSF copyright year lists in your project. -update-copyright-exclude-regexp ?= (^|/)COPYING$$ +# If you have an additional project-specific rule, +# add it in cfg.mk along with a line 'update-copyright: prereq'. +# By default, exclude all variants of COPYING; you can also +# add exemptions (such as ChangeLog..* for rotated change logs) +# in the file .x-update-copyright. .PHONY: update-copyright -update-copyright: $(update-copyright-local) +update-copyright: grep -l -w Copyright $$($(VC_LIST_EXCEPT)) \ - | grep -v -E '$(update-copyright-exclude-regexp)' \ - | xargs $(build_aux)/$@ + $(srcdir)/ChangeLog | grep -v COPYING \ + | $(update-copyright-env) xargs $(build_aux)/$@ -- 2.47.3