Skip to content

Commit

Permalink
support for TMOD_LMOD_FIND_FIRST added
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Jun 10, 2017
1 parent f0bff0b commit 8538b88
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 132 deletions.
2 changes: 2 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ANCIENT := @ANCIENT@
ALLOW_TCL_MFILES := @ALLOW_TCL_MFILES@
MPATH_AVAIL := @MPATH_AVAIL@
TMOD_PATH_RULE := @TMOD_PATH_RULE@
TMOD_FIND_FIRST := @TMOD_FIND_FIRST@
CACHED_LOADS := @CACHED_LOADS@
EXACT_MATCH := @EXACT_MATCH@
DUPLICATE_PATHS := @DUPLICATE_PATHS@
Expand Down Expand Up @@ -202,6 +203,7 @@ __installMe:
-e 's|@tclsh@|$(PATH_TO_TCLSH)|g' \
-e 's|@disable_name_autoswap@|$(DISABLE_NAME_AUTOSWAP)|g' \
-e 's|@tmod_path_rule@|$(TMOD_PATH_RULE)|g' \
-e 's|@tmod_find_first@|$(TMOD_FIND_FIRST)|g' \
-e 's|@redirect@|$(REDIRECT)|g' \
-e 's|@basename@|$(BASENAME)|g' \
-e 's|@cached_loads@|$(CACHED_LOADS)|g' \
Expand Down
78 changes: 40 additions & 38 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,46 @@ fi
echo
echo '----------------------------------- SUMMARY ----------------------------------'
echo
echo "Package version.................................." : Lmod-$LmodV
echo "Package version (git) ..........................." : $lmodV
echo
echo "LUA_INCLUDE......................................" : $LUA_INCLUDE
echo "Lua executable..................................." : $luaprog
echo "Luac executable.................................." : $PATH_TO_LUAC
echo "Prefix..........................................." : $prefix
echo "Actual Install dir..............................." : $prefix/lmod/$LmodV
echo
echo "MODULEPATH_ROOT.................................." : $MODULEPATH_ROOT
echo "Wait (s) before rebuilding cache................." : $ANCIENT
echo "Allow Duplicate Paths............................" : $DUPLICATE_PATHS
echo "Do not save Cache if build time < ..............." : $SHORT_TIME
echo "SPIDER_CACHE_DIRS................................" : $SPIDER_CACHE_DIRS
echo "Prepending multiple dirs (NORMAL / REVERSED)....." : $PREPEND_BLOCK
echo "Colorized output supported......................." : $COLORIZE
echo "File that is touched when system is updated......" : $UPDATE_SYSTEM_FN
echo "Allow duplicate entry in PATHs..................." : $DUPLICATE_PATHS
echo "Allow tcl modulefiles............................" : $ALLOW_TCL_MFILES
echo "ZSH Tab Completion Functions Site Directory......" : $ZSH_SITE_FUNCTIONS_DIRS
echo "Use Dot files in ~/.lmod.d......................." : $USE_DOT_FILES
echo "Full Settarg support............................." : $SETTARG
echo "Have lua-term...................................." : $HAVE_LUA_TERM
echo "Have lua-json...................................." : $HAVE_LUA_JSON
echo "Support Auto Swap when using families............" : $AUTO_SWAP
echo "Export the module shell function in Bash........." : $EXPORT_MODULE
echo "Disable same name autoswapping..................." : $DISABLE_NAME_AUTOSWAP
echo "Use Spider Cache on Loads........................" : $CACHED_LOADS
echo "Pager used inside Lmod..........................." : $PATH_TO_PAGER
echo "System LD_PRELOAD................................" : $SYS_LD_PRELOAD
echo "System LD_LIBRARY_PATH..........................." : $SYS_LD_LIB_PATH
echo "Hashsum program used............................." : $PATH_TO_HASHSUM
echo "Site Name........................................" : $SITE_NAME
echo "SYSHOST.........................................." : $SYSHOST
echo "Site Message file................................" : $SITE_MSG_FILE
echo 'Override $LANG Language for error etc............' : $LMOD_OVERRIDE_LANG
echo "Which LuaFileSystem is being used................" : $LFS_STATUS
echo 'Use italic instead of faint for hidden modules...' : $HIDDEN_ITALIC
echo "Package version............................................." : Lmod-$LmodV
echo "Package version (git) ......................................" : $lmodV
echo
echo "LUA_INCLUDE................................................." : $LUA_INCLUDE
echo "Lua executable.............................................." : $luaprog
echo "Luac executable............................................." : $PATH_TO_LUAC
echo "Prefix......................................................" : $prefix
echo "Actual Install dir.........................................." : $prefix/lmod/$LmodV
echo
echo "MODULEPATH_ROOT............................................." : $MODULEPATH_ROOT
echo "Wait (s) before rebuilding cache............................" : $ANCIENT
echo "Allow Duplicate Paths......................................." : $DUPLICATE_PATHS
echo "Do not save Cache if build time < .........................." : $SHORT_TIME
echo "SPIDER_CACHE_DIRS..........................................." : $SPIDER_CACHE_DIRS
echo "Prepending multiple dirs (NORMAL / REVERSED)................" : $PREPEND_BLOCK
echo "Colorized output supported.................................." : $COLORIZE
echo "File that is touched when system is updated................." : $UPDATE_SYSTEM_FN
echo "Allow duplicate entry in PATHs.............................." : $DUPLICATE_PATHS
echo "Allow tcl modulefiles......................................." : $ALLOW_TCL_MFILES
echo "ZSH Tab Completion Functions Site Directory................." : $ZSH_SITE_FUNCTIONS_DIRS
echo "Use Dot files in ~/.lmod.d.................................." : $USE_DOT_FILES
echo "Full Settarg support........................................" : $SETTARG
echo "Have lua-term..............................................." : $HAVE_LUA_TERM
echo "Have lua-json..............................................." : $HAVE_LUA_JSON
echo "Support Auto Swap when using families......................." : $AUTO_SWAP
echo "Export the module shell function in Bash...................." : $EXPORT_MODULE
echo "Disable same name autoswapping.............................." : $DISABLE_NAME_AUTOSWAP
echo "Use Spider Cache on Loads..................................." : $CACHED_LOADS
echo "Pager used inside Lmod......................................" : $PATH_TO_PAGER
echo "System LD_PRELOAD..........................................." : $SYS_LD_PRELOAD
echo "System LD_LIBRARY_PATH......................................" : $SYS_LD_LIB_PATH
echo "Hashsum program used........................................" : $PATH_TO_HASHSUM
echo "Site Name..................................................." : $SITE_NAME
echo "SYSHOST....................................................." : $SYSHOST
echo "Site Message file..........................................." : $SITE_MSG_FILE
echo 'Override $LANG Language for error etc.......................' : $LMOD_OVERRIDE_LANG
echo "Which LuaFileSystem is being used..........................." : $LFS_STATUS
echo 'Use italic instead of faint for hidden modules..............' : $HIDDEN_ITALIC
echo "If path entry is already there then don't prepend..........." : $TMOD_PATH_RULE
echo "Use Tmod Find First rule instead of Find Best for defaults.." : $TMOD_FIND_FIRST
echo
Expand Down
101 changes: 65 additions & 36 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ SYS_LD_PRELOAD
SYS_LD_LIB_PATH
CACHED_LOADS
LUA_INCLUDE
TMOD_FIND_FIRST
TMOD_PATH_RULE
PIN_VERSIONS
IGNORE_DIRS
Expand Down Expand Up @@ -711,6 +712,7 @@ with_settarg
with_ignoreDirs
with_pinVersions
with_tmodPathRule
with_tmodFindFirst
with_lua_include
with_cachedLoads
'
Expand Down Expand Up @@ -1378,6 +1380,9 @@ Optional Packages:
changing with the default.[[no]]
--with-tmodPathRule=ans If path entry is already there then do not
append/prepend.[[no]]
--with-tmodFindFirst=ans
Use Tmod Find First rule instead of Find Best for
defaults.[[no]]
--with-lua_include=ans Save/Restore will use the current version instead of
changing with the default.[[no]]
--with-cachedLoads=ans Use cache when loading modules. [[no]]
Expand Down Expand Up @@ -3251,6 +3256,28 @@ fi
# Check whether --with-tmodFindFirst was given.
if test "${with_tmodFindFirst+set}" = set; then :
withval=$with_tmodFindFirst; TMOD_FIND_FIRST="$withval"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: TMOD_FIND_FIRST=$with_tmodFindFirst" >&5
$as_echo "TMOD_FIND_FIRST=$with_tmodFindFirst" >&6; }
cat >>confdefs.h <<_ACEOF
#define TMOD_FIND_FIRST "$with_tmodFindFirst"
_ACEOF
else
withval="NO"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: TMOD_FIND_FIRST=$withval" >&5
$as_echo "TMOD_FIND_FIRST=$withval" >&6; }
TMOD_FIND_FIRST="$withval"
cat >>confdefs.h <<_ACEOF
#define TMOD_FIND_FIRST "$withval"
_ACEOF
fi
# Check whether --with-lua_include was given.
if test "${with_lua_include+set}" = set; then :
withval=$with_lua_include; LUA_INCLUDE="$withval"
Expand Down Expand Up @@ -5300,44 +5327,46 @@ fi
echo
echo '----------------------------------- SUMMARY ----------------------------------'
echo
echo "Package version.................................." : Lmod-$LmodV
echo "Package version (git) ..........................." : $lmodV
echo "Package version............................................." : Lmod-$LmodV
echo "Package version (git) ......................................" : $lmodV
echo
echo "LUA_INCLUDE......................................" : $LUA_INCLUDE
echo "Lua executable..................................." : $luaprog
echo "Luac executable.................................." : $PATH_TO_LUAC
echo "Prefix..........................................." : $prefix
echo "Actual Install dir..............................." : $prefix/lmod/$LmodV
echo "LUA_INCLUDE................................................." : $LUA_INCLUDE
echo "Lua executable.............................................." : $luaprog
echo "Luac executable............................................." : $PATH_TO_LUAC
echo "Prefix......................................................" : $prefix
echo "Actual Install dir.........................................." : $prefix/lmod/$LmodV
echo
echo "MODULEPATH_ROOT.................................." : $MODULEPATH_ROOT
echo "Wait (s) before rebuilding cache................." : $ANCIENT
echo "Allow Duplicate Paths............................" : $DUPLICATE_PATHS
echo "Do not save Cache if build time < ..............." : $SHORT_TIME
echo "SPIDER_CACHE_DIRS................................" : $SPIDER_CACHE_DIRS
echo "Prepending multiple dirs (NORMAL / REVERSED)....." : $PREPEND_BLOCK
echo "Colorized output supported......................." : $COLORIZE
echo "File that is touched when system is updated......" : $UPDATE_SYSTEM_FN
echo "Allow duplicate entry in PATHs..................." : $DUPLICATE_PATHS
echo "Allow tcl modulefiles............................" : $ALLOW_TCL_MFILES
echo "ZSH Tab Completion Functions Site Directory......" : $ZSH_SITE_FUNCTIONS_DIRS
echo "Use Dot files in ~/.lmod.d......................." : $USE_DOT_FILES
echo "Full Settarg support............................." : $SETTARG
echo "Have lua-term...................................." : $HAVE_LUA_TERM
echo "Have lua-json...................................." : $HAVE_LUA_JSON
echo "Support Auto Swap when using families............" : $AUTO_SWAP
echo "Export the module shell function in Bash........." : $EXPORT_MODULE
echo "Disable same name autoswapping..................." : $DISABLE_NAME_AUTOSWAP
echo "Use Spider Cache on Loads........................" : $CACHED_LOADS
echo "Pager used inside Lmod..........................." : $PATH_TO_PAGER
echo "System LD_PRELOAD................................" : $SYS_LD_PRELOAD
echo "System LD_LIBRARY_PATH..........................." : $SYS_LD_LIB_PATH
echo "Hashsum program used............................." : $PATH_TO_HASHSUM
echo "Site Name........................................" : $SITE_NAME
echo "SYSHOST.........................................." : $SYSHOST
echo "Site Message file................................" : $SITE_MSG_FILE
echo 'Override $LANG Language for error etc............' : $LMOD_OVERRIDE_LANG
echo "Which LuaFileSystem is being used................" : $LFS_STATUS
echo 'Use italic instead of faint for hidden modules...' : $HIDDEN_ITALIC
echo "MODULEPATH_ROOT............................................." : $MODULEPATH_ROOT
echo "Wait (s) before rebuilding cache............................" : $ANCIENT
echo "Allow Duplicate Paths......................................." : $DUPLICATE_PATHS
echo "Do not save Cache if build time < .........................." : $SHORT_TIME
echo "SPIDER_CACHE_DIRS..........................................." : $SPIDER_CACHE_DIRS
echo "Prepending multiple dirs (NORMAL / REVERSED)................" : $PREPEND_BLOCK
echo "Colorized output supported.................................." : $COLORIZE
echo "File that is touched when system is updated................." : $UPDATE_SYSTEM_FN
echo "Allow duplicate entry in PATHs.............................." : $DUPLICATE_PATHS
echo "Allow tcl modulefiles......................................." : $ALLOW_TCL_MFILES
echo "ZSH Tab Completion Functions Site Directory................." : $ZSH_SITE_FUNCTIONS_DIRS
echo "Use Dot files in ~/.lmod.d.................................." : $USE_DOT_FILES
echo "Full Settarg support........................................" : $SETTARG
echo "Have lua-term..............................................." : $HAVE_LUA_TERM
echo "Have lua-json..............................................." : $HAVE_LUA_JSON
echo "Support Auto Swap when using families......................." : $AUTO_SWAP
echo "Export the module shell function in Bash...................." : $EXPORT_MODULE
echo "Disable same name autoswapping.............................." : $DISABLE_NAME_AUTOSWAP
echo "Use Spider Cache on Loads..................................." : $CACHED_LOADS
echo "Pager used inside Lmod......................................" : $PATH_TO_PAGER
echo "System LD_PRELOAD..........................................." : $SYS_LD_PRELOAD
echo "System LD_LIBRARY_PATH......................................" : $SYS_LD_LIB_PATH
echo "Hashsum program used........................................" : $PATH_TO_HASHSUM
echo "Site Name..................................................." : $SITE_NAME
echo "SYSHOST....................................................." : $SYSHOST
echo "Site Message file..........................................." : $SITE_MSG_FILE
echo 'Override $LANG Language for error etc.......................' : $LMOD_OVERRIDE_LANG
echo "Which LuaFileSystem is being used..........................." : $LFS_STATUS
echo 'Use italic instead of faint for hidden modules..............' : $HIDDEN_ITALIC
echo "If path entry is already there then don't prepend..........." : $TMOD_PATH_RULE
echo "Use Tmod Find First rule instead of Find Best for defaults.." : $TMOD_FIND_FIRST
echo
Expand Down
12 changes: 12 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,18 @@ AC_ARG_WITH(tmodPathRule,
TMOD_PATH_RULE="$withval"
AC_DEFINE_UNQUOTED(TMOD_PATH_RULE, "$withval"))dnl

