[PATCH] s3:build_env.sh: allow to override build date

Bernhard M. Wiedemann bwiedemann at suse.de
Mon Jun 26 08:03:03 UTC 2017


and build host, kernel-version and user
to enable reproducible builds of samba packages

The date calls are designed to work with both GNU date and BSD date.

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.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann at suse.de>
---
 source3/script/build_env.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source3/script/build_env.sh b/source3/script/build_env.sh
index eb54f37aeda..be5ae6b794f 100755
--- a/source3/script/build_env.sh
+++ b/source3/script/build_env.sh
@@ -23,6 +23,12 @@ else
 fi
 
 host=`hostname`
+if [ -n "$SOURCE_DATE_EPOCH" ] ; then
+    uname=reproducible
+    date=`date -u -d "@$SOURCE_DATE_EPOCH" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" 2>/dev/null || date -u`
+    host=reproducible
+    whoami=reproducible
+fi
 
 cat <<EOF
 /* This file is automatically generated with "make include/build_env.h". DO NOT EDIT */
-- 
2.12.3




More information about the samba-technical mailing list