Skip to content

Commit 8a949fe

Browse files
committed
update load_eessi_extend_module.sh to rebuild EESSI-extend module if the easyconfig file used to create it was changed
1 parent fa5f211 commit 8a949fe

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

load_eessi_extend_module.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#
2525
set -o pipefail
2626

27+
EESSI_EXTEND_EASYCONFIG="EESSI-extend-easybuild.eb"
28+
2729
# this script is *sourced*, not executed, so can't rely on $0 to determine path to self or script name
2830
# $BASH_SOURCE points to correct path or script name, see also http://mywiki.wooledge.org/BashFAQ/028
2931
if [ $# -ne 1 ]; then
@@ -65,11 +67,25 @@ ml_av_eessi_extend_out=${TMPDIR}/ml_av_eessi_extend.out
6567
# need to use --ignore_cache to avoid the case that the module was removed (to be
6668
# rebuilt) but it is still in the cache
6769
module --ignore_cache avail 2>&1 | grep -i EESSI-extend/${EESSI_EXTEND_VERSION} &> ${ml_av_eessi_extend_out}
68-
6970
if [[ $? -eq 0 ]]; then
7071
echo_green ">> Module for EESSI-extend/${EESSI_EXTEND_VERSION} found!"
72+
install_eessi_extend=false
73+
rebuild_eessi_extend=false
74+
# $PR_DIFF should be set by the calling script (EESSI-install-software.sh)
75+
if [[ ! -z ${PR_DIFF} ]] && [[ -f "$PR_DIFF" ]]; then
76+
# check if EESSI-extend easyconfig was modified; if so, we need to rebuild it
77+
grep -q "^\+\+\+ b/${EESSI_EXTEND_EASYCONFIG}" "${PR_DIFF}"
78+
if [[ $? -eq 0 ]]; then
79+
rebuild_eessi_extend=true
80+
fi
81+
fi
7182
else
7283
echo_yellow ">> No module yet for EESSI-extend/${EESSI_EXTEND_VERSION}, installing it..."
84+
install_eessi_extend=true
85+
rebuild_eessi_extend=false
86+
fi
87+
88+
if [ "${install_eessi_extend}" = true ] || [ "${rebuild_eessi_extend}" = true ]; then
7389

7490
EB_TMPDIR=${TMPDIR}/ebtmp
7591
echo ">> Using temporary installation of EasyBuild (in ${EB_TMPDIR})..."
@@ -98,9 +114,15 @@ else
98114
eessi_install_out=${TMPDIR}/eessi_install.out
99115
ok_msg="EESSI-extend/${EESSI_EXTEND_VERSION} installed, let's go!"
100116
fail_msg="Installing EESSI-extend/${EESSI_EXTEND_VERSION} failed, that's not good... (output: ${eessi_install_out})"
117+
101118
# while always adding --try-amend=keep... may do no harm, we could make
102119
# an attempt to figure out if it is needed, e.g., when we are rebuilding
103-
${EB} "EESSI-extend-easybuild.eb" --try-amend=keeppreviousinstall=True 2>&1 | tee ${eessi_install_out}
120+
eb_args="--try-amend=keeppreviousinstall=True "
121+
if [ "${rebuild_eessi_extend}" = true ]; then
122+
eb_args+="--rebuild"
123+
fi
124+
echo ">> Installing EESSI-extend with '${EB} ${eb_args} ${EESSI_EXTEND_EASYCONFIG}'..."
125+
${EB} ${eb_args} "${EESSI_EXTEND_EASYCONFIG}" 2>&1 | tee ${eessi_install_out}
104126
check_exit_code $? "${ok_msg}" "${fail_msg}"
105127
)
106128

0 commit comments

Comments
 (0)