From f8a2266e8e4d8028039893a27df31d1ceda9558a Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Fri, 24 May 2024 13:31:58 +0200 Subject: [PATCH] make sure SitePackage.lua exists AND is updated if needed --- EESSI-install-software.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/EESSI-install-software.sh b/EESSI-install-software.sh index 23d7a7c051..3baf4feeba 100755 --- a/EESSI-install-software.sh +++ b/EESSI-install-software.sh @@ -168,6 +168,19 @@ _lmod_sitepackage_file=${_lmod_cfg_dir}/SitePackage.lua if [ ! -f ${_lmod_sitepackage_file} ]; then command -V python3 python3 ${TOPDIR}/create_lmodsitepackage.py ${_eessi_software_path} + echo "newly created '${_lmod_sitepackage_file}':" + cat -n ${_lmod_sitepackage_file} +else + echo ">> Updating Lmod SitePackage.lua ..." + export LMOD_PACKAGE_PATH="${EASYBUILD_INSTALLPATH}/.lmod" + lmod_sitepackage_file="$LMOD_PACKAGE_PATH/SitePackage.lua" + sitepackage_changed=$(cat ${pr_diff} | grep '^+++' | cut -f2 -d' ' | sed 's@^[a-z]/@@g' | grep '^create_lmodsitepackage.py$' > /dev/null; echo $?) + if [ ! -f "$lmod_sitepackage_file" ] || [ "${sitepackage_changed}" == '0' ]; then + python3 $TOPDIR/create_lmodsitepackage.py ${EASYBUILD_INSTALLPATH} + check_exit_code $? "$lmod_sitepackage_file created" "Failed to create $lmod_sitepackage_file" + fi + echo "just updated '${lmod_sitepackage_file}':" + cat -n ${lmod_sitepackage_file} fi # Set all the EESSI environment variables (respecting $EESSI_SOFTWARE_SUBDIR_OVERRIDE)