[Reproducible-commits] [libxslt] 01/01: Honour SOURCE_DATE_EPOCH when embedding timestamps in docs
Eduard Sanou
dhole-guest at moszumanska.debian.org
Wed Jul 8 15:56:37 UTC 2015
This is an automated email from the git hooks/post-receive script.
dhole-guest pushed a commit to branch pu/reproducible_builds
in repository libxslt.
commit 571bb438df0b11288598c2b05010099d1861a8ed
Author: Dhole <dhole at openmailbox.org>
Date: Wed Jul 8 15:26:12 2015 +0200
Honour SOURCE_DATE_EPOCH when embedding timestamps in docs
---
debian/changelog | 9 ++-
.../0010-Replace-timestamp-with-SOURCE_DATE_EPOCH | 65 ++++++++++++++++++++++
2 files changed, 72 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f9a6c34..a77cd80 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,14 @@
-libxslt (1.1.28-2.0~reproducible3) UNRELEASED; urgency=low
+libxslt (1.1.28-2.0~reproducible5) UNRELEASED; urgency=low
+ [ Jérémy Bobbio ]
* Add a patch from Daniel Veillard to make generate-id() provide stable IDs
to make its output reproducible.
- -- Jérémy Bobbio <lunar at debian.org> Wed, 01 Jul 2015 11:49:58 +0200
+ [ Eduard Sanou ]
+ * Add support for reproducible builds by using $SOURCE_DATE_EPOCH as the
+ date when processing docs (when using the var $date).
+
+ -- Dhole <dhole at openmailbox.org> Wed, 08 Jul 2015 15:05:07 +0200
libxslt (1.1.28-2) unstable; urgency=low
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..b7cb960
--- /dev/null
+++ b/debian/patches/0010-Replace-timestamp-with-SOURCE_DATE_EPOCH
@@ -0,0 +1,65 @@
+Description: Replace date timestamp by SOURCE_DATE_EPOCH env var
+Author: Dhole <dhole at openmailbox.org>
+
+---
+
+--- 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;
--
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