Source: jellyfish Version: 2.2.6-1 Severity: wishlist Tags: patch User: reproducible-bui...@lists.alioth.debian.org Usertags: timestamps toolchain buildpath X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org
Hi, Whilst working on the Reproducible Builds effort [0], we noticed that jellyfish generated JSON files that are not reproducible. This is due to including the output of getcwd(3) and the current date in the local timezone. It affects other packages in the archive (eg. src:quorum). Patch attached. [0] https://reproducible-builds.org/ Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
diff --git a/include/jellyfish/generic_file_header.hpp b/include/jellyfish/generic_file_header.hpp index a8ddf82..99f80b2 100644 --- a/include/jellyfish/generic_file_header.hpp +++ b/include/jellyfish/generic_file_header.hpp @@ -180,6 +180,8 @@ public: protected: std::string get_hostname() const { + if(std::getenv("SOURCE_DATE_EPOCH")) + return ""; struct utsname buf; if(uname(&buf) == -1) return ""; @@ -187,6 +189,8 @@ protected: } std::string get_pwd() const { + if(std::getenv("SOURCE_DATE_EPOCH")) + return "."; #ifdef PATH_MAX size_t len = PATH_MAX; #else @@ -202,6 +206,16 @@ protected: std::string get_localtime() const { time_t t = time(0); std::string res(ctime(&t)); + char *source_date_epoch = std::getenv("SOURCE_DATE_EPOCH"); + if(source_date_epoch) { + std::istringstream iss(source_date_epoch); + iss >> t; + if(iss.fail() || !iss.eof()) { + std::cerr << "Error: Cannot parse SOURCE_DATE_EPOCH as integer\n"; + exit(27); + } + res = asctime(gmtime(&t)); + } chomp(res); return res; }