summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <bwiedemann@suse.de>2018-09-09 05:34:37 +0200
committerEmanuele Rocca <ema@debian.org>2023-08-24 15:19:35 +0200
commit5c832c4bcedf7d1d48fcde75e3478814589d7e5b (patch)
tree49e621026c8429343059f8aac295f0cbaa694e10
parent092cc033570817f009787d44a89b5ad2aae4c9a7 (diff)
Allow to override build date with SOURCE_DATE_EPOCH
(Closes: #831587) in order to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. This date call works with all variants of date (GNU,BSD,Solaris). Also do not capture build user+host in this case to allow to get the same build results anywhere and anytime. Gbp-Pq: Name allow-to-override-build-date-with-source.patch
-rw-r--r--configure.ac7
1 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 9eed433..2681b5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,13 @@ timestamp=$(date)
AC_MSG_CHECKING([current timestamp])
AC_MSG_RESULT([$timestamp])
+if test -n "$SOURCE_DATE_EPOCH"
+then
+ timestamp=$(date -u -d "@$SOURCE_DATE_EPOCH" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" 2>/dev/null || date -u)
+ username=reproducible
+ hostname=reproducible
+fi
+
AC_DEFINE_UNQUOTED([STRESSAPPTEST_TIMESTAMP],
"$username @ $hostname on $timestamp",
[Timestamp when ./configure was executed])