[bnd] 06/07: Use SOURCE_DATE_EPOCH as the modification time of the entries in the jar files created by bnd

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 c9bf868b8148707c3c31c1382b7fa6c7e87bfcda
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Tue May 10 18:34:08 2016 +0200

    Use SOURCE_DATE_EPOCH as the modification time of the entries in the jar files created by bnd
---
 debian/changelog                             |  2 ++
 debian/patches/reproducible-timestamps.patch | 31 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index dddbce8..fcbc68b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,8 @@ bnd (2.4.1-4) UNRELEASED; urgency=medium
     - The value of the ${tstamp} and ${now} macros is now derived
       from SOURCE_DATE_EPOCH
     - Use SOURCE_DATE_EPOCH for the Bnd-LastModified field
+    - Use SOURCE_DATE_EPOCH as the modification time of the entries
+      in the jar files created by bnd
 
  -- 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
index d6f9341..bbe5746 100644
--- a/debian/patches/reproducible-timestamps.patch
+++ b/debian/patches/reproducible-timestamps.patch
@@ -34,3 +34,34 @@ Forwarded: no
  			}
  
  			String exportHeader = printClauses(exports, true);
+--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java
++++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Jar.java
+@@ -328,7 +328,7 @@
+ 			return;
+ 
+ 		JarEntry ze = new JarEntry(manifestName);
+-		ZipUtil.setModifiedTime(ze,lastModified);
++		ZipUtil.setModifiedTime(ze, System.getenv("SOURCE_DATE_EPOCH") != null ? 1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")) : lastModified);
+ 		jout.putNextEntry(ze);
+ 		writeManifest(jout);
+ 		jout.closeEntry();
+@@ -550,6 +550,9 @@
+ 			ZipEntry ze = new ZipEntry(path);
+ 			ze.setMethod(ZipEntry.DEFLATED);
+ 			long lastModified = resource.lastModified();
++			if (System.getenv("SOURCE_DATE_EPOCH") != null) {
++				lastModified = 1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH"));
++			}
+ 			if (lastModified == 0L) {
+ 				lastModified = System.currentTimeMillis();
+ 			}
+@@ -573,6 +576,9 @@
+ 				return;
+ 			createDirectories(directories, zip, path);
+ 			ZipEntry ze = new ZipEntry(path + '/');
++			if (System.getenv("SOURCE_DATE_EPOCH") != null) {
++				ZipUtil.setModifiedTime(ze, 1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
++			}
+ 			zip.putNextEntry(ze);
+ 			zip.closeEntry();
+ 			directories.add(path);

-- 
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