This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new ed9a6e3604e HDDS-14099. CI tools are reinstalled if not on path (#9454)
ed9a6e3604e is described below

commit ed9a6e3604e1e70518441fd2d7812432800cb3ec
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Mon Dec 15 13:19:28 2025 +0100

    HDDS-14099. CI tools are reinstalled if not on path (#9454)
---
 hadoop-ozone/dev-support/checks/_lib.sh         | 59 ++++++++++++++++---------
 hadoop-ozone/dev-support/checks/install/hugo.sh |  2 +-
 2 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/hadoop-ozone/dev-support/checks/_lib.sh 
b/hadoop-ozone/dev-support/checks/_lib.sh
index 7bcd0163105..8b0930de159 100644
--- a/hadoop-ozone/dev-support/checks/_lib.sh
+++ b/hadoop-ozone/dev-support/checks/_lib.sh
@@ -35,35 +35,54 @@ _install_tool() {
   bin="${4:-"${tool}"}"
   func="${5:-"_install_${tool}"}"
 
-  if [[ "${OZONE_PREFER_LOCAL_TOOL}" == "true" ]] && which "$bin" >& 
/dev/null; then
+  if [[ "${OZONE_PREFER_LOCAL_TOOL}" == "true" ]] && which "${bin}" >& 
/dev/null; then
     echo "Skip installing $bin, as it's already available on PATH."
     return
   fi
 
-  if [[ ! -d "${dir}" ]] || ! which "$bin" >& /dev/null; then
+  if [[ ! -d "${dir}" ]]; then
     mkdir -pv "${dir}"
-    pushd "${dir}"
-    if eval "${func}"; then
-      echo "Installed ${tool} in ${dir}"
-    else
-      msg="Failed to install ${tool}"
-      echo "$msg" >&2
-      if [[ -n "${REPORT_FILE}" ]]; then
-        echo "$msg" >> "${REPORT_FILE}"
-      fi
-      exit 1
+    _do_install "${tool}" "${dir}" "${func}"
+  fi
+
+  if [[ -n "${bindir}" ]]; then
+    _add_to_path "${dir}"/"${bindir}"
+
+    if ! which "${bin}" >& /dev/null; then
+      _do_install "${tool}" "${dir}" "${func}"
+      _add_to_path "${dir}"/"${bindir}"
     fi
+  fi
+}
+
+_do_install() {
+  local tool="$1"
+  local dir="$2"
+  local func="$3"
+
+  pushd "${dir}"
+  if eval "${func}"; then
+    echo "Installed ${tool} in ${dir}"
+    popd
+  else
     popd
+    msg="Failed to install ${tool}"
+    echo "${msg}" >&2
+    if [[ -n "${REPORT_FILE}" ]]; then
+      echo "${msg}" >> "${REPORT_FILE}"
+    fi
+    exit 1
   fi
+}
 
-  if [[ -n "${bindir}" ]]; then
-    bindir="${dir}"/"${bindir}"
-    if [[ -d "${bindir}" ]]; then
-      if [[ "${OZONE_PREFER_LOCAL_TOOL}" == "true" ]]; then
-        export PATH="${PATH}:${bindir}"
-      else
-        export PATH="${bindir}:${PATH}"
-      fi
+_add_to_path() {
+  local bindir="$1"
+
+  if [[ -d "${bindir}" ]]; then
+    if [[ "${OZONE_PREFER_LOCAL_TOOL}" == "true" ]]; then
+      export PATH="${PATH}:${bindir}"
+    else
+      export PATH="${bindir}:${PATH}"
     fi
   fi
 }
diff --git a/hadoop-ozone/dev-support/checks/install/hugo.sh 
b/hadoop-ozone/dev-support/checks/install/hugo.sh
index cff2e46d21c..d8678c241d8 100644
--- a/hadoop-ozone/dev-support/checks/install/hugo.sh
+++ b/hadoop-ozone/dev-support/checks/install/hugo.sh
@@ -23,7 +23,7 @@ _install_hugo() {
   local os=$(uname -s)
   local arch=$(uname -m)
 
-  mkdir bin
+  mkdir -p bin
 
   case "${arch}" in
     x86_64)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to