Hi Eric, thanks for the suggestion. On 04/27/2012 02:05 PM, Eric Blake wrote: > >> aclocal (GNU $PACKAGE) $VERSION >> -Copyright (C) 2011 Free Software Foundation, Inc. >> +Copyright (C) 2012 Free Software Foundation, Inc. > > But this is still prone to error next year. Since this is already a .in > file, and will be further processed by config.status and/or Makefile to > create the real aclocal executable, I suggest a more permanent solution, > by borrowing the same trick used by Autoconf. Make this @RELEASE_YEAR@, > which is set by an AC_SUBST'd string that auto-updates itself at > configure time, instead of manually changing it each time a year rolls > around. > I agree. What about the attached patch? I will push by tomorrow if there is no objection.
Regards, Stefano
>From ed680ab9fb203908dbdd3e4605a752dd812f5453 Mon Sep 17 00:00:00 2001 Message-Id: <ed680ab9fb203908dbdd3e4605a752dd812f5453.1335537258.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Fri, 27 Apr 2012 16:27:08 +0200 Subject: [PATCH] build: ensure release year in copyright notice is up-to-date >From a suggestion by Eric Blake. See automake bug#11356. This is a follow-up to previous patch 'v1.12-12-gb99b5be'. * configure.ac (RELEASE_YEAR): New AC_SUBST'd variable, should hold the value of the current year. * Makefile.am (update-copyright): Be sure to also update the definition of 'RELEASE_YEAR' in configure.ac. * lib/Automake/Config.in ($RELEASE_YEAR): New exported variable, initialized from the value substituted for '@RELEASE_YEAR@'. (@EXPORT): Add it. * automake.in, aclocal.in: Use '$RELEASE_YEAR' (which will be substituted at make time) instead of hard-coding the release year. This should ensure the copyright range in the version message and in the generated files (Makefile.in and aclocal.m4) are automatically kept up-to-date. * bootstrap (dosubst): Update, also substitute '@RELEASE_YEAR@'. Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> --- Makefile.am | 6 +++++- aclocal.in | 4 ++-- automake.in | 4 ++-- bootstrap | 3 +++ configure.ac | 5 +++++ lib/Automake/Config.in | 5 +++-- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0d02de7..27b3fa0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -860,7 +860,11 @@ update_copyright_env = \ .PHONY: update-copyright update-copyright: - $(AM_V_GEN)excluded_re=`echo $(FETCHFILES) \ + $(AM_V_GEN)set -e; \ + current_year=`date +%Y` && test -n "$$current_year" \ + || { echo "$@: cannot get current year" >&1; exit 1; }; \ + sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" configure.ac; \ + excluded_re=`echo $(FETCHFILES) \ | sed -e 's|^|lib/|' -e 's| | lib/|g' -e 's, ,|,g'`; \ $(GIT) ls-files \ | grep -Ev '^(lib/)?(COPYING|INSTALL)$$' \ diff --git a/aclocal.in b/aclocal.in index 1c58fb5..09e1da4 100644 --- a/aclocal.in +++ b/aclocal.in @@ -840,7 +840,7 @@ $output"; # name in the header. $output = "# generated automatically by aclocal $VERSION -*- Autoconf -*- -# Copyright (C) 1996-2012 Free Software Foundation, Inc. +# Copyright (C) 1996-$RELEASE_YEAR Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -935,7 +935,7 @@ sub version() { print <<EOF; aclocal (GNU $PACKAGE) $VERSION -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) $RELEASE_YEAR Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. diff --git a/automake.in b/automake.in index 544f893..a454109 100644 --- a/automake.in +++ b/automake.in @@ -252,7 +252,7 @@ my %standard_prefix = # Copyright on generated Makefile.ins. my $gen_copyright = "\ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. +# Copyright (C) 1994-$RELEASE_YEAR Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -8314,7 +8314,7 @@ sub version () { print <<EOF; automake (GNU $PACKAGE) $VERSION -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) $RELEASE_YEAR Free Software Foundation, Inc. License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. diff --git a/bootstrap b/bootstrap index 814aedb..1cede01 100755 --- a/bootstrap +++ b/bootstrap @@ -77,6 +77,8 @@ dosubst () { rm -f $2 in=`echo $1 | sed 's,^.*/,,'` + current_year=`date +%Y` && test -n "$current_year" \ + || { echo "$me: cannot get current year" >&2; exit 1; } sed -e "s%@APIVERSION@%$APIVERSION%g" \ -e "s%@PACKAGE@%$PACKAGE%g" \ -e "s%@PERL@%$PERL%g" \ @@ -84,6 +86,7 @@ dosubst () -e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \ -e "s%@VERSION@%$VERSION%g" \ -e "s%@datadir@%$datadir%g" \ + -e "s%@RELEASE_YEAR@%$current_year%g" \ -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \ $1 > $2 chmod a-w $2 diff --git a/configure.ac b/configure.ac index 22a158f..2829fd4 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,11 @@ dnl the automake options to avoid bloating and potential problems. AM_INIT_AUTOMAKE([dist-xz filename-length-max=99 color-tests parallel-tests silent-rules no-define no-dependencies]) +## Keep this on a line of its own, since it must be found and processed +## by the 'update-copyright' rule in out Makefile. +RELEASE_YEAR=2012 +AC_SUBST([RELEASE_YEAR]) + # The API version is the base version. We must guarantee # compatibility for all releases with the same API version. # Our current rule is that: diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in index 24c979c..bbf55ac 100644 --- a/lib/Automake/Config.in +++ b/lib/Automake/Config.in @@ -22,8 +22,8 @@ use 5.006; require Exporter; our @ISA = qw (Exporter); -our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION $libdir - $perl_threads); +our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION + $RELEASE_YEAR $libdir $perl_threads); # Parameters set by configure. Not to be changed. NOTE: assign # VERSION as string so that e.g. version 0.30 will print correctly. @@ -31,6 +31,7 @@ our $APIVERSION = '@APIVERSION@'; our $PACKAGE = '@PACKAGE@'; our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; our $VERSION = '@VERSION@'; +our $RELEASE_YEAR = '@RELEASE_YEAR@'; our $libdir = '@datadir@/@PACKAGE@-@APIVERSION@'; our $perl_threads = @PERL_THREADS@; -- 1.7.9.5