Your message dated Thu, 14 Jul 2016 19:41:31 -0500
with message-id <22408.12603.347950.727...@max.nulle.part>
has caused the   report #831044,
regarding gretl: please make the build reproducible
to be marked as having been forwarded to the upstream software
author(s) Allin Cottrell <cottr...@wfu.edu>

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
831044: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=831044
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Hi Allin,

A while back, Debian started an initiative to make all builds fully
reproducible.  Ie when starting from the same source, binaries should be bit
by bit identical.  This has come a long way, and IIRC other distros have
joined.  This is the Right Thing (TM) to do.

Gretl failed that recently and Chris (CC'ed) was kind enough to send me a
patch (see below too) to builddate.c to ensure it passes.  I applied the
patch, and gretl is now tagged 'reproducible' (for 2016c-2 with the patch
whereas older builds failed)
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/gretl.html

The patch branches off if an env var is defined, and uses that to set the
date. We typically seed this from the most recent changelog -- that way
builds on consecutive days get the same binary signature whereas your default
behaviour (quite rightly) uses calendar dates -- which will differ.

I think you will see the patch as benign and hoep you are going to apply it.

Let me know if you have any questions.

Best,  Dirk

--- gretl-2016b.orig/builddate.c
+++ gretl-2016b/builddate.c
@@ -2,11 +2,40 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <errno.h>
+#include <limits.h>
 
 void current_ymd (int *y, int *m, int *d)
 {
     time_t t = time(NULL);
     struct tm *lt = localtime(&t);
+    char *endptr;
+    char *source_date_epoch = getenv("SOURCE_DATE_EPOCH");
+    unsigned long long 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);
+        }
+        t = epoch;
+        lt = gmtime(&t);
+    }
 
     *y = lt->tm_year + 1900;
     *m = lt->tm_mon + 1;


On 13 July 2016 at 23:18, Chris Lamb wrote:
| Source: gretl
| Version: 2016b-3
| Severity: wishlist
| Tags: patch
| User: reproducible-bui...@lists.alioth.debian.org
| Usertags: timestamps
| X-Debbugs-Cc: reproducible-bui...@lists.alioth.debian.org
| 
| Hi,
| 
| Whilst working on the "reproducible builds" effort [0], we
| noticed that gretl could not be built reproducibly.
| 
| Patch attached. It can probably be sent upstream.
| 
|  [0] https://wiki.debian.org/ReproducibleBuilds
| 
| 
| Regards,
| 
| -- 
|       ,''`.
|      : :'  :     Chris Lamb
|      `. `'`      la...@debian.org / chris-lamb.co.uk
|        `-
| x[DELETED ATTACHMENT gretl.diff.txt, plain text]

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

--- End Message ---

Reply via email to