Skip to content

Commit

Permalink
Merge branch 'testing' of bitbucket.org:rtmclay/lmod into testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Nov 3, 2023
2 parents 29028f8 + b1253cc commit 53d3987
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 60 deletions.
93 changes: 47 additions & 46 deletions messageDir/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -409,52 +409,53 @@ MODULEPATH directory: "%{mpath}" has too many non-modulefiles (%{regularFn}). Pl
--------------------------------------------------------------------------
-- module help strings
--------------------------------------------------------------------------
StickyM = "Module is Sticky, requires --force to unload or purge",
LoadedM = "Module is loaded",
ExplM = "Experimental",
TstM = "Testing",
ObsM = "Obsolete",

help_hlp = "This help message",
style_hlp = "Site controlled avail style: %{styleA} (default: %{default})",
rt_hlp = "Lmod regression testing",
dbg_hlp = "Program tracing written to stderr",
dbg_hlp2 = "Program tracing written to stderr (where dbglvl is a number 1,2,3)",
pin_hlp = "When doing a restore use specified version, do not follow defaults",
avail_hlp = "List default modules only when used with avail",
quiet_hlp = "Do not print out warnings",
exprt_hlp = "Expert mode",
terse_hlp = "Write out in machine readable format for commands: list, avail, spider, savelist",
initL_hlp = "loading Lmod for first time in a user shell",
location_H = "Just print the file location when using show ",
latest_H = "Load latest (ignore default)",
cache_hlp = "Treat the cache file(s) as out-of-date",
novice_H = "Turn off expert and quiet flag",
raw_hlp = "Print modulefile in raw output when used with show",
width_hlp = "Use this as max term width",
v_hlp = "Print version info and quit",
rexp_hlp = "use regular expression match",
gitV_hlp = "Dump git version in a machine readable way and quit",
dumpV_hlp = "Dump version in a machine readable way and quit",
chkSyn_H = "Checking module command syntax: do not load",
config_H = "Report Lmod Configuration",
miniConfig_H = "Report Lmod Configuration differences",
jcnfig_H = "Report Lmod Configuration in json format",
MT_hlp = "Report Module Table State",
timer_hlp = "report run times",
force_hlp = "force removal of a sticky module or save an empty collection",
redirect_H= "Send the output of list, avail, spider to stdout (not stderr)",
nrdirect_H= "Force output of list, avail and spider to stderr",
hidden_H = "Avail and spider will report hidden modules",
spdrT_H = "a timeout for spider",
trace_T = "trace major changes such as loads",
nx_T = "Do not print extensions",

Where = "\n Where:\n",
Inactive = "\nInactive Modules",
DefaultM = "Default Module",
HiddenM = "Hidden Module",
Extension = "Extension that is provided by another module",
StickyM = "Module is Sticky, requires --force to unload or purge",
LoadedM = "Module is loaded",
ExplM = "Experimental",
TstM = "Testing",
ObsM = "Obsolete",

MT_hlp = "Report Module Table State",
avail_hlp = "List default modules only when used with avail",
cache_hlp = "Treat the cache file(s) as out-of-date",
chkSyn_H = "Checking module command syntax: do not load",
config_H = "Report Lmod Configuration",
dbg_hlp = "Program tracing written to stderr",
dbg_hlp2 = "Program tracing written to stderr (where dbglvl is a number 1,2,3)",
dumpV_hlp = "Dump version in a machine readable way and quit",
exprt_hlp = "Expert mode",
force_hlp = "force removal of a sticky module or save an empty collection",
gitV_hlp = "Dump git version in a machine readable way and quit",
help_hlp = "This help message",
hidden_H = "Avail and spider will report hidden modules",
initL_hlp = "loading Lmod for first time in a user shell",
jcnfig_H = "Report Lmod Configuration in json format",
latest_H = "Load latest (ignore default)",
location_H = "Just print the file location when using show ",
miniConfig_H = "Report Lmod Configuration differences",
novice_H = "Turn off expert and quiet flag",
nrdirect_H = "Force output of list, avail and spider to stderr",
nx_T = "Do not print extensions",
pin_hlp = "When doing a restore use specified version, do not follow defaults",
quiet_hlp = "Do not print out warnings",
raw_hlp = "Print modulefile in raw output when used with show",
redirect_H = "Send the output of list, avail, spider to stdout (not stderr)",
rexp_hlp = "use regular expression match",
rt_hlp = "Lmod regression testing",
spdrT_H = "a timeout for spider",
style_hlp = "Site controlled avail style: %{styleA} (default: %{default})",
terse_hlp = "Write out in machine readable format for commands: list, avail, spider, savelist",
terseShowExt_H = "report extensions when doing a terse avail",
timer_hlp = "report run times",
trace_T = "trace major changes such as loads",
v_hlp = "Print version info and quit",
width_hlp = "Use this as max term width",

