mirror of
https://github.com/envmodules/modules.git
synced 2026-05-30 00:12:31 +08:00
Insert provided-aliases in module search result
If provided-alias are requested, include them in the module search result. Aliases defined with "provide" and "family" modulefile commands are considered provided-aliases. This change requires to perform the modulefile scan evaluation during step #1 of getModules (gathering of entries) instead of step #4. Provided-aliases are then inserted right after to be part of step #2 and step #3 checks. Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
This commit is contained in:
1
Makefile
1
Makefile
@@ -1113,6 +1113,7 @@ tcl/syntaxdb.tcl: modulecmd.tcl $(NAGELFAR)
|
||||
set ::syntax(lprepend) {n x*};\
|
||||
set ::syntax(execute-modulefile) {x x n x x x? x? x?};\
|
||||
set ::syntax(scanExtraMatchSearch) {x x n};\
|
||||
set ::syntax(insertProvidedAliases) {x n};\
|
||||
set ::syntax(filterExtraMatchSearch) {x x n n};\
|
||||
set ::syntax(findModulesFromDirsAndFiles) {x x x x n n? n? n? n?};\
|
||||
set ::syntax(getArrayKey) {n x x};\
|
||||
|
||||
@@ -110,7 +110,7 @@ complete {complete complete-un reportCmd nop nop
|
||||
conflict {conflict nop reportCmd nop nop nop nop conflict-sc }
|
||||
depends-on {prereqAllModfileCmd nop reportCmd nop nop nop nop prereq-all-sc}
|
||||
depends-on-any {prereqAnyModfileCmd nop reportCmd nop nop nop nop prereq-sc }
|
||||
extensions {provide nop reportCmd nop nop nop nop nop }
|
||||
extensions {provide nop reportCmd nop nop nop nop provide-sc }
|
||||
family {family family-un reportCmd nop nop nop nop family-sc }
|
||||
haveDynamicMPATH {nop nop nop nop nop nop nop nop }
|
||||
hide-modulefile {hide-modulefile hide-modulefile hide-modulefile hide-modulefile hide-modulefile hide-modulefile nop nop }
|
||||
@@ -133,7 +133,7 @@ prepend-path {prepend-path prepend-path-un prepend-path prepend-path prep
|
||||
prereq-all {prereqAllModfileCmd nop reportCmd nop nop nop nop prereq-all-sc}
|
||||
prereq-any {prereqAnyModfileCmd nop reportCmd nop nop nop nop prereq-sc }
|
||||
prereq {prereqAnyModfileCmd nop reportCmd nop nop nop nop prereq-sc }
|
||||
provide {provide nop reportCmd nop nop nop nop nop }
|
||||
provide {provide nop reportCmd nop nop nop nop provide-sc }
|
||||
pushenv {pushenv pushenv-un pushenv pushenv pushenv pushenv-wh nop pushenv-sc }
|
||||
remove-path {remove-path remove-path-un remove-path remove-path remove-path edit-path-wh nop edit-path-sc}
|
||||
remove-property {nop nop nop nop nop nop nop nop }
|
||||
|
||||
@@ -3181,7 +3181,16 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
|
||||
}
|
||||
}
|
||||
|
||||
# Phase #3: filter-out dynamically hidden or expired elements
|
||||
# Phase #3: scan modulefiles if extra match search is needed
|
||||
|
||||
if {$ems_required} {
|
||||
scanExtraMatchSearch $dir $mod found_list
|
||||
if {[isEltInReport provided-alias 0]} {
|
||||
insertProvidedAliases $dir found_list
|
||||
}
|
||||
}
|
||||
|
||||
# Phase #4: filter-out dynamically hidden or expired elements
|
||||
|
||||
# define module name and version comparison procs
|
||||
defineModStartNbProc $icase
|
||||
@@ -3237,7 +3246,7 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
|
||||
}
|
||||
}
|
||||
|
||||
# Phase #4: elaborate directory content with default element selection
|
||||
# Phase #5: elaborate directory content with default element selection
|
||||
|
||||
array set dir_list {}
|
||||
array set autosym_list {}
|
||||
@@ -3305,18 +3314,13 @@ proc getModules {dir {mod {}} {fetch_mtime 0} {search {}} {filter {}}} {
|
||||
}
|
||||
}
|
||||
|
||||
# Phase #5: perform extra match search
|
||||
# Phase #6: perform extra match search filtering
|
||||
|
||||
if {$ems_required} {
|
||||
scanExtraMatchSearch $dir $mod found_list
|
||||
filterExtraMatchSearch $dir $mod found_list versmod_list
|
||||
}
|
||||
|
||||
# ensure modEqStatic is defined as expected (could have been redefined
|
||||
# during scan evaluation)
|
||||
defineModEqStaticProc $icase [getConf extended_default] $mod
|
||||
|
||||
# Phase #6: filter results to keep those matching search query
|
||||
# Phase #7: filter results to keep those matching search query
|
||||
|
||||
# define module name and version comparison procs
|
||||
defineDoesModMatchAtDepthProc $contains $querydepth $mtest
|
||||
|
||||
@@ -124,7 +124,16 @@ proc family-sc {name} {
|
||||
if {![string length $name] || ![regexp {^[A-Za-z0-9_]*$} $name]} {
|
||||
knerror "Invalid family name '$name'"
|
||||
}
|
||||
recordScanModuleElt $name family
|
||||
recordScanModuleElt $name family provided-alias
|
||||
}
|
||||
|
||||
proc provide-sc {args} {
|
||||
if {![llength $args]} {
|
||||
knerror {No module specified in argument}
|
||||
}
|
||||
foreach alias $args {
|
||||
recordScanModuleElt $alias provide provided-alias
|
||||
}
|
||||
}
|
||||
|
||||
proc prereq-sc {args} {
|
||||
@@ -367,6 +376,16 @@ proc isExtraMatchSearchRequired {mod} {
|
||||
{avail paths whatis spider}))}]
|
||||
}
|
||||
|
||||
proc insertProvidedAliases {modpath res_arrname} {
|
||||
upvar $res_arrname found_list
|
||||
foreach {alias target_mod} [getScanModuleElt $modpath provided-alias] {
|
||||
if {![info exists found_list($alias)]} {
|
||||
##nagelfar ignore Found constant
|
||||
set found_list($alias) [list alias $target_mod]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# scan modulefiles from currently being built module search result if extra
|
||||
# match search is needed
|
||||
proc scanExtraMatchSearch {modpath mod res_arrname} {
|
||||
|
||||
@@ -1312,9 +1312,10 @@ proc parseModuleSpecificationProcAdvVersSpec {mlspec nonamespec xtspec\
|
||||
# match
|
||||
set xtelt_valid_list [list always-load append-path chdir complete conflict\
|
||||
depends-on depends-on-any envvar family incompat load load-any\
|
||||
prepend-path prereq prereq-all prereq-any pushenv remove-path require\
|
||||
set-alias set-function setenv switch switch-on switch-off tag try-load\
|
||||
uncomplete unload unset-alias unset-function unsetenv use variant]
|
||||
prepend-path prereq prereq-all prereq-any provide provided-alias\
|
||||
pushenv remove-path require set-alias set-function setenv switch\
|
||||
switch-on switch-off tag try-load uncomplete unload unset-alias\
|
||||
unset-function unsetenv use variant]
|
||||
set xtelt_modspec_list [list always-load conflict depends-on\
|
||||
depends-on-any incompat load load-any prereq prereq-all prereq-any\
|
||||
require switch switch-on switch-off try-load unload]
|
||||
|
||||
Reference in New Issue
Block a user