Skip to content

Commit a87c847

Browse files
authored
Merge pull request #260 from bedroge/oldest_eessi_for_lmod_cache
Use Lmod cache update script from oldest available EESSI version
2 parents d7f1d4f + 6f3e6b5 commit a87c847

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

scripts/ingest-tarball.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ function update_lmod_caches() {
182182
error "the script for updating the Lmod caches (${update_caches_script}) does not have execute permissions!"
183183
fi
184184
${cvmfs_server} transaction "${cvmfs_repo}"
185-
${update_caches_script} "${CVMFS_ROOT}/${cvmfs_repo}/${basedir}/${version}"
185+
# Find the oldest version that we have, and use its Lmod to generate the cache to get better backwards compatibilty with old Lmod versions
186+
oldest_stack=$(ls -1 -v "${CVMFS_ROOT}/${cvmfs_repo}/${basedir}" | head -n 1)
187+
oldest_stack_lmod_update_script="${CVMFS_ROOT}/${cvmfs_repo}/${basedir}/${oldest_stack}/compat/linux/$(uname -m)/usr/share/Lmod/libexec/update_lmod_system_cache_files"
188+
${update_caches_script} "${CVMFS_ROOT}/${cvmfs_repo}/${basedir}/${version}" "${oldest_stack_lmod_update_script}"
186189
ec=$?
187190
if [ $ec -eq 0 ]; then
188191
${cvmfs_server} publish -m "update Lmod caches after ingesting ${tar_file_basename}" "${cvmfs_repo}"

scripts/update_lmod_caches.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,24 @@ function error() {
1414
}
1515

1616
# Check if a stack base dir has been specified
17-
if [ "$#" -ne 1 ]; then
18-
error "usage: $0 <path to main directory of an EESSI stack>"
17+
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
18+
error "usage: $0 <path to main directory of an EESSI stack> [<path to Lmod's update_lmod_system_cache_files script>]"
1919
fi
2020

2121
stack_base_dir="$1"
22+
update_lmod_system_cache_files="$2"
2223

2324
# Check if the given stack base dir exists
2425
if [ ! -d ${stack_base_dir} ]
2526
then
2627
error "${stack_base_dir} does not point to an existing directory!"
2728
fi
2829

29-
# Check if Lmod's cache update script can be found at the expected location (in the compatibility layer of the given stack)
30-
update_lmod_system_cache_files="${stack_base_dir}/compat/linux/$(uname -m)/usr/share/Lmod/libexec/update_lmod_system_cache_files"
30+
# If no Lmod cache update script was specified, try to find one in the compatibility layer of the given stack
31+
if [ -z ${update_lmod_system_cache_files} ]; then
32+
update_lmod_system_cache_files="${stack_base_dir}/compat/linux/$(uname -m)/usr/share/Lmod/libexec/update_lmod_system_cache_files"
33+
fi
34+
# Make sure that the expected Lmod cache update script exists
3135
if [ ! -f ${update_lmod_system_cache_files} ]
3236
then
3337
error "expected to find Lmod's cache update script at ${update_lmod_system_cache_files}, but it doesn't exist."

0 commit comments

Comments
 (0)