summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/openjdk-10-jar-reproducibility.patch
diff options
context:
space:
mode:
authorDanny Milosavljevic <[email protected]>2023-07-31 20:09:14 +0200
committerLudovic Courtès <[email protected]>2024-08-31 10:44:39 +0200
commit48ea1a2b3b8bc4c8b2247972401ab5a6f7f4ecc7 (patch)
tree46ef19732c710b7950ad9cecc7e5afdb71df4e27 /gnu/packages/patches/openjdk-10-jar-reproducibility.patch
parent2f1daa35746c896cd59882383c236ee97a3cbad7 (diff)
gnu: openjdk10: Make more reproducible.
* gnu/packages/patches/openjdk-10-char-reproducibility.patch: New file. * gnu/packages/patches/openjdk-10-classlist-reproducibility.patch: New file. * gnu/packages/patches/openjdk-10-corba-reproducibility.patch: New file. * gnu/packages/patches/openjdk-10-jar-reproducibility.patch: New file. * gnu/packages/patches/openjdk-10-jtask-reproducibility.patch: New file. * gnu/packages/patches/openjdk-10-module-reproducibility.patch: New file. * gnu/packages/patches/openjdk-10-module3-reproducibility.patch: New file. * gnu/packages/patches/openjdk-10-module4-reproducibility.patch: New file. * gnu/packages/java.scm (openjdk10)[source]: Add patches. [arguments]<#:phases>[remove-timestamping]: New phase. * gnu/local.mk (dist_patch_DATA): Add patches. Signed-off-by: Maxim Cournoyer <[email protected]>
Diffstat (limited to 'gnu/packages/patches/openjdk-10-jar-reproducibility.patch')
-rw-r--r--gnu/packages/patches/openjdk-10-jar-reproducibility.patch103
1 files changed, 103 insertions, 0 deletions
diff --git a/gnu/packages/patches/openjdk-10-jar-reproducibility.patch b/gnu/packages/patches/openjdk-10-jar-reproducibility.patch
new file mode 100644
index 0000000000..176eedfce6
--- /dev/null
+++ b/gnu/packages/patches/openjdk-10-jar-reproducibility.patch
@@ -0,0 +1,103 @@
+diff -ru orig/jdk-6fa770f9f8ab/make/common/JarArchive.gmk jdk-6fa770f9f8ab/make/common/JarArchive.gmk
+--- orig/jdk-6fa770f9f8ab/make/common/JarArchive.gmk 2022-04-13 19:24:10.107680441 +0200
++++ jdk-6fa770f9f8ab/make/common/JarArchive.gmk 2022-04-13 19:31:18.031271019 +0200
+@@ -251,12 +251,14 @@
+ $(ECHO) "Main-Class: $$(strip $$($1_JARMAIN))" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \
+ $$(if $$($1_EXTRA_MANIFEST_ATTR), \
+ $(PRINTF) "$$($1_EXTRA_MANIFEST_ATTR)\n" >> $$($1_MANIFEST_FILE) $$(NEWLINE)) \
++ $(TOUCH) -h -c -t 197001010000.00 $$($1_MANIFEST_FILE) $$(NEWLINE) \
+ $(ECHO) Creating $$($1_NAME) $$(NEWLINE) \
+ $$($1_JAR_CMD) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
+ $$($1_SCAPTURE_CONTENTS) \
+ $$($1_SCAPTURE_METAINF) \
+ $$($1_SUPDATE_CONTENTS) \
+- $$($1_JARINDEX) && true \
++ $$($1_JARINDEX) && true $$(NEWLINE) \
++ d="`mktemp -d`" && $(CP) -f $$@ "$$$$d/a.jar" && (cd "$$$$d" && unzip a.jar META-INF/MANIFEST.MF && $(TOUCH) -h -c -t 197001010000.00 META-INF && $(TOUCH) -h -c -t 197001010000.00 META-INF/MANIFEST.MF && (zip --symlinks -0 -X a.jar META-INF META-INF/MANIFEST.MF; zip --symlinks -0 -X a.jar META-INF META-INF/MANIFEST.MF)) && $(CP) -f "$$$$d/a.jar" $$@ \
+ , \
+ $(ECHO) Modifying $$($1_NAME) $$(NEWLINE) \
+ $$($1_CAPTURE_CONTENTS) \
+diff -ru orig/jdk-6fa770f9f8ab/make/JrtfsJar.gmk jdk-6fa770f9f8ab/make/JrtfsJar.gmk
+--- orig/jdk-6fa770f9f8ab/make/JrtfsJar.gmk 2022-04-13 19:24:10.091680007 +0200
++++ jdk-6fa770f9f8ab/make/JrtfsJar.gmk 2022-04-13 19:29:30.044346222 +0200
+@@ -57,13 +57,18 @@
+ # file will not be copied unless META-INF/services would also be added to the INCLUDES.
+ # Adding META-INF/services would include all files in that directory when only the one
+ # is needed, which is why this explicit copy is defined instead.
+-$(eval $(call SetupCopyFiles, COPY_JIMAGE_SERVICE_PROVIDER, \
++$(eval $(call SetupCopyFiles, COPY_JIMAGE_SERVICE_PROVIDER, \
+ SRC := $(TOPDIR)/src/java.base/share/classes, \
+ DEST := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
+ FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
+
++.PHONY: $(COPY_JIMAGE_SERVICE_PROVIDER)_fix
++$(COPY_JIMAGE_SERVICE_PROVIDER)_fix: $(COPY_JIMAGE_SERVICE_PROVIDER)
++ find $(SUPPORT_OUTPUTDIR)/jrtfs_classes -exec $(TOUCH) -h -c -t 197001010000.00 {} \;
++ $(TOUCH) -h -c -t 197001010000.00 $(SUPPORT_OUTPUTDIR)/java-main-manifest.mf
++
+ $(eval $(call SetupJarArchive,BUILD_JRTFS_JAR, \
+- DEPENDENCIES := $(BUILD_JRTFS) $(COPY_JIMAGE_SERVICE_PROVIDER), \
++ DEPENDENCIES := $(BUILD_JRTFS) $(COPY_JIMAGE_SERVICE_PROVIDER)_fix, \
+ SRCS := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
+ JAR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jrt-fs.jar, \
+ MANIFEST := $(SUPPORT_OUTPUTDIR)/java-main-manifest.mf, \
+diff -ru orig/jdk-6fa770f9f8ab/src/jdk.jartool/share/classes/sun/tools/jar/Main.java jdk-6fa770f9f8ab/src/jdk.jartool/share/classes/sun/tools/jar/Main.java
+--- orig/jdk-6fa770f9f8ab/src/jdk.jartool/share/classes/sun/tools/jar/Main.java 2022-04-13 19:24:12.555746751 +0200
++++ jdk-6fa770f9f8ab/src/jdk.jartool/share/classes/sun/tools/jar/Main.java 2022-04-13 19:25:34.117955999 +0200
+@@ -849,12 +849,18 @@
+ output(getMsg("out.added.manifest"));
+ }
+ ZipEntry e = new ZipEntry(MANIFEST_DIR);
+- e.setTime(System.currentTimeMillis());
++ if (System.getenv("SOURCE_DATE_EPOCH") != null)
++ e.setTime(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
++ else
++ e.setTime(System.currentTimeMillis());
+ e.setSize(0);
+ e.setCrc(0);
+ zos.putNextEntry(e);
+ e = new ZipEntry(MANIFEST_NAME);
+- e.setTime(System.currentTimeMillis());
++ if (System.getenv("SOURCE_DATE_EPOCH") != null)
++ e.setTime(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
++ else
++ e.setTime(System.currentTimeMillis());
+ if (flag0) {
+ crc32Manifest(e, manifest);
+ }
+@@ -1021,7 +1027,10 @@
+ throws IOException
+ {
+ ZipEntry e = new ZipEntry(INDEX_NAME);
+- e.setTime(System.currentTimeMillis());
++ if (System.getenv("SOURCE_DATE_EPOCH") != null)
++ e.setTime(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
++ else
++ e.setTime(System.currentTimeMillis());
+ if (flag0) {
+ CRC32OutputStream os = new CRC32OutputStream();
+ index.write(os);
+@@ -1040,7 +1049,10 @@
+ String name = mi.getKey();
+ byte[] bytes = mi.getValue();
+ ZipEntry e = new ZipEntry(name);
+- e.setTime(System.currentTimeMillis());
++ if (System.getenv("SOURCE_DATE_EPOCH") != null)
++ e.setTime(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
++ else
++ e.setTime(System.currentTimeMillis());
+ if (flag0) {
+ crc32ModuleInfo(e, bytes);
+ }
+@@ -1065,7 +1077,10 @@
+ addMultiRelease(m);
+ }
+ ZipEntry e = new ZipEntry(MANIFEST_NAME);
+- e.setTime(System.currentTimeMillis());
++ if (System.getenv("SOURCE_DATE_EPOCH") != null)
++ e.setTime(1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")));
++ else
++ e.setTime(System.currentTimeMillis());
+ if (flag0) {
+ crc32Manifest(e, m);
+ }