unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 176eedfce690273ea8bd79d69f4c39a8e81f3bc8 5593 bytes (raw)
name: gnu/packages/patches/openjdk-10-jar-reproducibility.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
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);
         }

debug log:

solving 176eedfce6 ...
found 176eedfce6 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).