[Reproducible-commits] [libxslt] 02/05: Honour SOURCE_DATE_EPOCH when embedding timestamps in docs
Mattia Rizzolo
mattia at debian.org
Mon May 9 20:19:23 UTC 2016
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch master
in repository libxslt.
commit 2c30bab8540fcd17a899dbf8beb2e56ba5bddec9
Author: Dhole <dhole at openmailbox.org>
Date: Wed Jul 8 15:26:12 2015 +0200
Honour SOURCE_DATE_EPOCH when embedding timestamps in docs
Closes: #791815
---
.../0010-Replace-timestamp-with-SOURCE_DATE_EPOCH | 68 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 69 insertions(+)
diff --git a/debian/patches/0010-Replace-timestamp-with-SOURCE_DATE_EPOCH b/debian/patches/0010-Replace-timestamp-with-SOURCE_DATE_EPOCH
new file mode 100644
index 0000000..7965775
--- /dev/null
+++ b/debian/patches/0010-Replace-timestamp-with-SOURCE_DATE_EPOCH
@@ -0,0 +1,68 @@
+Description: Replace date timestamp by SOURCE_DATE_EPOCH env var
+Author: Dhole <dhole at openmailbox.org>
+Forwarded: yes
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=758148
+Bug-Debian: https://bugs.debian.org/791815
+
+---
+
+--- 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;
diff --git a/debian/patches/series b/debian/patches/series
index dd7601a..f1bb994 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,4 @@
0008-Fix-quoting-of-xlocale-test-program-in-configure.in.patch
0009-Fix-for-type-confusion-in-preprocessing-attributes.patch
0010-Make-generate-id-deterministic.patch
+0010-Replace-timestamp-with-SOURCE_DATE_EPOCH
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/libxslt.git
More information about the Reproducible-commits
mailing list