[Reproducible-commits] [ghostscript] 01/01: Modify patch to use SOURCE_DATE_EPOCH instead of DEB_BUILD_TIMESTAMP. Set TZ=UTC when needed
Eduard Sanou
dhole-guest at moszumanska.debian.org
Fri Jul 24 14:47:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
dhole-guest pushed a commit to branch pu/reproducible_builds
in repository ghostscript.
commit f9ea4e8e205368a3b555769ff0a1b06bf7d36829
Author: Dhole <dhole at openmailbox.org>
Date: Fri Jul 24 16:47:35 2015 +0200
Modify patch to use SOURCE_DATE_EPOCH instead of DEB_BUILD_TIMESTAMP. Set TZ=UTC when needed
---
debian/changelog | 5 +++--
debian/patches/2009_add_build_timestamp_setting.patch | 18 ++++++++++++------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 914064f..20006f8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
-ghostscript (9.06~dfsg-2.0~reproducible1) UNRELEASED; urgency=low
+ghostscript (9.06~dfsg-2.0~reproducible2) UNRELEASED; urgency=low
[ Peter De Wachter ]
* Add patch to allow the build timestamp to be set through the environment
- variable BUILD_TIMESTAMP. This is needed for reproducible builds.
+ variable SOURCE_DATE_EPOCH, and set TZ=UTC in case the external timestamp
+ is used. This is needed for reproducible builds.
-- Jérémy Bobbio <lunar at debian.org> Fri, 23 Jan 2015 13:23:45 +0100
diff --git a/debian/patches/2009_add_build_timestamp_setting.patch b/debian/patches/2009_add_build_timestamp_setting.patch
index c45769f..5ee2610 100644
--- a/debian/patches/2009_add_build_timestamp_setting.patch
+++ b/debian/patches/2009_add_build_timestamp_setting.patch
@@ -1,10 +1,12 @@
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 use consistently use gp_get_realtime() instead of directly calling
+ 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 BUILD_TIMESTAMP environment variable if set.
-Author: Peter De Wachter <pdewacht at gmail.com>
+ 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: Peter De Wachter <pdewacht at gmail.com>, Dhole <dhole at openmailbox.org>
--- ghostscript-9.06~dfsg.orig/base/gdevpdf.c
+++ ghostscript-9.06~dfsg/base/gdevpdf.c
@@ -81,11 +83,11 @@ Author: Peter De Wachter <pdewacht at gmail.com>
#if gettimeofday_no_timezone /* older versions of SVR4 */
{
-@@ -164,6 +166,22 @@ gp_get_realtime(long *pdt)
+@@ -164,6 +166,26 @@ gp_get_realtime(long *pdt)
}
#endif
-+ env = getenv("DEB_BUILD_TIMESTAMP");
++ env = getenv("SOURCE_DATE_EPOCH");
+ if (env) {
+ char *end;
+ long timestamp;
@@ -93,12 +95,16 @@ Author: Peter De Wachter <pdewacht at gmail.com>
+ errno = 0;
+ timestamp = strtol(env, &end, 10);
+ if (env == end || *end || errno != 0) {
-+ lprintf("Ghostscript: DEB_BUILD_TIMESTAMP is not a number!\n");
++ 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 */
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/ghostscript.git
More information about the Reproducible-commits
mailing list