[Drbd-dev] [PATCH] drbd-utils: Allow to override build date

Bernhard M. Wiedemann bwiedemann at suse.de
Sun Jul 23 17:57:51 CEST 2017


and to not record build user and hostname if requested
in order to allow for reproducible builds.
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.
---
 user/shared/Makefile.in | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/user/shared/Makefile.in b/user/shared/Makefile.in
index cce7c1bc..596bcf81 100644
--- a/user/shared/Makefile.in
+++ b/user/shared/Makefile.in
@@ -84,7 +84,12 @@ drbd_buildtag.c:
 	else									\
 		grep return $@ ;						\
 	fi ;									\
-	echo -e "\t\t\" build by $$USER@$$HOSTNAME, `date "+%F %T"`\";\n}";	\
+	if [ -z "${WANT_DRBD_REPRODUCIBLE_BUILD}" ] || [ -z "${SOURCE_DATE_EPOCH}" ] ; then \
+		buildinfo="build by $$USER@$$HOSTNAME, `date "+%F %T"`" ; \
+	else \
+		buildinfo="reproducible build, `date -u -d@${SOURCE_DATE_EPOCH} "+%F %T"`" ; \
+	fi ; \
+	echo -e "\t\t\" $$buildinfo\";\n}";	\
 	mv -f $@.new $@
 
 drbdmeta_scanner.c: drbdmeta_scanner.fl drbdmeta_parser.h
-- 
2.12.3



More information about the drbd-dev mailing list