all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 130eacd8672ef6949dddfa51996c43fbf050b3ff 5450 bytes (raw)
name: gnu/packages/patches/openjdk-9-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
104
105
106
107
 
From: Danny Milosavljevic <dannym@scratchpost.org>
Date: Wed, 18 Apr 2022 20:10:01 +0100
Subject: Make JARs reproducible

--- jdk-09/make/common/JarArchive.gmk.orig	2022-04-08 21:56:04.075111687 +0200
+++ jdk-09/make/common/JarArchive.gmk	2022-04-11 00:49:16.809140388 +0200
@@ -249,12 +249,16 @@
 	    $(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)) \
-	  $(ECHO) Creating $$($1_NAME) $$(NEWLINE) \
+	  $(TOUCH) -h -c -t 197001010000.00 $$($1_MANIFEST_FILE) $$(NEWLINE) \
+	  $(ECHO) XCreating $$($1_NAME) $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
 	  $(JAR) $$($1_JAR_CREATE_OPTIONS) $$@ $$($1_MANIFEST_FILE) $$(NEWLINE) \
 	  $$($1_SCAPTURE_CONTENTS) \
 	  $$($1_SCAPTURE_METAINF) \
 	  $$($1_SUPDATE_CONTENTS) \
-	  $$($1_JARINDEX) && true \
+	  $$($1_JARINDEX) && true $$(NEWLINE) \
+	  $(ECHO) Kreppel2 $$@ $$(NEWLINE) \
+	  unzip -v $$@ $$(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) \
--- jdk-09/make/JrtfsJar.gmk.orig	2022-04-10 13:48:57.385120008 +0200
+++ jdk-09/make/JrtfsJar.gmk	2022-04-10 13:58:04.688158538 +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_PROVIDER1, \
     SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
     DEST := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
     FILES := META-INF/services/java.nio.file.spi.FileSystemProvider))
 
+.PHONY: jrtfsfixtimestamps47
+jrtfsfixtimestamps47: $(COPY_JIMAGE_SERVICE_PROVIDER1)
+	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) jrtfsfixtimestamps47, \
     SRCS := $(SUPPORT_OUTPUTDIR)/jrtfs_classes, \
     JAR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jrt-fs.jar, \
     MANIFEST := $(SUPPORT_OUTPUTDIR)/java-main-manifest.mf, \
--- jdk-09/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java.orig	2022-04-10 02:05:50.983247794 +0200
+++ jdk-09/jdk/src/jdk.jartool/share/classes/sun/tools/jar/Main.java	2022-04-10 02:13:01.638960337 +0200
@@ -850,12 +850,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);
                 }
@@ -1022,7 +1028,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);
@@ -1041,7 +1050,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);
             }
@@ -1066,7 +1078,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 130eacd867 ...
found 130eacd867 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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.