[arch-commits] Commit in ghostscript/trunk (2 files)
Andreas Radke
andyrtr at gemini.archlinux.org
Mon Sep 27 14:48:43 UTC 2021
Date: Monday, September 27, 2021 @ 14:48:42
Author: andyrtr
Revision: 424757
upgpkg: ghostscript 9.55.0-2: make the build reproducible
Added:
ghostscript/trunk/2010_add_build_timestamp_setting.patch
Modified:
ghostscript/trunk/PKGBUILD
----------------------------------------+
2010_add_build_timestamp_setting.patch | 119 +++++++++++++++++++++++++++++++
PKGBUILD | 11 ++
2 files changed, 127 insertions(+), 3 deletions(-)
Added: 2010_add_build_timestamp_setting.patch
===================================================================
--- 2010_add_build_timestamp_setting.patch (rev 0)
+++ 2010_add_build_timestamp_setting.patch 2021-09-27 14:48:42 UTC (rev 424757)
@@ -0,0 +1,119 @@
+Description: Allow the build timestamp to be externally set
+ In order to make Ghostscript output reproducible, we need a way to
+ set the build timestamp to other values than the current time.
+ We now consistently use gp_get_realtime() instead of directly calling
+ time() or gp_get_usertime() and make gp_get_realtime() use the value
+ found in the SOURCE_DATE_EPOCH environment variable if set. Also,
+ environment timezone is fixed to UTC if SOURCE_DATE_EPOCH is used to
+ avoid variations.
+Author: Eduard Sanou <dhole at openmailbox.org>
+Author: Peter De Wachter <pdewacht at gmail.com>
+Bug-Debian: https://bugs.debian.org/794004
+Last-Update: 2015-07-30
+---
+This patch header follows DEP-3: https://dep.debian.net/deps/dep3/
+--- a/base/gp_unix.c
++++ b/base/gp_unix.c
+@@ -19,6 +19,7 @@
+ #ifdef __MINGW32__
+ # include "windows_.h"
+ #endif
++#include "errno_.h"
+ #include "pipe_.h"
+ #include "string_.h"
+ #include "time_.h"
+@@ -148,6 +149,7 @@
+ gp_get_realtime(long *pdt)
+ {
+ struct timeval tp;
++ const char *env;
+
+ #if gettimeofday_no_timezone /* older versions of SVR4 */
+ {
+@@ -167,6 +169,26 @@
+ }
+ #endif
+
++ env = getenv("SOURCE_DATE_EPOCH");
++ if (env) {
++ char *end;
++ long timestamp;
++
++ errno = 0;
++ timestamp = strtol(env, &end, 10);
++ if (env == end || *end || errno != 0) {
++ lprintf("Ghostscript: SOURCE_DATE_EPOCH is not a number!\n");
++ timestamp = 0;
++ }
++
++ tp.tv_sec = timestamp;
++ tp.tv_usec = 0;
++
++ /* We need to fix the environment timezone to get reproducible */
++ /* results when parsing the result of gp_get_realtime. */
++ setenv("TZ", "UTC", 1);
++ }
++
+ /* tp.tv_sec is #secs since Jan 1, 1970 */
+ pdt[0] = tp.tv_sec;
+
+--- a/devices/vector/gdevpdf.c
++++ b/devices/vector/gdevpdf.c
+@@ -427,6 +427,7 @@
+ */
+ {
+ struct tm tms;
++ long secs_ns[2];
+ time_t t;
+ char buf[1+2+4+2+2+2+2+2+1+2+1+2+1+1+1]; /* (D:yyyymmddhhmmssZhh'mm')\0 */
+ int timeoffset;
+@@ -438,7 +439,8 @@
+ timesign = 'Z';
+ timeoffset = 0;
+ #else
+- time(&t);
++ gp_get_realtime(secs_ns);
++ t = secs_ns[0];
+ tms = *gmtime(&t);
+ tms.tm_isdst = -1;
+ timeoffset = (int)difftime(t, mktime(&tms)); /* tz+dst in seconds */
+--- a/devices/vector/gdevpdfe.c
++++ b/devices/vector/gdevpdfe.c
+@@ -199,6 +199,7 @@
+ {
+ /* We don't write a day time because we don't have a time zone. */
+ struct tm tms;
++ long secs_ns[2];
+ time_t t;
+ char buf1[4+1+2+1+2+1]; /* yyyy-mm-dd\0 */
+
+@@ -206,7 +207,8 @@
+ memset(&t, 0, sizeof(t));
+ memset(&tms, 0, sizeof(tms));
+ #else
+- time(&t);
++ gp_get_realtime(secs_ns);
++ t = secs_ns[0];
+ tms = *localtime(&t);
+ #endif
+ gs_sprintf(buf1,
+--- a/devices/vector/gdevpsu.c
++++ b/devices/vector/gdevpsu.c
+@@ -183,6 +183,7 @@
+ fprintf(f, "%%%%Creator: %s %ld (%s)\n", gs_product, (long)gs_revision,
+ dev->dname);
+ {
++ long secs_ns[2];
+ time_t t;
+ struct tm tms;
+
+@@ -190,7 +191,8 @@
+ memset(&t, 0, sizeof(t));
+ memset(&tms, 0, sizeof(tms));
+ #else
+- time(&t);
++ gp_get_realtime(secs_ns);
++ t = secs_ns[0];
+ tms = *localtime(&t);
+ #endif
+ fprintf(f, "%%%%CreationDate: %d/%02d/%02d %02d:%02d:%02d\n",
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2021-09-27 11:48:46 UTC (rev 424756)
+++ PKGBUILD 2021-09-27 14:48:42 UTC (rev 424757)
@@ -3,7 +3,7 @@
pkgbase=ghostscript
pkgname=(ghostscript ghostxps ghostpcl)
pkgver=9.55.0
-pkgrel=1
+pkgrel=2
pkgdesc="An interpreter for the PostScript language"
url="https://www.ghostscript.com/"
arch=('x86_64')
@@ -13,8 +13,10 @@
makedepends=('gtk3' 'gnutls' 'glu' 'freeglut')
# https://github.com/ArtifexSoftware/ghostpdl-downloads/releases
source=(#https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${pkgver//./}/ghostpdl-${pkgver}.tar.xz
- https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/ghostpdl-${pkgver/.0//}/ghostpdl-${pkgver}.tar.xz)
-sha512sums=('d23864be1548ce7c7ae61398f52c34c5485dfe74e78bf7ef16c8fa5690e2ea857cc9795409a70feda5ff78c27b3c2bbc0e0710d190763fca77137ee9c56a0fed')
+ https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/ghostpdl-${pkgver/.0//}/ghostpdl-${pkgver}.tar.xz
+ 2010_add_build_timestamp_setting.patch)
+sha512sums=('d23864be1548ce7c7ae61398f52c34c5485dfe74e78bf7ef16c8fa5690e2ea857cc9795409a70feda5ff78c27b3c2bbc0e0710d190763fca77137ee9c56a0fed'
+ 'cd7794ee4f28b11177021b950196385200b610127ed6cb94a45e3202b690b721a0dfcc0276ff39448d4dab64c1b31a76e6c323696a8315aad9edc22077f18a3d')
### update jbig2dec first! ###
@@ -54,6 +56,9 @@
# https://bugs.ghostscript.com/show_bug.cgi?id=704405
sed -i "s/gscms_transformm_color_const/gscms_transform_color_const/" base/gsicc_lcms2.c
+
+ # Debian: # allow the build timestamp to be externally set
+ patch -Np1 -i ../2010_add_build_timestamp_setting.patch
}
build() {
More information about the arch-commits
mailing list