Source: ncbi-tools6 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps
Dear Maintainer, while trying to make the metastudent-data package reproducible, I noticed that the binary package contains BLAST index files which embed timestamps representing the index build time. I have attached a patch to libncbi6 that adds support for SOURCE_DATE_EPOCH [1] to avoid embedding the current time and date into generated index files. I hope that this will make the build of packages including BLAST indexes in their artifacts reproducible. Thanks and kind regards Sascha [1] https://reproducible-builds.org/specs/source-date-epoch
Description: add support for SOURCE_DATE_EPOCH BLAST index files embed the date and time of their generation. This patch adds support for SOURCE_DATE_EPOCH (see public specification at https://reproducible-builds.org/specs/source-date-epoch/) to formatdb. Author: Sascha Steinbiss <sa...@debian.org> --- a/corelib/ncbitime.c +++ b/corelib/ncbitime.c @@ -77,6 +77,7 @@ #include <ncbi.h> #include <ncbithr.h> #include <ncbiwin.h> +#include <stdlib.h> #ifdef OS_UNIX #include <sys/times.h> @@ -108,8 +109,14 @@ *****************************************************************************/ NLM_EXTERN Nlm_Boolean LIBCALL Nlm_GetDayTime (Nlm_DayTimePtr dtp) { + const char *sde = getenv("SOURCE_DATE_EPOCH"); #if (defined(SOLARIS_THREADS_AVAIL) || defined(POSIX_THREADS_AVAIL) || defined(WIN32)) && !defined(OS_UNIX_DARWIN) - time_t t = time( NULL ); + time_t t; + if (sde) { + t = strtoul(sde, NULL, 0); + } else { + t = time( NULL ); + } #ifdef WIN32 static TNlmMutex localtime_lock; if (NlmMutexLockEx( &localtime_lock ) != 0) @@ -125,7 +132,11 @@ time_t ltime; struct tm *dt; Nlm_MemFill ((Nlm_VoidPtr) dtp, 0, sizeof(Nlm_DayTime)); - time(<ime); + if (sde) { + ltime = strtoul(sde, NULL, 0); + } else { + time(<ime); + } if ((dt = localtime (<ime)) != NULL) { Nlm_MemCopy ((Nlm_VoidPtr) dtp, (Nlm_VoidPtr) dt, sizeof (struct tm));