[Reproducible-commits] [man2html] 01/01: Use $SOURCE_DATE_EPOCH to produce reproducible output

Maria Valentina Marin Rodrigues akira-guest at moszumanska.debian.org
Sat Aug 15 12:47:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

akira-guest pushed a commit to branch pu/reproducible_builds
in repository man2html.

commit 4d334e23a95ba7f0804e326ef8094e750cf4ef7b
Author: akira <marivalenm at gmail.com>
Date:   Sat Aug 15 14:35:00 2015 +0200

    Use $SOURCE_DATE_EPOCH to produce reproducible output
---
 debian/changelog                     |  8 ++++++
 debian/patches/Use-SOURCE-DATE-EPOCH | 51 ++++++++++++++++++++++++++++++++++++
 debian/patches/series                |  1 +
 3 files changed, 60 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 5c6a1b3..6b82ce4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+man2html (1.6g-7.0~reproducible1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Apply patch Use-SOURCE-DATE-EPOCH to produce reproducible timestamps in
+    documentation
+
+ -- akira <marivalenm at gmail.com>  Fri, 14 Aug 2015 11:24:55 +0200
+
 man2html (1.6g-7) unstable; urgency=low
 
   * utils.c: Fix querystring2argv() to create argv in case man2html and
diff --git a/debian/patches/Use-SOURCE-DATE-EPOCH b/debian/patches/Use-SOURCE-DATE-EPOCH
new file mode 100644
index 0000000..b1dc420
--- /dev/null
+++ b/debian/patches/Use-SOURCE-DATE-EPOCH
@@ -0,0 +1,51 @@
+--- a/man2html/cgibase.c
++++ b/man2html/cgibase.c
+@@ -8,6 +8,8 @@
+ #include <ctype.h>		/* tolower() */
+ #include <string.h>		/* strlen() */
+ #include "defs.h"
++#include <errno.h>
++#include <limits.h>
+ 
+ /*
+  * The default is to use cgibase. With relative html style
+@@ -83,11 +85,39 @@ void print_sig()
+     char timebuf[TIMEBUFSZ];
+     struct tm *timetm;
+     time_t now;
++    char *source_date_epoch;
++    unsigned long long epoch;
++    char *endptr;
+ 
+     timebuf[0] = 0;
+ #ifdef TIMEFORMAT
+     sprintf(timebuf, "Time: ");
++    source_date_epoch = getenv("SOURCE_DATE_EPOCH");
++    if (source_date_epoch) {
++		errno = 0;
++		epoch = strtoull(source_date_epoch, &endptr, 10);
++		if ((errno == ERANGE && (epoch == ULLONG_MAX || epoch == 0))
++				|| (errno != 0 && epoch == 0)) {
++			fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: strtoull: %s\n", strerror(errno));
++			exit(EXIT_FAILURE);
++		}
++		if (endptr == source_date_epoch) {
++			fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n", endptr);
++			exit(EXIT_FAILURE);
++		}
++		if (*endptr != '\0') {
++			fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n", endptr);
++			exit(EXIT_FAILURE);
++		}
++		if (epoch > ULONG_MAX) {
++			fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: value must be smaller than or equal to: %lu but was found to be: %llu \n", ULONG_MAX  ,epoch);
++			exit(EXIT_FAILURE);
++		}
++		now=epoch;
++	}
++	else {
+     now=time(NULL);
++	}
+     timetm=gmtime(&now);
+     strftime(timebuf+6, TIMEBUFSZ-6, TIMEFORMAT, timetm);
+     timebuf[TIMEBUFSZ-1] = 0;
diff --git a/debian/patches/series b/debian/patches/series
index d262411..dd48540 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -28,3 +28,4 @@
 032-man2html-man-remove-LO-tags.patch
 033-gcc-warnings.patch
 034-UTF8-charset.patch
+Use-SOURCE-DATE-EPOCH

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/man2html.git



More information about the Reproducible-commits mailing list