File gnutls-3.6.7-reproducible-date.patch of Package gnutls.22970

From b11beb199f2dda14642bb08091781c549b57d934 Mon Sep 17 00:00:00 2001
From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
Date: Fri, 15 Feb 2019 16:50:28 +0100
Subject: [PATCH] Use git or ChangeLog date instead of build date

in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good.

date calls work with GNU date and BSD date
but there is a fallback for other platforms (e.g. Solaris).

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
---
 configure.ac | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 430530e179..572a6f6b93 100644
--- a/configure.ac
+++ b/configure.ac
@@ -931,7 +931,11 @@ AC_DEFINE([read_file], [_gnutls_read_file], [static lib rename])
 AC_DEFINE([read_binary_file], [_gnutls_read_binary_file], [static lib rename])
 
 dnl Some variables needed in makefiles
-YEAR=`date +%Y`
+EPOCH=$(git log -1 --format=%ct)
+YEAR=`date -u -d "@$EPOCH" +%Y 2>/dev/null ||
+  date -u -r "$EPOCH" +%Y 2>/dev/null ||
+  date -u -r ChangeLog +%Y 2>/dev/null ||
+  echo 2019`
 AC_SUBST([YEAR], $YEAR)
 
 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
-- 
GitLab

openSUSE Build Service is sponsored by