Skip to content

Commit

Permalink
Usng proper laud countdown before cleaning of repository
Browse files Browse the repository at this point in the history
  • Loading branch information
judovana committed Apr 3, 2024
1 parent 646a79f commit 6e45040
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions sbin/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,13 @@ function isFromJdk21LTS() {
[[ "${BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]}" -ge 21 ]] && [[ $(((BUILD_CONFIG[OPENJDK_FEATURE_NUMBER]-21) % 4)) == 0 ]]
}

# waits N second (10 by default), printing countdown every second.
function verboseSleep() {
if [[ -z "${1}" ]] ; then
local i=10
else
local i="${1}"
fi
while [ $i -gt 0 ] ; do echo -n " $i " && sleep 1s && i=$(($i-1)) ; done && echo " $i"
}

7 changes: 5 additions & 2 deletions sbin/prepareWorkspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=sbin/common/constants.sh
source "$SCRIPT_DIR/common/constants.sh"

# shellcheck source=sbin/common/common.sh
source "$SCRIPT_DIR/common/common.sh"

# Set default versions for 3 libraries that OpenJDK relies on to build

ALSA_LIB_VERSION=${ALSA_LIB_VERSION:-1.1.6}
Expand Down Expand Up @@ -65,7 +68,7 @@ checkoutAndCloneOpenJDKGitRepo() {
if [ "${isValidGitRepo}" == "0" ]; then
cd "${BUILD_CONFIG[OPENJDK_SOURCE_DIR]}" || return
echo "Resetting the git openjdk source repository at $PWD in 10 seconds..."
sleep 10
verboseSleep 10
echo "Pulling latest changes from git openjdk source repository"
elif [ "${BUILD_CONFIG[CLEAN_GIT_REPO]}" == "true" ]; then
echo "Removing current git repo as it is the wrong type"
Expand Down Expand Up @@ -343,7 +346,7 @@ checkingAndDownloadingAlsa() {
break
elif [[ ${i} -lt 10 ]]; then
echo "gpg recv-keys attempt has failed. Retrying after 10 second pause..."
sleep 10s
verboseSleep 10
else
echo "ERROR: gpg recv-keys final attempt has failed. Will not try again."
fi
Expand Down

0 comments on commit 6e45040

Please sign in to comment.