[Reproducible-commits] [gettext] 01/01: Adapt patch to honour SOURCE_DATE_EPOCH to version 0.19.5.1-1

Eduard Sanou dhole-guest at moszumanska.debian.org
Tue Aug 4 17:15:21 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 gettext.

commit b6e972eab1f04f3fbd368433b496f1f4a6b372a3
Author: Dhole <dhole at openmailbox.org>
Date:   Tue Aug 4 18:48:53 2015 +0200

    Adapt patch to honour SOURCE_DATE_EPOCH to version 0.19.5.1-1
---
 debian/changelog                                   |  8 ++++
 .../04-Replace-timestamp-with-SOURCE_DATE_EPOCH    | 45 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 54 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 6ba9a9f..57db696 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+gettext (0.19.5.1-1.0~reproducible1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add support for reproducible builds by using $SOURCE_DATE_EPOCH as the
+    date on creation of PO files with xgettext.
+
+ -- Eduard Sanou <dhole at openmailbox.org>  Tue, 04 Aug 2015 18:43:52 +0200
+
 gettext (0.19.5.1-1) unstable; urgency=medium
 
   * New upstream release.
diff --git a/debian/patches/04-Replace-timestamp-with-SOURCE_DATE_EPOCH b/debian/patches/04-Replace-timestamp-with-SOURCE_DATE_EPOCH
new file mode 100644
index 0000000..0e76ea5
--- /dev/null
+++ b/debian/patches/04-Replace-timestamp-with-SOURCE_DATE_EPOCH
@@ -0,0 +1,45 @@
+Description: Replace date timestamp by SOURCE_DATE_EPOCH env var in xgettext
+ .
+ gettext (0.19.5.1-1.0~reproducible1) UNRELEASED; urgency=medium
+ .
+   * Non-maintainer upload.
+   * Add support for reproducible builds by using $SOURCE_DATE_EPOCH as the
+     date on creation of PO files with xgettext.
+Author: Eduard Sanou <dhole at openmailbox.org>
+
+--- gettext-0.19.5.1.orig/gettext-tools/src/xgettext.c
++++ gettext-0.19.5.1/gettext-tools/src/xgettext.c
+@@ -3516,6 +3516,7 @@ construct_header ()
+   message_ty *mp;
+   char *msgstr;
+   char *comment;
++  char *source_date_epoch;
+   static lex_pos_ty pos = { __FILE__, __LINE__ };
+ 
+   if (package_name != NULL)
+@@ -3537,7 +3538,24 @@ the MSGID_BUGS_ADDRESS variable there; o
+ specify an --msgid-bugs-address command line option.\n\
+ ")));
+ 
+-  time (&now);
++  /* Allow the date and time to be set externally by an exported
++     environment variable to enable reproducible builds. */
++  source_date_epoch = getenv ("SOURCE_DATE_EPOCH");
++  if (source_date_epoch)
++    {
++      errno = 0;
++      now = (time_t) strtol (source_date_epoch, NULL, 10);
++      if (errno != 0)
++        error (EXIT_FAILURE, errno, _("\
++SOURCE_DATE_EPOCH=\"%s\" is not a valid number"), source_date_epoch);
++
++      /* The function po_strftime uses localtime() to parse the timestamp, so 
++         we need to fix the environment timezone to get reproducible results */
++      setenv("TZ", "UTC", 1);
++    }
++  else
++    time (&now);
++
+   timestring = po_strftime (&now);
+ 
+   msgstr = xasprintf ("\
diff --git a/debian/patches/series b/debian/patches/series
index 2cbcf30..85d89df 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 01-do-not-use-java-in-urlget
 02-msgfmt-default-little-endian
 03-fix-gettextize-version
+04-Replace-timestamp-with-SOURCE_DATE_EPOCH

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/gettext.git



More information about the Reproducible-commits mailing list