From 76b9c561109e4a19375231fd6e8fd8a1c7947f34 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 3 Oct 2019 07:15:01 +0200 Subject: Remove support for generating dotkit files (#11986) Dotkit is being used only at a few sites and has been deprecated on new machines. This commit removes all the code that provide support for the generation of dotkit module files. A new validator named "deprecatedProperties" has been added to the jsonschema validators. It permits to prompt a warning message or exit with an error if a property that has been marked as deprecated is encountered. * Removed references to dotkit in the docs * Removed references to dotkit in setup-env-test.sh * Added a unit test for the 'deprecatedProperties' schema validator --- share/spack/csh/spack.csh | 34 ++++++-------------- share/spack/qa/setup-env-test.sh | 32 +------------------ share/spack/setup-env.csh | 8 ++--- share/spack/setup-env.sh | 37 +++++++--------------- share/spack/spack-completion.bash | 49 +---------------------------- share/spack/templates/modules/modulefile.dk | 31 ------------------ 6 files changed, 25 insertions(+), 166 deletions(-) delete mode 100644 share/spack/templates/modules/modulefile.dk (limited to 'share') diff --git a/share/spack/csh/spack.csh b/share/spack/csh/spack.csh index 01be616572..ac893d72b1 100644 --- a/share/spack/csh/spack.csh +++ b/share/spack/csh/spack.csh @@ -5,27 +5,27 @@ ######################################################################## # This is a wrapper around the spack command that forwards calls to -# 'spack use' and 'spack unuse' to shell functions. This in turn -# allows them to be used to invoke dotkit functions. +# 'spack load' and 'spack unload' to shell functions. This in turn +# allows them to be used to invoke environment-modules functions. # -# 'spack use' is smarter than just 'use' because it converts its -# arguments into a unique spack spec that is then passed to dotkit +# 'spack load' is smarter than just 'load' because it converts its +# arguments into a unique Spack spec that is then passed to environment-modules # commands. This allows the user to use packages without knowing all # their installation details. # -# e.g., rather than requring a full spec for libelf, the user can type: +# e.g., rather than requiring a full spec for libelf, the user can type: # -# spack use libelf +# spack load libelf # -# This will first find the available libelf dotkits and use a +# This will first find the available libelf module file and use a # matching one. If there are two versions of libelf, the user would # need to be more specific, e.g.: # -# spack use libelf@0.8.13 +# spack load libelf@0.8.13 # # This is very similar to how regular spack commands work and it # avoids the need to come up with a user-friendly naming scheme for -# spack dotfiles. +# spack module files. ######################################################################## # accumulate initial flags for main spack command set _sp_flags = "" @@ -104,8 +104,6 @@ case env: breaksw endsw endif -case use: -case unuse: case load: case unload: set _sp_module_args="""" @@ -115,22 +113,10 @@ case unload: set _sp_spec = ($_sp_spec) endif - # Here the user has run use or unuse with a spec. Find a matching + # Here the user has run load or unload with a spec. Find a matching # spec using 'spack module find', then use the appropriate module # tool's commands to add/remove the result from the environment. switch ($_sp_subcommand) - case "use": - set _sp_full_spec = ( "`\spack $_sp_flags module dotkit find $_sp_spec`" ) - if ( $? == 0 ) then - use $_sp_module_args $_sp_full_spec - endif - breaksw - case "unuse": - set _sp_full_spec = ( "`\spack $_sp_flags module dotkit find $_sp_spec`" ) - if ( $? == 0 ) then - unuse $_sp_module_args $_sp_full_spec - endif - breaksw case "load": # _sp_module_args may be "-r" for recursive spec retrieval set _sp_full_spec = ( "`\spack $_sp_flags module tcl find $_sp_module_args $_sp_spec`" ) diff --git a/share/spack/qa/setup-env-test.sh b/share/spack/qa/setup-env-test.sh index 6515a99d8c..e16e31fffb 100755 --- a/share/spack/qa/setup-env-test.sh +++ b/share/spack/qa/setup-env-test.sh @@ -167,7 +167,7 @@ is_not_set() { # ----------------------------------------------------------------------- -# Instead of invoking the module/use/dotkit commands, we print the +# Instead of invoking the module commands, we print the # arguments that Spack invokes the command with, so we can check that # Spack passes the expected arguments in the tests below. # @@ -177,14 +177,6 @@ module() { echo module "$@" } -use() { - echo use "$@" -} - -unuse() { - echo unuse "$@" -} - # ----------------------------------------------------------------------- # Setup test environment and do some preliminary checks # ----------------------------------------------------------------------- @@ -219,11 +211,9 @@ echo "Creating a mock package installation" spack -m install --fake a a_install=$(spack location -i a) a_module=$(spack -m module tcl find a) -a_dotkit=$(spack -m module dotkit find a) b_install=$(spack location -i b) b_module=$(spack -m module tcl find b) -b_dotkit=$(spack -m module dotkit find b) # create a test environment for tesitng environment commands echo "Creating a mock environment" @@ -304,26 +294,6 @@ contains "usage: spack unload " spack -m unload -h contains "usage: spack unload " spack -m unload -h d contains "usage: spack unload " spack -m unload --help -title 'Testing `spack use`' -contains "use $b_dotkit" spack -m use b -fails spack -m use -l -contains "use -l --arg $b_dotkit" spack -m use -l --arg b -contains "use $b_dotkit $a_dotkit" spack -m use -r a -contains "use $b_dotkit $a_dotkit" spack -m use --dependencies a -fails spack -m use d -contains "usage: spack use " spack -m use -h -contains "usage: spack use " spack -m use -h d -contains "usage: spack use " spack -m use --help - -title 'Testing `spack unuse`' -contains "unuse $b_dotkit" spack -m unuse b -fails spack -m unuse -l -contains "unuse -l --arg $b_dotkit" spack -m unuse -l --arg b -fails spack -m unuse d -contains "usage: spack unuse " spack -m unuse -h -contains "usage: spack unuse " spack -m unuse -h d -contains "usage: spack unuse " spack -m unuse --help - title 'Testing `spack env`' contains "usage: spack env " spack env -h contains "usage: spack env " spack env --help diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh index ac5479196d..b49597918c 100755 --- a/share/spack/setup-env.csh +++ b/share/spack/setup-env.csh @@ -6,7 +6,7 @@ # # This file is part of Spack and sets up the spack environment for -# csh and tcsh. This includes dotkit support, module support, and +# csh and tcsh. This includes environment modules and lmod support, and # it also puts spack in your path. Source it like this: # # setenv SPACK_ROOT /path/to/spack @@ -24,7 +24,7 @@ if ($?SPACK_ROOT) then _spack_pathadd PATH "$SPACK_ROOT/bin" eval `spack --print-shell-vars csh` - # Set up modules and dotkit search paths in the user environment + # Set up module search paths in the user environment set tcl_roots = `echo $_sp_tcl_roots:q | sed 's/:/ /g'` set compatible_sys_types = `echo $_sp_compatible_sys_types:q | sed 's/:/ /g'` foreach tcl_root ($tcl_roots:q) @@ -33,10 +33,6 @@ if ($?SPACK_ROOT) then end end - set dotkit_roots = `echo $_sp_dotkit_roots:q | sed 's/:/ /g'` - foreach dotkit_root ($dotkit_roots) - _spack_pathadd DK_NODE "$dotkit_root/$_sp_sys_type" - end else echo "ERROR: Sourcing spack setup-env.csh requires setting SPACK_ROOT to " echo " the root of your spack installation." diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index 0fd5eb30f7..d5cad059a6 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -7,8 +7,8 @@ ######################################################################## # # This file is part of Spack and sets up the spack environment for bash, -# zsh, and dash (sh). This includes dotkit support, module support, and -# it also puts spack in your path. The script also checks that at least +# zsh, and dash (sh). This includes environment modules and lmod support, +# and it also puts spack in your path. The script also checks that at least # module support exists, and provides suggestions if it doesn't. Source # it like this: # @@ -16,27 +16,27 @@ # ######################################################################## # This is a wrapper around the spack command that forwards calls to -# 'spack use' and 'spack unuse' to shell functions. This in turn -# allows them to be used to invoke dotkit functions. +# 'spack load' and 'spack unload' to shell functions. This in turn +# allows them to be used to invoke environment modules functions. # -# 'spack use' is smarter than just 'use' because it converts its -# arguments into a unique spack spec that is then passed to dotkit +# 'spack load' is smarter than just 'load' because it converts its +# arguments into a unique Spack spec that is then passed to module # commands. This allows the user to use packages without knowing all # their installation details. # # e.g., rather than requiring a full spec for libelf, the user can type: # -# spack use libelf +# spack load libelf # -# This will first find the available libelf dotkits and use a +# This will first find the available libelf module file and use a # matching one. If there are two versions of libelf, the user would # need to be more specific, e.g.: # -# spack use libelf@0.8.13 +# spack load libelf@0.8.13 # # This is very similar to how regular spack commands work and it # avoids the need to come up with a user-friendly naming scheme for -# spack dotfiles. +# spack module files. ######################################################################## spack() { @@ -140,7 +140,7 @@ spack() { fi return ;; - "use"|"unuse"|"load"|"unload") + "load"|"unload") # Shift any other args for use off before parsing spec. _sp_subcommand_args="" _sp_module_args="" @@ -161,20 +161,6 @@ spack() { # tool's commands to add/remove the result from the environment. # If spack module command comes back with an error, do nothing. case $_sp_subcommand in - "use") - if _sp_full_spec=$(command spack $_sp_flags module dotkit find $_sp_subcommand_args "$@"); then - use $_sp_module_args $_sp_full_spec - else - $(exit 1) - fi - ;; - "unuse") - if _sp_full_spec=$(command spack $_sp_flags module dotkit find $_sp_subcommand_args "$@"); then - unuse $_sp_module_args $_sp_full_spec - else - $(exit 1) - fi - ;; "load") if _sp_full_spec=$(command spack $_sp_flags module tcl find $_sp_subcommand_args "$@"); then module load $_sp_module_args $_sp_full_spec @@ -356,7 +342,6 @@ _sp_multi_pathadd() { done } _sp_multi_pathadd MODULEPATH "$_sp_tcl_roots" -_sp_multi_pathadd DK_NODE "$_sp_dotkit_roots" # Add programmable tab completion for Bash # diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index bd6675dd16..935092aedb 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -760,7 +760,7 @@ function _spack_module { then compgen -W "-h --help" -- "$cur" else - compgen -W "lmod tcl dotkit" -- "$cur" + compgen -W "lmod tcl" -- "$cur" fi } @@ -812,53 +812,6 @@ function _spack_module_tcl_rm { fi } -function _spack_module_dotkit { - if $list_options - then - compgen -W "-h --help" -- "$cur" - else - compgen -W "refresh find rm loads" -- "$cur" - fi -} - - -function _spack_module_dotkit_find { - if $list_options - then - compgen -W "-h --help --full-path -r --dependencies" -- "$cur" - else - compgen -W "$(_installed_packages)" -- "$cur" - fi -} - -function _spack_module_dotkit_loads { - if $list_options - then - compgen -W "-h --help --input-only -p --prefix -x --exclude - -r --dependencies" -- "$cur" - else - compgen -W "$(_installed_packages)" -- "$cur" - fi - -} - -function _spack_module_dotkit_refresh { - if $list_options - then - compgen -W "-h --help --delete-tree -y --yes-to-all" -- "$cur" - else - compgen -W "$(_installed_packages)" -- "$cur" - fi -} - -function _spack_module_dotkit_rm { - if $list_options - then - compgen -W "-h --help -y --yes-to-all" -- "$cur" - else - compgen -W "$(_installed_packages)" -- "$cur" - fi -} function _spack_module_lmod { if $list_options diff --git a/share/spack/templates/modules/modulefile.dk b/share/spack/templates/modules/modulefile.dk deleted file mode 100644 index c3f6d2dce1..0000000000 --- a/share/spack/templates/modules/modulefile.dk +++ /dev/null @@ -1,31 +0,0 @@ -{% block header %} -{% if category %} -#c {{ category }} -{% endif %} -{% if short_description %} -#d {{ short_description }} -{% endif %} -{% if long_description %} -{{ long_description| textwrap(72)| prepend_to_line('#h ')| join() }} -{% endif %} -{% endblock %} - -{% block autoloads %} -{% for module in autoload %} -dk_op {{ module }} -{% endfor %} -{% endblock %} - -{% block environment %} -{% for command_name, cmd in environment_modifications %} -{% if command_name == 'PrependPath' %} -dk_alter {{ cmd.name }} {{ cmd.value }} -{% endif %} -{% if command_name == 'RemovePath' %} -dk_unalter {{ cmd.name }} {{ cmd.value }} -{% endif %} -{% if command_name == 'SetEnv' %} -dk_setenv {{ cmd.name }} {{ cmd.value }} -{% endif %} -{% endfor %} -{% endblock %} -- cgit v1.2.3-60-g2f50