cd838da878
This solves problems like the need to update test suite on every New Year's Eve. * Makefile.am (dist-hook): Generate .year. * copyright-year-gen: New file. * configure.ac (copyright_year): New m4 variable, defined as the output of copyright-year-gen script. (AC_COPYRIGHT): Use it. (COPYRIGHT_YEAR): New output variable and preprocessor macro. * strace.c (print_version): Use COPYRIGHT_YEAR. * strace.spec.in (%prep): Save the value of COPYRIGHT_YEAR autoconf variable to .year file. * tests/strace-V.test (config_year): New variable, derived from config.h. Add sanity checks for $config_year and use it in expected output. Reported-by: Andreas Schwab <schwab@suse.de>
28 lines
464 B
Bash
Executable File
28 lines
464 B
Bash
Executable File
#! /bin/sh
|
|
|
|
: ${YEAR_FILE:=$1}
|
|
: ${DEFAULT_YEAR:=$2}
|
|
|
|
year=
|
|
|
|
[ -n "${YEAR_FILE}" ] || {
|
|
echo >&2 "$0 $(dirname "$0")/.year [DEFAULT_YEAR]"
|
|
exit 1
|
|
}
|
|
|
|
[ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
|
|
|
|
[ -n "${year}" ] ||
|
|
year="$(git show --format=format:%cd --no-patch --date=format:%Y)"
|
|
|
|
[ -n "${year}" ] || year="${DEFAULT_YEAR}"
|
|
|
|
[ -n "${year}" ] || year="$(date "+%Y")"
|
|
|
|
[ -n "${year}" ] || {
|
|
echo >&2 'Undefined year.'
|
|
exit 1
|
|
}
|
|
|
|
printf "%s" "${year}"
|