Skip to content

Commit

Permalink
improve setup.sh when adding repos etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderRichert-NOAA committed Jan 23, 2024
1 parent 0d4a43c commit 90908ec
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ echo "Setting environment variable SPACK_STACK_DIR to ${SPACK_STACK_DIR}"
source ${SPACK_STACK_DIR:?}/spack/share/spack/setup-env.sh
echo "Sourcing spack environment ${SPACK_STACK_DIR}/spack/share/spack/setup-env.sh"

# Register spack-stack Spack extensions
libpath=${SPACK_STACK_DIR}/lib/jcsda-emc/spack-stack
if [ -d ${libpath}/stack/cmd ]; then
spack config --scope defaults add "config:extensions:$libpath"
Expand All @@ -30,14 +29,18 @@ else
fi

# Register the jcsda-emc repos
msg="Error: Repository is already registered with Spack"
msg1="Added repo with namespace"
msg2="Repository is already registered with Spack"
for repo in jcsda-emc jcsda-emc-bundles; do
othererrors=$(spack repo add ${SPACK_STACK_DIR}/repos/$repo --scope defaults |& grep -v "$msg" | wc -l)
if [ $othererrors -ne 0 ]; then
othererrors=$(spack repo add ${SPACK_STACK_DIR}/repos/$repo --scope defaults |& grep -v -e "$msg1" -e "$msg2")
if [ $(echo "$othererrors" | grep -c .) -ne 0 ]; then
echo "$othererrors"
return 2
fi
if [ ! -d ${SPACK_STACK_DIR}/repos/$repo ]; then
echo "WARNING: Repo directory ${SPACK_STACK_DIR}/repos/$repo does not exist!"
echo "FATAL ERROR: Repo directory ${SPACK_STACK_DIR}/repos/$repo does not exist!"
return 3
fi
done

echo "spack-stack extensions and repos are registered"

0 comments on commit 90908ec

Please sign in to comment.