From c1c27cf134f49bbe71ae919bf8c39dd9467795b9 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Tue, 1 May 2012 12:43:22 +0200 Subject: [PATCH] bootstrap: consistently use correct copyright year Suggested by Peter Johansson in the discussion about automake bug#11356: * boostrap.sh (dosubst): Don't initialize the substituted value for the release year from the current year (using `date +%Y`); instead, do it through ... ($RELEASE_YEAR): ... this new statically-defined variable. To ensure it won't get out-of-sync, it will be automatically updated ... * Makefile.am (update-copyright): ... by this target's recipe. Since are at it, fix a botched output redirection for an error message, i.e., use ">&2" instead of ">&1". Signed-off-by: Stefano Lattarini --- Makefile.am | 5 +++-- bootstrap.sh | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 37b44cf..aab2786 100644 --- a/Makefile.am +++ b/Makefile.am @@ -862,8 +862,9 @@ update_copyright_env = \ update-copyright: $(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; \ + || { echo "$@: cannot get current year" >&2; exit 1; }; \ + sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \ + bootstrap.sh configure.ac; \ excluded_re=`echo $(FETCHFILES) \ | sed -e 's|^|lib/|' -e 's| | lib/|g' -e 's, ,|,g'`; \ $(GIT) ls-files \ diff --git a/bootstrap.sh b/bootstrap.sh index 1cede01..683b9e9 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -36,6 +36,9 @@ VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac` PACKAGE=automake datadir=. PERL_THREADS=0 +# This should be automatically updated by the 'update-copyright' +# rule of our Makefile. +RELEASE_YEAR=2012 # Override SHELL. This is required on DJGPP so that Perl's system() # uses bash, not COMMAND.COM which doesn't quote arguments properly. @@ -77,8 +80,6 @@ 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" \ @@ -86,7 +87,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%@RELEASE_YEAR@%$RELEASE_YEAR%G" \ -e "s%@configure_input@%Generated from $in; do not edit by hand.%g" \ $1 > $2 chmod a-w $2 -- 2.7.4