File yudit-2.9.6-reproducible.patch of Package yudit

Date: 2017-07-20
Author: Bernhard M. Wiedemann <bwiedemann suse de>

Allow to override current date

to allow for reproducible package 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.

Index: yudit-2.9.6/mytool/Main.cpp
===================================================================
--- yudit-2.9.6.orig/mytool/Main.cpp
+++ yudit-2.9.6/mytool/Main.cpp
@@ -497,7 +497,10 @@ main (int argc, char* argv[])
   }
   else if (inputFileCount)
   {
-    time_t  tim = time(0);
+    time_t  tim;
+    char *source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
+    if (source_date_epoch == NULL || (tim = (time_t)strtol (source_date_epoch, NULL, 10)) <= 0)
+      tim = time(0);
     struct tm* ts = localtime (&tim);
     sprintf (shortComment, "created by mytool %04d-%02d-%02d", 
       ts->tm_year+1900, ts->tm_mon+1, ts->tm_mday);