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 14:42:39 +0200
commit2148381b2dac5ec53c4a346b258f54f58ba9064d (patch)
treed6f273183ae018ff119f666a676c96cbb8981ce7
parent7c480b3eb127c4974507ec566aa72a244321ac52 (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 603ba73..818d357 100644
--- a/configure.ac
+++ b/configure.ac
@@ -99,6 +99,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])