From dca02f4dd870315cf304fb4c0540d08602a8c4a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de>
Date: Thu, 23 Mar 2023 12:10:29 +0100
Subject: [PATCH] Indent for clarity.

---
 platforms/common/spack_utils.sh | 98 ++++++++++++++++-----------------
 1 file changed, 48 insertions(+), 50 deletions(-)

diff --git a/platforms/common/spack_utils.sh b/platforms/common/spack_utils.sh
index 28b1033..22eea00 100644
--- a/platforms/common/spack_utils.sh
+++ b/platforms/common/spack_utils.sh
@@ -1,58 +1,56 @@
 function _install_spack() {
-if [ ! -e ${SPACK_ROOT} ]; then
-  echo "Cloning to ${SPACK_ROOT}"
-  git clone --depth 1 ${SPACK_URL} -b ${SPACK_BRANCH} ${SPACK_ROOT}
-fi
-
-_init_spack
-
-if [[ $(spack compiler info ${SPACK_COMPILER}) ]]; then
-  echo "Found Compiler $(spack compiler info ${SPACK_COMPILER})"
-else
-  echo "could not find compiler, will now try to install it... this may take a while"
-  spack install ${SPACK_COMPILER}
-  spack compiler add $(spack location --install-dir $SPACK_COMPILER)
-fi
+  if [ ! -e ${SPACK_ROOT} ]; then
+    echo "Cloning to ${SPACK_ROOT}"
+    git clone --depth 1 ${SPACK_URL} -b ${SPACK_BRANCH} ${SPACK_ROOT}
+  fi
+
+  _init_spack
+
+  if [[ $(spack compiler info ${SPACK_COMPILER}) ]]; then
+    echo "Found Compiler $(spack compiler info ${SPACK_COMPILER})"
+  else
+    echo "could not find compiler, will now try to install it... this may take a while"
+    spack install ${SPACK_COMPILER}
+    spack compiler add $(spack location --install-dir $SPACK_COMPILER)
+  fi
 }
 
 function _init_spack() {
-#SPACK_INIT_CMD=$1
-#SPACK_ROOT=$2
-if [ -z "$SPACK_INIT_CMD" ] && [ ! -z "${SPACK_ROOT}" ]; then
-  echo "Empty SPACK_INIT_CMD -> trying to source config file of spack root: $SPACK_ROOT/share/spack/setup-env.sh"
-  . $SPACK_ROOT/share/spack/setup-env.sh
-else
-  echo "Executing SPACK_INIT_CMD: $SPACK_INIT_CMD"
-  $SPACK_INIT_CMD
-fi
+  #SPACK_INIT_CMD=$1
+  #SPACK_ROOT=$2
+  if [ -z "$SPACK_INIT_CMD" ] && [ ! -z "${SPACK_ROOT}" ]; then
+    echo "Empty SPACK_INIT_CMD -> trying to source config file of spack root: $SPACK_ROOT/share/spack/setup-env.sh"
+    . $SPACK_ROOT/share/spack/setup-env.sh
+  else
+    echo "Executing SPACK_INIT_CMD: $SPACK_INIT_CMD"
+    $SPACK_INIT_CMD
+  fi
 }
 
 function load_spack() {
-export SPACK_INIT_CMD=$1
-export SPACK_ROOT=${2:-spack}
-export SPACK_URL=${3:-https://github.com/spack/spack.git}
-export SPACK_BRANCH=${4:-develop}
-export SPACK_COMPILER=${5:-gcc@12.2.0}
-export SPACK_DISABLE_LOCAL_CONFIG=${6:-true}
-export SPACK_USER_CACHE_PATH=${7:-${SPACK_ROOT}/spack_user_cache_path}
-
-echo "SPACK_INIT_CMD                = $SPACK_INIT_CMD"
-echo "SPACK_ROOT                    = $SPACK_ROOT"
-echo "SPACK_URL                     = $SPACK_URL"
-echo "SPACK_BRANCH                  = $SPACK_BRANCH"
-echo "SPACK_COMPILER                = $SPACK_COMPILER"
-echo "SPACK_DISABLE_LOCAL_CONFIG    = $SPACK_DISABLE_LOCAL_CONFIG"
-echo "SPACK_USER_CACHE_PATH         = $SPACK_USER_CACHE_PATH"
-
-if [ -z "$SPACK_USER_CACHE_PATH" ]; then
-  unset SPACK_USER_CACHE_PATH
-fi
-
-
-if [ ! -e ${SPACK_ROOT} ] && [ ! -z "${SPACK_ROOT}" ] ; then _install_spack; fi
-
-_init_spack "$SPACK_INIT_CMD" "$SPACK_ROOT"
-
-echo "Using spack from $(which spack)"
+  export SPACK_INIT_CMD=$1
+  export SPACK_ROOT=${2:-spack}
+  export SPACK_URL=${3:-https://github.com/spack/spack.git}
+  export SPACK_BRANCH=${4:-develop}
+  export SPACK_COMPILER=${5:-gcc@12.2.0}
+  export SPACK_DISABLE_LOCAL_CONFIG=${6:-true}
+  export SPACK_USER_CACHE_PATH=${7:-${SPACK_ROOT}/spack_user_cache_path}
+
+  echo "SPACK_INIT_CMD                = $SPACK_INIT_CMD"
+  echo "SPACK_ROOT                    = $SPACK_ROOT"
+  echo "SPACK_URL                     = $SPACK_URL"
+  echo "SPACK_BRANCH                  = $SPACK_BRANCH"
+  echo "SPACK_COMPILER                = $SPACK_COMPILER"
+  echo "SPACK_DISABLE_LOCAL_CONFIG    = $SPACK_DISABLE_LOCAL_CONFIG"
+  echo "SPACK_USER_CACHE_PATH         = $SPACK_USER_CACHE_PATH"
+
+  if [ -z "$SPACK_USER_CACHE_PATH" ]; then
+    unset SPACK_USER_CACHE_PATH
+  fi
+
+  if [ ! -e ${SPACK_ROOT} ] && [ ! -z "${SPACK_ROOT}" ]; then _install_spack; fi
+
+  _init_spack "$SPACK_INIT_CMD" "$SPACK_ROOT"
+
+  echo "Using spack from $(which spack)"
 }
-
-- 
GitLab