From 1d1f6ab5ed86b1c0537dece9b893670b3d77cacf Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Wed, 28 Feb 2024 11:12:28 -0600 Subject: [PATCH] Adding non-main branch name to version report on lmod and settarg and spider commands --- Makefile.in | 18 ++++----- build.rtm | 4 +- proj_mgmt/buildVersion_src | 71 +++--------------------------------- rt/dbT/err.txt | 2 +- rt/dbT/mf4/bar/.modulerc.lua | 1 - rt/dbT/mf4/bar/2.3.lua | 1 - rt/dbT/out.txt | 20 ---------- src/spider.in.lua | 21 +++++++++++ 8 files changed, 37 insertions(+), 101 deletions(-) delete mode 100644 rt/dbT/mf4/bar/.modulerc.lua delete mode 100644 rt/dbT/mf4/bar/2.3.lua diff --git a/Makefile.in b/Makefile.in index 48b912ded..cf68f77d1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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@ @@ -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@ @@ -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);;' \ @@ -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 diff --git a/build.rtm b/build.rtm index 10c851a3d..e49955134 100755 --- a/build.rtm +++ b/build.rtm @@ -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 diff --git a/proj_mgmt/buildVersion_src b/proj_mgmt/buildVersion_src index 47f3cd76a..f025b95b3 100755 --- a/proj_mgmt/buildVersion_src +++ b/proj_mgmt/buildVersion_src @@ -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() @@ -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() diff --git a/rt/dbT/err.txt b/rt/dbT/err.txt index ed0604eb5..fe428e792 100644 --- a/rt/dbT/err.txt +++ b/rt/dbT/err.txt @@ -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 diff --git a/rt/dbT/mf4/bar/.modulerc.lua b/rt/dbT/mf4/bar/.modulerc.lua deleted file mode 100644 index 05c262c4f..000000000 --- a/rt/dbT/mf4/bar/.modulerc.lua +++ /dev/null @@ -1 +0,0 @@ -hide_version("bar/2.3") diff --git a/rt/dbT/mf4/bar/2.3.lua b/rt/dbT/mf4/bar/2.3.lua deleted file mode 100644 index f6bbfc7ce..000000000 --- a/rt/dbT/mf4/bar/2.3.lua +++ /dev/null @@ -1 +0,0 @@ -setenv("BAR",'bar") diff --git a/rt/dbT/out.txt b/rt/dbT/out.txt index 74dfb66c6..01f614baf 100644 --- a/rt/dbT/out.txt +++ b/rt/dbT/out.txt @@ -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", @@ -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", diff --git a/src/spider.in.lua b/src/spider.in.lua index 4292ca25d..b49c6196a 100644 --- a/src/spider.in.lua +++ b/src/spider.in.lua @@ -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() @@ -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 mclay@tacc.utexas.edu\n\n" + return concatTbl(v,"") +end -------------------------------------------------------------------------- -- -- @param moduleDirA @@ -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) @@ -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',