From f6e9d9888c90c82707f5050e667da71dcef1ed7b Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Sat, 20 Apr 2024 19:08:36 +0200 Subject: [PATCH] if EESSI_SOFTWARE_SUBDIR_OVERRIDE is present, don't use *detect --- init/eessi_environment_variables | 51 ++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/init/eessi_environment_variables b/init/eessi_environment_variables index 5450b2bfb4..6a6cb4c783 100644 --- a/init/eessi_environment_variables +++ b/init/eessi_environment_variables @@ -25,26 +25,39 @@ if [ -d $EESSI_PREFIX ]; then if [ -d $EESSI_EPREFIX ]; then # determine subdirectory in software layer - if [ "$EESSI_USE_ARCHDETECT" == "1" ]; then - # if archdetect is enabled, use internal code - all_cpupaths=$(${EESSI_INIT_DIR_PATH}/eessi_archdetect.sh -a cpupath) - # iterate over colon-separated list verifying if the architecture is present - # under $EESSI_PREFIX/software/$EESSI_OS_TYPE; if so use the architecture as best match - IFS=: read -r -a archs <<< "${all_cpupaths}" - for arch in "${archs[@]}"; do - if [ -d ${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${arch} ]; then - export EESSI_SOFTWARE_SUBDIR=${arch} - show_msg "archdetect says ${EESSI_SOFTWARE_SUBDIR}" - break - fi - done - elif [ "$EESSI_USE_ARCHSPEC" == "1" ]; then - # note: eessi_software_subdir_for_host.py will pick up value from $EESSI_SOFTWARE_SUBDIR_OVERRIDE if it's defined! - export EESSI_EPREFIX_PYTHON=$EESSI_EPREFIX/usr/bin/python3 - export EESSI_SOFTWARE_SUBDIR=$($EESSI_EPREFIX_PYTHON ${EESSI_INIT_DIR_PATH}/eessi_software_subdir_for_host.py $EESSI_PREFIX) - show_msg "archspec says ${EESSI_SOFTWARE_SUBDIR}" + if [ ! -z "$EESSI_SOFTWARE_SUBDIR_OVERRIDE" ]; then + # a specific software subdirectory is given, so we use that and don't + # detect it + export EESSI_SOFTWARE_SUBDIR=${EESSI_SOFTWARE_SUBDIR_OVERRIDE} + # however, check if the directory is present in the CernVM-FS repository + # and show a warning if it isn't + cvmfs_software_path=${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${EESSI_SOFTWARE_SUBDIR} + if [ ! -d ${cvmfs_software_path} ]; then + show_msg "Warning: EESSI_SOFTWARE_SUBDIRECTORY_OVERRIDE is '${EESSI_SOFTWARE_SUBDIRECTORY_OVERRIDE}'," + show_msg " but directory '${cvmfs_software_path}' does NOT exist in CernVM-FS repository" + fi else - error "Don't know how to detect host CPU, giving up!" + if [ "$EESSI_USE_ARCHDETECT" == "1" ]; then + # if archdetect is enabled, use internal code + all_cpupaths=$(${EESSI_INIT_DIR_PATH}/eessi_archdetect.sh -a cpupath) + # iterate over colon-separated list verifying if the architecture is present + # under $EESSI_PREFIX/software/$EESSI_OS_TYPE; if so use the architecture as best match + IFS=: read -r -a archs <<< "${all_cpupaths}" + for arch in "${archs[@]}"; do + if [ -d ${EESSI_PREFIX}/software/${EESSI_OS_TYPE}/${arch} ]; then + export EESSI_SOFTWARE_SUBDIR=${arch} + show_msg "archdetect says ${EESSI_SOFTWARE_SUBDIR}" + break + fi + done + elif [ "$EESSI_USE_ARCHSPEC" == "1" ]; then + # note: eessi_software_subdir_for_host.py will pick up value from $EESSI_SOFTWARE_SUBDIR_OVERRIDE if it's defined! + export EESSI_EPREFIX_PYTHON=$EESSI_EPREFIX/usr/bin/python3 + export EESSI_SOFTWARE_SUBDIR=$($EESSI_EPREFIX_PYTHON ${EESSI_INIT_DIR_PATH}/eessi_software_subdir_for_host.py $EESSI_PREFIX) + show_msg "archspec says ${EESSI_SOFTWARE_SUBDIR}" + else + error "Don't know how to detect host CPU, giving up!" + fi fi if [ ! -z $EESSI_SOFTWARE_SUBDIR ]; then