Skip to content

Commit

Permalink
Issue #690: Partial support for hide{} function. Support for MRC:isVi…
Browse files Browse the repository at this point in the history
…sible to take visibleT
  • Loading branch information
Robert McLay committed Aug 10, 2024
1 parent 0cf26a3 commit 965b565
Show file tree
Hide file tree
Showing 16 changed files with 839 additions and 786 deletions.
373 changes: 187 additions & 186 deletions TAGS

Large diffs are not rendered by default.

979 changes: 490 additions & 489 deletions TAGS.world

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions messageDir/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ return {
--------------------------------------------------------------------------
e_Args_Not_Strings = [==[Syntax error in file: %{fn}
with command: %{cmdName}, one or more arguments are not strings.
]==], --
e_Args_Not_Table = [==[Syntax error in file: %{fn}
with function: %{func}, is not a table.
]==], --
e_Args_Not_Strings_short = "command: %{cmdName}, one or more arguments are not strings.",
e_Avail_No_MPATH = "module %{name} is not possible. MODULEPATH is not set or not set with valid paths.\n",
Expand Down
2 changes: 1 addition & 1 deletion rt/dbT/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.7.40 2024-06-11 15:18 -06:00
Modules based on Lua: Version 8.7.47 2024-07-22 10:04 -04:00
by Robert McLay mclay@tacc.utexas.edu
===========================
step 2
Expand Down
8 changes: 6 additions & 2 deletions rt/dbT/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ timestampFn = {
mrcT = {
alias2modT = {},
hiddenT = {
["foobar/1.2.3"] = true,
["foobar/1.2.3"] = {
kind = "hidden",
},
},
version2modT = {},
}
mrcMpathT = {
["ProjectDIR/rt/dbT/mf3"] = {
hiddenT = {
["foobar/1.2.3"] = true,
["foobar/1.2.3"] = {
kind = "hidden",
},
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion rt/modulerc/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.7.37 2024-03-17 13:11 -06:00
Modules based on Lua: Version 8.7.47 2024-07-22 10:04 -04:00
by Robert McLay mclay@tacc.utexas.edu
===========================
step 2
Expand Down
16 changes: 12 additions & 4 deletions rt/modulerc/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,12 @@ timestampFn = {
mrcT = {
alias2modT = {},
hiddenT = {
["h2/1.0"] = true,
["hidden/1.0"] = true,
["h2/1.0"] = {
kind = "hidden",
},
["hidden/1.0"] = {
kind = "hidden",
},
},
version2modT = {},
}
Expand All @@ -221,8 +225,12 @@ mrcMpathT = {
z23 = "z/23",
},
hiddenT = {
["h2/1.0"] = true,
["hidden/1.0"] = true,
["h2/1.0"] = {
kind = "hidden",
},
["hidden/1.0"] = {
kind = "hidden",
},
},
version2modT = {
["a/13"] = "a/13.2.345",
Expand Down
2 changes: 1 addition & 1 deletion rt/spider/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.7.39 2024-06-02 12:29 -05:00
Modules based on Lua: Version 8.7.47 2024-07-22 10:04 -04:00
by Robert McLay mclay@tacc.utexas.edu
===========================
step 2
Expand Down
20 changes: 15 additions & 5 deletions rt/spider/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ mrcT = {
intelcompiler = "intel",
},
hiddenT = {
["gcc/4.8"] = true,
["gcc/4.8"] = {
kind = "hidden",
},
},
version2modT = {
["intel/17"] = "intel/2017.1.132",
Expand Down Expand Up @@ -900,7 +902,9 @@ mrcT = {
intelcompiler = "intel",
},
hiddenT = {
["gcc/4.8"] = true,
["gcc/4.8"] = {
kind = "hidden",
},
},
version2modT = {
["intel/17"] = "intel/2017.1.132",
Expand Down Expand Up @@ -942,7 +946,9 @@ mrcT = {
intelcompiler = "intel",
},
hiddenT = {
["gcc/4.8"] = true,
["gcc/4.8"] = {
kind = "hidden",
},
},
version2modT = {
["intel/17"] = "intel/2017.1.132",
Expand Down Expand Up @@ -1089,7 +1095,9 @@ mrcT = {
intelcompiler = "intel",
},
hiddenT = {
["gcc/4.8"] = true,
["gcc/4.8"] = {
kind = "hidden",
},
},
version2modT = {
["intel/17"] = "intel/2017.1.132",
Expand Down Expand Up @@ -1215,7 +1223,9 @@ mrcT = {
intelcompiler = "intel",
},
hiddenT = {
["gcc/4.8"] = true,
["gcc/4.8"] = {
kind = "hidden",
},
},
version2modT = {
["intel/17"] = "intel/2017.1.132",
Expand Down
6 changes: 3 additions & 3 deletions src/MN_Match.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ M.my_name = "match"


local s_stepA = {
MName.find_exact_match,
MName.find_highest,
MName.find_exact_match_meta_module,
MName.find_exact_match, -- exact match with required version
MName.find_highest, -- Highest match
MName.find_exact_match_meta_module, -- match meta module
}

function M.steps()
Expand Down
102 changes: 46 additions & 56 deletions src/MName.lua
Original file line number Diff line number Diff line change
Expand Up @@ -417,81 +417,74 @@ end
-- the whole module tree is treated as NVV.


------------------------------------------------------------------------
-- M.find_exact_match() is more difficult because there are possibly
-- more than one marked default:
-- 1) The filesystem can mark a default (weighted by '^')
-- 2) The system admins can have a modulerc file. (weighted by 's')
-- 3) The user can have a ~/.modulerc file. (weighted by 'u')


function M.find_exact_match(self, fileA)
--dbg.start{"MName:find_exact_match(fileA)"}
local function l_find_exact_match(self, must_have_version, fileA)
dbg.start{"MName l_find_exact_match(must_have_version:,",must_have_version,",fileA)"}
local versionStr = self.__versionStr
local mrc = MRC:singleton()
local fn = false
local version = false
local pV = " " -- this is less than the lowest possible weight
local wV = false
local found = false
if (not versionStr) then
--dbg.print{"found: ",found,", fn: ",fn,", version: ", version,"\n"}
--dbg.fini("MName:find_exact_match")
if (must_have_version and not versionStr) then
return found, fn, version
end

for j = 1, #fileA do
local blockA = fileA[j]
for i = 1, #blockA do
local entry = blockA[i]
if (entry.version == versionStr and entry.pV > pV ) then
pV = entry.pV
wV = entry.wV
fn = entry.fn
version = entry.version or false
found = true
self.__range = { pV, pV }
break
if (mrc:isVisible{fullName=entry.fullName,sn=entry.sn,fn=entry.fn,
visibleT = {soft = true, hidden = true}}) then
if (entry.version == versionStr and entry.pV > pV ) then
pV = entry.pV
wV = entry.wV
fn = entry.fn
version = entry.version or false
found = true
self.__range = { pV, pV }
break
end
end
end
end

--dbg.print{"found: ",found,", fn: ",fn,", version: ", version,"\n"}
--dbg.fini("MName:find_exact_match")
dbg.print{"found: ",found,", fn: ",fn,", version: ", version,", wV: ",wV,"\n"}
dbg.fini("MName l_find_exact_match")
return found, fn, version, wV
end


function M.find_exact_match_meta_module(self, fileA)
--dbg.start{"MName:find_exact_match_meta_module(fileA)"}
local versionStr = self.__versionStr
local fn = false
local version = false
local pV = " " -- this is less than the lowest possible weight
local wV = false
local found = false
for j = 1, #fileA do
local blockA = fileA[j]
for i = 1, #blockA do
local entry = blockA[i]
if (entry.version == versionStr and entry.pV > pV ) then
pV = entry.pV
wV = entry.wV
fn = entry.fn
version = entry.version or false
found = true
self.__range = { pV, pV }
break
end
end
end
------------------------------------------------------------------------
-- M.find_exact_match() is more difficult because there are possibly
-- more than one marked default:
-- 1) The filesystem can mark a default (weighted by '^')
-- 2) The system admins can have a modulerc file. (weighted by 's')
-- 3) The user can have a ~/.modulerc file. (weighted by 'u')

--dbg.print{"found: ",found,", fn: ",fn,", version: ", version,"\n"}
--dbg.fini("MName:find_exact_match_meta_module")
function M.find_exact_match(self, fileA)
dbg.start{"MName:find_exact_match(fileA)"}
local must_have_version = true
local found, fn, version, wV = l_find_exact_match(self, must_have_version, fileA)
dbg.fini("MName:find_exact_match")
return found, fn, version, wV
end
------------------------------------------------------------------------
-- This routine is almost the same as M.find_exact_match
-- But this routine is here to find moduleName w/o versions
-- (namely meta modules). But modules with version have a
-- higher priority over meta modules.

function M.find_exact_match_meta_module(self, fileA)
dbg.start{"MName:find_exact_match_meta_module(fileA)"}
local must_have_version = false
local found, fn, version, wV = l_find_exact_match(self, must_have_version, fileA)
dbg.fini("MName:find_exact_match_meta_module")
return found, fn, version, wV
end

local function l_find_highest_by_key(self, key, fileA)
--dbg.start{"MName: l_find_highest_by_key(key:\"",key,"\",fileA)"}
dbg.start{"MName: l_find_highest_by_key(key:\"",key,"\",fileA)"}
local mrc = MRC:singleton()
local weight = " " -- this is less than the lower possible weight.
local idx = nil
Expand All @@ -509,7 +502,8 @@ local function l_find_highest_by_key(self, key, fileA)
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 (isMarked(v) or mrc:isVisible{fullName=entry.fullName,sn=entry.sn,fn=entry.fn,
visibleT = {soft = true}}) then
if (v > weight) then
idx = i
weight = v
Expand All @@ -526,8 +520,8 @@ local function l_find_highest_by_key(self, key, fileA)
found = true
self.__range = { pV, pV }
end
--dbg.print{"found: ",found,", fn: ",fn,", version: ", version,", wV: ",wV,"\n"}
--dbg.fini("MName: l_find_highest_by_key")
dbg.print{"found: ",found,", fn: ",fn,", version: ", version,", wV: ",wV,"\n"}
dbg.fini("MName: l_find_highest_by_key")
return found, fn, version, wV
end

Expand Down Expand Up @@ -590,10 +584,6 @@ function M.find_between(self, fileA)
return found, fn, version, wV
end

function M.find_inherit_match(self,fileA)
local a = fileA[1] or {}
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,")"}
local have_range = false
Expand Down
Loading

0 comments on commit 965b565

Please sign in to comment.