From fcbfdf9372989ac73eb21f582df628d3bb312a1a Mon Sep 17 00:00:00 2001
From: "Fabian.Jakub" <fabian@jakub.com>
Date: Thu, 23 Mar 2023 14:30:07 +0100
Subject: [PATCH] always run _install_spack in case there is a spack root given

---
 platforms/common/spack_utils.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/platforms/common/spack_utils.sh b/platforms/common/spack_utils.sh
index 28b1033..b571a06 100644
--- a/platforms/common/spack_utils.sh
+++ b/platforms/common/spack_utils.sh
@@ -4,7 +4,7 @@ if [ ! -e ${SPACK_ROOT} ]; then
   git clone --depth 1 ${SPACK_URL} -b ${SPACK_BRANCH} ${SPACK_ROOT}
 fi
 
-_init_spack
+_init_spack "$SPACK_INIT_CMD" "$SPACK_ROOT"
 
 if [[ $(spack compiler info ${SPACK_COMPILER}) ]]; then
   echo "Found Compiler $(spack compiler info ${SPACK_COMPILER})"
@@ -16,8 +16,8 @@ fi
 }
 
 function _init_spack() {
-#SPACK_INIT_CMD=$1
-#SPACK_ROOT=$2
+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
@@ -49,7 +49,7 @@ if [ -z "$SPACK_USER_CACHE_PATH" ]; then
 fi
 
 
-if [ ! -e ${SPACK_ROOT} ] && [ ! -z "${SPACK_ROOT}" ] ; then _install_spack; fi
+if [ ! -z "${SPACK_ROOT}" ] ; then _install_spack; fi
 
 _init_spack "$SPACK_INIT_CMD" "$SPACK_ROOT"
 
-- 
GitLab