File: reproducible-build-jmod.diff

package info (click to toggle)
openjdk-25 25~32ea-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 825,280 kB
  • sloc: java: 5,584,902; cpp: 1,333,941; xml: 1,321,242; ansic: 487,993; asm: 404,003; objc: 21,088; sh: 15,102; javascript: 13,265; python: 8,319; makefile: 2,515; perl: 357; awk: 351; pascal: 103; exp: 83; sed: 72; jsp: 24
file content (39 lines) | stat: -rw-r--r-- 1,961 bytes parent folder | download | duplicates (4)
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
Description: jlink: Hash of module differs to expected hash recorded in java.base
 The cause is the use of dh_strip_nondeterminism late in the build
 process.  This reorganises the jmod files, which in turn changes their
 SHA256 checksums.  This would not be a problem, except that the
 checksums are saved in java.base.jmod *before* the use of
 dh_strip_nondeterminism.  Performing this stripping immediately after
 each jmod file is created results in the checksums being consistent
 throughout.
Author: Julian Gilbey <jdg@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=944738
Forwarded: not-needed

--- a/make/CreateJmods.gmk
+++ b/make/CreateJmods.gmk
@@ -248,6 +248,15 @@ endif
 
 # Create jmods in the support dir and then move them into place to keep the
 # module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
+# strip-nondeterminism requires the same timestamp as
+# dh_strip_nondeterminism uses, so we determine this first.
+# Fall back to the original behavior if the tools are missing for backports
+DSN_TIMESTAMP := $(shell perl -MDebian::Debhelper::Dh_Lib -e 'print get_source_date_epoch()' 2>/dev/null)
+ifneq (,$(DSN_TIMESTAMP))
+  ifneq (,$(wildcard /bin/strip-nondeterminism /usr/bin/strip-nondeterminism))
+    use_strip_ndt = yes
+  endif
+endif
 $(eval $(call SetupExecute, create_$(JMOD_FILE), \
     WARN := Creating $(INTERIM_MSG)$(JMOD_FILE), \
     DEPS := $(DEPS), \
@@ -259,7 +268,7 @@ $(eval $(call SetupExecute, create_$(JMO
         --module-path $(JMODS_DIR) $(JMOD_FLAGS) \
         --date $(SOURCE_DATE_ISO_8601) \
         $(JMODS_SUPPORT_DIR)/$(JMOD_FILE), \
-    POST_COMMAND := $(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
+    POST_COMMAND := $(if $(use_strip_ndt),strip-nondeterminism --timestamp $(DSN_TIMESTAMP) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) && )$(MV) $(JMODS_SUPPORT_DIR)/$(JMOD_FILE) $(JMODS_DIR)/$(JMOD_FILE), \
 ))
 
 TARGETS += $(create_$(JMOD_FILE))