From 5fa16cde0a4eca12346247ece1a3d24e2748ab79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 21 Nov 2025 15:06:42 +0100 Subject: [PATCH 1/4] find the oldest EESSI version and use its Lmod cache update script for any version --- scripts/ingest-tarball.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh index 9a2580d2..c5b53ce4 100755 --- a/scripts/ingest-tarball.sh +++ b/scripts/ingest-tarball.sh @@ -182,6 +182,9 @@ function update_lmod_caches() { error "the script for updating the Lmod caches (${update_caches_script}) does not have execute permissions!" fi ${cvmfs_server} transaction "${cvmfs_repo}" + # Find the oldest version that we have, and use its Lmod to generate the cache to get better backwards compatibilty with old Lmod versions + oldest_stack=$(ls -1 -v "${CVMFS_ROOT}/${cvmfs_repo}/${basedir}" | head -n 1) + 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" ${update_caches_script} "${CVMFS_ROOT}/${cvmfs_repo}/${basedir}/${version}" ec=$? if [ $ec -eq 0 ]; then From dd1ce43727e4f6791ebfc27aac9a3913141173f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 21 Nov 2025 15:06:52 +0100 Subject: [PATCH 2/4] allow overriding of the Lmod cache update script location --- scripts/update_lmod_caches.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/update_lmod_caches.sh b/scripts/update_lmod_caches.sh index 70737123..a1826edc 100755 --- a/scripts/update_lmod_caches.sh +++ b/scripts/update_lmod_caches.sh @@ -14,11 +14,12 @@ function error() { } # Check if a stack base dir has been specified -if [ "$#" -ne 1 ]; then +if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then error "usage: $0 " fi stack_base_dir="$1" +update_lmod_system_cache_files="$2" # Check if the given stack base dir exists if [ ! -d ${stack_base_dir} ] @@ -26,8 +27,11 @@ then error "${stack_base_dir} does not point to an existing directory!" fi -# Check if Lmod's cache update script can be found at the expected location (in the compatibility layer of the given stack) -update_lmod_system_cache_files="${stack_base_dir}/compat/linux/$(uname -m)/usr/share/Lmod/libexec/update_lmod_system_cache_files" +# If no Lmod cache update script was specified, try to find one in the compatibility layer of the given stack +if [ -z ${update_lmod_system_cache_files} ]; then + update_lmod_system_cache_files="${stack_base_dir}/compat/linux/$(uname -m)/usr/share/Lmod/libexec/update_lmod_system_cache_files" +fi +# Make sure that the expected Lmod cache update script exists if [ ! -f ${update_lmod_system_cache_files} ] then error "expected to find Lmod's cache update script at ${update_lmod_system_cache_files}, but it doesn't exist." From 431d1ae8523021cc413661dc100da762bb3a2b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 21 Nov 2025 15:14:21 +0100 Subject: [PATCH 3/4] actually pass oldest_stack_lmod_update_script as argument --- scripts/ingest-tarball.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ingest-tarball.sh b/scripts/ingest-tarball.sh index c5b53ce4..952c8629 100755 --- a/scripts/ingest-tarball.sh +++ b/scripts/ingest-tarball.sh @@ -185,7 +185,7 @@ function update_lmod_caches() { # Find the oldest version that we have, and use its Lmod to generate the cache to get better backwards compatibilty with old Lmod versions oldest_stack=$(ls -1 -v "${CVMFS_ROOT}/${cvmfs_repo}/${basedir}" | head -n 1) 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" - ${update_caches_script} "${CVMFS_ROOT}/${cvmfs_repo}/${basedir}/${version}" + ${update_caches_script} "${CVMFS_ROOT}/${cvmfs_repo}/${basedir}/${version}" "${oldest_stack_lmod_update_script}" ec=$? if [ $ec -eq 0 ]; then ${cvmfs_server} publish -m "update Lmod caches after ingesting ${tar_file_basename}" "${cvmfs_repo}" From 6f3e6b5ba0721e3cd7f7704254abd3db82a25953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Fri, 21 Nov 2025 15:16:37 +0100 Subject: [PATCH 4/4] update usage info --- scripts/update_lmod_caches.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_lmod_caches.sh b/scripts/update_lmod_caches.sh index a1826edc..79ba632d 100755 --- a/scripts/update_lmod_caches.sh +++ b/scripts/update_lmod_caches.sh @@ -15,7 +15,7 @@ function error() { # Check if a stack base dir has been specified if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then - error "usage: $0 " + error "usage: $0 []" fi stack_base_dir="$1"