Skip to content
Snippets Groups Projects
Commit 4c7f04e2 authored by Eleni Mathioulaki's avatar Eleni Mathioulaki
Browse files

adapt installation script to use in CI

parent 6eaaf2c0
No related branches found
No related tags found
1 merge request!434create new experimental release
Pipeline #25377 waiting for manual action with stage
in 16 seconds
#!/bin/bash
# ===========================================================================================================
# ===============================================================================================================================
# title : install_spack_env.sh
# usage : ./install_spack_env.sh $INSTALLATION_ROOT $SPACK_VERSION $EBRAINS_REPO $EBRAINS_SPACK_ENV
# usage : ./install_spack_env.sh $INSTALLATION_ROOT $SPACK_VERSION $EBRAINS_REPO $EBRAINS_SPACK_ENV $UPSTREAM_INSTANCE
# description : installs or updates the spack environment defined in the EBRAINS spack repo
# (if the specified spack instance doesn't exist, it also creates it)
# ===========================================================================================================
# ===============================================================================================================================
INSTALLATION_ROOT=$1 # where to set up the installation
SPACK_VERSION=$2 # which spack version to use
EBRAINS_REPO=$3 # location of ebrains-spack-builds repository
EBRAINS_SPACK_ENV=$4 # name of EBRAINS Spack environment to be created/updated
UPSTREAM_INSTANCE=$5 # path to Spack instance to use as upstream (optional)
# specify location of .spack dir (by default in ~)
# this is where cache and configuration settings are stored
......@@ -29,26 +30,34 @@ then
sed -i "s/self.file_like, \"w\"/self.file_like, \"a\"/g" $INSTALLATION_ROOT/spack/lib/spack/llnl/util/tty/log.py
fi
if [[ $UPSTREAM_INSTANCE ]]
then
cat <<EOF > $INSTALLATION_ROOT/spack/etc/spack/defaults/upstreams.yaml
upstreams:
upstream-spack-instance:
install_tree: $UPSTREAM_INSTANCE/spack/opt/spack
EOF
fi
# activate Spack
source $INSTALLATION_ROOT/spack/share/spack/setup-env.sh
# add repo if it does not exist
if [[ ! $(spack repo list | grep $EBRAINS_REPO) ]]
then
spack repo add $EBRAINS_REPO
fi
# install platform compiler (extract version from packages.yaml)
if [ $SYSTEMNAME == ebrainslab ]
then
EBRAINS_SPACK_COMPILER=$(grep 'compiler' $EBRAINS_REPO/site-config/$SYSTEMNAME/packages.yaml | awk -F'[][]' '{ print $2 }')
spack compiler find
spack compiler list | grep -q $EBRAINS_SPACK_COMPILER || spack install $EBRAINS_SPACK_COMPILER
spack load $EBRAINS_SPACK_COMPILER
spack load $EBRAINS_SPACK_COMPILER || (spack install $EBRAINS_SPACK_COMPILER; spack load $EBRAINS_SPACK_COMPILER)
fi
spack compiler find
# add repo if it does not exist
if [[ ! $(spack repo list | grep $EBRAINS_REPO) ]]
then
spack repo add $EBRAINS_REPO
fi
# create environment if it does not exist
if [ ! -d "$SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV" ]
then
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment