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

Reiner Herrmann reiner at reiner-h.de
Thu Mar 3 23:25:13 UTC 2016


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 87feeed7bcfbb748415f254c5aa94e36410b0298
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/patches/honour-source-date-epoch | 79 +++++++++++++++++++++++++++++++++
 debian/patches/series                   |  1 +
 2 files changed, 80 insertions(+)

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 ef048f1..c14513e 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