Skip to content

Commit

Permalink
Remove apt-cyg installation and check for jq. (adoptium#3718)
Browse files Browse the repository at this point in the history
* Remove apt-cyg installation and check for jq.

* Update windows_repro_build_compare.sh

Fix jq installation check and make work_dir relative.

* Remove redundant if clause

* Fix issue with config arg being passed to build args.

* Fix bug with parsing branch name

---------

Co-authored-by: Martijn Verburg <martijnverburg@gmail.com>
  • Loading branch information
steelhead31 and karianna authored Mar 26, 2024
1 parent de92492 commit dd22c24
Showing 1 changed file with 42 additions and 35 deletions.
77 changes: 42 additions & 35 deletions tooling/reproducible/windows_repro_build_compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -55,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
Expand Down Expand Up @@ -138,37 +139,41 @@ Check_Parameters() {
}

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"
exit 1
fi
# 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
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() {
Expand Down Expand Up @@ -281,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
Expand Down Expand Up @@ -567,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")
Expand All @@ -580,7 +585,7 @@ 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
Expand All @@ -600,13 +605,15 @@ 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
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


# Fix Build Variant Parameter To Strip JDK Version

if [ "$fixed_param" == "--build-variant" ] ; then
Expand All @@ -628,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
Expand Down

0 comments on commit dd22c24

Please sign in to comment.