Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to comparable_patch.sh to support Windows vendor neutral comparison #3536

Merged
merged 11 commits into from
Nov 17, 2023
69 changes: 68 additions & 1 deletion tooling/ReproducibleBuilds.MD
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,79 @@ remove any Signatures from the executeables.

## Comparable Build Tools

1. comparable_patch.sh : Patches a JDK folder to enable "Comparable" comparison of two different Vendor JDK builds.
comparable_patch.sh : Patches a JDK folder to enable "Comparable" comparison of two different Vendor JDK builds.
The patching process involves:

- Expanding all zips and jmods, so executeables can be processed to remove signatures prior to comaprison.
- Removing Signatures (Windows & MacOS).
- Neutralise VS_VERSION_INFO Vendor strings (Windows).
- Remove non-comparable CRC generated uuid values, which are binary values based on the hash of the content (Windows & MacOS).
- Remove Vendor strings embedded in executables, classes and text files.
- Remove module-info differences due to "hash" of Signed module executables
- Remove any non-deterministic build process artifact strings, like Manifest Created-By stamps.

### How to setup and run comparable_patch.sh on Windows

#### Tooling setup:

1. The comparable patch tools, tooling/src/c/WindowsUpdateVsVersionInfo.c and src/java/temurin/tools/BinRepl.java need compiling
before the comparable_patch.sh can be run

2. Compile tooling/src/c/WindowsUpdateVsVersionInfo.c :

- Ensure VS2022 SDK is installed and on PATH
- Compile:
- cd tooling/src/c
- cl WindowsUpdateVsVersionInfo.c version.lib

3. Compile src/java/temurin/tools/BinRepl.java :

- Ensure suitable JDK on PATH
- cd tooling/src/java
- javac temurin/tools/BinRepl.java

4. Setting environment within a CYGWIN shell :

- For BinRepl : export CLASSPATH=<temurin-build>/tooling/src/java:$CLASSPATH
- For WindowsUpdateVsVersionInfo.exe : export PATH=<temurin-build>/tooling/src/c:$PATH
- For dumpbin.exe MSVC tool : export PATH=/cygdrive/c/progra\~1/micros\~2/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64:$PATH
- For running BinRepl java : export PATH=<jdk>/bin:$PATH

#### Running comparable_patch.sh:

1. Unzip your JDK archive into a directory (eg.jdk1)

2. Run comparable_patch.sh

```bash
bash comparable_patch.sh <jdk_home_dir> <version_str> <vendor_name> <vendor_url> <vendor_bug_url> <vendor_vm_bug_url>
```

The Vendor strings and urls can be found by running your jdk's "java -XshowSettings":

```java
java -XshowSettings:
...
java.vendor = Eclipse Adoptium
java.vendor.url = https://adoptium.net/
java.vendor.url.bug = https://github.com/adoptium/adoptium-support/issues
java.vendor.version = Temurin-21.0.1+12
...
```

eg.

```bash
bash comparable_patch.sh jdk1/jdk-21.0.1+12 "Temurin-21.0.1+12" "Eclipse Adoptium" "https://adoptium.net/" "https://github.com/adoptium/adoptium-support/issues" "https://github.com/adoptium/adoptium-support/issues"
```

3. Unzip the other Vendor JDK to compare with, say into "jdk2", and run a similar comparable_patch.sh
for that Vendor branding

4. Diff recursively the now Vendor neutralized jdk directories

```bash
diff -r jdk1 jdk2
```

The diff should be "identical" if the two Vendor JDK's are "Comparable", ie."Identical except for the Vendor Branding"
Loading
Loading