Skip to content

Commit

Permalink
Update reproducible comparing on linux (#3921)
Browse files Browse the repository at this point in the history
* Renable reproducible compare on mac

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Remove non-relevant files

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Move compare process to common script

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Testing

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Testing

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Remove release and other generated files

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Remove extra debuginfo in aqa level

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Revert clean up

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Update exclude lists

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Linter issue

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

* Revert some changes

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>

---------

Signed-off-by: Sophia Guo <sophia.gwf@gmail.com>
  • Loading branch information
sophia-guo authored Sep 6, 2024
1 parent c3eadc9 commit fc65df3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 27 deletions.
4 changes: 3 additions & 1 deletion test/system/reproducibleCompare/reproducible.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ endif

ifneq (,$(findstring linux,$(SPEC)))
SBOM_FILE := $(subst $(TEST_ROOT)/../jdkbinary,/home/jenkins/test,$(SBOM_FILE))
endif
endif

RM_DEBUGINFO := $(shell find $(TEST_JDK_HOME) -type f -name "*.debuginfo" -delete)
36 changes: 13 additions & 23 deletions tooling/reproducible/linux_repro_build_compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ ANT_VERSION=1.10.5
ANT_SHA=9028e2fc64491cca0f991acc09b06ee7fe644afe41d1d6caf72702ca25c4613c
ANT_CONTRIB_VERSION=1.0b3
ANT_CONTRIB_SHA=4d93e07ae6479049bb28071b069b7107322adaee5b70016674a0bffd4aac47f9
isJdkDir=false
USING_DEVKIT="false"
ScriptPath=$(dirname "$(realpath "$0")")

installPrereqs() {
if test -r /etc/redhat-release; then
# Replace mirrorlist to vault as centos7 reached EOL.
Expand Down Expand Up @@ -88,12 +89,6 @@ setAntEnvironment() {
export PATH="${LOCALGCCDIR}/bin:/usr/local/bin:/usr/bin:$PATH:/usr/local/apache-ant-${ANT_VERSION}/bin"
}

cleanBuildInfo() {
local DIR="$1"
# BUILD_INFO name of OS level build was built on will likely differ
sed -i '/^BUILD_INFO=.*$/d' "${DIR}/release"
}

setTemurinBuildArgs() {
local buildArgs="$1"
local bootJdk="$2"
Expand Down Expand Up @@ -185,41 +180,36 @@ if [ -z "$JDK_PARAM" ] && [ ! -d "jdk-${TEMURIN_VERSION}" ] ; then
JDK_PARAM="https://api.adoptium.net/v3/binary/version/jdk-${TEMURIN_VERSION}/linux/${NATIVE_API_ARCH}/jdk/hotspot/normal/eclipse?project=jdk"
fi

sourceJDK="jdk-${TEMURIN_VERSION}"
mkdir "${sourceJDK}"
if [[ $JDK_PARAM =~ ^https?:// ]]; then
echo Retrieving original tarball from adoptium.net && curl -L "$JDK_PARAM" | tar xpfz - && ls -lart "$PWD/jdk-${TEMURIN_VERSION}" || exit 1
elif [[ $JDK_PARAM =~ tar.gz ]]; then
mkdir "$PWD/jdk-${TEMURIN_VERSION}"
tar xpfz "$JDK_PARAM" --strip-components=1 -C "$PWD/jdk-${TEMURIN_VERSION}"
else
echo "Local jdk dir"
isJdkDir=true
fi

comparedDir="jdk-${TEMURIN_VERSION}"
if [ "${isJdkDir}" = true ]; then
comparedDir=$JDK_PARAM
# Local jdk dir
cp -R "${JDK_PARAM}"/* "${sourceJDK}"
fi

echo "Rebuild args for makejdk_any_platform.sh are: $TEMURIN_BUILD_ARGS"
echo " cd temurin-build && ./makejdk-any-platform.sh $TEMURIN_BUILD_ARGS 2>&1 | tee build.$$.log" | sh

echo Comparing ...
mkdir compare.$$
tar xpfz temurin-build/workspace/target/OpenJDK*-jdk_*tar.gz -C compare.$$
mkdir tarJDK
tar xpfz temurin-build/workspace/target/OpenJDK*-jdk_*tar.gz -C tarJDK
cp temurin-build/workspace/target/OpenJDK*-jdk_*tar.gz reproJDK.tar.gz
cp "$SBOM" SBOM.json

cleanBuildInfo "${comparedDir}"
cleanBuildInfo "compare.$$/jdk-$TEMURIN_VERSION"
cp "$ScriptPath"/repro_*.sh "$PWD"
chmod +x "$PWD"/repro_*.sh
rc=0

# shellcheck disable=SC2069
diff -r "${comparedDir}" "compare.$$/jdk-$TEMURIN_VERSION" 2>&1 > "reprotest.diff" || rc=$?
set +e
./repro_compare.sh temurin "$sourceJDK" temurin tarJDK/jdk-"$TEMURIN_VERSION" Linux 2>&1 || rc=$?
set -e

if [ $rc -eq 0 ]; then
echo "Compare identical !"
else
cat "reprotest.diff"
echo "Differences found..., logged in: reprotest.diff"
fi

Expand Down
3 changes: 1 addition & 2 deletions tooling/reproducible/repro_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ function cleanTemurinFiles() {
local DIR="$1"

echo "Cleaning Temurin build-scripts specific files and metadata from ${DIR}"

echo "Removing Temurin NOTICE file from $DIR"
rm "${DIR}"/NOTICE

Expand Down Expand Up @@ -453,7 +452,7 @@ function cleanTemurinFiles() {
echo "Removing SOURCE= from ${DIR}/release file, as Temurin builds from Adoptium mirror repo _adopt tag"
sed -i '/^SOURCE=.*$/d' "${DIR}/release"
fi

echo "Removing cacerts file, as Temurin builds with different Mozilla cacerts"
find "${DIR}" -type f -name "cacerts" -delete

Expand Down
2 changes: 1 addition & 1 deletion tooling/reproducible/repro_process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ fi
patchManifests "${JDK_DIR}"

echo "***********"
echo "SUCCESS :-)"
echo " Preprocess ${JDK_DIR} SUCCESS :-)"
echo "***********"

0 comments on commit fc65df3

Please sign in to comment.