From 721dde550c5c4c48e307f79638c8231790e01e40 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Sun, 29 Sep 2024 20:59:55 +0200 Subject: [PATCH] Update the setup script --- scripts/cvmfs/setup-nightlies.sh | 63 +++++++++++++++++++------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/scripts/cvmfs/setup-nightlies.sh b/scripts/cvmfs/setup-nightlies.sh index 1aa0b418..ce0c5ad1 100644 --- a/scripts/cvmfs/setup-nightlies.sh +++ b/scripts/cvmfs/setup-nightlies.sh @@ -3,9 +3,9 @@ # This script sets up the Key4hep software stack from CVMFS for the nightlies function usage() { - echo "Usage: source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh [-r ] [-d] [--list-releases [distribution]] [--list-packages [distribution]]" - echo " -d : setup the debug version of the software stack" + echo "Usage: source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh [-c ] [-r ] [-d] [--list-releases [distribution]] [--list-packages [distribution]]" echo " -c : select compiler, system or gcc14 (default) on AlmaLinux 9, system for the other OSes" + echo " -d : setup the debug version of the software stack" echo " -r : setup a specific release, if not specified the latest release will be used (also used for --list-packages)" echo " --help, -h : print this help message" echo " --list-releases [distribution] : list available releases for the specified distribution (almalinux, centos, ubuntu). By default (no OS is specified) it will list the releases for the detected distribution" @@ -25,13 +25,16 @@ if [[ "$1" = "-r" && -n "$2" && (! -d "/cvmfs/sw-nightlies.hsf.org/key4hep/relea } function list_releases() { - if [ ! -n "$1" ]; then + if [ -z "$1" ]; then os=$os else os=$1 fi if [ "$os" = "almalinux" ] || [ "$os" = "almalinux9" ]; then name="almalinux9" + if [ -z "$compiler" ]; then + compiler="gcc14" + fi elif [ "$os" = "ubuntu" ] || [ "$os" = "ubuntu22" ]; then name="ubuntu22" else @@ -39,18 +42,23 @@ function list_releases() { usage return 1 fi - find /cvmfs/sw-nightlies.hsf.org/key4hep/releases/ -maxdepth 2 -type d -name "*$name*$build_type*" | + echo "Compiler is $compiler" + find /cvmfs/sw-nightlies.hsf.org/key4hep/releases/ -maxdepth 2 -type d -name "*$name*$compiler*$build_type*" | \awk -F/ '{print $(NF-1)}' | sort + unset compiler } function list_packages() { - if [ ! -n "$1" ]; then + if [ -z "$1" ]; then os=$os else os=$1 fi if [ "$os" = "almalinux" ] || [ "$os" = "almalinux9" ]; then name="almalinux9" + if [ -z "$compiler" ]; then + compiler="gcc14" + fi elif [ "$os" = "ubuntu" ] || [ "$os" = "ubuntu22" ]; then name="ubuntu22" else @@ -62,7 +70,7 @@ function list_packages() { previous_scratch_releases=() while IFS= read -r line; do previous_scratch_releases+=("$line") - done < <(find /cvmfs/sw-nightlies.hsf.org/key4hep/releases/ -maxdepth 3 -mindepth 3 -type f -name ".scratch" | grep "$name" | grep opt | sort | xargs -n1 dirname) + done < <(find /cvmfs/sw-nightlies.hsf.org/key4hep/releases/ -maxdepth 3 -mindepth 3 -type f -name ".scratch" | grep "$name" | grep "$compiler" | grep opt | sort | xargs -n1 dirname) for release in "${previous_scratch_releases[@]}"; do # Get the latest previous or equal date if [[ "$(basename $(dirname $release))" = "$rel" ]] || [[ "$(basename $(dirname $release))" < "$rel" ]]; then @@ -76,31 +84,34 @@ function list_packages() { 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*-*$build_type*) + folders+=(/cvmfs/sw-nightlies.hsf.org/key4hep/releases/$rel/*$name*$compiler*-*$build_type*) - declare -a package_versions - package_versions=() + declare -A package_versions for folder in "${folders[@]}"; do for package in $(ls $folder); do package_name=$(basename "$package") version_string=$(ls $folder/$package_name -t | head -n 1) package_version=$(echo "$version_string" | awk '{if ($NF ~ /develop/) {split($NF,arr,"_"); printf "%s", arr[1]} else {split($(NF),arr,"-"); printf "%s", arr[1]; for (i=2; i