diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2016-04-18 23:21:42 +0200 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2016-05-02 17:54:01 +0200 |
commit | c74c7c13176a97c84ace3e2417456ddc561b0638 (patch) | |
tree | 45b5f0b9d14f3dd630f4685f3d3f0af618b9178e /gnu/packages/patches/libxslt-remove-date-timestamps.patch | |
parent | c3052d6bcd2193b258fb92b99291a4918931fe36 (diff) | |
download | guix-c74c7c13176a97c84ace3e2417456ddc561b0638.tar guix-c74c7c13176a97c84ace3e2417456ddc561b0638.tar.gz |
gnu: libxslt: Make generated documentation reproducible.
* gnu/packages/patches/libxslt-generated-ids.patch: New file.
* gnu/packages/patches/libxslt-remove-date-timestamps.patch: Likewise.
* gnu/packages/xml.scm (libxslt)[source]: Use them.
* gnu/local.mk (dist_patch_DATA): Add them.
Diffstat (limited to 'gnu/packages/patches/libxslt-remove-date-timestamps.patch')
-rw-r--r-- | gnu/packages/patches/libxslt-remove-date-timestamps.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gnu/packages/patches/libxslt-remove-date-timestamps.patch b/gnu/packages/patches/libxslt-remove-date-timestamps.patch new file mode 100644 index 0000000000..51470d0847 --- /dev/null +++ b/gnu/packages/patches/libxslt-remove-date-timestamps.patch @@ -0,0 +1,66 @@ +Use deterministic SOURCE_DATE_EPOCH for embedded timestamps in generated documentation. + +Written by Eduard Sanou. + +https://bugzilla.gnome.org/show_bug.cgi?id=758148 + +--- libxslt-1.1.28.orig/libexslt/date.c ++++ libxslt-1.1.28/libexslt/date.c +@@ -46,6 +46,7 @@ + #include "exslt.h" + + #include <string.h> ++#include <errno.h> + + #ifdef HAVE_MATH_H + #include <math.h> +@@ -747,21 +748,46 @@ static exsltDateValPtr + exsltDateCurrent (void) + { + struct tm localTm, gmTm; ++ struct tm *tb = NULL; + time_t secs; + int local_s, gm_s; + exsltDateValPtr ret; ++ char *source_date_epoch; + + ret = exsltDateCreateDate(XS_DATETIME); + if (ret == NULL) + return NULL; + +- /* get current time */ + secs = time(NULL); ++ /* ++ * Allow the date and time to be set externally by an exported ++ * environment variable to enable reproducible builds. ++ */ ++ source_date_epoch = getenv("SOURCE_DATE_EPOCH"); ++ if (source_date_epoch) { ++ errno = 0; ++ secs = (time_t) strtol (source_date_epoch, NULL, 10); ++ if (errno == 0) { ++ tb = gmtime(&secs); ++ if (tb == NULL) { ++ /* SOURCE_DATE_EPOCH is not a valid date */ ++ return NULL; ++ } else { ++ localTm = *tb; ++ } ++ } else { ++ /* SOURCE_DATE_EPOCH is not a valid number */ ++ return NULL; ++ } ++ } else { ++ /* get current time */ + #if HAVE_LOCALTIME_R +- localtime_r(&secs, &localTm); ++ localtime_r(&secs, &localTm); + #else +- localTm = *localtime(&secs); ++ localTm = *localtime(&secs); + #endif ++ } ++ + + /* get real year, not years since 1900 */ + ret->value.date.year = localTm.tm_year + 1900; |