[ant] 01/01: Honor SOURCE_DATE_EPOCH for the timestamp in the .properties files generated by the PropertyFile task

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon May 23 22:23:42 UTC 2016


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

ebourg-guest pushed a commit to branch master
in repository ant.

commit fb28d52ff4681f18699221707efe6fb8d06c1dc2
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Tue May 24 00:22:11 2016 +0200

    Honor SOURCE_DATE_EPOCH for the timestamp in the .properties files generated by the PropertyFile task
---
 debian/changelog                                   |  8 +++++++
 .../0011-reproducible-propertyfile-task.patch      | 26 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 35 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 9e7134c..179e2b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+ant (1.9.7-4) UNRELEASED; urgency=medium
+
+  * Reproducibility improvements:
+    - The PropertyFile task now honors the SOURCE_DATE_EPOCH variable
+      for the date in the header of the .properties file generated
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Mon, 23 May 2016 23:30:45 +0200
+
 ant (1.9.7-3) unstable; urgency=medium
 
   * Do not set the javadoc encoding/locale parameters if they were already
diff --git a/debian/patches/0011-reproducible-propertyfile-task.patch b/debian/patches/0011-reproducible-propertyfile-task.patch
new file mode 100644
index 0000000..b578eb1
--- /dev/null
+++ b/debian/patches/0011-reproducible-propertyfile-task.patch
@@ -0,0 +1,26 @@
+Description: Improves the reproducibility of the propertyfile task for the Debian
+ builds by using the date specified by the SOURCE_DATE_EPOCH variable in the header
+ of the .properties file generated
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: no
+--- a/src/main/org/apache/tools/ant/util/DateUtils.java
++++ b/src/main/org/apache/tools/ant/util/DateUtils.java
+@@ -208,6 +208,10 @@
+      */
+     public static String getDateForHeader() {
+         Calendar cal = Calendar.getInstance();
++        if (System.getenv("SOURCE_DATE_EPOCH") != null) {
++            cal.setTimeZone(TimeZone.getTimeZone("UTC"));
++            cal.setTime(new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"))));
++        }
+         TimeZone tz = cal.getTimeZone();
+         int offset = tz.getOffset(cal.get(Calendar.ERA),
+                                   cal.get(Calendar.YEAR),
+@@ -228,6 +232,7 @@
+         }
+         tzMarker.append(minutes);
+         synchronized (DATE_HEADER_FORMAT_INT) {
++            DATE_HEADER_FORMAT_INT.setTimeZone(tz);
+             return DATE_HEADER_FORMAT_INT.format(cal.getTime()) + tzMarker.toString();
+         }
+     }
diff --git a/debian/patches/series b/debian/patches/series
index 45995ac..3247671 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 0008-junit4-replace-assumeFalse.patch
 0009-reproducible-timestamp-task.patch
 0010-reproducible-javadoc-task.patch
+0011-reproducible-propertyfile-task.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/ant.git



More information about the pkg-java-commits mailing list