Dmitry V. Levin
fc8294cbc2
* Makefile.am (today): Consistently print the UTC date in C locale. * configure.ac (RPM_CHANGELOGTIME, DEB_CHANGELOGTIME): Likewise. * maint/update_copyright_years.sh: Likewise. * copyright-year-gen: Likewise. When $SOURCE_DATE_EPOCH is non-empty, use it as fallback date before the current system date. References: https://github.com/strace/strace/pull/68
35 lines
602 B
Bash
Executable File
35 lines
602 B
Bash
Executable File
#! /bin/sh
|
|
|
|
: ${YEAR_FILE:=$1}
|
|
: ${DEFAULT_YEAR:=$2}
|
|
LC_TIME=C; export LC_TIME
|
|
|
|
year=
|
|
|
|
[ -n "${YEAR_FILE}" ] || {
|
|
echo >&2 "$0 $(dirname "$0")/.year [DEFAULT_YEAR]"
|
|
exit 1
|
|
}
|
|
|
|
[ -f "${YEAR_FILE}" ] && year="$(cat "${YEAR_FILE}")"
|
|
|
|
[ -n "${year}" ] ||
|
|
year="$(date -u +%Y -d "$(git show --format=format:%cD --no-patch)")"
|
|
|
|
[ -n "${year}" ] ||
|
|
year="${DEFAULT_YEAR}"
|
|
|
|
[ -n "${year}" ] ||
|
|
[ -z "${SOURCE_DATE_EPOCH-}" ] ||
|
|
year="$(date -u +%Y -d "@${SOURCE_DATE_EPOCH}")"
|
|
|
|
[ -n "${year}" ] ||
|
|
year="$(date -u +%Y)"
|
|
|
|
[ -n "${year}" ] || {
|
|
echo >&2 'Undefined year.'
|
|
exit 1
|
|
}
|
|
|
|
printf "%s" "${year}"
|