From be71f9fdc4ae85c4c9644447713ab0916a6348d4 Mon Sep 17 00:00:00 2001 From: Richarda Butler <39577672+RikkiButler20@users.noreply.github.com> Date: Tue, 7 May 2024 09:32:40 -0700 Subject: Include concrete environments with `include_concrete` (#33768) Add the ability to include any number of (potentially nested) concrete environments, e.g.: ```yaml spack: specs: [] concretizer: unify: true include_concrete: - /path/to/environment1 - /path/to/environment2 ``` or, from the CLI: ```console $ spack env create myenv $ spack -e myenv add python $ spack -e myenv concretize $ spack env create --include-concrete myenv included_env ``` The contents of included concrete environments' spack.lock files are included in the environment's lock file at creation time. Any changes to included concrete environments are only reflected after the environment is re-concretized from the re-concretized included environments. - [x] Concretize included envs - [x] Save concrete specs in memory by hash - [x] Add included envs to combined env's lock file - [x] Add test - [x] Update documentation Co-authored-by: Kayla Butler < Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.co m> Co-authored-by: Todd Gamblin Signed-off-by: Todd Gamblin --- share/spack/spack-completion.bash | 6 +++--- share/spack/spack-completion.fish | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'share') diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 387b364189..1f73849fc8 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1052,7 +1052,7 @@ _spack_env_deactivate() { _spack_env_create() { if $list_options then - SPACK_COMPREPLY="-h --help -d --dir --keep-relative --without-view --with-view" + SPACK_COMPREPLY="-h --help -d --dir --keep-relative --without-view --with-view --include-concrete" else _environments fi @@ -1061,7 +1061,7 @@ _spack_env_create() { _spack_env_remove() { if $list_options then - SPACK_COMPREPLY="-h --help -y --yes-to-all" + SPACK_COMPREPLY="-h --help -y --yes-to-all -f --force" else _environments fi @@ -1070,7 +1070,7 @@ _spack_env_remove() { _spack_env_rm() { if $list_options then - SPACK_COMPREPLY="-h --help -y --yes-to-all" + SPACK_COMPREPLY="-h --help -y --yes-to-all -f --force" else _environments fi diff --git a/share/spack/spack-completion.fish b/share/spack/spack-completion.fish index 3818b12f1b..63abb4864e 100755 --- a/share/spack/spack-completion.fish +++ b/share/spack/spack-completion.fish @@ -1538,7 +1538,7 @@ complete -c spack -n '__fish_spack_using_command env deactivate' -l pwsh -f -a s complete -c spack -n '__fish_spack_using_command env deactivate' -l pwsh -d 'print pwsh commands to activate the environment' # spack env create -set -g __fish_spack_optspecs_spack_env_create h/help d/dir keep-relative without-view with-view= +set -g __fish_spack_optspecs_spack_env_create h/help d/dir keep-relative without-view with-view= include-concrete= complete -c spack -n '__fish_spack_using_command_pos 0 env create' -f -a '(__fish_spack_environments)' complete -c spack -n '__fish_spack_using_command env create' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command env create' -s h -l help -d 'show this help message and exit' @@ -1550,22 +1550,28 @@ complete -c spack -n '__fish_spack_using_command env create' -l without-view -f complete -c spack -n '__fish_spack_using_command env create' -l without-view -d 'do not maintain a view for this environment' complete -c spack -n '__fish_spack_using_command env create' -l with-view -r -f -a with_view complete -c spack -n '__fish_spack_using_command env create' -l with-view -r -d 'specify that this environment should maintain a view at the specified path (by default the view is maintained in the environment directory)' +complete -c spack -n '__fish_spack_using_command env create' -l include-concrete -r -f -a include_concrete +complete -c spack -n '__fish_spack_using_command env create' -l include-concrete -r -d 'name of old environment to copy specs from' # spack env remove -set -g __fish_spack_optspecs_spack_env_remove h/help y/yes-to-all +set -g __fish_spack_optspecs_spack_env_remove h/help y/yes-to-all f/force complete -c spack -n '__fish_spack_using_command_pos_remainder 0 env remove' -f -a '(__fish_spack_environments)' complete -c spack -n '__fish_spack_using_command env remove' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command env remove' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command env remove' -s y -l yes-to-all -f -a yes_to_all complete -c spack -n '__fish_spack_using_command env remove' -s y -l yes-to-all -d 'assume "yes" is the answer to every confirmation request' +complete -c spack -n '__fish_spack_using_command env remove' -s f -l force -f -a force +complete -c spack -n '__fish_spack_using_command env remove' -s f -l force -d 'remove the environment even if it is included in another environment' # spack env rm -set -g __fish_spack_optspecs_spack_env_rm h/help y/yes-to-all +set -g __fish_spack_optspecs_spack_env_rm h/help y/yes-to-all f/force complete -c spack -n '__fish_spack_using_command_pos_remainder 0 env rm' -f -a '(__fish_spack_environments)' complete -c spack -n '__fish_spack_using_command env rm' -s h -l help -f -a help complete -c spack -n '__fish_spack_using_command env rm' -s h -l help -d 'show this help message and exit' complete -c spack -n '__fish_spack_using_command env rm' -s y -l yes-to-all -f -a yes_to_all complete -c spack -n '__fish_spack_using_command env rm' -s y -l yes-to-all -d 'assume "yes" is the answer to every confirmation request' +complete -c spack -n '__fish_spack_using_command env rm' -s f -l force -f -a force +complete -c spack -n '__fish_spack_using_command env rm' -s f -l force -d 'remove the environment even if it is included in another environment' # spack env rename set -g __fish_spack_optspecs_spack_env_rename h/help d/dir f/force -- cgit v1.2.3-70-g09d2