[gnuplot] 01/01: Make the build reproducible.

Anton Gladky gladk at moszumanska.debian.org
Mon Jun 13 20:04:46 UTC 2016


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

gladk pushed a commit to branch master
in repository gnuplot.

commit 8487b29547b4b1432f19e4baee8222328b4094d4
Author: Alexis Bienvenüe <pado at passoire.fr>
Date:   Mon Jun 13 22:04:26 2016 +0200

    Make the build reproducible.
---
 debian/patches/13_honour_SOURCE_DATE_EPOCH.patch   | 59 ++++++++++++++++++++++
 debian/patches/14_strip_username_from_output.patch | 36 +++++++++++++
 debian/patches/series                              |  2 +
 debian/rules                                       |  6 +--
 4 files changed, 100 insertions(+), 3 deletions(-)

diff --git a/debian/patches/13_honour_SOURCE_DATE_EPOCH.patch b/debian/patches/13_honour_SOURCE_DATE_EPOCH.patch
new file mode 100644
index 0000000..6a3ac88
--- /dev/null
+++ b/debian/patches/13_honour_SOURCE_DATE_EPOCH.patch
@@ -0,0 +1,59 @@
+Description: Honour SOURCE_DATE_EPOCH
+ Get date from the environment variable SOURCE_DATE_EPOCH (when set),
+ to build output timestamps.
+ See https://reproducible-builds.org/specs/source-date-epoch/
+Author: Alexis Bienvenüe <pado at passoire.fr>
+
+Index: gnuplot/term/post.trm
+===================================================================
+--- gnuplot.orig/term/post.trm
++++ gnuplot/term/post.trm
+@@ -1657,15 +1657,45 @@ end\n\
+     int i;
+     time_t now;
+     char *timedate;
+-
++    char *source_date_epoch;
++    unsigned long long epoch;
++    char *endptr;
++ 
+     ps_common_uses_fonts = uses_fonts;
+     ps_common_xoff = xoff;
+     ps_common_yoff = yoff;
+ 
+     ps_page = 0;
+ 
+-    time(&now);
+-    timedate=asctime(localtime(&now));
++    /* get source date from environment variable SOURCE_DATE_EPOCH, if set.
++       See https://reproducible-builds.org/specs/source-date-epoch/ */
++    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;
++      timedate=asctime(gmtime(&now));
++    } else {
++      time(&now);
++      timedate=asctime(localtime(&now));
++    }
+     timedate[strlen(timedate)-1]='\0';
+ 
+ #ifdef PSLATEX_DRIVER
diff --git a/debian/patches/14_strip_username_from_output.patch b/debian/patches/14_strip_username_from_output.patch
new file mode 100644
index 0000000..49e9ba1
--- /dev/null
+++ b/debian/patches/14_strip_username_from_output.patch
@@ -0,0 +1,36 @@
+Description: Strip username from output
+ Strip username from output to make it reproducible.
+Author: Alexis Bienvenüe <pado at passoire.fr>
+
+Index: gnuplot/term/post.trm
+===================================================================
+--- gnuplot.orig/term/post.trm
++++ gnuplot/term/post.trm
+@@ -1644,7 +1644,6 @@ SDict begin [\n\
+   /Title (%s)\n\
+   /Subject (gnuplot plot)\n\
+   /Creator (gnuplot %s patchlevel %s)\n\
+-  /Author (%s)\n\
+ %%  /Producer (gnuplot)\n\
+ %%  /Keywords ()\n\
+   /CreationDate (%s)\n\
+@@ -1821,18 +1820,11 @@ end\n\
+ 
+     /* HH: print pdf information interpreted by ghostscript/acrobat */
+     {
+-	char *username=getusername();
+-	char *username2=PS_escape_string(username,"()\\");
+ 	char *outstr2=PS_escape_string(outstr,"()\\");
+ 	fprintf(gppsfile, psi3,
+ 		outstr2?outstr2:"",
+-		gnuplot_version, gnuplot_patchlevel,
+-		username2?username2:"", 
++		gnuplot_version, gnuplot_patchlevel, 
+ 		timedate);
+-	if (username)
+-	    free(username);
+-	if (username2)
+-	    free(username2);
+ 	if (outstr2)
+ 	    free(outstr2);
+     }
diff --git a/debian/patches/series b/debian/patches/series
index 519eb43..212c096 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,5 @@
 10_removepicins.patch
 11_fix_linkage_wx.patch
 12_info.patch
+13_honour_SOURCE_DATE_EPOCH.patch
+14_strip_username_from_output.patch
diff --git a/debian/rules b/debian/rules
index fefa3e1..131128c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -35,11 +35,11 @@ conf_opts += \
 
 override_dh_auto_configure:
 	mkdir -p $(BUILDDIR_NOX)
-	cd $(BUILDDIR_NOX);  ./../../configure $(conf_opts) --with-qt=no --without-x --disable-wxwidgets
+	cd $(BUILDDIR_NOX); CONFIG_SHELL=/bin/sh ./../../configure $(conf_opts) --with-qt=no --without-x --disable-wxwidgets
 	mkdir -p $(BUILDDIR_X11)
-	cd $(BUILDDIR_X11); ../../configure $(conf_opts) --with-qt=no --with-tutorial
+	cd $(BUILDDIR_X11); CONFIG_SHELL=/bin/sh ../../configure $(conf_opts) --with-qt=no --with-tutorial
 	mkdir -p $(BUILDDIR_QT)
-	cd $(BUILDDIR_QT); ../../configure $(conf_opts)  --enable-qt
+	cd $(BUILDDIR_QT); CONFIG_SHELL=/bin/sh ../../configure $(conf_opts)  --enable-qt
 
 override_dh_auto_build:
 	dh_auto_build -a -- -C $(BUILDDIR_NOX)/src

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/gnuplot.git



More information about the debian-science-commits mailing list