-
Notifications
You must be signed in to change notification settings - Fork 7
/
Lmod-compile-cache-alt-lua-versions.patch
31 lines (28 loc) · 1.49 KB
/
Lmod-compile-cache-alt-lua-versions.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
see also https://github.com/TACC/Lmod/pull/475
-
commit ae104381f8a70580cabd4938d53d392fffb4112a
Author: Kenneth Hoste <kenneth.hoste@ugent.be>
Date: Mon Oct 26 11:05:02 2020 +0100
also compile Lmod spider cache for alternate Lua versions if corresponding luac command is available
diff --git a/src/update_lmod_system_cache_files.in b/src/update_lmod_system_cache_files.in
index 7e7e46a4..82097377 100644
--- a/src/update_lmod_system_cache_files.in
+++ b/src/update_lmod_system_cache_files.in
@@ -319,6 +319,18 @@ update_cache() {
lua_ver=$(@path_to_lua@ -e 'print((_VERSION:gsub("Lua ","")))')
@path_to_luac@ -o ${cache_file_name}.new.luac_$lua_ver ${cache_file_name}.lua
install_new_cache luac_$lua_ver ${cache_file_name}
+
+ # also compile cache with other Lua 5.x versions, if corresponding luac is available
+ for alt_luac in $(ls @path_to_luac@-5.* 2> /dev/null); do
+ alt_lua_ver=$(basename ${alt_luac} | cut -f2 -d'-')
+ debug "Found potential alternate Lua version ${alt_lua_ver} (via ${alt_luac}"
+ # only for Lua versions different than what lua/luac commands correspond to (see above)
+ if [ "${alt_lua_ver}" != "${lua_ver}" ]; then
+ debug "Compiling cache file ${cache_file_name} for Lua ${alt_lua_ver}..."
+ ${alt_luac} -o ${cache_file_name}.new.luac_${alt_lua_ver} ${cache_file_name}.lua
+ install_new_cache luac_${alt_lua_ver} ${cache_file_name}
+ fi
+ done
fi
}