diff --git a/reproducible-jar-mtime.patch b/reproducible-jar-mtime.patch index deb7930..b4df609 100644 --- a/reproducible-jar-mtime.patch +++ b/reproducible-jar-mtime.patch @@ -1,5 +1,5 @@ --- apache-ant-1.10.14/src/main/org/apache/tools/ant/taskdefs/Jar.java 2024-07-16 13:38:38.336428941 +0200 -+++ apache-ant-1.10.14/src/main/org/apache/tools/ant/taskdefs/Jar.java 2024-07-16 13:48:05.794045414 +0200 ++++ apache-ant-1.10.14/src/main/org/apache/tools/ant/taskdefs/Jar.java 2024-07-16 14:33:49.541982462 +0200 @@ -450,6 +450,13 @@ serviceList.add(service); } @@ -41,3 +41,28 @@ null, ZipFileSet.DEFAULT_FILE_MODE); } } +--- apache-ant-1.10.14/src/main/org/apache/tools/ant/taskdefs/Zip.java 2024-07-16 13:38:38.343095619 +0200 ++++ apache-ant-1.10.14/src/main/org/apache/tools/ant/taskdefs/Zip.java 2024-07-16 14:33:59.575332992 +0200 +@@ -1669,6 +1669,13 @@ + extra); + } + ++ private long currentTimeMillisOrSourceDateEpoch() { ++ if ( System.getenv("SOURCE_DATE_EPOCH") != null ) { ++ return 1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")); ++ } ++ return System.currentTimeMillis(); ++ } ++ + /** + * Add a directory to the zip stream. + * @param dir the directory to add to the archive +@@ -1708,7 +1715,7 @@ + } else if (dir != null && dir.isExists()) { + ze.setTime(dir.getLastModified() + millisToAdd); + } else { +- ze.setTime(System.currentTimeMillis() + millisToAdd); ++ ze.setTime(currentTimeMillisOrSourceDateEpoch() + millisToAdd); + } + ze.setSize(0); + ze.setMethod(ZipEntry.STORED);