From 2856493ad5a1dfdec0b9adf6304ce567b7637514 Mon Sep 17 00:00:00 2001 From: Scott Fryer Date: Tue, 19 Mar 2024 17:45:37 +0000 Subject: [PATCH 1/5] Remove apt-cyg installation and check for jq. --- .../windows_repro_build_compare.sh | 35 +++---------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/tooling/reproducible/windows_repro_build_compare.sh b/tooling/reproducible/windows_repro_build_compare.sh index c24bbe992..0ca2b0fac 100644 --- a/tooling/reproducible/windows_repro_build_compare.sh +++ b/tooling/reproducible/windows_repro_build_compare.sh @@ -137,38 +137,11 @@ Check_Parameters() { fi } -Install_PreReqs() { - # Install Cygwin Package Manager If Not Present - echo "Checking If Apt-Cyg Is Already Installed" - if [ -f /usr/local/bin/apt-cyg ]; then - echo "Skipping apt-cyg Install" - APTCYG_INSTALLED="True" - else - echo "Installing apt-cyg" - APTCYG_INSTALLED="False" - wget -q -O "./apt-cyg" "https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg" - ACTSHASUM=$(sha256sum "apt-cyg" | awk '{print $1}') - EXPSHASUM="d020050e2cb56fec990f16fd10695e153afd064cb0839ba935247b5a9e4c29a0" - - if [ "$ACTSHASUM" == "$EXPSHASUM" ]; then - chmod +x apt-cyg - mv apt-cyg /usr/local/bin - else - echo "Checksum Is Not OK - Exiting" +Check_PreReqs() { + if ! command -v jq &> /dev/null; then + echo "Error: JQ is not installed. Please install JQ before proceeding." exit 1 fi - fi - - # Install JQ Where Not Already Installed - echo "Checking If JQ Is Already Installed" - if [ -f /usr/local/bin/jq ]; then - echo "Skipping JQ Install" - APTJQ_INSTALLED="True" - else - echo "Installing JQ via APTCYG" - APTJQ_INSTALLED="False" - apt-cyg install jq libjq1 libonig5 - fi } Get_SBOM_Values() { @@ -796,7 +769,7 @@ Create_WorkDir echo "---------------------------------------------" Check_Parameters echo "---------------------------------------------" -Install_PreReqs +Check_PreReqs echo "---------------------------------------------" Get_SBOM_Values echo "---------------------------------------------" From 2218ca52c34da1805b54bbec98b4df4b6c652906 Mon Sep 17 00:00:00 2001 From: Scott Fryer Date: Tue, 19 Mar 2024 18:21:58 +0000 Subject: [PATCH 2/5] Update windows_repro_build_compare.sh Fix jq installation check and make work_dir relative. --- .../windows_repro_build_compare.sh | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/tooling/reproducible/windows_repro_build_compare.sh b/tooling/reproducible/windows_repro_build_compare.sh index 0ca2b0fac..5c2bae841 100644 --- a/tooling/reproducible/windows_repro_build_compare.sh +++ b/tooling/reproducible/windows_repro_build_compare.sh @@ -39,7 +39,8 @@ TARBALL_URL="$2" # These Values Should Be Updated To Reflect The Build Environment # The Defaults Below Are Suitable For An Adoptium Windows Build Environment # Which Has Been Created Via The Ansible Infrastructure Playbooks -WORK_DIR="/cmp$(date +%Y%m%d%H%M%S)" +CURR_DIR=$(pwd) +WORK_DIR="$CURR_DIR/cmp$(date +%Y%m%d%H%M%S)" ANT_VERSION="1.10.5" ANT_CONTRIB_VERSION="1.0b3" ANT_BASE_PATH="/cygdrive/c/apache-ant" @@ -137,11 +138,44 @@ Check_Parameters() { fi } -Check_PreReqs() { - if ! command -v jq &> /dev/null; then - echo "Error: JQ is not installed. Please install JQ before proceeding." - exit 1 - fi +Install_PreReqs() { + # Check For JQ & Install Apt-Cyg & JQ Where Not Available + if ! command -v jq &> /dev/null; then + echo "WARNING: JQ is not installed. Attempting To Install Via Apt-Cyg" + echo "Checking If Apt-Cyg Is Already Installed" + if [ -f /usr/local/bin/apt-cyg ]; then + echo "Skipping apt-cyg Install" + APTCYG_INSTALLED="True" + else + echo "Installing apt-cyg" + APTCYG_INSTALLED="False" + wget -q -O "./apt-cyg" "https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg" + ACTSHASUM=$(sha256sum "apt-cyg" | awk '{print $1}') + EXPSHASUM="d020050e2cb56fec990f16fd10695e153afd064cb0839ba935247b5a9e4c29a0" + if [ "$ACTSHASUM" == "$EXPSHASUM" ]; then + chmod +x apt-cyg + mv apt-cyg /usr/local/bin + else + echo "Checksum Is Not OK - Exiting" + exit 1 + fi + fi + + echo "Checking If JQ Is Already Installed" + if [ -f /usr/local/bin/jq ]; then + echo "Skipping JQ Install" + APTJQ_INSTALLED="True" + else + echo "Installing JQ via APTCYG" + APTJQ_INSTALLED="False" + apt-cyg install jq libjq1 libonig5 + fi + else + echo "JQ Is Already Installed" + fi + + # Install JQ Where Not Already Installed + } Get_SBOM_Values() { @@ -769,7 +803,7 @@ Create_WorkDir echo "---------------------------------------------" Check_Parameters echo "---------------------------------------------" -Check_PreReqs +Install_PreReqs echo "---------------------------------------------" Get_SBOM_Values echo "---------------------------------------------" From 50db03a7673aa3f62e9b50b225e1ae73db58cc8f Mon Sep 17 00:00:00 2001 From: Scott Fryer Date: Thu, 21 Mar 2024 16:51:10 +0000 Subject: [PATCH 3/5] Remove redundant if clause --- tooling/reproducible/windows_repro_build_compare.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tooling/reproducible/windows_repro_build_compare.sh b/tooling/reproducible/windows_repro_build_compare.sh index 5c2bae841..727a51e8f 100644 --- a/tooling/reproducible/windows_repro_build_compare.sh +++ b/tooling/reproducible/windows_repro_build_compare.sh @@ -170,8 +170,6 @@ Install_PreReqs() { APTJQ_INSTALLED="False" apt-cyg install jq libjq1 libonig5 fi - else - echo "JQ Is Already Installed" fi # Install JQ Where Not Already Installed From e47b86bc42f7aeb383618f5c7d8c458d58545d0b Mon Sep 17 00:00:00 2001 From: Scott Fryer Date: Fri, 22 Mar 2024 14:03:11 +0000 Subject: [PATCH 4/5] Fix issue with config arg being passed to build args. --- tooling/reproducible/windows_repro_build_compare.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tooling/reproducible/windows_repro_build_compare.sh b/tooling/reproducible/windows_repro_build_compare.sh index 727a51e8f..ba1646ff1 100644 --- a/tooling/reproducible/windows_repro_build_compare.sh +++ b/tooling/reproducible/windows_repro_build_compare.sh @@ -56,7 +56,7 @@ SIGNTOOL_BASE="C:/Program Files (x86)/Windows Kits/10" # Define What Are Configure Args & Redundant Args # This MAY Need Updating If Additional Configure Args Are Passed -CONFIG_ARGS=("--disable-warnings-as-errors" "--disable-ccache" "--with-toolchain-version" "--with-ucrt-dll-dir") +CONFIG_ARGS=("--disable-warnings-as-errors" "--disable-ccache" "--with-toolchain-version" "--with-ucrt-dll-dir" "--with-version-opt") NOTUSE_ARGS=("--assemble-exploded-image" "--configure-args") # Addiitonal Working Variables Defined For Use By This Script @@ -286,7 +286,7 @@ Get_SBOM_Values() { echo "Temurin Build Arguments: $buildArgs" export buildArgs else - echo "ERROR: Temurin Build Version not found in the SBOM." + echo "ERROR: Temurin Build Arguments not found in the SBOM." echo "This Is A Mandatory Element" exit 1 fi @@ -585,9 +585,11 @@ Prepare_Env_For_Build() { fi done - # Add the last parameter to the array + # Add the last parameter to the array params+=("$param = $value") + + # Read the separated parameters and values into a new array export fixed_param="" export fixed_value="" @@ -608,7 +610,7 @@ Prepare_Env_For_Build() { if [ "$fixed_param" == "--jdk-boot-dir" ]; then fixed_value="$BOOTJDK_HOME " ; fi if [ "$fixed_param" == "--freetype-dir" ]; then fixed_value="$fixed_value " ; fi if [ "$fixed_param" == "--with-toolchain-version" ]; then fixed_value="$visualStudioVersion " ; fi - if [ "$fixed_param" == "--with-ucrt-dll-dir" ]; then fixed_value="temporary_speech_mark_placeholder${UCRT_PARAM_PATH}temporary_speech_mark_placeholder" ; fi + if [ "$fixed_param" == "--with-ucrt-dll-dir" ]; then fixed_value="temporary_speech_mark_placeholder${UCRT_PARAM_PATH}temporary_speech_mark_placeholder " ; fi if [ "$fixed_param" == "--target-file-name" ]; then target_file="$fixed_value" ; fixed_value="$fixed_value " ; fi if [ "$fixed_param" == "--tag" ]; then fixed_value="$fixed_value " ; fi @@ -633,7 +635,7 @@ Prepare_Env_For_Build() { # Add Config Arg To New Array # Handle Windows Param Names In Config Args (Replace Space with =) - if [ "$fixed_param" == "--with-toolchain-version" ] || [ "$fixed_param" == "--with-ucrt-dll-dir" ] ; then + if [ "$fixed_param" == "--with-toolchain-version" ] || [ "$fixed_param" == "--with-ucrt-dll-dir" ] || [ "$fixed_param" == "--with-version-opt" ] ; then STRINGTOADD="$fixed_param=$fixed_value" CONFIG_ARRAY+=("$STRINGTOADD") else From 5efd06c130cf4035d9591206f2de72ced01587e3 Mon Sep 17 00:00:00 2001 From: Scott Fryer Date: Fri, 22 Mar 2024 14:22:55 +0000 Subject: [PATCH 5/5] Fix bug with parsing branch name --- tooling/reproducible/windows_repro_build_compare.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tooling/reproducible/windows_repro_build_compare.sh b/tooling/reproducible/windows_repro_build_compare.sh index ba1646ff1..6935f7d1a 100644 --- a/tooling/reproducible/windows_repro_build_compare.sh +++ b/tooling/reproducible/windows_repro_build_compare.sh @@ -572,7 +572,7 @@ Prepare_Env_For_Build() { # Loop through the words for word in "${words[@]}"; do # Check if the word starts with '--' - if [[ $word == --* ]]; then + if [[ $word == --* ]] || [[ $word == -b* ]]; then # If a parameter already exists, store it in the params array if [[ -n $param ]]; then params+=("$param=$value") @@ -588,8 +588,6 @@ Prepare_Env_For_Build() { # Add the last parameter to the array params+=("$param = $value") - - # Read the separated parameters and values into a new array export fixed_param="" export fixed_value="" @@ -607,6 +605,7 @@ Prepare_Env_For_Build() { fixed_value=$(echo "$prepped_value" | awk '{$1=$1};1') # Handle Special parameters + if [ "$fixed_param" == "-b" ]; then fixed_value="$fixed_value " ; fi if [ "$fixed_param" == "--jdk-boot-dir" ]; then fixed_value="$BOOTJDK_HOME " ; fi if [ "$fixed_param" == "--freetype-dir" ]; then fixed_value="$fixed_value " ; fi if [ "$fixed_param" == "--with-toolchain-version" ]; then fixed_value="$visualStudioVersion " ; fi @@ -614,6 +613,7 @@ Prepare_Env_For_Build() { if [ "$fixed_param" == "--target-file-name" ]; then target_file="$fixed_value" ; fixed_value="$fixed_value " ; fi if [ "$fixed_param" == "--tag" ]; then fixed_value="$fixed_value " ; fi + # Fix Build Variant Parameter To Strip JDK Version if [ "$fixed_param" == "--build-variant" ] ; then