Skip to content

Commit

Permalink
Merge IS713-tmod-hidden onto IS714-utf8
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Jul 18, 2024
2 parents 2b32ab8 + 4063ec2 commit 75a3103
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 62 deletions.
5 changes: 3 additions & 2 deletions README.new
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,6 @@ Lmod 8.7+
(8.7.43) * Support for ksh flag not needed anymore
(8.7.44) * Issue #710: path2pathA() keep double delims, Reduce triple delims to double
W.I.P.:
(8.7.45) * Issue #714: Adding "=encoding UTF-8" to pod generation

(8.7.45) * Issue #713: Changing MName.src: l_find_highest_by_key() to loop over all fileA entries.
Now stoping at first one found rather than just looking at fileA[1].
* Issue #714: Adding "=encoding UTF-8" to pod generation
40 changes: 39 additions & 1 deletion rt/hidden/err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
step 1
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --version
===========================
Modules based on Lua: Version 8.6.9 2022-02-02 11:25 -04:00
Modules based on Lua: Version 8.7.44 2024-07-11 16:39 -06:00
by Robert McLay [email protected]
===========================
step 2
Expand Down Expand Up @@ -31,3 +31,41 @@ Currently Loaded Modules:
Where:
H: Hidden Module
S: Module is Sticky, requires --force to unload or purge
===========================
step 5
lua ProjectDIR/src/lmod.in.lua shell --regression_testing purge
===========================
The following modules were not unloaded:
(Use "module --force purge" to unload all):
1) .system
===========================
step 6
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --show_hidden av
===========================
ProjectDIR/rt/hidden/mf2/top
A/1.0 B/.9.8.7 (H)
ProjectDIR/rt/hidden/mf2/bottom
A/2.0 B/9.8.7
Where:
H: Hidden Module
Module defaults are chosen based on Find First Rules due to Name/Version/Version modules found in the module tree.
See https://lmod.readthedocs.io/en/latest/060_locating.html for details.
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".
===========================
step 7
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load B
===========================
===========================
step 8
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load A
===========================
===========================
step 9
lua ProjectDIR/src/lmod.in.lua shell --regression_testing list
===========================
Currently Loaded Modules:
1) B/9.8.7 2) A/1.0
9 changes: 9 additions & 0 deletions rt/hidden/hidden.tdesc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ testdescript = {
runLmod load .system # 3
runLmod list # 4
runLmod purge # 5
unsetMT
export MODULEPATH=$(testDir)/mf2/top:$(testDir)/mf2/bottom
export LMOD_TMOD_FIND_FIRST=1
runLmod --show_hidden av # 6
runLmod load B # 7
runLmod load A # 8
runLmod list # 9
HOME=$ORIG_HOME
cat _stdout.[0-9][0-9][0-9] > _stdout.orig
joinBase64Results -bash _stdout.orig _stdout.new
Expand Down
1 change: 1 addition & 0 deletions rt/hidden/mf2/bottom/A/2.0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setenv(myModuleName(),myModuleVersion())
1 change: 1 addition & 0 deletions rt/hidden/mf2/bottom/B/9.8.7.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setenv(myModuleName(),myModuleVersion())
1 change: 1 addition & 0 deletions rt/hidden/mf2/top/A/1.0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setenv(myModuleName(),myModuleVersion())
1 change: 1 addition & 0 deletions rt/hidden/mf2/top/B/.9.8.7.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setenv(myModuleName(),myModuleVersion())
56 changes: 56 additions & 0 deletions rt/hidden/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,59 @@ MODULEPATH=ProjectDIR/rt/hidden/mf;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={[".system"]={fn="ProjectDIR/rt/hidden/mf/.system.lua",fullName=".system",loadOrder=1,propT={lmod={sticky=1,},},stackDepth=0,status="active",userName=".system",wV="M.*zfinal",},},mpathA={"ProjectDIR/rt/hidden/mf",},systemBaseMPATH="ProjectDIR/rt/hidden/mf",}';
export _ModuleTable_;
===========================
step 5
lua ProjectDIR/src/lmod.in.lua shell --regression_testing purge
===========================
MODULEPATH=ProjectDIR/rt/hidden/mf;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={[".system"]={fn="ProjectDIR/rt/hidden/mf/.system.lua",fullName=".system",loadOrder=1,propT={lmod={sticky=1,},},stackDepth=0,status="active",userName=".system",wV="M.*zfinal",},},mpathA={"ProjectDIR/rt/hidden/mf",},systemBaseMPATH="ProjectDIR/rt/hidden/mf",}';
export _ModuleTable_;
===========================
step 6
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --show_hidden av
===========================
unset LOADEDMODULES;
__LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/hidden/mf2/top:1\;ProjectDIR/rt/hidden/mf2/bottom:1;
export __LMOD_REF_COUNT_MODULEPATH;
MODULEPATH=ProjectDIR/rt/hidden/mf2/top:ProjectDIR/rt/hidden/mf2/bottom;
export MODULEPATH;
unset _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/hidden/mf2/top","ProjectDIR/rt/hidden/mf2/bottom",},systemBaseMPATH="ProjectDIR/rt/hidden/mf2/top:ProjectDIR/rt/hidden/mf2/bottom",}';
export _ModuleTable_;
===========================
step 7
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load B
===========================
B=9.8.7;
export B;
LOADEDMODULES=B/9.8.7;
export LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/hidden/mf2/top:ProjectDIR/rt/hidden/mf2/bottom;
export MODULEPATH;
_LMFILES_=ProjectDIR/rt/hidden/mf2/bottom/B/9.8.7.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={B={fn="ProjectDIR/rt/hidden/mf2/bottom/B/9.8.7.lua",fullName="B/9.8.7",loadOrder=1,propT={},stackDepth=0,status="active",userName="B",wV="000000009.000000008.000000007.*zfinal",},},mpathA={"ProjectDIR/rt/hidden/mf2/top","ProjectDIR/rt/hidden/mf2/bottom",},systemBaseMPATH="ProjectDIR/rt/hidden/mf2/top:ProjectDIR/rt/hidden/mf2/bottom",}';
export _ModuleTable_;
===========================
step 8
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load A
===========================
A=1.0;
export A;
LOADEDMODULES=B/9.8.7:A/1.0;
export LOADEDMODULES;
MODULEPATH=ProjectDIR/rt/hidden/mf2/top:ProjectDIR/rt/hidden/mf2/bottom;
export MODULEPATH;
_LMFILES_=ProjectDIR/rt/hidden/mf2/bottom/B/9.8.7.lua:ProjectDIR/rt/hidden/mf2/top/A/1.0.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={A={fn="ProjectDIR/rt/hidden/mf2/top/A/1.0.lua",fullName="A/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="A",wV="000000001.*zfinal",},B={fn="ProjectDIR/rt/hidden/mf2/bottom/B/9.8.7.lua",fullName="B/9.8.7",loadOrder=1,propT={},stackDepth=0,status="active",userName="B",wV="000000009.000000008.000000007.*zfinal",},},mpathA={"ProjectDIR/rt/hidden/mf2/top","ProjectDIR/rt/hidden/mf2/bottom",},systemBaseMPATH="ProjectDIR/rt/hidden/mf2/top:ProjectDIR/rt/hidden/mf2/bottom",}';
export _ModuleTable_;
===========================
step 9
lua ProjectDIR/src/lmod.in.lua shell --regression_testing list
===========================
MODULEPATH=ProjectDIR/rt/hidden/mf2/top:ProjectDIR/rt/hidden/mf2/bottom;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={A={fn="ProjectDIR/rt/hidden/mf2/top/A/1.0.lua",fullName="A/1.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="A",wV="000000001.*zfinal",},B={fn="ProjectDIR/rt/hidden/mf2/bottom/B/9.8.7.lua",fullName="B/9.8.7",loadOrder=1,propT={},stackDepth=0,status="active",userName="B",wV="000000009.000000008.000000007.*zfinal",},},mpathA={"ProjectDIR/rt/hidden/mf2/top","ProjectDIR/rt/hidden/mf2/bottom",},systemBaseMPATH="ProjectDIR/rt/hidden/mf2/top:ProjectDIR/rt/hidden/mf2/bottom",}';
export _ModuleTable_;
54 changes: 30 additions & 24 deletions src/MName.lua
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ function M.find_exact_match(self, fileA)
end
end

---dbg.print{"found: ",found,", fn: ",fn,", version: ", version,"\n"}
--dbg.print{"found: ",found,", fn: ",fn,", version: ", version,"\n"}
--dbg.fini("MName:find_exact_match")
return found, fn, version, wV
end
Expand Down Expand Up @@ -491,37 +491,43 @@ end


local function l_find_highest_by_key(self, key, fileA)
--dbg.start{"MName:find_by_key(key:\"",key,"\",fileA)"}
--dbg.start{"MName: l_find_highest_by_key(key:\"",key,"\",fileA)"}
local mrc = MRC:singleton()
local a = fileA[1] or {}
local weight = " " -- this is less than the lower possible weight.
local idx = nil
local fn = false
local found = false
local version = false
local pV = false
local wV = false
fileA = fileA or {}
local blockA

for j = 1,#a do
local entry = a[j]
local v = entry[key]
if (mrc:isVisible{fullName=entry.fullName,sn=entry.sn,fn=entry.fn} or isMarked(v)) then
if (v > weight) then
idx = j
weight = v
pV = entry.pV
wV = entry.wV
for j = 1,#fileA do
blockA = fileA[j]

for i = 1,#blockA do
local entry = blockA[i]
local v = entry[key]
if (mrc:isVisible{fullName=entry.fullName,sn=entry.sn,fn=entry.fn} or isMarked(v)) then
if (v > weight) then
idx = i
weight = v
pV = entry.pV
wV = entry.wV
end
end
end
if (idx) then break end
end
if (idx) then
fn = a[idx].fn
version = a[idx].version or false
fn = blockA[idx].fn
version = blockA[idx].version or false
found = true
self.__range = { pV, pV }
end
--dbg.print{"found: ",found,", fn: ",fn,", version: ", version,", wV: ",wV,"\n"}
--dbg.fini("MName:find_by_key")
--dbg.fini("MName: l_find_highest_by_key")
return found, fn, version, wV
end

Expand Down Expand Up @@ -589,12 +595,12 @@ function M.find_inherit_match(self,fileA)
end

local function l_rangeCk(self, version, result_if_found, result_if_not_found)
dbg.start{"l_rangeCk(self, version: ",version,", result_if_found: ",result_if_found,", result_if_not_found: ",result_if_not_found,")"}
--dbg.start{"l_rangeCk(self, version: ",version,", result_if_found: ",result_if_found,", result_if_not_found: ",result_if_not_found,")"}
local have_range = false
local result = result_if_not_found
if (not self.__have_range) then
dbg.print{"no range\n"}
dbg.fini("l_rangeCk")
--dbg.print{"no range\n"}
--dbg.fini("l_rangeCk")
return have_range, result
end

Expand All @@ -604,17 +610,17 @@ local function l_rangeCk(self, version, result_if_found, result_if_not_found)
local lowerFn = self.__range_fnA[1]
local upperFn = self.__range_fnA[2]
local pV = parseVersion(version)
dbg.print{"lowerBound: ",lowerBound,"\n"}
dbg.print{"upperBound: ",upperBound,"\n"}
dbg.print{"pV: ",pV,"\n"}
dbg.print{"lowerFn: ",lowerFn.name,", lowerFn.func(lowerBound, pV): ",lowerFn.func(lowerBound, pV),"\n"}
dbg.print{"upperFn: ",upperFn.name,", upperFn.func(pV, upperBound): ",upperFn.func(pV, upperBound),"\n"}
--dbg.print{"lowerBound: ",lowerBound,"\n"}
--dbg.print{"upperBound: ",upperBound,"\n"}
--dbg.print{"pV: ",pV,"\n"}
--dbg.print{"lowerFn: ",lowerFn.name,", lowerFn.func(lowerBound, pV): ",lowerFn.func(lowerBound, pV),"\n"}
--dbg.print{"upperFn: ",upperFn.name,", upperFn.func(pV, upperBound): ",upperFn.func(pV, upperBound),"\n"}

if (lowerFn.func(lowerBound, pV) and upperFn.func(pV, upperBound)) then
result = result_if_found
end

dbg.fini("l_rangeCk")
--dbg.fini("l_rangeCk")
return have_range, result
end

Expand Down
Loading

0 comments on commit 75a3103

Please sign in to comment.