From 3419dac9a9f4829ea26822c6ebbd499abce48adc Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Tue, 8 Oct 2024 16:04:45 +0200 Subject: [PATCH] Make a few fixes to the setup scripts and to the script that deletes unused specs. --- scripts/cvmfs/setup-nightlies.sh | 2 +- scripts/cvmfs/setup-releases.sh | 7 ++++++- scripts/delete-unused.sh | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/cvmfs/setup-nightlies.sh b/scripts/cvmfs/setup-nightlies.sh index ce0c5ad1..ac1a0016 100644 --- a/scripts/cvmfs/setup-nightlies.sh +++ b/scripts/cvmfs/setup-nightlies.sh @@ -81,7 +81,7 @@ function list_packages() { # Define an array containing the paths to the folders folders=("$latest_previous_release") - if [ $build_type = "dbg" ] && [ -d $(echo $latest_previous_release | sed 's/opt/dbg/') ]; then + if [ "$build_type" = "dbg" ] && [ -d $(echo $latest_previous_release | sed 's/opt/dbg/') ]; then folders+=($(echo $latest_previous_release | sed 's/opt/dbg/')) fi folders+=(/cvmfs/sw-nightlies.hsf.org/key4hep/releases/$rel/*$name*$compiler*-*$build_type*) diff --git a/scripts/cvmfs/setup-releases.sh b/scripts/cvmfs/setup-releases.sh index 296e8363..5801fd9d 100644 --- a/scripts/cvmfs/setup-releases.sh +++ b/scripts/cvmfs/setup-releases.sh @@ -189,6 +189,11 @@ if [[ "$1" = "-r" && -n "$2" ]]; then rel="$2" fi +# Build types are supported only after 2024-10-03 +if [[ ! "$rel" == "latest"* ]] && [[ "$rel" < "2024-10-03" ]]; then + build_type="" +fi + if [[ "$(grep -E '^ID=' /etc/os-release)" = 'ID="centos"' && "$(grep -E 'VERSION_ID' /etc/os-release)" = 'VERSION_ID="7"' ]] || [[ "$(grep -E '^ID=' /etc/os-release)" = 'ID="rhel"' && "$(grep -E 'VERSION_ID' /etc/os-release)" = VERSION_ID=\"7* ]]; then os="centos7" @@ -259,7 +264,7 @@ for ((i=1; i<=$#; i++)); do esac done -k4path=$(/usr/bin/ls -rd /cvmfs/sw-nightlies.hsf.org/key4hep/releases/$rel/*$os*$compiler*$build_type | head -n1) +k4path=$(/usr/bin/ls -rd /cvmfs/sw.hsf.org/key4hep/releases/$rel/*$os*$compiler*$build_type | head -n1) if [ -n "$KEY4HEP_STACK" ]; then echo "The Key4hep software stack is already set up, please start a new shell to avoid conflicts" diff --git a/scripts/delete-unused.sh b/scripts/delete-unused.sh index 2da61517..ce76d29f 100755 --- a/scripts/delete-unused.sh +++ b/scripts/delete-unused.sh @@ -1,7 +1,7 @@ # This will delete unused (from example from a previous failed installation) specs that # are no longer in the current installation -spack python -c 'from spack.cmd import uninstall; uninstall.do_uninstall([x for x in spack.store.STORE.db.query_local() if not any(x.satisfies(y) for y in spack.environment.active_environment().all_specs_generator())], False)' +spack -e . python -c 'from spack.cmd import uninstall; uninstall.do_uninstall([x for x in spack.store.STORE.db.query_local() if not any(x.satisfies(y) for y in spack.environment.active_environment().all_specs_generator())], False)' # Same command but only print what would be deleted -# spack python -c 'print([x.name for x in spack.store.STORE.db.query_local() if not any(x.satisfies(y) for y in spack.environment.active_environment().all_specs_generator())])' +# spack -e . python -c 'print([x.name for x in spack.store.STORE.db.query_local() if not any(x.satisfies(y) for y in spack.environment.active_environment().all_specs_generator())])'