Skip to content

Commit

Permalink
Issue #735: convert old-style hidden flag with new table
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Nov 29, 2024
1 parent cb19ca0 commit 32391c0
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 5 deletions.
17 changes: 17 additions & 0 deletions rt/modulerc/err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1348,3 +1348,20 @@ step 113
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load Foo/invisible
===========================
module: Foo/invisible isVisible status: false
===========================
step 114
lua ProjectDIR/src/lmod.in.lua shell --regression_testing purge
===========================
===========================
step 115
lua ProjectDIR/src/lmod.in.lua shell --regression_testing -A avail
===========================
ProjectDIR/rt/modulerc/mfG/Core
cluster/A (H) cluster/B (H) cluster/C (H)
Where:
H: Hidden Module
If the avail list is too long consider trying:
"module --default avail" or "ml -d av" to just list the default modules.
"module overview" or "ml ov" to display the number of modules for each name.
Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
3 changes: 3 additions & 0 deletions rt/modulerc/mfG/Core/cluster/.modulerc.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hide_version("cluster/A")
hide_version("cluster/B")
hide_version("cluster/C")
File renamed without changes.
Empty file.
Empty file.
21 changes: 18 additions & 3 deletions rt/modulerc/modulerc.tdesc
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ EOF
export MODULEPATH_ROOT=$(testDir)/mfE
export MODULEPATH=$MODULEPATH_ROOT/Core
cp $(testDir)/isVisibleHook_SitePackage.lua SitePackage.lua
runLmod avail #97
runLmod -A avail #98
runLmod load A/1.0 #99
runLmod avail # 97
runLmod -A avail # 98
runLmod load A/1.0 # 99
runLmod load B/3.0 #100
runLmod load F/1.0 #101
runLmod rm F/1.0 #102
Expand All @@ -263,6 +263,21 @@ EOF
runLmod load xcc #112
runLmod load Foo/invisible #113
runLmod purge #114
unsetMT
unset LMOD_MODULERC
rm SitePackage.lua
export MODULEPATH_ROOT=$(testDir)/mfG
export MODULEPATH=$MODULEPATH_ROOT/Core
rm -rf $HOME/.cache
mkdir -p $HOME/.cache/lmod
SED=sed
if [ `uname -s` = Darwin ]; then SED=gsed; fi
$SED -e "s|%testDir%|$(testDir)|g" < $(testDir)/spiderT-old.lua > $HOME/.cache/lmod/spiderT.lua
runLmod -A avail #115
HOME=$ORIG_HOME
cat _stdout.[0-9][0-9][0-9] > _stdout.orig
Expand Down
22 changes: 22 additions & 0 deletions rt/modulerc/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3031,3 +3031,25 @@ MODULEPATH=ProjectDIR/rt/modulerc/mfF/Compiler/xcc/1.0:ProjectDIR/rt/modulerc/mf
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={Foo={fn="ProjectDIR/rt/modulerc/mfF/Compiler/xcc/1.0/Foo/invisible.lua",fullName="Foo/invisible",loadOrder=2,moduleKindT={kind="hidden",},propT={},stackDepth=0,status="active",userName="Foo/invisible",wV="*invisible.*zfinal",},xcc={actionA={"prepend_path(\"MODULEPATH\",\"ProjectDIR/rt/modulerc/mfF/Compiler/xcc/1.0\")",},fn="ProjectDIR/rt/modulerc/mfF/Core/xcc/1.0.lua",fullName="xcc/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="xcc",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/modulerc/mfF/Compiler/xcc/1.0","ProjectDIR/rt/modulerc/mfF/Core",},systemBaseMPATH="ProjectDIR/rt/modulerc/mfF/Core",}';
export _ModuleTable_;
===========================
step 114
lua ProjectDIR/src/lmod.in.lua shell --regression_testing purge
===========================
unset LOADEDMODULES;
__LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/modulerc/mfF/Core:1;
export __LMOD_REF_COUNT_MODULEPATH;
MODULEPATH=ProjectDIR/rt/modulerc/mfF/Core;
export MODULEPATH;
unset _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/modulerc/mfF/Core",},systemBaseMPATH="ProjectDIR/rt/modulerc/mfF/Core",}';
export _ModuleTable_;
===========================
step 115
lua ProjectDIR/src/lmod.in.lua shell --regression_testing -A avail
===========================
__LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/modulerc/mfG/Core:1;
export __LMOD_REF_COUNT_MODULEPATH;
MODULEPATH=ProjectDIR/rt/modulerc/mfG/Core;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/modulerc/mfG/Core",},systemBaseMPATH="ProjectDIR/rt/modulerc/mfG/Core",}';
export _ModuleTable_;
81 changes: 81 additions & 0 deletions rt/modulerc/spiderT-old.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
timestampFn = {
false,
}
mrcT = {
alias2modT = {},
hiddenT = {
["cluster/A"] = true,
["cluster/B"] = true,
["cluster/C"] = true,
},
version2modT = {},
}

mrcMpathT = {
["%testDir%/mfG/Core"] = {
hiddenT = {
["cluster/A"] = true,
["cluster/B"] = true,
["cluster/C"] = true,
},
},
}
spiderT = {
["%testDir%/mfG/Core"] = {
cluster = {
defaultA = {
{
barefn = ".modulerc.lua",
defaultIdx = 2,
fn = "%testDir%/mfG/Core/cluster/.modulerc.lua",
fullName = "cluster/.modulerc",
luaExt = 10,
mpath = "%testDir%/mfG/Core",
value = false,
},
},
defaultT = {
barefn = ".modulerc.lua",
defaultIdx = 2,
fn = "%testDir%/mfG/Core/cluster/.modulerc.lua",
fullName = "cluster/.modulerc",
luaExt = 10,
mpath = "%testDir%/mfG/Core",
value = false,
},
dirT = {},
fileT = {
["cluster/A"] = {
Version = "A",
canonical = "A",
fn = "%testDir%/mfG/Core/cluster/A.lua",
luaExt = 2,
mpath = "%testDir%/mfG/Core",
pV = "*a.*zfinal",
wV = "*a.*zfinal",
},
["cluster/B"] = {
Version = "B",
canonical = "B",
fn = "%testDir%/mfG/Core/cluster/B.lua",
luaExt = 2,
mpath = "%testDir%/mfG/Core",
pV = "*b.*zfinal",
wV = "*b.*zfinal",
},
["cluster/C"] = {
Version = "C",
canonical = "C",
fn = "%testDir%/mfG/Core/cluster/C.lua",
luaExt = 2,
mpath = "%testDir%/mfG/Core",
pV = "*c.*zfinal",
wV = "*c.*zfinal",
},
},
},
},
version = 5,
}
mpathMapT = {}

9 changes: 7 additions & 2 deletions src/MRC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,13 @@ local function l_find_resultT(self, tbl_kind, replaceT, mpath, wantedA)
local wanted = wantedA[i]
local key = self:resolve(mpathA, wanted)
local ans = ttt[key] or tt[key]
if (ans and type(ans) == "table") then
resultT = ans
if (ans) then
if (type(ans) == "table") then
resultT = ans
else
resultT = replaceT
end
dbg.printT("resultT",resultT)
dbg.fini("MRC:l_find_resultT")
return resultT
end
Expand Down

0 comments on commit 32391c0

Please sign in to comment.