Skip to content

Commit

Permalink
Adding non-main branch name to version report on lmod and settarg and…
Browse files Browse the repository at this point in the history
… spider commands
  • Loading branch information
Robert McLay committed Feb 28, 2024
1 parent dc1afc4 commit 1d1f6ab
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 101 deletions.
18 changes: 7 additions & 11 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ LEGACY_ORDERING := @LEGACY_ORDERING@
EXPORT_MODULE := @EXPORT_MODULE@
BASENAME := @BASENAME@
UPDATE_VERSION := LUA_PATH="$(srcdir)/tools/?.lua;$$LUA_PATH;;" $(srcdir)/proj_mgmt/updateVersion
BUILD_V_src := LUA_PATH="$(srcdir)/tools/?.lua;$$LUA_PATH;;" $(srcdir)/proj_mgmt/buildVersion_src
BUILD_V_src := LUA_PATH="$(srcdir)/tools/?.lua;$(SYS_LUA_PATH)" LUA_CPATH="$(SYS_LUA_CPATH)" $(srcdir)/proj_mgmt/buildVersion_src
PS := @PS@
READLINK := @READLINK@
EXPR := @EXPR@
Expand Down Expand Up @@ -105,7 +105,6 @@ LMOD_MF := $(MY_PACKAGE)/modulefiles/Core
MAN_PAGES := $(MY_PACKAGE)/share/man/cat1
LMOD_MF_SOURCE := $(patsubst %, $(srcdir)/%, MF/*.version.lua)
SETTARG_SOURCE := $(patsubst %, $(srcdir)/%, settarg/*.lua settarg/targ.in)
SETTARG_SOURCE := $(filter-out $(srcdir)/settarg/Version.lua, $(SETTARG_SOURCE))
DATE_cmd := $(srcdir)/proj_mgmt/DATE_cmd.sh
UNAME_S := $(shell uname -s)
MODE := @MODE@
Expand Down Expand Up @@ -247,6 +246,9 @@ echo:
@echo Version: $(version)
@echo GIT_VERSION: $(GIT_VERSION)
@echo GIT_BRANCH: $(GIT_BRANCH)
@echo "SETTARG_SRC: " $(SETTARG_SRC)
@echo "SETTARG_SOURCE: " $(SETTARG_SOURCE)
@echo "\$(srcdir)/settarg/Version.lua: " $(srcdir)/settarg/Version.lua
man_pages: $(DESTDIR)$(MAN_PAGES)
LUA_CPATH='$(MY_PACKAGE)/lib/?.so;$(SYS_LUA_CPATH);;' \
LUA_PATH='$(MY_PACKAGE)/libexec/?.lua;$(SYS_LUA_PATH);;' \
Expand Down Expand Up @@ -545,16 +547,10 @@ libexec: $(lua_code)
$(MAKE) FILELIST="$^" DIRLOC=$(DESTDIR)$(LIBEXEC) GIT_VERSION=$(GIT_VERSION) __installMe

VersionSrc:
echo LUA_PATH: $$LUA_PATH
echo LUA_CPATH: $$LUA_CPATH
$(BUILD_V_src) -b $(GIT_BRANCH) -t $(version) -g $(GIT_VERSION) \
-d $(VDATE) > $(DESTDIR)$(LIBEXEC)/Version.lua

STVersionSrc:
$(BUILD_V_src) -b $(GIT_BRANCH) -t $(version) -g $(GIT_VERSION) \
-d $(VDATE) > $(DESTDIR)$(SETTARG)/Version.luaSTVersionSrc

$(BUILD_V_src) $(GIT_BRANCH) $(version) $(GIT_VERSION) "$(VDATE)" > $(DESTDIR)$(LIBEXEC)/Version.lua

STVersionSrc: Inst_Settarg
$(BUILD_V_src) $(GIT_BRANCH) $(version) $(GIT_VERSION) "$(VDATE)" > $(DESTDIR)$(SETTARG)/Version.lua

Inst_Tools: $(TOOL_SRC)
$(MAKE) FILELIST="$^" DIRLOC=$(DESTDIR)$(TOOLS) GIT_VERSION=$(GIT_VERSION) __installMe
Expand Down
4 changes: 2 additions & 2 deletions build.rtm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ parallel_make_install()
fi

if [ "$BUILD_TYPE" != "EXPERIMENTAL" ]; then
echo "$SUDO $MAKE GIT_VERSION=$GIT_VERSION install $MAKE_EXTRA"
$SUDO $MAKE GIT_VERSION=$GIT_VERSION install $MAKE_EXTRA
echo "$SUDO $MAKE -j GIT_VERSION=$GIT_VERSION install $MAKE_EXTRA"
$SUDO $MAKE -j GIT_VERSION=$GIT_VERSION install $MAKE_EXTRA
else
echo "$SUDO $MAKE pre-install $MAKE_EXTRA"
$SUDO $MAKE GIT_VERSION=$GIT_VERSION -j pre-install $MAKE_EXTRA
Expand Down
71 changes: 6 additions & 65 deletions proj_mgmt/buildVersion_src
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
-- -*- lua -*-

Version = "0.0"
_G._DEBUG = false
local posix = require("posix")

local Optiks = require("Optiks")
local dbg = require("Dbg"):dbg()
local s_mTbl = {}

function mTbl()
Expand Down Expand Up @@ -43,69 +38,15 @@ function buildVersionCode(branch, tag, gittag, dateStr)
return table.concat(a,"\n")
end


-- This function forces the option parser to write to stderr instead of
-- stdout.
local function l_prt(...)
stderr:write(...)
end


--------------------------------------------------------------------------
-- This function prevents the option parser from exiting when it finds an
-- error.
local function l_nothing()
end

function main()
options()
local mTbl = mTbl()
print("branch: ",mTbl.branch)
local s = buildVersionCode(mTbl.branch, mTbl.tag, mTbl.gittag, mTbl.vdate)
print (s)
end

function options()
local mTbl = mTbl()
local usage = "Usage: buildVersion.lua --branch branch --tag tag --gittag gittag --vdate dateStr outfile"
local cmdlineParser = Optiks:new{usage=usage,
error=l_nothing,
exit=l_nothing,
prt=l_prt,
version=Version}

cmdlineParser:add_option{
name = {'-v','--verbose'},
dest = 'verbosityLevel',
action = 'count',
}
cmdlineParser:add_option{
name = {'-b','--branch'},
dest = 'branch',
action = 'store',
}
cmdlineParser:add_option{
name = {'-t','--tag'},
dest = 'tag',
action = 'store',
}
cmdlineParser:add_option{
name = {'-g','--gittag'},
dest = 'gittag',
action = 'store',
}
cmdlineParser:add_option{
name = {'-d','--vdate'},
dest = 'vdate',
action = 'store',
}
local optionTbl, pargs = cmdlineParser:parse(arg)

for v in pairs(optionTbl) do
mTbl[v] = optionTbl[v]
end
mTbl.pargs = pargs
local branch = arg[1]
local tag = arg[2]
local gittag = arg[3]
local vdate = arg[4]

local s = buildVersionCode(branch, tag, gittag, vdate)
print (s)
end

main()
2 changes: 1 addition & 1 deletion rt/dbT/err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ lua ProjectDIR/src/lmod.in.lua shell --regression_testing --show_hidden av
ProjectDIR/rt/dbT/mf3
foobar/1.2.3 (H)
ProjectDIR/rt/dbT/mf4
bar/2.3 (H) newdir/1.0 (L)
newdir/1.0 (L)
Where:
H: Hidden Module
L: Module is loaded
Expand Down
1 change: 0 additions & 1 deletion rt/dbT/mf4/bar/.modulerc.lua

This file was deleted.

1 change: 0 additions & 1 deletion rt/dbT/mf4/bar/2.3.lua

This file was deleted.

20 changes: 0 additions & 20 deletions rt/dbT/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ timestampFn = {
false,
}
dbT = {
bar = {
["ProjectDIR/rt/dbT/mf4/bar/2.3.lua"] = {
Version = "2.3",
fullName = "bar/2.3",
hidden = true,
mpath = "ProjectDIR/rt/dbT/mf4",
pV = "000000002.000000003.*zfinal",
wV = "000000002.000000003.*zfinal",
},
},
foobar = {
["ProjectDIR/rt/dbT/mf3/foobar/1.2.3.lua"] = {
Version = "1.2.3",
Expand Down Expand Up @@ -98,16 +88,6 @@ timestampFn = {
false,
}
dbT = {
bar = {
["ProjectDIR/rt/dbT/mf4/bar/2.3.lua"] = {
Version = "2.3",
fullName = "bar/2.3",
hidden = true,
mpath = "ProjectDIR/rt/dbT/mf4",
pV = "000000002.000000003.*zfinal",
wV = "000000002.000000003.*zfinal",
},
},
foobar = {
["ProjectDIR/rt/dbT/mf3/foobar/1.2.3.lua"] = {
Version = "1.2.3",
Expand Down
21 changes: 21 additions & 0 deletions src/spider.in.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ BaseShell = require("BaseShell")
Shell = false
local Optiks = require("Optiks")
local Spider = require("Spider")
local Version = require("Version")
local concatTbl = table.concat
local cosmic = require("Cosmic"):singleton()
local dbg = require("Dbg"):dbg()
Expand Down Expand Up @@ -221,6 +222,14 @@ local function l_add2map(entry, tbl, dirA, moduleFn, kind, rmapT)
dbg.fini("l_add2map")
end

--------------------------------------------------------------------------
-- Build the version string.
function l_version()
local v = {}
v[#v + 1] = "\nModules based on Lua: Version " .. Version.name().."\n"
v[#v + 1] = " by Robert McLay [email protected]\n\n"
return concatTbl(v,"")
end
--------------------------------------------------------------------------
--
-- @param moduleDirA
Expand Down Expand Up @@ -437,6 +446,11 @@ function main()

local hub = Hub:singleton(false)

if (optionTbl.version) then
io.stderr:write(version())
os.exit(0)
end

for _, v in ipairs(pargs) do
for path in v:split(":") do
local my_path = path_regularize(path)
Expand Down Expand Up @@ -632,6 +646,13 @@ function options()
prt = l_prt,
}

cmdlineParser:add_option{
name = {'-v','--version'},
dest = 'version',
action = 'store_true',
help = "Version info",
}

cmdlineParser:add_option{
name = {'-D'},
dest = 'debug',
Expand Down

0 comments on commit 1d1f6ab

Please sign in to comment.