Source: openjdk-11
Version: 11.0.4+11-1
Severity: normal
OpenJDK generates module-info.java files at build time which capture the build
path in the comments. Here is for example an extract of the module-info.java
file in the java.base module:
module java.base {
// source file:
file:///home/johndoe/openjdk/src/java.base/share/classes/module-info.java
//
file:///home/johndoe/openjdk/src/java.base/unix/classes/module-info.java.extra
exports java.io;
exports java.lang;
This affects the reproducibility of the src.zip installed by openjdk-11-source.
The patch attached fixes the GenModuleInfoSource build tool responsible for
this issue. The full build path is replaced by a path relative to the OpenJDK
source directory.
Emmanuel Bourg
Description: Makes the generated module-info.java files reproducible (removes a
captured build path)
Author: Emmanuel Bourg <[email protected]>
Forwarded: no
--- a/make/jdk/src/classes/build/tools/module/GenModuleInfoSource.java
+++ b/make/jdk/src/classes/build/tools/module/GenModuleInfoSource.java
@@ -147,9 +147,10 @@
writer.println(l);
if (l.trim().startsWith("module ")) {
// print URI rather than file path to avoid escape
- writer.format(" // source file: %s%n",
sourceFile.toUri());
+ String buildPath =
System.getProperty("user.dir").replaceAll("make$", "");
+ writer.format(" // source file: %s%n",
sourceFile.toUri().toString().replace(buildPath, ""));
for (Path file: extraFiles) {
- writer.format(" // %s%n",
file.toUri());
+ writer.format(" // %s%n",
file.toUri().toString().replace(buildPath, ""));
}
break;
}