AC_SUBST(TMOD_FIND_FIRST)
AC_ARG_WITH(tmodFindFirst,
AC_HELP_STRING([--with-tmodFindFirst=ans],[Use Tmod Find First rule instead of Find Best for defaults.[[no]]]),
TMOD_FIND_FIRST="$withval"
AC_MSG_RESULT([TMOD_FIND_FIRST=$with_tmodFindFirst])
AC_DEFINE_UNQUOTED(TMOD_FIND_FIRST, "$with_tmodFindFirst")dnl
,
withval="NO"
AC_MSG_RESULT([TMOD_FIND_FIRST=$withval])
TMOD_FIND_FIRST="$withval"
AC_DEFINE_UNQUOTED(TMOD_FIND_FIRST, "$withval"))dnl

AC_SUBST(LUA_INCLUDE)
AC_ARG_WITH(lua_include,
AC_HELP_STRING([--with-lua_include=ans],[Save/Restore will use the current version instead of changing with the default.[[no]]]),
Expand Down
2 changes: 2 additions & 0 deletions src/Configuration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ local function new(self)
local case_ind_sorting = cosmic:value("LMOD_CASE_INDEPENDENT_SORTING")
local disable1N = cosmic:value("LMOD_DISABLE_SAME_NAME_AUTOSWAP")
local tmod_rule = cosmic:value("LMOD_TMOD_PATH_RULE")
local find_first = cosmic:value("LMOD_TMOD_FIND_FIRST")
local exactMatch = cosmic:value("LMOD_EXACT_MATCH")
local cached_loads = cosmic:value("LMOD_CACHED_LOADS")
local ignore_cache = cosmic:value("LMOD_IGNORE_CACHE") and "yes" or "no"
Expand Down Expand Up @@ -221,6 +222,7 @@ local function new(self)
tbl.tm_ancient = { k = "User cache valid time(sec)" , v = ancient, }
tbl.tm_short = { k = "Write cache after (sec)" , v = shortTime, }
tbl.tm_threshold = { k = "Threshold (sec)" , v = threshold, }
tbl.tmod_find1st = { k = "Tmod find first rule" , v = find_first, }
tbl.tmod_rule = { k = "Tmod prepend PATH Rule" , v = tmod_rule, }
tbl.tracing = { k = "Tracing" , v = tracing, }
tbl.uname = { k = "uname -a" , v = uname, }
Expand Down
9 changes: 3 additions & 6 deletions src/ModuleA.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ local getenv = os.getenv
local s_moduleA = false
local sort = table.sort
local exact_match = cosmic:value("LMOD_EXACT_MATCH")
local find_first = cosmic:value("LMOD_TMOD_FIND_FIRST")

-- print(__FILE__() .. ':' .. __LINE__())
----------------------------------------------------------------------
Expand Down Expand Up @@ -499,7 +500,7 @@ local function build_from_spiderT(spiderT)
local mt = frameStk:mt()
local mpathA = mt:modulePathA()
local moduleA = {}
local isNV = true
local isNV = find_first == "no"
for i = 1, #mpathA do
local mpath = mpathA[i]
if (isDir(mpath)) then
Expand All @@ -515,10 +516,6 @@ local function build_from_spiderT(spiderT)
return moduleA, not isNV
end





------------------------------------------------------------
-- This routine updates the self.__moduleA array when
-- MODULEPATH changes. It has to know about how the Ctor
Expand Down Expand Up @@ -594,7 +591,7 @@ function M.__new(self, mpathA, maxdepthT, moduleRCT, spiderT)

local dirTree = false
self.__index = self
o.__isNVV = false
o.__isNVV = (find_first ~= "no")
spiderT = spiderT or {}
if (next(spiderT) ~= nil) then
o.__spiderBuilt = true
Expand Down
Loading

0 comments on commit 8538b88

Please sign in to comment.