Where = "\n Where:\n",
Inactive = "\nInactive Modules",
DefaultM = "Default Module",
HiddenM = "Hidden Module",
Extension = "Extension that is provided by another module",

avail = [==[If the avail list is too long consider trying:
Expand Down
12 changes: 7 additions & 5 deletions rt/help/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.26 2023-06-07 18:16 -05:00
Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00
by Robert McLay [email protected]
===========================
step 2
Expand Down Expand Up @@ -45,6 +45,7 @@ Options:
-T --trace
--nx --no_extensions
--loc --location Just print the file location when using show
--terse_show_extensions
module [options] sub-command [args ...]
Help sub-commands:
help prints this message
Expand Down Expand Up @@ -107,7 +108,7 @@ Lmod Web Sites
SourceForge: https://lmod.sf.net
TACC Homepage: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod
To report a bug please read https://lmod.readthedocs.io/en/latest/075_bug_reporting.html
Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00
Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00
by Robert McLay [email protected]
===========================
step 3
Expand Down Expand Up @@ -150,6 +151,7 @@ Options:
-T --trace
--nx --no_extensions
--loc --location Just print the file location when using show
--terse_show_extensions
module [options] sub-command [args ...]
Help sub-commands:
help prints this message
Expand Down Expand Up @@ -212,7 +214,7 @@ Lmod Web Sites
SourceForge: https://lmod.sf.net
TACC Homepage: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod
To report a bug please read https://lmod.readthedocs.io/en/latest/075_bug_reporting.html
Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00
Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00
by Robert McLay [email protected]
===========================
step 4
Expand All @@ -232,7 +234,7 @@ Version 9
step 5
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --config
===========================
Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00
Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00
by Robert McLay [email protected]
Description Value
Allow root to use Lmod (LMOD_ALLOW_ROOT_USE) yes
Expand Down Expand Up @@ -410,7 +412,7 @@ propT = {
step 6
lua ProjectDIR/src/lmod.in.lua shell --regression_testing --miniConfig
===========================
Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00
Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00
by Robert McLay [email protected]
LMOD_PACKAGE_PATH D nil <empty>
LMOD_SYSTEM_DEFAULT_MODULES D __unknown__ <empty>
Expand Down
5 changes: 3 additions & 2 deletions rt/i18n/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.26 2023-06-07 18:16 -05:00
Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00
by Robert McLay [email protected]
===========================
step 2
Expand Down Expand Up @@ -87,6 +87,7 @@ Options:
-T --trace
--nx --no_extensions
--loc --location Just print the file location when using show
--terse_show_extensions
module [options] sub-command [args ...]
Sous-commandes d'aide :
help affiche ce message
Expand Down Expand Up @@ -149,5 +150,5 @@ Sites web de Lmod
SourceForge: https://lmod.sf.net
TACC Homepage: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod
Pour rapporter un bogue, veuillez lire https://lmod.readthedocs.io/en/latest/075_bug_reporting.html
Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00
Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00
by Robert McLay [email protected]
3 changes: 3 additions & 0 deletions src/Configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ end
-- @param self A Configuration object
-- @return the configuration report in json as a single string.
function M.report_json(self)
require("declare")
declare("loadstring")
loadstring = (_VERSION == "Lua 5.1") and loadstring or load
local json = require("json")
local tbl = self.tbl
local configT = {}
Expand Down
25 changes: 22 additions & 3 deletions src/Hub.lua
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,8 @@ function M.overview(self,argA)
end

availA = regroup_avail_blocks(availStyle, availA)
self:terse_avail(mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, aa)
local providedByT = false
self:terse_avail(mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, providedByT, aa)

local label = ""
local a = {}
Expand Down Expand Up @@ -1056,7 +1057,7 @@ function M.overview(self,argA)
return a
end

function M.terse_avail(self, mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, a)
function M.terse_avail(self, mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, providedByT, a)
dbg.start{"Hub:terse_avail()"}
local mrc = MRC:singleton()
local optionTbl = optionTbl()
Expand Down Expand Up @@ -1110,6 +1111,14 @@ function M.terse_avail(self, mpathA, availA, alias2modT, searchA, showSN, defaul
end
end

-- if providedByT is not false then output

if (providedByT and next(providedByT) ~= nil ) then
end




dbg.fini("Hub:terse_avail")
return a
end
Expand Down Expand Up @@ -1180,7 +1189,17 @@ function M.avail(self, argA)
if (optionTbl.terse) then
--------------------------------------------------
-- Terse output
self:terse_avail(mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, a)
local spiderT = false
local dbT = false
local mpathMapT = false
local providedByT = false
if (optionTbl.terseShowExtensions) then
local cache = Cache:singleton{buildCache=true}
spiderT,dbT, mpathMapT, providedByT = cache:build()
end

self:terse_avail(mpathA, availA, alias2modT, searchA, showSN,
defaultOnly, defaultT, providedByT, a)

dbg.fini("Hub:avail")
return a
Expand Down
7 changes: 7 additions & 0 deletions src/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,13 @@ function M.singleton(self, usage)
default = 0.0
}

cmdlineParser:add_option{
name = {"--terse_show_extensions"},
dest = "terseShowExtensions",
action = "store_true",
help = i18n("terseShowExt"),
}

local optTbl, pargs = cmdlineParser:parse(arg)
local optionTbl = optionTbl()
optionTbl.pargs = pargs
Expand Down
3 changes: 3 additions & 0 deletions src/chkJson
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ package.cpath = LuaCommandName_dir .. "../lib/?.so;"..

require("strict")
require("serializeTbl")
require("declare")
declare("loadstring")
loadstring = (_VERSION == "Lua 5.1") and loadstring or load
local Dbg = require("Dbg")
local json = require("json")

Expand Down
9 changes: 9 additions & 0 deletions src/spider.in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ require("modfuncs")
require("cmdfuncs")
require("deepcopy")
require("parseVersion")
require("declare")
MainControl = require("MainControl")
Cache = require("Cache")
MRC = require("MRC")
Expand Down Expand Up @@ -342,6 +343,8 @@ end

local function l_rptReverseMapTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)
dbg.start{ "l_rptReverseMapTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)"}
declare("loadstring")
loadstring = (_VERSION == "Lua 5.1") and loadstring or load
local json = require("json")
local reverseMapT = l_buildReverseMapT(dbT)
local libA = l_buildLibMapA(reverseMapT)
Expand All @@ -354,6 +357,8 @@ end

local function l_rptXALTRmapTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)
dbg.start{ "l_rptXALTRmapTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)"}
declare("loadstring")
loadstring = (_VERSION == "Lua 5.1") and loadstring or load
local json = require("json")
local reverseMapT = l_buildReverseMapT(dbT)
local libA = l_buildLibMapA(reverseMapT)
Expand All @@ -366,6 +371,8 @@ end

local function l_rptSoftwarePageJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)
dbg.start{ "l_rptSoftwarePageJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)"}
declare("loadstring")
loadstring = (_VERSION == "Lua 5.1") and loadstring or load
local json = require("json")
local spA = softwarePage(dbT)
print(json.encode(spA))
Expand Down Expand Up @@ -399,6 +406,8 @@ end

local function l_rptDbTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)
dbg.start{ "l_rptDbTJson(mpathMapT, spiderT, timestampFn, dbT, providedByT)"}
declare("loadstring")
loadstring = (_VERSION == "Lua 5.1") and loadstring or load
local json = require("json")
print(json.encode(dbT))
dbg.fini("l_rptDbTJson")
Expand Down
8 changes: 4 additions & 4 deletions tools/json.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
-----------------------------------------------------------------------------
-- Imports and dependencies
-----------------------------------------------------------------------------
local math = require('math')
local string = require("string")
local table = require("table")
local load = (_VERSION == "Lua 5.1") and loadstring or load
local math = require('math')
local string = require("string")
local table = require("table")
local load = (_VERSION == "Lua 5.1") and loadstring or load

-----------------------------------------------------------------------------
-- Module declaration
Expand Down

0 comments on commit 53d3987

Please sign in to comment.