[bnd] 04/07: Use SOURCE_DATE_EPOCH when expanding the ${tstamp} and ${now} macros

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Tue May 10 16:40:09 UTC 2016


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

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

commit a54f18b8bef2cf18604f2d3e394be63b69071662
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Tue May 10 09:35:58 2016 +0200

    Use SOURCE_DATE_EPOCH when expanding the ${tstamp} and ${now} macros
---
 debian/changelog                             |  3 +++
 debian/patches/reproducible-timestamps.patch | 25 +++++++++++++++++++++++++
 debian/patches/series                        |  1 +
 3 files changed, 29 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 62926f2..2181b43 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ bnd (2.4.1-4) UNRELEASED; urgency=medium
   * Fixed the build failure caused by the swicth from groovy2 to groovy
   * Standards-Version updated to 3.9.8 (no changes)
   * Use a secure Vcs-Git URL
+  * Reproducibility improvements:
+    - The value of the ${tstamp} and ${now} macros is now derived
+      from SOURCE_DATE_EPOCH
 
  -- Emmanuel Bourg <ebourg at apache.org>  Tue, 10 May 2016 09:01:16 +0200
 
diff --git a/debian/patches/reproducible-timestamps.patch b/debian/patches/reproducible-timestamps.patch
new file mode 100644
index 0000000..184c0e9
--- /dev/null
+++ b/debian/patches/reproducible-timestamps.patch
@@ -0,0 +1,25 @@
+Description: Use the value of the SOURCE_DATE_EPOCH variable for the timestamps generated by BND
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: no
+--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Macro.java
++++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Macro.java
+@@ -456,6 +456,9 @@
+ 	public Object _now(String args[]) {
+ 		verifyCommand(args, _nowHelp, null, 1, 2);
+ 		Date now = new Date();
++                if (System.getenv("SOURCE_DATE_EPOCH") != null) {
++                    now = new Date(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
++                }
+ 
+ 		if (args.length == 2) {
+ 			if ("long".equals(args[1]))
+@@ -676,6 +679,9 @@
+ 	public String _tstamp(String args[]) {
+ 		String format = "yyyyMMddHHmm";
+ 		long now = System.currentTimeMillis();
++                if (System.getenv("SOURCE_DATE_EPOCH") != null) {
++                    now = 1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"));
++                }
+ 		TimeZone tz = TimeZone.getTimeZone("UTC");
+ 
+ 		if (args.length > 1) {
diff --git a/debian/patches/series b/debian/patches/series
index 7a1a39a..8d71617 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,4 @@ disable-jpm-plugin.patch
 gradle-compatibility.patch
 use-bootstrapped-gradle-plugin.patch
 remove-recursion-in-macro-warning.patch
+reproducible-timestamps.patch

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



More information about the pkg-java-commits mailing list