[Reproducible-commits] [texlive-bin] 01/04: Add patch honour-source-date-epoch

Reiner Herrmann reiner at reiner-h.de
Sun Oct 18 13:00:46 UTC 2015


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

deki-guest pushed a commit to branch pu/reproducible_builds
in repository texlive-bin.

commit 54066068949b941087d1685c2b8c741496a9841c
Author: akira <marivalenm at gmail.com>
Date:   Thu Jul 9 22:34:24 2015 +0200

    Add patch honour-source-date-epoch
    
    The patch makes pdflatex honour the environment variable
    $SOURCE_DATE_EPOCH to produce reproducible pdf files.
---
 debian/changelog                        |  8 ++++
 debian/patches/honour-source-date-epoch | 79 +++++++++++++++++++++++++++++++++
 debian/patches/series                   |  1 +
 3 files changed, 88 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 8857a1f..ff289b2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,14 @@ texlive-bin (2015.20150524.37493-7) unstable; urgency=medium
 
  -- Norbert Preining <preining at debian.org>  Wed, 14 Oct 2015 12:50:25 +0900
 
+texlive-bin (2015.20150524.37493-5.1~reproducible1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add patch honour-source-date-epoch to let pdflatex produce deterministic
+    pdf files
+
+ -- akira <marivalenm at gmail.com>  Thu, 09 Jul 2015 22:31:40 +0200
+
 texlive-bin (2015.20150524.37493-6) unstable; urgency=medium
 
   * fix garbled output of vptovf and ovf2ovp (Closes: #795054)
diff --git a/debian/patches/honour-source-date-epoch b/debian/patches/honour-source-date-epoch
new file mode 100644
index 0000000..2fca7d5
--- /dev/null
+++ b/debian/patches/honour-source-date-epoch
@@ -0,0 +1,79 @@
+--- a/texk/web2c/lib/texmfmp.c
++++ b/texk/web2c/lib/texmfmp.c
+@@ -2869,6 +2869,7 @@ void pdftex_fail(const char *fmt, ...)
+ }
+ #endif /* not pdfTeX */
+ 
++static boolean start_time_set = false;
+ static time_t start_time = 0;
+ #define TIME_STR_SIZE 30
+ char start_time_str[TIME_STR_SIZE];
+@@ -2925,8 +2926,42 @@ static void makepdftime(time_t t, char *
+ 
+ void initstarttime(void)
+ {
+-    if (start_time == 0) {
+-        start_time = time((time_t *) NULL);
++	char *source_date_epoch;
++	unsigned long long epoch;
++	char *endptr;
++    if (!start_time_set) {
++        start_time_set = true;
++	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));
++			uexit(EXIT_FAILURE);
++		}
++		if (endptr == source_date_epoch)
++		{
++			fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: No digits were found: %s\n", endptr);
++			uexit(EXIT_FAILURE);
++		}
++		if (*endptr != '\0')
++		{
++			fprintf(stderr, "Environment variable $SOURCE_DATE_EPOCH: Trailing garbage: %s\n", endptr);
++			uexit(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);
++			uexit(EXIT_FAILURE);
++		}
++		start_time = epoch;
++	}
++	else {
++		start_time = time((time_t *) NULL);
++	}
+         makepdftime(start_time, start_time_str);
+     }
+ }
+--- a/texk/web2c/pdftexdir/utils.c
++++ b/texk/web2c/pdftexdir/utils.c
+@@ -723,9 +723,6 @@ static void convertStringToHexString(con
+  */
+ void printID(strnumber filename)
+ {
+-    time_t t;
+-    size_t size;
+-    char time_str[32];
+     md5_state_t state;
+     md5_byte_t digest[16];
+     char id[64];
+@@ -734,9 +731,8 @@ void printID(strnumber filename)
+     /* start md5 */
+     md5_init(&state);
+     /* get the time */
+-    t = time(NULL);
+-    size = strftime(time_str, sizeof(time_str), "%Y%m%dT%H%M%SZ", gmtime(&t));
+-    md5_append(&state, (const md5_byte_t *) time_str, size);
++    initstarttime();
++    md5_append(&state, (const md5_byte_t *) start_time_str, strlen(start_time_str));
+     /* get the file name */
+     if (getcwd(pwd, sizeof(pwd)) == NULL)
+         pdftex_fail("getcwd() failed (%s), path too long?", strerror(errno));
diff --git a/debian/patches/series b/debian/patches/series
index c650c12..baa4fef 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,6 +10,7 @@ libpng-arm64-neon-fix
 mktexlsr-use-mktemp
 dvihp-use-mktemp
 remove-libdir-from-kpathsea-pkgconfig
+honour-source-date-epoch
 # from here on upstream patches
 upstream-svn37801-xobjcect-typo
 upstream-svn38047-dvipdfmx-fix

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



More information about the Reproducible-commits mailing list