005-init_ts.exp (modules-5.1.1.tar.bz2) | : | 005-init_ts.exp (modules-5.2.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 38 | skipping to change at line 38 | |||
# Regular expressions matching error and warning outputs | # Regular expressions matching error and warning outputs | |||
# | # | |||
set messages "(\[^(\]+)\[(\]\[0-9\]+\[)\]" | set messages "(\[^(\]+)\[(\]\[0-9\]+\[)\]" | |||
set error_msgs "ERROR" | set error_msgs "ERROR" | |||
set warn_msgs "WARNING" | set warn_msgs "WARNING" | |||
set prob_msgs "$messages:PROB:\[0-9\]+" | set prob_msgs "$messages:PROB:\[0-9\]+" | |||
set verb_msgs "$messages:VERB:\[0-9\]+" | set verb_msgs "$messages:VERB:\[0-9\]+" | |||
set moderr_msgs "Module $error_msgs" | set moderr_msgs "Module $error_msgs" | |||
set info_msgs "INFO" | set info_msgs "INFO" | |||
set timer_msgs TIMER | ||||
# Used as a line separator inside modules | # Used as a line separator inside modules | |||
set modlin "\[-\]+" | set modlin "\[-\]+" | |||
# List of supported shells | # List of supported shells | |||
set sh_shells [list sh bash ksh zsh] | set sh_shells [list sh bash ksh zsh] | |||
set csh_shells [list csh tcsh] | set csh_shells [list csh tcsh] | |||
set real_shells [concat $sh_shells $csh_shells [list fish]] | set real_shells [concat $sh_shells $csh_shells [list fish]] | |||
set other_shells [list tcl cmd perl python ruby lisp cmake r] | set other_shells [list tcl cmd perl python ruby lisp cmake r] | |||
set supported_shells [concat $real_shells $other_shells] | set supported_shells [concat $real_shells $other_shells] | |||
# Common messages | # Common messages | |||
set vers_reportre {Modules Release [0-9a-zA-Z\.\+\-]+ \([0-9\-]{10}\)} | set vers_reportre {Modules Release [0-9a-zA-Z\.\+\-_/]+ \([0-9\-]{10}\)} | |||
set no_loaded {No Modulefiles Currently Loaded.} | set no_loaded {No Modulefiles Currently Loaded.} | |||
set no_matchingloaded {No Matching Modulefiles Currently Loaded.} | set no_matchingloaded {No Matching Modulefiles Currently Loaded.} | |||
set cur_loaded {Currently Loaded Modulefiles:} | set cur_loaded {Currently Loaded Modulefiles:} | |||
set cur_matchingloaded {Currently Loaded Matching Modulefiles:} | set cur_matchingloaded {Currently Loaded Matching Modulefiles:} | |||
set msg_invcmdname {invalid command name} | set msg_invcmdname {invalid command name} | |||
set msg_patheqsep {cannot handle path equals to separator string} | set msg_patheqsep {cannot handle path equals to separator string} | |||
set msg_needenvvarname {should get an environment variable name} | set msg_needenvvarname {should get an environment variable name} | |||
set msg_needenvvarval {should get a value for environment variable} | set msg_needenvvarval {should get a value for environment variable} | |||
set msg_validenvvarname {should get a valid environment variable name} | set msg_validenvvarname {should get a valid environment variable name} | |||
set msg_valididxvalue {should get valid number as index value} | set msg_valididxvalue {should get valid number as index value} | |||
set msg_nonemptydelim {should get a non-empty path delimiter} | set msg_nonemptydelim {should get a non-empty path delimiter} | |||
set msg_nomodnameinarg {No module name defined in argument} | set msg_nomodnameinarg {No module name defined in argument} | |||
set msg_invversspec {Invalid version specifier} | set msg_invversspec {Invalid version specifier} | |||
set msg_filenameempty {File name empty} | set msg_filenameempty {File name empty} | |||
set msg_collnameempty {Invalid empty collection name} | set msg_collnameempty {Invalid empty collection name} | |||
set msg_nomodpath {No module path defined} | set msg_nomodpath {No module path defined} | |||
set msg_nomodloaded {No module has been loaded} | set msg_nomodloaded {No module has been loaded} | |||
set datetimere {[0-9/]{10} [0-9:]{8}} | set datetimere {[0-9/]{10} [0-9:]{8}} | |||
set avail_long_headerre "- Package/Alias $modlin.- Versions $modlin.- Last mod. $modlin" | set avail_long_headerre "- Package/Alias $modlin.- Versions $modlin.- Last mod. $modlin" | |||
set list_long_headerre "- Package $modlin.- Versions $modlin.- Last mod. $modlin " | set list_long_headerre "- Package $modlin.- Versions $modlin.- Last mod. $modlin " | |||
set savelist_long_headerre "- Collection $modlin.- Last mod. $modlin" | ||||
# Common error responses | # Common error responses | |||
set err_path "$error_msgs: Unable to locate a modulefile for " | set err_path "$error_msgs: Unable to locate a modulefile for " | |||
set err_file "$error_msgs: No such file or directory on " | set err_file "$error_msgs: No such file or directory on " | |||
set err_illdir "$error_msgs: Illegal operation on a directory on " | set err_illdir "$error_msgs: Illegal operation on a directory on " | |||
set err_nomodpath "$error_msgs: $msg_nomodpath" | set err_nomodpath "$error_msgs: $msg_nomodpath" | |||
set err_magicns "$moderr_msgs: Magic cookie '#%Module' missing\nIn " | set err_magicns "$moderr_msgs: Magic cookie '#%Module' missing\nIn " | |||
set err_magic "$moderr_msgs: Magic cookie '#%Module' missing\n In " | set err_magic "$moderr_msgs: Magic cookie '#%Module' missing\n In " | |||
set err_contactns "Please contact <root@localhost>" | set err_contactns "Please contact <root@localhost>" | |||
set err_contact " $err_contactns" | set err_contact " $err_contactns" | |||
skipping to change at line 98 | skipping to change at line 100 | |||
set err_nodefault "$error_msgs: No default version defined for " | set err_nodefault "$error_msgs: No default version defined for " | |||
set err_evalabort "$error_msgs: Module evaluation aborted" | set err_evalabort "$error_msgs: Module evaluation aborted" | |||
set err_specmodname "$error_msgs: $msg_nomodnameinarg " | set err_specmodname "$error_msgs: $msg_nomodnameinarg " | |||
set err_specvers "$error_msgs: $msg_invversspec " | set err_specvers "$error_msgs: $msg_invversspec " | |||
set err_rangevers "$error_msgs: Invalid version range " | set err_rangevers "$error_msgs: Invalid version range " | |||
set err_stickyunload "$::error_msgs: Unload of sticky module skipped" | set err_stickyunload "$::error_msgs: Unload of sticky module skipped" | |||
set err_stickyunloadf "$::warn_msgs: Unload of sticky module forced" | set err_stickyunloadf "$::warn_msgs: Unload of sticky module forced" | |||
set err_superstickyunload "$::error_msgs: Unload of super-sticky module skipped" | set err_superstickyunload "$::error_msgs: Unload of super-sticky module skipped" | |||
set err_reqfull "$::error_msgs: Module version must be specified to load module" | set err_reqfull "$::error_msgs: Module version must be specified to load module" | |||
set err_nomodloaded "$error_msgs: $msg_nomodloaded" | set err_nomodloaded "$error_msgs: $msg_nomodloaded" | |||
set err_save_emptyenv "$::error_msgs: Nothing to save in a collection" | ||||
set err_save_unsat "$::error_msgs: Cannot save collection, some module constrain | ||||
ts are not satistied" | ||||
set warn_nostash "$::warn_msgs: No specific environment to save" | ||||
proc err_conflict {args} { | proc err_conflict {args} { | |||
return "$::error_msgs: Module cannot be loaded due to a conflict. | return "$::error_msgs: Module cannot be loaded due to a conflict. | |||
HINT: Might try \"module unload [join $args { }]\" first." | HINT: Might try \"module unload [join $args { }]\" first." | |||
} | } | |||
proc err_conloi {args} { | proc err_conloi {args} { | |||
set is [expr {[llength $args] > 1 ? {are} : {is}}] | set is [expr {[llength $args] > 1 ? {are} : {is}}] | |||
return "$::error_msgs: Conflicting [join $args { and }] $is loading" | return "$::error_msgs: Conflicting [join $args { and }] $is loading" | |||
} | } | |||
skipping to change at line 325 | skipping to change at line 330 | |||
} | } | |||
proc err_tagmanset {tag} { | proc err_tagmanset {tag} { | |||
return "$::error_msgs: Tag '$tag' cannot be manually set" | return "$::error_msgs: Tag '$tag' cannot be manually set" | |||
} | } | |||
proc err_misoptval {opt} { | proc err_misoptval {opt} { | |||
return "$::error_msgs: Missing value for '$opt' option" | return "$::error_msgs: Missing value for '$opt' option" | |||
} | } | |||
proc err_unsupportedshell {shell} { | ||||
return "$::error_msgs: Unsupported shell type '$shell'" | ||||
} | ||||
proc err_unsupportedopt {opt subcmd} { | ||||
return "$::error_msgs: Unsupported option '$opt' on $subcmd sub-command" | ||||
} | ||||
proc err_coll_notfound {coll {target {}}} { | ||||
if {$target ne {}} { | ||||
set targetmsg "(for target \"$target\") " | ||||
} else { | ||||
set targetmsg {} | ||||
} | ||||
return "$::error_msgs: Collection $coll ${targetmsg}cannot be found" | ||||
} | ||||
proc err_coll_notvalid {coll} { | ||||
return "$::error_msgs: $coll is not a valid collection" | ||||
} | ||||
proc err_stash_index {idx} { | ||||
return "$::error_msgs: Invalid stash index '$idx'" | ||||
} | ||||
proc err_stash_name {name} { | ||||
return "$::error_msgs: Invalid stash collection name '$name'" | ||||
} | ||||
proc msg_named_coll {{matching 0} {target {}}} { | ||||
if {$matching} { | ||||
set msg {Matching named } | ||||
} else { | ||||
set msg {Named } | ||||
} | ||||
append msg {collection list} | ||||
if {$target ne {}} { | ||||
append msg " (for target \"$target\")" | ||||
} | ||||
append msg : | ||||
return $msg | ||||
} | ||||
proc msg_no_named_coll {{matching 0} {target {}}} { | ||||
if {$matching} { | ||||
set msg {No matching } | ||||
} else { | ||||
set msg {No } | ||||
} | ||||
append msg {named collection} | ||||
if {$target ne {}} { | ||||
append msg " (for target \"$target\")" | ||||
} | ||||
append msg . | ||||
return $msg | ||||
} | ||||
proc msg_stash_coll {{target {}}} { | ||||
set msg {Stash collection list} | ||||
if {$target ne {}} { | ||||
append msg " (for target \"$target\")" | ||||
} | ||||
append msg : | ||||
return $msg | ||||
} | ||||
proc msg_no_stash_coll {{target {}}} { | ||||
set msg {No stash collection} | ||||
if {$target ne {}} { | ||||
append msg " (for target \"$target\")" | ||||
} | ||||
append msg . | ||||
return $msg | ||||
} | ||||
proc msg_moderr {msg cmdline modfile linenum {pad {}} {procname {}} {contact {}} {custom {}} {custom2 {while executing}}} { | proc msg_moderr {msg cmdline modfile linenum {pad {}} {procname {}} {contact {}} {custom {}} {custom2 {while executing}}} { | |||
set linefile [expr {$procname ne {} || $linenum eq {} ? {} : " line $linenum "}] | set linefile [expr {$procname ne {} || $linenum eq {} ? {} : " line $linenum "}] | |||
set errcontact [expr {$contact eq {} ? $::err_contactns : "Please contact <$ contact>"}] | set errcontact [expr {$contact eq {} ? $::err_contactns : "Please contact <$ contact>"}] | |||
set res "$::moderr_msgs: $msg | set res "$::moderr_msgs: $msg | |||
$pad $custom2 | $pad $custom2 | |||
$pad\"$cmdline\"" | $pad\"$cmdline\"" | |||
if {$procname ne {}} { | if {$procname ne {}} { | |||
append res " | append res " | |||
$pad (procedure \"$procname\" line $linenum) | $pad (procedure \"$procname\" line $linenum) | |||
$pad invoked from within | $pad invoked from within | |||
$pad\"$procname\"" | $pad\"$procname\"" | |||
skipping to change at line 450 | skipping to change at line 531 | |||
append msg [eval msg_block_content $args] | append msg [eval msg_block_content $args] | |||
return $msg | return $msg | |||
} | } | |||
proc msg_tag {mod args} { | proc msg_tag {mod args} { | |||
set msg "Tagging $mod" | set msg "Tagging $mod" | |||
append msg [eval msg_block_content $args] | append msg [eval msg_block_content $args] | |||
return $msg | return $msg | |||
} | } | |||
proc msg_lint {mod args} { | ||||
set msg "Linting $mod" | ||||
append msg [eval msg_block_content $args] | ||||
return $msg | ||||
} | ||||
proc msg_top_load {mod unlist reqlolist deprelist args} { | proc msg_top_load {mod unlist reqlolist deprelist args} { | |||
lassign [mix_depre_depun_list $deprelist {}] deprelist depunlist | lassign [mix_depre_depun_list $deprelist {}] deprelist depunlist | |||
if {[llength $depunlist] > 0} { | if {[llength $depunlist] > 0} { | |||
lappend args "Unloading dependent: [join $depunlist]" | lappend args "Unloading dependent: [join $depunlist]" | |||
} | } | |||
if {[llength $unlist] > 0} { | if {[llength $unlist] > 0} { | |||
lappend args "Unloading conflict: [join $unlist]" | lappend args "Unloading conflict: [join $unlist]" | |||
} | } | |||
if {[llength $reqlolist] > 0} { | if {[llength $reqlolist] > 0} { | |||
skipping to change at line 600 | skipping to change at line 687 | |||
regexp {version (.+)$} [exec $fishbin --version] match fish_version | regexp {version (.+)$} [exec $fishbin --version] match fish_version | |||
set fish_version_ge31 [expr {[lindex [lsort -dictionary [list $fish_version 3 .1.0]] 0] eq {3.1.0}}] | set fish_version_ge31 [expr {[lindex [lsort -dictionary [list $fish_version 3 .1.0]] 0] eq {3.1.0}}] | |||
set fish_version_ge32 [expr {[lindex [lsort -dictionary [list $fish_version 3 .2.0]] 0] eq {3.2.0}}] | set fish_version_ge32 [expr {[lindex [lsort -dictionary [list $fish_version 3 .2.0]] 0] eq {3.2.0}}] | |||
} | } | |||
# find ksh flavor | # find ksh flavor | |||
if {[set kshbin [lindex [auto_execok ksh] 0]] ne {}} { | if {[set kshbin [lindex [auto_execok ksh] 0]] ne {}} { | |||
set ksh_is_mksh [expr {[string first MIRBSD [exec $kshbin -c "echo \$KSH_VERS ION"]] != -1}] | set ksh_is_mksh [expr {[string first MIRBSD [exec $kshbin -c "echo \$KSH_VERS ION"]] != -1}] | |||
} | } | |||
# is FPATH set during autoinit for zsh shell | ||||
set install_setzshfpath [expr {$install_zshcompletiondir eq {} ? {y} : {n}}] | ||||
if {$install_setzshfpath eq {y}} { | ||||
set install_zshcompletiondir $install_initdir/zsh-functions | ||||
} | ||||
# locate siteconfig file | # locate siteconfig file | |||
set siteconfig_file "$install_etcdir/siteconfig.tcl" | set siteconfig_file "$install_etcdir/siteconfig.tcl" | |||
set siteconfig_filere [regsub -all "\(\[.+?\]\)" $siteconfig_file {\\\1}] | set siteconfig_filere [regsub -all "\(\[.+?\]\)" $siteconfig_file {\\\1}] | |||
# determine if siteconfig forces stderr terminal attachment state | # determine if siteconfig forces stderr terminal attachment state | |||
proc siteconfig_isStderrTty {} { | proc siteconfig_isStderrTty {} { | |||
interp create _siteconfig | interp create _siteconfig | |||
interp eval _siteconfig set ::siteconfig_file $::siteconfig_file | interp eval _siteconfig set ::siteconfig_file "{$::siteconfig_file}" | |||
set is_stderr_tty [interp eval _siteconfig { | set is_stderr_tty [interp eval _siteconfig { | |||
set is_stderr_tty 0 | set is_stderr_tty 0 | |||
if {[file readable $::siteconfig_file]} { | if {[file readable $::siteconfig_file]} { | |||
# evaluate siteconfig file to check initStateIsStderrTty procedure | # evaluate siteconfig file to check initStateIsStderrTty procedure | |||
catch { | catch { | |||
source $::siteconfig_file | source $::siteconfig_file | |||
if {[info procs initStateIsStderrTty] eq "initStateIsStderrTty"} { | if {[info procs initStateIsStderrTty] eq "initStateIsStderrTty"} { | |||
set is_stderr_tty [initStateIsStderrTty] | set is_stderr_tty [initStateIsStderrTty] | |||
} | } | |||
} errorMsg | } errorMsg | |||
skipping to change at line 702 | skipping to change at line 795 | |||
# check x11 capabilities | # check x11 capabilities | |||
set x11_warn_prefix "$error_msgs: X11 resources cannot be edited, issue spotted" | set x11_warn_prefix "$error_msgs: X11 resources cannot be edited, issue spotted" | |||
set xrdb_warn "$x11_warn_prefix\n$error_msgs: Command 'xrdb' cannot be found" | set xrdb_warn "$x11_warn_prefix\n$error_msgs: Command 'xrdb' cannot be found" | |||
# check where to find the 'xrdb' binary on this system | # check where to find the 'xrdb' binary on this system | |||
set xrdb [auto_execok xrdb] | set xrdb [auto_execok xrdb] | |||
if {$xrdb eq ""} { | if {$xrdb eq ""} { | |||
set x11_warn $xrdb_warn | set x11_warn $xrdb_warn | |||
} elseif {[catch {exec $xrdb -query} errMsg]} { | } elseif {[catch {exec $xrdb -query} errMsg]} { | |||
set x11_warn "$x11_warn_prefix\n$error_msgs: $errMsg" | set x11_warn "$x11_warn_prefix\n$error_msgs: $errMsg" | |||
} | } | |||
send_user "\tX11 setup is [expr {[info exists x11_warn] ? {KO} : {OK}}]\n" | ||||
# check if domainname binary is available on this system | # check if domainname binary is available on this system | |||
set domainname [auto_execok domainname] | set domainname [auto_execok domainname] | |||
set domainname_warn "$error_msgs: Command 'domainname' cannot be found" | set domainname_warn "$error_msgs: Command 'domainname' cannot be found" | |||
# display result of id command | # display result of id command | |||
send_user "\tid output is '[exec id]'\n" | set idoutput [exec id] | |||
send_user "\tid output is '$idoutput'\n" | ||||
# get current working directory | ||||
set ORIG_CWD [pwd] | ||||
# get current username and groups | # get current username and groups | |||
set username [exec id -u -n] | set username [exec id -u -n] | |||
set userid [exec id -u] | set userid [exec id -u] | |||
send_user "\tCurrent username is '$username'\n" | send_user "\tCurrent username is '$username'\n" | |||
set group_name_fetch_failed 0 | ||||
if {[catch { | if {[catch { | |||
# correctly split groups in case some contain a space character (like on Cyg win/MSYS platforms) | # correctly split groups in case some contain a space character (like on Cyg win/MSYS platforms) | |||
set usergroups [lsort [split [string range [exec id -G -n -z] 0 end-1] \0]] | set usergroups [lsort [split [string range [exec id -G -n -z] 0 end-1] \0]] | |||
} errMsg]} { | } errMsg]} { | |||
# fallback to a more generic groups retrieval (in case '-z' option not suppo rted on id) | # fallback to a more generic groups retrieval (in case '-z' option not suppo rted on id) | |||
set usergroups [lsort [exec id -G -n]] | if {[catch { | |||
set usergroups [lsort [exec id -G -n]] | ||||
} errMsg]} { | ||||
set group_name_fetch_failed 1 | ||||
# fallback in case all group names could not be resolved by 'id' command | ||||
# it happens especially when running testsuite through mockbuild | ||||
foreach grpinfo [split [string range [lindex [split $idoutput] 2] 7 end] | ||||
,] { | ||||
if {[set idx [string first ( $grpinfo]] != -1} { | ||||
set grp [string range $grpinfo $idx+1 end-1] | ||||
} else { | ||||
set grp $grpinfo | ||||
} | ||||
lappend usergroups $grp | ||||
} | ||||
set usergroups [lsort $usergroups] | ||||
} | ||||
} | } | |||
# filter specific volatile groups | # filter specific volatile groups | |||
set usergroups [lsearch -all -inline -not -glob $usergroups com.apple.sharepoint .group.*] | set usergroups [lsearch -all -inline -not -glob $usergroups com.apple.sharepoint .group.*] | |||
send_user "\tGroups of current user are '$usergroups'\n" | send_user "\tGroups of current user are '$usergroups'\n" | |||
set userfgroup [lindex $usergroups 0] | set userfgroup [lindex $usergroups 0] | |||
# escape regexp chars in string | # escape regexp chars in string | |||
proc escre {str} { | proc escre {str} { | |||
return [string map {<EXM> (.*)+} [regsub -all {([.?*()+\[\]$])} $str {\\\1}] ] | return [string map {<EXM> (.*)+} [regsub -all {([.?*()+\[\]$])} $str {\\\1}] ] | |||
} | } | |||
skipping to change at line 746 | skipping to change at line 860 | |||
if {$str1 eq $str2} { | if {$str1 eq $str2} { | |||
return 0 | return 0 | |||
# put both strings in a list, then lsort it and get first element | # put both strings in a list, then lsort it and get first element | |||
} elseif {[lindex [lsort -dictionary [list $str1 $str2]] 0] eq $str1} { | } elseif {[lindex [lsort -dictionary [list $str1 $str2]] 0] eq $str1} { | |||
return -1 | return -1 | |||
} else { | } else { | |||
return 1 | return 1 | |||
} | } | |||
} | } | |||
proc create_stash_coll {content} { | ||||
set colldir $::env(HOME)/.module | ||||
if {![file exists $colldir]} { | ||||
file mkdir $colldir | ||||
} | ||||
set coll stash-[clock milliseconds] | ||||
if {[info exists ::env(MODULES_COLLECTION_TARGET)]} { | ||||
append coll .$::env(MODULES_COLLECTION_TARGET) | ||||
} | ||||
send_user "\tCreating stash collection $colldir/$coll\n" | ||||
set fid [open $colldir/$coll w] | ||||
puts $fid $content | ||||
close $fid | ||||
} | ||||
proc delete_last_stash_coll {} { | ||||
set collfile [lindex [lsort [glob $::env(HOME)/.module/stash-*]] 0] | ||||
send_user "\tDeleting stash collection $collfile\n" | ||||
file delete $collfile | ||||
} | ||||
# fetch stash collections | ||||
proc get_all_stash_colls {} { | ||||
return [glob -types f $::env(HOME)/.module/stash-*] | ||||
} | ||||
proc get_last_stash_coll {} { | ||||
return [lindex [lsort [get_all_stash_colls]] end] | ||||
} | ||||
# report current system information | # report current system information | |||
send_user "\tMachine hardware name is '$tcl_platform(machine)'\n" | send_user "\tMachine hardware name is '$tcl_platform(machine)'\n" | |||
send_user "\tOS name is '$tcl_platform(os)'\n" | send_user "\tOS name is '$tcl_platform(os)'\n" | |||
send_user "\tOS version is '$tcl_platform(osVersion)'\n" | send_user "\tOS version is '$tcl_platform(osVersion)'\n" | |||
send_user "\tPlatform name is '$tcl_platform(platform)'\n" | send_user "\tPlatform name is '$tcl_platform(platform)'\n" | |||
# fetch tclsh version used to adapt tests producing different output depending o n this version | # fetch tclsh version used to adapt tests producing different output depending o n this version | |||
default_tclsh | default_tclsh | |||
catch {set tclsh_version [exec $TCLSH << {puts [info tclversion]}]} errMsg | catch {set tclsh_version [exec $TCLSH << {puts [info tclversion]}]} errMsg | |||
if {[info exists tclsh_version]} { | if {[info exists tclsh_version]} { | |||
End of changes. 14 change blocks. | ||||
4 lines changed or deleted | 150 lines changed or added |