File reproducible.patch of Package vdrift
commit 9b8e7fbabf520e45982466b52b88e6633f5ead2e
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date: Thu Jul 11 10:33:52 2019 +0200
Allow to override build date with SOURCE_DATE_EPOCH
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.
Also use UTC/gmtime to be independent of timezone.
diff --git a/SConstruct b/SConstruct
index b987edcd..d4001626 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,5 +1,4 @@
-import os, sys, errno, SCons
-from time import gmtime, strftime
+import os, sys, time, errno, SCons
#---------------#
# Build Options #
@@ -395,7 +394,7 @@ else:
#------------------------#
# Version, debug/release #
#------------------------#
-version = strftime("%Y-%m-%d")
+version = time.strftime("%Y-%m-%d", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
build_dir = 'build'
if env['release']:
# release build, debugging off, optimizations on