diff --git a/Makefile b/Makefile index 9447f080..f22888d5 100644 --- a/Makefile +++ b/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};\ diff --git a/tcl/interp.tcl.in b/tcl/interp.tcl.in index 2ae632dd..3f7b66e9 100644 --- a/tcl/interp.tcl.in +++ b/tcl/interp.tcl.in @@ -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 } diff --git a/tcl/modfind.tcl.in b/tcl/modfind.tcl.in index c993d193..225fb338 100644 --- a/tcl/modfind.tcl.in +++ b/tcl/modfind.tcl.in @@ -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 diff --git a/tcl/modscan.tcl b/tcl/modscan.tcl index 4d257224..eef0aa76 100644 --- a/tcl/modscan.tcl +++ b/tcl/modscan.tcl @@ -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} { diff --git a/tcl/modspec.tcl b/tcl/modspec.tcl index 78baa505..7e4de25d 100644 --- a/tcl/modspec.tcl +++ b/tcl/modspec.tcl @@ -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]