From 6e45040bd156fc0cc5200ceea36c2f09954c1bda Mon Sep 17 00:00:00 2001 From: Jiri Date: Wed, 3 Apr 2024 17:05:38 +0200 Subject: [PATCH] Usng proper laud countdown before cleaning of repository --- sbin/common/common.sh | 10 ++++++++++ sbin/prepareWorkspace.sh | 7 +++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sbin/common/common.sh b/sbin/common/common.sh index a2eac67a94..b0e34817dc 100755 --- a/sbin/common/common.sh +++ b/sbin/common/common.sh @@ -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" +} + diff --git a/sbin/prepareWorkspace.sh b/sbin/prepareWorkspace.sh index edc3a4e5fb..63d827ae34 100644 --- a/sbin/prepareWorkspace.sh +++ b/sbin/prepareWorkspace.sh @@ -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} @@ -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" @@ -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