2023-01-19 06:30:17 +08:00
|
|
|
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
|
2018-10-08 04:52:23 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2017-02-07 04:34:35 +08:00
|
|
|
#
|
2018-10-08 04:52:23 +08:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
2017-02-07 04:34:35 +08:00
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
# NOTE: spack-completion.bash is auto-generated by:
|
|
|
|
#
|
|
|
|
# $ spack commands --aliases --format=bash
|
2023-08-09 21:28:55 +08:00
|
|
|
# --header=bash/spack-completion.bash --update=spack-completion.bash
|
2020-01-06 15:35:23 +08:00
|
|
|
#
|
|
|
|
# Please do not manually modify this file.
|
|
|
|
|
|
|
|
|
|
|
|
# The following global variables are set by Bash programmable completion:
|
|
|
|
#
|
|
|
|
# COMP_CWORD: An index into ${COMP_WORDS} of the word containing the
|
|
|
|
# current cursor position
|
|
|
|
# COMP_KEY: The key (or final key of a key sequence) used to invoke
|
|
|
|
# the current completion function
|
|
|
|
# COMP_LINE: The current command line
|
|
|
|
# COMP_POINT: The index of the current cursor position relative to the
|
|
|
|
# beginning of the current command
|
|
|
|
# COMP_TYPE: Set to an integer value corresponding to the type of
|
|
|
|
# completion attempted that caused a completion function
|
|
|
|
# to be called
|
|
|
|
# COMP_WORDBREAKS: The set of characters that the readline library treats
|
|
|
|
# as word separators when performing word completion
|
|
|
|
# COMP_WORDS: An array variable consisting of the individual words in
|
|
|
|
# the current command line
|
|
|
|
#
|
|
|
|
# The following global variable is used by Bash programmable completion:
|
|
|
|
#
|
|
|
|
# COMPREPLY: An array variable from which bash reads the possible
|
|
|
|
# completions generated by a shell function invoked by the
|
|
|
|
# programmable completion facility
|
|
|
|
#
|
|
|
|
# See `man bash` for more details.
|
2017-02-07 04:34:35 +08:00
|
|
|
|
2020-12-19 09:26:15 +08:00
|
|
|
if test -n "${ZSH_VERSION:-}" ; then
|
|
|
|
if [[ "$(emulate)" = zsh ]] ; then
|
2021-10-29 02:32:59 +08:00
|
|
|
if ! typeset -f compdef >& /dev/null ; then
|
|
|
|
# ensure base completion support is enabled, ignore insecure directories
|
|
|
|
autoload -U +X compinit && compinit -i
|
|
|
|
fi
|
|
|
|
if ! typeset -f complete >& /dev/null ; then
|
|
|
|
# ensure bash compatible completion support is enabled
|
|
|
|
autoload -U +X bashcompinit && bashcompinit
|
|
|
|
fi
|
2020-12-19 09:26:15 +08:00
|
|
|
emulate sh -c "source '$0:A'"
|
|
|
|
return # stop interpreting file
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-02-07 04:34:35 +08:00
|
|
|
# Bash programmable completion for Spack
|
2020-01-06 15:35:23 +08:00
|
|
|
_bash_completion_spack() {
|
2017-02-07 04:34:35 +08:00
|
|
|
# In all following examples, let the cursor be denoted by brackets, i.e. []
|
|
|
|
|
|
|
|
# For our purposes, flags should not affect tab completion. For instance,
|
|
|
|
# `spack install []` and `spack -d install --jobs 8 []` should both give the same
|
|
|
|
# possible completions. Therefore, we need to ignore any flags in COMP_WORDS.
|
2021-03-11 01:44:50 +08:00
|
|
|
local -a COMP_WORDS_NO_FLAGS
|
2017-02-07 04:34:35 +08:00
|
|
|
local index=0
|
|
|
|
while [[ "$index" -lt "$COMP_CWORD" ]]
|
|
|
|
do
|
|
|
|
if [[ "${COMP_WORDS[$index]}" == [a-z]* ]]
|
|
|
|
then
|
|
|
|
COMP_WORDS_NO_FLAGS+=("${COMP_WORDS[$index]}")
|
|
|
|
fi
|
|
|
|
let index++
|
|
|
|
done
|
|
|
|
|
|
|
|
# Options will be listed by a subfunction named after non-flag arguments.
|
|
|
|
# For example, `spack -d install []` will call _spack_install
|
|
|
|
# and `spack compiler add []` will call _spack_compiler_add
|
|
|
|
local subfunction=$(IFS='_'; echo "_${COMP_WORDS_NO_FLAGS[*]}")
|
2020-01-07 13:18:14 +08:00
|
|
|
|
2017-05-03 21:12:33 +08:00
|
|
|
# Translate dashes to underscores, as dashes are not permitted in
|
2017-11-05 08:08:04 +08:00
|
|
|
# compatibility mode. See https://github.com/spack/spack/pull/4079
|
2017-05-03 21:12:33 +08:00
|
|
|
subfunction=${subfunction//-/_}
|
2017-02-07 04:34:35 +08:00
|
|
|
|
|
|
|
# However, the word containing the current cursor position needs to be
|
|
|
|
# added regardless of whether or not it is a flag. This allows us to
|
|
|
|
# complete something like `spack install --keep-st[]`
|
|
|
|
COMP_WORDS_NO_FLAGS+=("${COMP_WORDS[$COMP_CWORD]}")
|
|
|
|
|
|
|
|
# Since we have removed all words after COMP_CWORD, we can safely assume
|
|
|
|
# that COMP_CWORD_NO_FLAGS is simply the index of the last element
|
2020-01-06 15:35:23 +08:00
|
|
|
local COMP_CWORD_NO_FLAGS=$((${#COMP_WORDS_NO_FLAGS[@]} - 1))
|
2017-02-07 04:34:35 +08:00
|
|
|
|
|
|
|
# There is no guarantee that the cursor is at the end of the command line
|
|
|
|
# when tab completion is envoked. For example, in the following situation:
|
|
|
|
# `spack -d [] install`
|
|
|
|
# if the user presses the TAB key, a list of valid flags should be listed.
|
|
|
|
# Note that we cannot simply ignore everything after the cursor. In the
|
|
|
|
# previous scenario, the user should expect to see a list of flags, but
|
|
|
|
# not of other subcommands. Obviously, `spack -d list install` would be
|
|
|
|
# invalid syntax. To accomplish this, we use the variable list_options
|
|
|
|
# which is true if the current word starts with '-' or if the cursor is
|
|
|
|
# not at the end of the line.
|
|
|
|
local list_options=false
|
2020-01-06 15:35:23 +08:00
|
|
|
if [[ "${COMP_WORDS[$COMP_CWORD]}" == -* || "$COMP_POINT" -ne "${#COMP_LINE}" ]]
|
2017-02-07 04:34:35 +08:00
|
|
|
then
|
|
|
|
list_options=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
# In general, when envoking tab completion, the user is not expecting to
|
|
|
|
# see optional flags mixed in with subcommands or package names. Tab
|
|
|
|
# completion is used by those who are either lazy or just bad at spelling.
|
|
|
|
# If someone doesn't remember what flag to use, seeing single letter flags
|
|
|
|
# in their results won't help them, and they should instead consult the
|
|
|
|
# documentation. However, if the user explicitly declares that they are
|
|
|
|
# looking for a flag, we can certainly help them out.
|
|
|
|
# `spack install -[]`
|
|
|
|
# and
|
|
|
|
# `spack install --[]`
|
|
|
|
# should list all flags and long flags, respectively. Furthermore, if a
|
|
|
|
# subcommand has no non-flag completions, such as `spack arch []`, it
|
|
|
|
# should list flag completions.
|
|
|
|
|
|
|
|
local cur=${COMP_WORDS_NO_FLAGS[$COMP_CWORD_NO_FLAGS]}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
# If the cursor is in the middle of the line, like:
|
|
|
|
# `spack -d [] install`
|
|
|
|
# COMP_WORDS will not contain the empty character, so we have to add it.
|
2022-01-06 21:47:03 +08:00
|
|
|
if [[ "${COMP_LINE:$COMP_POINT-1:1}" == " " ]]
|
2020-01-06 15:35:23 +08:00
|
|
|
then
|
|
|
|
cur=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Uncomment this line to enable logging
|
|
|
|
#_test_vars >> temp
|
2017-02-07 04:34:35 +08:00
|
|
|
|
|
|
|
# Make sure function exists before calling it
|
2020-12-19 09:26:15 +08:00
|
|
|
local rgx #this dance is necessary to cover bash and zsh regex
|
|
|
|
rgx="$subfunction.*function.* "
|
2022-04-29 07:24:10 +08:00
|
|
|
if [[ "$(LC_ALL=C type $subfunction 2>&1)" =~ $rgx ]]
|
2017-02-07 04:34:35 +08:00
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
$subfunction
|
|
|
|
COMPREPLY=($(compgen -W "$SPACK_COMPREPLY" -- "$cur"))
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Helper functions for subcommands
|
|
|
|
# Results of each query are cached via environment variables
|
|
|
|
|
|
|
|
_subcommands() {
|
|
|
|
if [[ -z "${SPACK_SUBCOMMANDS:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_SUBCOMMANDS="$(spack commands)"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_SUBCOMMANDS"
|
|
|
|
}
|
|
|
|
|
|
|
|
_all_packages() {
|
|
|
|
if [[ -z "${SPACK_ALL_PACKAGES:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_ALL_PACKAGES="$(spack list)"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_ALL_PACKAGES"
|
|
|
|
}
|
|
|
|
|
|
|
|
_all_resource_hashes() {
|
|
|
|
if [[ -z "${SPACK_ALL_RESOURCES_HASHES:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_ALL_RESOURCE_HASHES="$(spack resource list --only-hashes)"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_ALL_RESOURCE_HASHES"
|
|
|
|
}
|
|
|
|
|
|
|
|
_installed_packages() {
|
|
|
|
if [[ -z "${SPACK_INSTALLED_PACKAGES:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_INSTALLED_PACKAGES="$(spack --color=never find --no-groups)"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_INSTALLED_PACKAGES"
|
|
|
|
}
|
|
|
|
|
|
|
|
_installed_compilers() {
|
|
|
|
if [[ -z "${SPACK_INSTALLED_COMPILERS:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_INSTALLED_COMPILERS="$(spack compilers | egrep -v "^(-|=)")"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_INSTALLED_COMPILERS"
|
|
|
|
}
|
|
|
|
|
|
|
|
_providers() {
|
|
|
|
if [[ -z "${SPACK_PROVIDERS:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_PROVIDERS="$(spack providers)"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_PROVIDERS"
|
|
|
|
}
|
|
|
|
|
|
|
|
_mirrors() {
|
|
|
|
if [[ -z "${SPACK_MIRRORS:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_MIRRORS="$(spack mirror list | awk '{print $1}')"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_MIRRORS"
|
|
|
|
}
|
|
|
|
|
|
|
|
_repos() {
|
|
|
|
if [[ -z "${SPACK_REPOS:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_REPOS="$(spack repo list | awk '{print $1}')"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_REPOS"
|
|
|
|
}
|
|
|
|
|
2022-03-09 23:09:57 +08:00
|
|
|
_unit_tests() {
|
2020-01-06 15:35:23 +08:00
|
|
|
if [[ -z "${SPACK_TESTS:-}" ]]
|
|
|
|
then
|
2022-03-09 23:09:57 +08:00
|
|
|
SPACK_TESTS="$(spack unit-test -l)"
|
2020-01-06 15:35:23 +08:00
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_TESTS"
|
|
|
|
}
|
|
|
|
|
|
|
|
_environments() {
|
|
|
|
if [[ -z "${SPACK_ENVIRONMENTS:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_ENVIRONMENTS="$(spack env list)"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_ENVIRONMENTS"
|
|
|
|
}
|
|
|
|
|
|
|
|
_keys() {
|
|
|
|
if [[ -z "${SPACK_KEYS:-}" ]]
|
|
|
|
then
|
|
|
|
SPACK_KEYS="$(spack gpg list)"
|
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_KEYS"
|
|
|
|
}
|
|
|
|
|
|
|
|
_config_sections() {
|
|
|
|
if [[ -z "${SPACK_CONFIG_SECTIONS:-}" ]]
|
|
|
|
then
|
2020-01-25 09:28:20 +08:00
|
|
|
SPACK_CONFIG_SECTIONS="$(spack config list)"
|
2020-01-06 15:35:23 +08:00
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_CONFIG_SECTIONS"
|
|
|
|
}
|
|
|
|
|
|
|
|
_extensions() {
|
|
|
|
if [[ -z "${SPACK_EXTENSIONS:-}" ]]
|
|
|
|
then
|
2020-02-18 07:41:48 +08:00
|
|
|
SPACK_EXTENSIONS="$(spack extensions)"
|
2020-01-06 15:35:23 +08:00
|
|
|
fi
|
|
|
|
SPACK_COMPREPLY="$SPACK_EXTENSIONS"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Testing functions
|
|
|
|
|
|
|
|
# Function for unit testing tab completion
|
|
|
|
# Syntax: _spack_completions spack install py-
|
|
|
|
_spack_completions() {
|
|
|
|
local COMP_CWORD COMP_KEY COMP_LINE COMP_POINT COMP_TYPE COMP_WORDS COMPREPLY
|
|
|
|
|
|
|
|
# Set each variable the way bash would
|
|
|
|
COMP_LINE="$*"
|
|
|
|
COMP_POINT=${#COMP_LINE}
|
|
|
|
COMP_WORDS=("$@")
|
|
|
|
if [[ ${COMP_LINE: -1} == ' ' ]]
|
|
|
|
then
|
|
|
|
COMP_WORDS+=('')
|
|
|
|
fi
|
|
|
|
COMP_CWORD=$((${#COMP_WORDS[@]} - 1))
|
|
|
|
COMP_KEY=9 # ASCII 09: Horizontal Tab
|
|
|
|
COMP_TYPE=64 # ASCII 64: '@', to list completions if the word is not unmodified
|
|
|
|
|
|
|
|
# Run Spack's tab completion function
|
|
|
|
_bash_completion_spack
|
|
|
|
|
|
|
|
# Return the result
|
|
|
|
echo "${COMPREPLY[@]:-}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Log the environment variables used
|
|
|
|
# Syntax: _test_vars >> temp
|
|
|
|
_test_vars() {
|
|
|
|
echo "-----------------------------------------------------"
|
|
|
|
echo "Variables set by bash:"
|
|
|
|
echo
|
|
|
|
echo "COMP_LINE: '$COMP_LINE'"
|
|
|
|
echo "# COMP_LINE: '${#COMP_LINE}'"
|
|
|
|
echo "COMP_WORDS: $(_pretty_print COMP_WORDS[@])"
|
|
|
|
echo "# COMP_WORDS: '${#COMP_WORDS[@]}'"
|
|
|
|
echo "COMP_CWORD: '$COMP_CWORD'"
|
|
|
|
echo "COMP_KEY: '$COMP_KEY'"
|
|
|
|
echo "COMP_POINT: '$COMP_POINT'"
|
|
|
|
echo "COMP_TYPE: '$COMP_TYPE'"
|
|
|
|
echo "COMP_WORDBREAKS: '$COMP_WORDBREAKS'"
|
|
|
|
echo
|
|
|
|
echo "Intermediate variables:"
|
|
|
|
echo
|
|
|
|
echo "COMP_WORDS_NO_FLAGS: $(_pretty_print COMP_WORDS_NO_FLAGS[@])"
|
|
|
|
echo "# COMP_WORDS_NO_FLAGS: '${#COMP_WORDS_NO_FLAGS[@]}'"
|
|
|
|
echo "COMP_CWORD_NO_FLAGS: '$COMP_CWORD_NO_FLAGS'"
|
|
|
|
echo
|
|
|
|
echo "Subfunction: '$subfunction'"
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
echo "List options: 'True'"
|
|
|
|
else
|
|
|
|
echo "List options: 'False'"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
2020-01-06 15:35:23 +08:00
|
|
|
echo "Current word: '$cur'"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
# Pretty-prints one or more arrays
|
|
|
|
# Syntax: _pretty_print array1[@] ...
|
|
|
|
_pretty_print() {
|
|
|
|
for arg in $@
|
|
|
|
do
|
|
|
|
local array=("${!arg}")
|
|
|
|
printf "$arg: ["
|
|
|
|
printf "'%s'" "${array[0]}"
|
|
|
|
printf ", '%s'" "${array[@]:1}"
|
|
|
|
echo "]"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -o bashdefault -o default -F _bash_completion_spack spack
|
|
|
|
|
2020-05-14 02:02:38 +08:00
|
|
|
# Completion for spacktivate
|
|
|
|
complete -o bashdefault -o default -F _bash_completion_spack spacktivate
|
|
|
|
|
|
|
|
_spacktivate() {
|
|
|
|
_spack_env_activate
|
|
|
|
}
|
|
|
|
|
2017-02-07 04:34:35 +08:00
|
|
|
# Spack commands
|
2020-01-06 15:35:23 +08:00
|
|
|
#
|
|
|
|
# Everything below here is auto-generated.
|
2017-02-07 04:34:35 +08:00
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2022-10-24 09:12:38 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -H --all-help --color -c --config -C --config-scope -d --debug --timestamp --pdb -e --env -D --env-dir -E --no-env --use-env-repo -k --insecure -l --enable-locks -L --disable-locks -m --mock -b --bootstrap -p --profile --sorted-profile --lines -v --verbose --stacktrace --backtrace -V --version --print-shell-vars"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
remove activate/deactivate support in favor of environments (#29317)
Environments and environment views have taken over the role of `spack activate/deactivate`, and we should deprecate these commands for several reasons:
- Global activation is a really poor idea:
- Install prefixes should be immutable; since they can have multiple, unrelated dependents; see below
- Added complexity elsewhere: verification of installations, tarballs for build caches, creation of environment views of packages with unrelated extensions "globally activated"... by removing the feature, it gets easier for people to contribute, and we'd end up with fewer bugs due to edge cases.
- Environment accomplish the same thing for non-global "activation" i.e. `spack view`, but better.
Also we write in the docs:
```
However, Spack global activations have two potential drawbacks:
#. Activated packages that involve compiled C extensions may still
need their dependencies to be loaded manually. For example,
``spack load openblas`` might be required to make ``py-numpy``
work.
#. Global activations "break" a core feature of Spack, which is that
multiple versions of a package can co-exist side-by-side. For example,
suppose you wish to run a Python package in two different
environments but the same basic Python --- one with
``py-numpy@1.7`` and one with ``py-numpy@1.8``. Spack extensions
will not support this potential debugging use case.
```
Now that environments are established and views can take over the role of activation
non-destructively, we can remove global activation/deactivation.
2022-11-11 16:50:07 +08:00
|
|
|
SPACK_COMPREPLY="add arch audit blame bootstrap build-env buildcache cd change checksum ci clean clone commands compiler compilers concretize config containerize create debug dependencies dependents deprecate dev-build develop diff docs edit env extensions external fetch find gc gpg graph help info install license list load location log-parse maintainers make-installer mark mirror module patch pkg providers pydoc python reindex remove rm repo resource restage solve spec stage style tags test test-env tutorial undevelop uninstall unit-test unload url verify versions view"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_add() {
|
2018-12-18 03:02:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -l --list-name"
|
2018-12-18 03:02:09 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2018-12-18 03:02:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_arch() {
|
2021-11-02 17:19:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -g --generic-target --known-targets -p --platform -o --operating-system -t --target -f --frontend -b --backend"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2021-06-18 21:52:08 +08:00
|
|
|
_spack_audit() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
2021-09-02 14:46:27 +08:00
|
|
|
SPACK_COMPREPLY="configs packages-https packages list"
|
2021-06-18 21:52:08 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_audit_configs() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
}
|
|
|
|
|
2021-09-02 14:46:27 +08:00
|
|
|
_spack_audit_packages_https() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --all"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-06-18 21:52:08 +08:00
|
|
|
_spack_audit_packages() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_audit_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_blame() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-05-26 02:40:08 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -t --time -p --percent -g --git --json"
|
2018-03-25 21:03:29 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-07-13 07:00:37 +08:00
|
|
|
_spack_bootstrap() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
2022-11-17 19:42:57 +08:00
|
|
|
SPACK_COMPREPLY="now status enable disable reset root list add remove mirror"
|
2021-07-13 07:00:37 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-10-20 01:25:20 +08:00
|
|
|
_spack_bootstrap_now() {
|
2022-12-06 18:54:02 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --dev"
|
2022-10-20 01:25:20 +08:00
|
|
|
}
|
|
|
|
|
2021-12-24 02:34:04 +08:00
|
|
|
_spack_bootstrap_status() {
|
|
|
|
SPACK_COMPREPLY="-h --help --optional --dev"
|
|
|
|
}
|
|
|
|
|
2021-07-13 07:00:37 +08:00
|
|
|
_spack_bootstrap_enable() {
|
2022-10-30 03:24:26 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
2021-07-13 07:00:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
_spack_bootstrap_disable() {
|
2022-10-30 03:24:26 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
2021-07-13 07:00:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
_spack_bootstrap_reset() {
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_bootstrap_root() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-08-19 02:14:02 +08:00
|
|
|
_spack_bootstrap_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
|
|
|
}
|
|
|
|
|
2022-05-25 05:33:52 +08:00
|
|
|
_spack_bootstrap_add() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --scope --trust"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_bootstrap_remove() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_bootstrap_mirror() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --binary-packages --dev"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_build_env() {
|
2018-12-18 03:02:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-03-14 16:22:20 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --clean --dirty -U --fresh --reuse --reuse-deps --dump --pickle"
|
2018-12-18 03:02:09 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2018-12-18 03:02:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache() {
|
2017-08-17 04:58:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-08-17 04:58:09 +08:00
|
|
|
else
|
2023-05-06 01:54:26 +08:00
|
|
|
SPACK_COMPREPLY="push create install list keys preview check download get-buildcache-name save-specfile sync update-index rebuild-index"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_buildcache_push() {
|
|
|
|
if $list_options
|
|
|
|
then
|
2023-08-23 17:20:33 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -f --force --allow-root -a --unsigned -u --key -k --update-index --rebuild-index --spec-file --only --fail-fast"
|
2023-05-06 01:54:26 +08:00
|
|
|
else
|
|
|
|
_mirrors
|
2017-08-17 04:58:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_create() {
|
2017-08-17 04:58:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-08-23 17:20:33 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -f --force --allow-root -a --unsigned -u --key -k --update-index --rebuild-index --spec-file --only --fail-fast"
|
2017-08-17 04:58:09 +08:00
|
|
|
else
|
Refer to mirrors by name, path, or url (#34891)
With this change we get the invariant that `mirror.fetch_url` and
`mirror.push_url` return valid URLs, even when the backing config
file is actually using (relative) paths with potentially `$spack` and
`$env` like variables.
Secondly it avoids expanding mirror path / URLs too early,
so if I say `spack mirror add name ./path`, it stays `./path` in my
config. When it's retrieved through MirrorCollection() we
exand it to say `file://<env dir>/path` if `./path` was set in an
environment scope.
Thirdly, the interface is simplified for the relevant buildcache
commands, so it's more like `git push`:
```
spack buildcache create [mirror] [specs...]
```
`mirror` is either a mirror name, a path, or a URL.
Resolving the relevant mirror goes as follows:
- If it contains either / or \ it is used as an anonymous mirror with
path or url.
- Otherwise, it's interpreted as a named mirror, which must exist.
This helps to guard against typos, e.g. typing `my-mirror` when there
is no such named mirror now errors with:
```
$ spack -e . buildcache create my-mirror
==> Error: no mirror named "my-mirror". Did you mean ./my-mirror?
```
instead of creating a directory in the current working directory. I
think this is reasonable, as the alternative (requiring that a local dir
exists) feels a bit pendantic in the general case -- spack is happy to
create the build cache dir when needed, saving a `mkdir`.
The old (now deprecated) format will still be available in Spack 0.20,
but is scheduled to be removed in 0.21:
```
spack buildcache create (--directory | --mirror-url | --mirror-name) [specs...]
```
This PR also touches `tmp_scope` in tests, because it didn't really
work for me, since spack fixes the possible --scope values once and
for all across tests, so tests failed when run out of order.
2023-01-17 02:14:41 +08:00
|
|
|
_mirrors
|
2017-08-17 04:58:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_install() {
|
2017-08-17 04:58:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-06-12 20:33:26 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -f --force -m --multiple -u --unsigned -o --otherarch"
|
2020-01-07 13:18:14 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_list() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-08-02 19:16:14 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -l --long -L --very-long -N --namespaces -v --variants -a --allarch"
|
2017-08-17 04:58:09 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-08-17 04:58:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_keys() {
|
|
|
|
SPACK_COMPREPLY="-h --help -i --install -t --trust -f --force"
|
2017-08-17 04:58:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_preview() {
|
2017-08-17 04:58:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-08-17 04:58:09 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2017-08-17 04:58:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_check() {
|
2022-01-29 00:49:15 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -m --mirror-url -o --output-file --scope -s --spec --spec-file"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_download() {
|
2022-04-15 00:42:30 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -s --spec --spec-file -p --path"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_get_buildcache_name() {
|
specs: move to new spec.json format with build provenance (#22845)
This is a major rework of Spack's core core `spec.yaml` metadata format. It moves from `spec.yaml` to `spec.json` for speed, and it changes the format in several ways. Specifically:
1. The spec format now has a `_meta` section with a version (now set to version `2`). This will simplify major changes like this one in the future.
2. The node list in spec dictionaries is no longer keyed by name. Instead, it is a list of records with no required key. The name, hash, etc. are fields in the dictionary records like any other.
3. Dependencies can be keyed by any hash (`hash`, `full_hash`, `build_hash`).
4. `build_spec` provenance from #20262 is included in the spec format. This means that, for spliced specs, we preserve the *full* provenance of how to build, and we can reproduce a spliced spec from the original builds that produced it.
**NOTE**: Because we have switched the spec format, this PR changes Spack's hashing algorithm. This means that after this commit, Spack will think a lot of things need rebuilds.
There are two major benefits this PR provides:
* The switch to JSON format speeds up Spack significantly, as Python's builtin JSON implementation is orders of magnitude faster than YAML.
* The new Spec format will soon allow us to represent DAGs with potentially multiple versions of the same dependency -- e.g., for build dependencies or for compilers-as-dependencies. This PR lays the necessary groundwork for those features.
The old `spec.yaml` format continues to be supported, but is now considered a legacy format, and Spack will opportunistically convert these to the new `spec.json` format.
2021-09-09 16:48:30 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -s --spec --spec-file"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
specs: move to new spec.json format with build provenance (#22845)
This is a major rework of Spack's core core `spec.yaml` metadata format. It moves from `spec.yaml` to `spec.json` for speed, and it changes the format in several ways. Specifically:
1. The spec format now has a `_meta` section with a version (now set to version `2`). This will simplify major changes like this one in the future.
2. The node list in spec dictionaries is no longer keyed by name. Instead, it is a list of records with no required key. The name, hash, etc. are fields in the dictionary records like any other.
3. Dependencies can be keyed by any hash (`hash`, `full_hash`, `build_hash`).
4. `build_spec` provenance from #20262 is included in the spec format. This means that, for spliced specs, we preserve the *full* provenance of how to build, and we can reproduce a spliced spec from the original builds that produced it.
**NOTE**: Because we have switched the spec format, this PR changes Spack's hashing algorithm. This means that after this commit, Spack will think a lot of things need rebuilds.
There are two major benefits this PR provides:
* The switch to JSON format speeds up Spack significantly, as Python's builtin JSON implementation is orders of magnitude faster than YAML.
* The new Spec format will soon allow us to represent DAGs with potentially multiple versions of the same dependency -- e.g., for build dependencies or for compilers-as-dependencies. This PR lays the necessary groundwork for those features.
The old `spec.yaml` format continues to be supported, but is now considered a legacy format, and Spack will opportunistically convert these to the new `spec.json` format.
2021-09-09 16:48:30 +08:00
|
|
|
_spack_buildcache_save_specfile() {
|
|
|
|
SPACK_COMPREPLY="-h --help --root-spec --root-specfile -s --specs --specfile-dir"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-08-20 02:15:40 +08:00
|
|
|
_spack_buildcache_sync() {
|
Refer to mirrors by name, path, or url (#34891)
With this change we get the invariant that `mirror.fetch_url` and
`mirror.push_url` return valid URLs, even when the backing config
file is actually using (relative) paths with potentially `$spack` and
`$env` like variables.
Secondly it avoids expanding mirror path / URLs too early,
so if I say `spack mirror add name ./path`, it stays `./path` in my
config. When it's retrieved through MirrorCollection() we
exand it to say `file://<env dir>/path` if `./path` was set in an
environment scope.
Thirdly, the interface is simplified for the relevant buildcache
commands, so it's more like `git push`:
```
spack buildcache create [mirror] [specs...]
```
`mirror` is either a mirror name, a path, or a URL.
Resolving the relevant mirror goes as follows:
- If it contains either / or \ it is used as an anonymous mirror with
path or url.
- Otherwise, it's interpreted as a named mirror, which must exist.
This helps to guard against typos, e.g. typing `my-mirror` when there
is no such named mirror now errors with:
```
$ spack -e . buildcache create my-mirror
==> Error: no mirror named "my-mirror". Did you mean ./my-mirror?
```
instead of creating a directory in the current working directory. I
think this is reasonable, as the alternative (requiring that a local dir
exists) feels a bit pendantic in the general case -- spack is happy to
create the build cache dir when needed, saving a `mkdir`.
The old (now deprecated) format will still be available in Spack 0.20,
but is scheduled to be removed in 0.21:
```
spack buildcache create (--directory | --mirror-url | --mirror-name) [specs...]
```
This PR also touches `tmp_scope` in tests, because it didn't really
work for me, since spack fixes the possible --scope values once and
for all across tests, so tests failed when run out of order.
2023-01-17 02:14:41 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-06-12 20:33:26 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --manifest-glob"
|
Refer to mirrors by name, path, or url (#34891)
With this change we get the invariant that `mirror.fetch_url` and
`mirror.push_url` return valid URLs, even when the backing config
file is actually using (relative) paths with potentially `$spack` and
`$env` like variables.
Secondly it avoids expanding mirror path / URLs too early,
so if I say `spack mirror add name ./path`, it stays `./path` in my
config. When it's retrieved through MirrorCollection() we
exand it to say `file://<env dir>/path` if `./path` was set in an
environment scope.
Thirdly, the interface is simplified for the relevant buildcache
commands, so it's more like `git push`:
```
spack buildcache create [mirror] [specs...]
```
`mirror` is either a mirror name, a path, or a URL.
Resolving the relevant mirror goes as follows:
- If it contains either / or \ it is used as an anonymous mirror with
path or url.
- Otherwise, it's interpreted as a named mirror, which must exist.
This helps to guard against typos, e.g. typing `my-mirror` when there
is no such named mirror now errors with:
```
$ spack -e . buildcache create my-mirror
==> Error: no mirror named "my-mirror". Did you mean ./my-mirror?
```
instead of creating a directory in the current working directory. I
think this is reasonable, as the alternative (requiring that a local dir
exists) feels a bit pendantic in the general case -- spack is happy to
create the build cache dir when needed, saving a `mkdir`.
The old (now deprecated) format will still be available in Spack 0.20,
but is scheduled to be removed in 0.21:
```
spack buildcache create (--directory | --mirror-url | --mirror-name) [specs...]
```
This PR also touches `tmp_scope` in tests, because it didn't really
work for me, since spack fixes the possible --scope values once and
for all across tests, so tests failed when run out of order.
2023-01-17 02:14:41 +08:00
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
2021-08-20 02:15:40 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_buildcache_update_index() {
|
Refer to mirrors by name, path, or url (#34891)
With this change we get the invariant that `mirror.fetch_url` and
`mirror.push_url` return valid URLs, even when the backing config
file is actually using (relative) paths with potentially `$spack` and
`$env` like variables.
Secondly it avoids expanding mirror path / URLs too early,
so if I say `spack mirror add name ./path`, it stays `./path` in my
config. When it's retrieved through MirrorCollection() we
exand it to say `file://<env dir>/path` if `./path` was set in an
environment scope.
Thirdly, the interface is simplified for the relevant buildcache
commands, so it's more like `git push`:
```
spack buildcache create [mirror] [specs...]
```
`mirror` is either a mirror name, a path, or a URL.
Resolving the relevant mirror goes as follows:
- If it contains either / or \ it is used as an anonymous mirror with
path or url.
- Otherwise, it's interpreted as a named mirror, which must exist.
This helps to guard against typos, e.g. typing `my-mirror` when there
is no such named mirror now errors with:
```
$ spack -e . buildcache create my-mirror
==> Error: no mirror named "my-mirror". Did you mean ./my-mirror?
```
instead of creating a directory in the current working directory. I
think this is reasonable, as the alternative (requiring that a local dir
exists) feels a bit pendantic in the general case -- spack is happy to
create the build cache dir when needed, saving a `mkdir`.
The old (now deprecated) format will still be available in Spack 0.20,
but is scheduled to be removed in 0.21:
```
spack buildcache create (--directory | --mirror-url | --mirror-name) [specs...]
```
This PR also touches `tmp_scope` in tests, because it didn't really
work for me, since spack fixes the possible --scope values once and
for all across tests, so tests failed when run out of order.
2023-01-17 02:14:41 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-06-12 20:33:26 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -k --keys"
|
Refer to mirrors by name, path, or url (#34891)
With this change we get the invariant that `mirror.fetch_url` and
`mirror.push_url` return valid URLs, even when the backing config
file is actually using (relative) paths with potentially `$spack` and
`$env` like variables.
Secondly it avoids expanding mirror path / URLs too early,
so if I say `spack mirror add name ./path`, it stays `./path` in my
config. When it's retrieved through MirrorCollection() we
exand it to say `file://<env dir>/path` if `./path` was set in an
environment scope.
Thirdly, the interface is simplified for the relevant buildcache
commands, so it's more like `git push`:
```
spack buildcache create [mirror] [specs...]
```
`mirror` is either a mirror name, a path, or a URL.
Resolving the relevant mirror goes as follows:
- If it contains either / or \ it is used as an anonymous mirror with
path or url.
- Otherwise, it's interpreted as a named mirror, which must exist.
This helps to guard against typos, e.g. typing `my-mirror` when there
is no such named mirror now errors with:
```
$ spack -e . buildcache create my-mirror
==> Error: no mirror named "my-mirror". Did you mean ./my-mirror?
```
instead of creating a directory in the current working directory. I
think this is reasonable, as the alternative (requiring that a local dir
exists) feels a bit pendantic in the general case -- spack is happy to
create the build cache dir when needed, saving a `mkdir`.
The old (now deprecated) format will still be available in Spack 0.20,
but is scheduled to be removed in 0.21:
```
spack buildcache create (--directory | --mirror-url | --mirror-name) [specs...]
```
This PR also touches `tmp_scope` in tests, because it didn't really
work for me, since spack fixes the possible --scope values once and
for all across tests, so tests failed when run out of order.
2023-01-17 02:14:41 +08:00
|
|
|
else
|
|
|
|
_mirrors
|
|
|
|
fi
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2023-05-06 01:54:26 +08:00
|
|
|
_spack_buildcache_rebuild_index() {
|
|
|
|
if $list_options
|
|
|
|
then
|
2023-06-12 20:33:26 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -k --keys"
|
2023-05-06 01:54:26 +08:00
|
|
|
else
|
|
|
|
_mirrors
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_cd() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-05-10 18:26:29 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -m --module-dir -r --spack-root -i --install-dir -p --package-dir -P --packages -s --stage-dir -S --stages --source-dir -b --build-dir -e --env --first"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-09-02 02:04:01 +08:00
|
|
|
_spack_change() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -l --list-name --match-spec -a --all"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_checksum() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-08-01 05:49:43 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --keep-stage -b --batch -l --latest -p --preferred -a --add-to-package --verify"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_ci() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
Pipelines: reproducible builds (#22887)
### Overview
The goal of this PR is to make gitlab pipeline builds (especially build failures) more reproducible outside of the pipeline environment. The two key changes here which aim to improve reproducibility are:
1. Produce a `spack.lock` during pipeline generation which is passed to child jobs via artifacts. This concretized environment is used both by generated child jobs as well as uploaded as an artifact to be used when reproducing the build locally.
2. In the `spack ci rebuild` command, if a spec needs to be rebuilt from source, do this by generating and running an `install.sh` shell script which is then also uploaded as a job artifact to be run during local reproduction.
To make it easier to take advantage of improved build reproducibility, this PR also adds a new subcommand, `spack ci reproduce-build`, which, given a url to job artifacts:
- fetches and unzips the job artifacts to a local directory
- looks for the generated pipeline yaml and parses it to find details about the job to reproduce
- attempts to provide a copy of the same version of spack used in the ci build
- if the ci build used a docker image, the command prints a `docker run` command you can run to get an interactive shell for reproducing the build
#### Some highlights
One consequence of this change will be much smaller pipeline yaml files. By encoding the concrete environment in a `spack.lock` and passing to child jobs via artifacts, we will no longer need to encode the concrete root of each spec and write it into the job variables, greatly reducing the size of the generated pipeline yaml.
Additionally `spack ci rebuild` output (stdout/stderr) is no longer internally redirected to a log file, so job output will appear directly in the gitlab job trace. With debug logging turned on, this often results in log files getting truncated because they exceed the maximum amount of log output gitlab allows. If this is a problem, you still have the option to `tee` command output to a file in the within the artifacts directory, as now each generated job exposes a `user_data` directory as an artifact, which you can fill with whatever you want in your custom job scripts.
There are some changes to be aware of in how pipelines should be set up after this PR:
#### Pipeline generation
Because the pipeline generation job now writes a `spack.lock` artifact to be consumed by generated downstream jobs, `spack ci generate` takes a new option `--artifacts-root`, inside which it creates a `concrete_env` directory to place the lockfile. This artifacts root directory is also where the `user_data` directory will live, in case you want to generate any custom artifacts. If you do not provide `--artifacts-root`, the default is for it to create a `jobs_scratch_dir` within your `CI_PROJECT_DIR` (a gitlab predefined environment variable) or whatever is your current working directory if that variable isn't set. Here's the diff of the PR testing `.gitlab-ci.yml` taking advantage of the new option:
```
$ git diff develop..pipelines-reproducible-builds share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
index 579d7b56f3..0247803a30 100644
--- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
+++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
@@ -28,10 +28,11 @@ default:
- cd share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME}
- spack env activate --without-view .
- spack ci generate --check-index-only
+ --artifacts-root "${CI_PROJECT_DIR}/jobs_scratch_dir"
--output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
artifacts:
paths:
- - "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
+ - "${CI_PROJECT_DIR}/jobs_scratch_dir"
tags: ["spack", "public", "medium", "x86_64"]
interruptible: true
```
Notice how we replaced the specific pointer to the generated pipeline file with its containing folder, the same folder we passed as `--artifacts-root`. This way anything in that directory (the generated pipeline yaml, as well as the concrete environment directory containing the `spack.lock`) will be uploaded as an artifact and available to the downstream jobs.
#### Rebuild jobs
Rebuild jobs now must activate the concrete environment created by `spack ci generate` and provided via artifacts. When the pipeline is generated, a directory called `concrete_environment` is created within the artifacts root directory, and this is where the `spack.lock` file is written to be passed to the generated rebuild jobs. The artifacts root directory can be specified using the `--artifacts-root` option to `spack ci generate`, otherwise, it is assumed to be `$CI_PROJECT_DIR`. The directory containing the concrete environment files (`spack.yaml` and `spack.lock`) is then passed to generated child jobs via the `SPACK_CONCRETE_ENV_DIR` variable in the generated pipeline yaml file.
When you don't provide custom `script` sections in your `mappings` within the `gitlab-ci` section of your `spack.yaml`, the default behavior of rebuild jobs is now to change into `SPACK_CONCRETE_ENV_DIR` and activate that environment. If you do provide custom rebuild scripts in your `spack.yaml`, be aware those scripts should do the same thing: assume `SPACK_CONCRETE_ENV_DIR` contains the concretized environment to activate. No other changes to existing custom rebuild scripts should be required as a result of this PR.
As mentioned above, one key change made in this PR is the generation of the `install.sh` script by the rebuild jobs, as that same script is both run by the CI rebuild job as well as exported as an artifact to aid in subsequent attempts to reproduce the build outside of CI. The generated `install.sh` script contains only a single `spack install` command with arguments computed by `spack ci rebuild`. If the install fails, the job trace in gitlab will contain instructions on how to reproduce the build locally:
```
To reproduce this build locally, run:
spack ci reproduce-build https://gitlab.next.spack.io/api/v4/projects/7/jobs/240607/artifacts [--working-dir <dir>]
If this project does not have public pipelines, you will need to first:
export GITLAB_PRIVATE_TOKEN=<generated_token>
... then follow the printed instructions.
```
When run locally, the `spack ci reproduce-build` command shown above will download and process the job artifacts from gitlab, then print out instructions you can copy-paste to run a local reproducer of the CI job.
This PR includes a few other changes to the way pipelines work, see the documentation on pipelines for more details.
This PR erelies on
~- [ ] #23194 to be able to refer to uninstalled specs by DAG hash~
EDIT: that is going to take longer to come to fruition, so for now, we will continue to install specs represented by a concrete `spec.yaml` file on disk.
- [x] #22657 to support install a single spec already present in the active, concrete environment
2021-05-29 00:38:07 +08:00
|
|
|
SPACK_COMPREPLY="generate rebuild-index rebuild reproduce-build"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_ci_generate() {
|
2022-05-26 22:31:22 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --output-file --copy-to --optimize --dependencies --buildcache-destination --prune-dag --no-prune-dag --check-index-only --artifacts-root"
|
2020-01-06 15:35:23 +08:00
|
|
|
}
|
|
|
|
|
Pipelines: reproducible builds (#22887)
### Overview
The goal of this PR is to make gitlab pipeline builds (especially build failures) more reproducible outside of the pipeline environment. The two key changes here which aim to improve reproducibility are:
1. Produce a `spack.lock` during pipeline generation which is passed to child jobs via artifacts. This concretized environment is used both by generated child jobs as well as uploaded as an artifact to be used when reproducing the build locally.
2. In the `spack ci rebuild` command, if a spec needs to be rebuilt from source, do this by generating and running an `install.sh` shell script which is then also uploaded as a job artifact to be run during local reproduction.
To make it easier to take advantage of improved build reproducibility, this PR also adds a new subcommand, `spack ci reproduce-build`, which, given a url to job artifacts:
- fetches and unzips the job artifacts to a local directory
- looks for the generated pipeline yaml and parses it to find details about the job to reproduce
- attempts to provide a copy of the same version of spack used in the ci build
- if the ci build used a docker image, the command prints a `docker run` command you can run to get an interactive shell for reproducing the build
#### Some highlights
One consequence of this change will be much smaller pipeline yaml files. By encoding the concrete environment in a `spack.lock` and passing to child jobs via artifacts, we will no longer need to encode the concrete root of each spec and write it into the job variables, greatly reducing the size of the generated pipeline yaml.
Additionally `spack ci rebuild` output (stdout/stderr) is no longer internally redirected to a log file, so job output will appear directly in the gitlab job trace. With debug logging turned on, this often results in log files getting truncated because they exceed the maximum amount of log output gitlab allows. If this is a problem, you still have the option to `tee` command output to a file in the within the artifacts directory, as now each generated job exposes a `user_data` directory as an artifact, which you can fill with whatever you want in your custom job scripts.
There are some changes to be aware of in how pipelines should be set up after this PR:
#### Pipeline generation
Because the pipeline generation job now writes a `spack.lock` artifact to be consumed by generated downstream jobs, `spack ci generate` takes a new option `--artifacts-root`, inside which it creates a `concrete_env` directory to place the lockfile. This artifacts root directory is also where the `user_data` directory will live, in case you want to generate any custom artifacts. If you do not provide `--artifacts-root`, the default is for it to create a `jobs_scratch_dir` within your `CI_PROJECT_DIR` (a gitlab predefined environment variable) or whatever is your current working directory if that variable isn't set. Here's the diff of the PR testing `.gitlab-ci.yml` taking advantage of the new option:
```
$ git diff develop..pipelines-reproducible-builds share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
index 579d7b56f3..0247803a30 100644
--- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
+++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
@@ -28,10 +28,11 @@ default:
- cd share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME}
- spack env activate --without-view .
- spack ci generate --check-index-only
+ --artifacts-root "${CI_PROJECT_DIR}/jobs_scratch_dir"
--output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
artifacts:
paths:
- - "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
+ - "${CI_PROJECT_DIR}/jobs_scratch_dir"
tags: ["spack", "public", "medium", "x86_64"]
interruptible: true
```
Notice how we replaced the specific pointer to the generated pipeline file with its containing folder, the same folder we passed as `--artifacts-root`. This way anything in that directory (the generated pipeline yaml, as well as the concrete environment directory containing the `spack.lock`) will be uploaded as an artifact and available to the downstream jobs.
#### Rebuild jobs
Rebuild jobs now must activate the concrete environment created by `spack ci generate` and provided via artifacts. When the pipeline is generated, a directory called `concrete_environment` is created within the artifacts root directory, and this is where the `spack.lock` file is written to be passed to the generated rebuild jobs. The artifacts root directory can be specified using the `--artifacts-root` option to `spack ci generate`, otherwise, it is assumed to be `$CI_PROJECT_DIR`. The directory containing the concrete environment files (`spack.yaml` and `spack.lock`) is then passed to generated child jobs via the `SPACK_CONCRETE_ENV_DIR` variable in the generated pipeline yaml file.
When you don't provide custom `script` sections in your `mappings` within the `gitlab-ci` section of your `spack.yaml`, the default behavior of rebuild jobs is now to change into `SPACK_CONCRETE_ENV_DIR` and activate that environment. If you do provide custom rebuild scripts in your `spack.yaml`, be aware those scripts should do the same thing: assume `SPACK_CONCRETE_ENV_DIR` contains the concretized environment to activate. No other changes to existing custom rebuild scripts should be required as a result of this PR.
As mentioned above, one key change made in this PR is the generation of the `install.sh` script by the rebuild jobs, as that same script is both run by the CI rebuild job as well as exported as an artifact to aid in subsequent attempts to reproduce the build outside of CI. The generated `install.sh` script contains only a single `spack install` command with arguments computed by `spack ci rebuild`. If the install fails, the job trace in gitlab will contain instructions on how to reproduce the build locally:
```
To reproduce this build locally, run:
spack ci reproduce-build https://gitlab.next.spack.io/api/v4/projects/7/jobs/240607/artifacts [--working-dir <dir>]
If this project does not have public pipelines, you will need to first:
export GITLAB_PRIVATE_TOKEN=<generated_token>
... then follow the printed instructions.
```
When run locally, the `spack ci reproduce-build` command shown above will download and process the job artifacts from gitlab, then print out instructions you can copy-paste to run a local reproducer of the CI job.
This PR includes a few other changes to the way pipelines work, see the documentation on pipelines for more details.
This PR erelies on
~- [ ] #23194 to be able to refer to uninstalled specs by DAG hash~
EDIT: that is going to take longer to come to fruition, so for now, we will continue to install specs represented by a concrete `spec.yaml` file on disk.
- [x] #22657 to support install a single spec already present in the active, concrete environment
2021-05-29 00:38:07 +08:00
|
|
|
_spack_ci_rebuild_index() {
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
}
|
|
|
|
|
Pipelines: reproducible builds (#22887)
### Overview
The goal of this PR is to make gitlab pipeline builds (especially build failures) more reproducible outside of the pipeline environment. The two key changes here which aim to improve reproducibility are:
1. Produce a `spack.lock` during pipeline generation which is passed to child jobs via artifacts. This concretized environment is used both by generated child jobs as well as uploaded as an artifact to be used when reproducing the build locally.
2. In the `spack ci rebuild` command, if a spec needs to be rebuilt from source, do this by generating and running an `install.sh` shell script which is then also uploaded as a job artifact to be run during local reproduction.
To make it easier to take advantage of improved build reproducibility, this PR also adds a new subcommand, `spack ci reproduce-build`, which, given a url to job artifacts:
- fetches and unzips the job artifacts to a local directory
- looks for the generated pipeline yaml and parses it to find details about the job to reproduce
- attempts to provide a copy of the same version of spack used in the ci build
- if the ci build used a docker image, the command prints a `docker run` command you can run to get an interactive shell for reproducing the build
#### Some highlights
One consequence of this change will be much smaller pipeline yaml files. By encoding the concrete environment in a `spack.lock` and passing to child jobs via artifacts, we will no longer need to encode the concrete root of each spec and write it into the job variables, greatly reducing the size of the generated pipeline yaml.
Additionally `spack ci rebuild` output (stdout/stderr) is no longer internally redirected to a log file, so job output will appear directly in the gitlab job trace. With debug logging turned on, this often results in log files getting truncated because they exceed the maximum amount of log output gitlab allows. If this is a problem, you still have the option to `tee` command output to a file in the within the artifacts directory, as now each generated job exposes a `user_data` directory as an artifact, which you can fill with whatever you want in your custom job scripts.
There are some changes to be aware of in how pipelines should be set up after this PR:
#### Pipeline generation
Because the pipeline generation job now writes a `spack.lock` artifact to be consumed by generated downstream jobs, `spack ci generate` takes a new option `--artifacts-root`, inside which it creates a `concrete_env` directory to place the lockfile. This artifacts root directory is also where the `user_data` directory will live, in case you want to generate any custom artifacts. If you do not provide `--artifacts-root`, the default is for it to create a `jobs_scratch_dir` within your `CI_PROJECT_DIR` (a gitlab predefined environment variable) or whatever is your current working directory if that variable isn't set. Here's the diff of the PR testing `.gitlab-ci.yml` taking advantage of the new option:
```
$ git diff develop..pipelines-reproducible-builds share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
index 579d7b56f3..0247803a30 100644
--- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
+++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
@@ -28,10 +28,11 @@ default:
- cd share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME}
- spack env activate --without-view .
- spack ci generate --check-index-only
+ --artifacts-root "${CI_PROJECT_DIR}/jobs_scratch_dir"
--output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
artifacts:
paths:
- - "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
+ - "${CI_PROJECT_DIR}/jobs_scratch_dir"
tags: ["spack", "public", "medium", "x86_64"]
interruptible: true
```
Notice how we replaced the specific pointer to the generated pipeline file with its containing folder, the same folder we passed as `--artifacts-root`. This way anything in that directory (the generated pipeline yaml, as well as the concrete environment directory containing the `spack.lock`) will be uploaded as an artifact and available to the downstream jobs.
#### Rebuild jobs
Rebuild jobs now must activate the concrete environment created by `spack ci generate` and provided via artifacts. When the pipeline is generated, a directory called `concrete_environment` is created within the artifacts root directory, and this is where the `spack.lock` file is written to be passed to the generated rebuild jobs. The artifacts root directory can be specified using the `--artifacts-root` option to `spack ci generate`, otherwise, it is assumed to be `$CI_PROJECT_DIR`. The directory containing the concrete environment files (`spack.yaml` and `spack.lock`) is then passed to generated child jobs via the `SPACK_CONCRETE_ENV_DIR` variable in the generated pipeline yaml file.
When you don't provide custom `script` sections in your `mappings` within the `gitlab-ci` section of your `spack.yaml`, the default behavior of rebuild jobs is now to change into `SPACK_CONCRETE_ENV_DIR` and activate that environment. If you do provide custom rebuild scripts in your `spack.yaml`, be aware those scripts should do the same thing: assume `SPACK_CONCRETE_ENV_DIR` contains the concretized environment to activate. No other changes to existing custom rebuild scripts should be required as a result of this PR.
As mentioned above, one key change made in this PR is the generation of the `install.sh` script by the rebuild jobs, as that same script is both run by the CI rebuild job as well as exported as an artifact to aid in subsequent attempts to reproduce the build outside of CI. The generated `install.sh` script contains only a single `spack install` command with arguments computed by `spack ci rebuild`. If the install fails, the job trace in gitlab will contain instructions on how to reproduce the build locally:
```
To reproduce this build locally, run:
spack ci reproduce-build https://gitlab.next.spack.io/api/v4/projects/7/jobs/240607/artifacts [--working-dir <dir>]
If this project does not have public pipelines, you will need to first:
export GITLAB_PRIVATE_TOKEN=<generated_token>
... then follow the printed instructions.
```
When run locally, the `spack ci reproduce-build` command shown above will download and process the job artifacts from gitlab, then print out instructions you can copy-paste to run a local reproducer of the CI job.
This PR includes a few other changes to the way pipelines work, see the documentation on pipelines for more details.
This PR erelies on
~- [ ] #23194 to be able to refer to uninstalled specs by DAG hash~
EDIT: that is going to take longer to come to fruition, so for now, we will continue to install specs represented by a concrete `spec.yaml` file on disk.
- [x] #22657 to support install a single spec already present in the active, concrete environment
2021-05-29 00:38:07 +08:00
|
|
|
_spack_ci_rebuild() {
|
2022-08-23 15:52:48 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -t --tests --fail-fast"
|
2021-02-17 00:12:37 +08:00
|
|
|
}
|
|
|
|
|
Pipelines: reproducible builds (#22887)
### Overview
The goal of this PR is to make gitlab pipeline builds (especially build failures) more reproducible outside of the pipeline environment. The two key changes here which aim to improve reproducibility are:
1. Produce a `spack.lock` during pipeline generation which is passed to child jobs via artifacts. This concretized environment is used both by generated child jobs as well as uploaded as an artifact to be used when reproducing the build locally.
2. In the `spack ci rebuild` command, if a spec needs to be rebuilt from source, do this by generating and running an `install.sh` shell script which is then also uploaded as a job artifact to be run during local reproduction.
To make it easier to take advantage of improved build reproducibility, this PR also adds a new subcommand, `spack ci reproduce-build`, which, given a url to job artifacts:
- fetches and unzips the job artifacts to a local directory
- looks for the generated pipeline yaml and parses it to find details about the job to reproduce
- attempts to provide a copy of the same version of spack used in the ci build
- if the ci build used a docker image, the command prints a `docker run` command you can run to get an interactive shell for reproducing the build
#### Some highlights
One consequence of this change will be much smaller pipeline yaml files. By encoding the concrete environment in a `spack.lock` and passing to child jobs via artifacts, we will no longer need to encode the concrete root of each spec and write it into the job variables, greatly reducing the size of the generated pipeline yaml.
Additionally `spack ci rebuild` output (stdout/stderr) is no longer internally redirected to a log file, so job output will appear directly in the gitlab job trace. With debug logging turned on, this often results in log files getting truncated because they exceed the maximum amount of log output gitlab allows. If this is a problem, you still have the option to `tee` command output to a file in the within the artifacts directory, as now each generated job exposes a `user_data` directory as an artifact, which you can fill with whatever you want in your custom job scripts.
There are some changes to be aware of in how pipelines should be set up after this PR:
#### Pipeline generation
Because the pipeline generation job now writes a `spack.lock` artifact to be consumed by generated downstream jobs, `spack ci generate` takes a new option `--artifacts-root`, inside which it creates a `concrete_env` directory to place the lockfile. This artifacts root directory is also where the `user_data` directory will live, in case you want to generate any custom artifacts. If you do not provide `--artifacts-root`, the default is for it to create a `jobs_scratch_dir` within your `CI_PROJECT_DIR` (a gitlab predefined environment variable) or whatever is your current working directory if that variable isn't set. Here's the diff of the PR testing `.gitlab-ci.yml` taking advantage of the new option:
```
$ git diff develop..pipelines-reproducible-builds share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
index 579d7b56f3..0247803a30 100644
--- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
+++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
@@ -28,10 +28,11 @@ default:
- cd share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME}
- spack env activate --without-view .
- spack ci generate --check-index-only
+ --artifacts-root "${CI_PROJECT_DIR}/jobs_scratch_dir"
--output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
artifacts:
paths:
- - "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
+ - "${CI_PROJECT_DIR}/jobs_scratch_dir"
tags: ["spack", "public", "medium", "x86_64"]
interruptible: true
```
Notice how we replaced the specific pointer to the generated pipeline file with its containing folder, the same folder we passed as `--artifacts-root`. This way anything in that directory (the generated pipeline yaml, as well as the concrete environment directory containing the `spack.lock`) will be uploaded as an artifact and available to the downstream jobs.
#### Rebuild jobs
Rebuild jobs now must activate the concrete environment created by `spack ci generate` and provided via artifacts. When the pipeline is generated, a directory called `concrete_environment` is created within the artifacts root directory, and this is where the `spack.lock` file is written to be passed to the generated rebuild jobs. The artifacts root directory can be specified using the `--artifacts-root` option to `spack ci generate`, otherwise, it is assumed to be `$CI_PROJECT_DIR`. The directory containing the concrete environment files (`spack.yaml` and `spack.lock`) is then passed to generated child jobs via the `SPACK_CONCRETE_ENV_DIR` variable in the generated pipeline yaml file.
When you don't provide custom `script` sections in your `mappings` within the `gitlab-ci` section of your `spack.yaml`, the default behavior of rebuild jobs is now to change into `SPACK_CONCRETE_ENV_DIR` and activate that environment. If you do provide custom rebuild scripts in your `spack.yaml`, be aware those scripts should do the same thing: assume `SPACK_CONCRETE_ENV_DIR` contains the concretized environment to activate. No other changes to existing custom rebuild scripts should be required as a result of this PR.
As mentioned above, one key change made in this PR is the generation of the `install.sh` script by the rebuild jobs, as that same script is both run by the CI rebuild job as well as exported as an artifact to aid in subsequent attempts to reproduce the build outside of CI. The generated `install.sh` script contains only a single `spack install` command with arguments computed by `spack ci rebuild`. If the install fails, the job trace in gitlab will contain instructions on how to reproduce the build locally:
```
To reproduce this build locally, run:
spack ci reproduce-build https://gitlab.next.spack.io/api/v4/projects/7/jobs/240607/artifacts [--working-dir <dir>]
If this project does not have public pipelines, you will need to first:
export GITLAB_PRIVATE_TOKEN=<generated_token>
... then follow the printed instructions.
```
When run locally, the `spack ci reproduce-build` command shown above will download and process the job artifacts from gitlab, then print out instructions you can copy-paste to run a local reproducer of the CI job.
This PR includes a few other changes to the way pipelines work, see the documentation on pipelines for more details.
This PR erelies on
~- [ ] #23194 to be able to refer to uninstalled specs by DAG hash~
EDIT: that is going to take longer to come to fruition, so for now, we will continue to install specs represented by a concrete `spec.yaml` file on disk.
- [x] #22657 to support install a single spec already present in the active, concrete environment
2021-05-29 00:38:07 +08:00
|
|
|
_spack_ci_reproduce_build() {
|
|
|
|
if $list_options
|
|
|
|
then
|
2023-08-03 00:51:12 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --runtime --working-dir -s --autostart --gpg-file --gpg-url"
|
Pipelines: reproducible builds (#22887)
### Overview
The goal of this PR is to make gitlab pipeline builds (especially build failures) more reproducible outside of the pipeline environment. The two key changes here which aim to improve reproducibility are:
1. Produce a `spack.lock` during pipeline generation which is passed to child jobs via artifacts. This concretized environment is used both by generated child jobs as well as uploaded as an artifact to be used when reproducing the build locally.
2. In the `spack ci rebuild` command, if a spec needs to be rebuilt from source, do this by generating and running an `install.sh` shell script which is then also uploaded as a job artifact to be run during local reproduction.
To make it easier to take advantage of improved build reproducibility, this PR also adds a new subcommand, `spack ci reproduce-build`, which, given a url to job artifacts:
- fetches and unzips the job artifacts to a local directory
- looks for the generated pipeline yaml and parses it to find details about the job to reproduce
- attempts to provide a copy of the same version of spack used in the ci build
- if the ci build used a docker image, the command prints a `docker run` command you can run to get an interactive shell for reproducing the build
#### Some highlights
One consequence of this change will be much smaller pipeline yaml files. By encoding the concrete environment in a `spack.lock` and passing to child jobs via artifacts, we will no longer need to encode the concrete root of each spec and write it into the job variables, greatly reducing the size of the generated pipeline yaml.
Additionally `spack ci rebuild` output (stdout/stderr) is no longer internally redirected to a log file, so job output will appear directly in the gitlab job trace. With debug logging turned on, this often results in log files getting truncated because they exceed the maximum amount of log output gitlab allows. If this is a problem, you still have the option to `tee` command output to a file in the within the artifacts directory, as now each generated job exposes a `user_data` directory as an artifact, which you can fill with whatever you want in your custom job scripts.
There are some changes to be aware of in how pipelines should be set up after this PR:
#### Pipeline generation
Because the pipeline generation job now writes a `spack.lock` artifact to be consumed by generated downstream jobs, `spack ci generate` takes a new option `--artifacts-root`, inside which it creates a `concrete_env` directory to place the lockfile. This artifacts root directory is also where the `user_data` directory will live, in case you want to generate any custom artifacts. If you do not provide `--artifacts-root`, the default is for it to create a `jobs_scratch_dir` within your `CI_PROJECT_DIR` (a gitlab predefined environment variable) or whatever is your current working directory if that variable isn't set. Here's the diff of the PR testing `.gitlab-ci.yml` taking advantage of the new option:
```
$ git diff develop..pipelines-reproducible-builds share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
index 579d7b56f3..0247803a30 100644
--- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
+++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
@@ -28,10 +28,11 @@ default:
- cd share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME}
- spack env activate --without-view .
- spack ci generate --check-index-only
+ --artifacts-root "${CI_PROJECT_DIR}/jobs_scratch_dir"
--output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
artifacts:
paths:
- - "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
+ - "${CI_PROJECT_DIR}/jobs_scratch_dir"
tags: ["spack", "public", "medium", "x86_64"]
interruptible: true
```
Notice how we replaced the specific pointer to the generated pipeline file with its containing folder, the same folder we passed as `--artifacts-root`. This way anything in that directory (the generated pipeline yaml, as well as the concrete environment directory containing the `spack.lock`) will be uploaded as an artifact and available to the downstream jobs.
#### Rebuild jobs
Rebuild jobs now must activate the concrete environment created by `spack ci generate` and provided via artifacts. When the pipeline is generated, a directory called `concrete_environment` is created within the artifacts root directory, and this is where the `spack.lock` file is written to be passed to the generated rebuild jobs. The artifacts root directory can be specified using the `--artifacts-root` option to `spack ci generate`, otherwise, it is assumed to be `$CI_PROJECT_DIR`. The directory containing the concrete environment files (`spack.yaml` and `spack.lock`) is then passed to generated child jobs via the `SPACK_CONCRETE_ENV_DIR` variable in the generated pipeline yaml file.
When you don't provide custom `script` sections in your `mappings` within the `gitlab-ci` section of your `spack.yaml`, the default behavior of rebuild jobs is now to change into `SPACK_CONCRETE_ENV_DIR` and activate that environment. If you do provide custom rebuild scripts in your `spack.yaml`, be aware those scripts should do the same thing: assume `SPACK_CONCRETE_ENV_DIR` contains the concretized environment to activate. No other changes to existing custom rebuild scripts should be required as a result of this PR.
As mentioned above, one key change made in this PR is the generation of the `install.sh` script by the rebuild jobs, as that same script is both run by the CI rebuild job as well as exported as an artifact to aid in subsequent attempts to reproduce the build outside of CI. The generated `install.sh` script contains only a single `spack install` command with arguments computed by `spack ci rebuild`. If the install fails, the job trace in gitlab will contain instructions on how to reproduce the build locally:
```
To reproduce this build locally, run:
spack ci reproduce-build https://gitlab.next.spack.io/api/v4/projects/7/jobs/240607/artifacts [--working-dir <dir>]
If this project does not have public pipelines, you will need to first:
export GITLAB_PRIVATE_TOKEN=<generated_token>
... then follow the printed instructions.
```
When run locally, the `spack ci reproduce-build` command shown above will download and process the job artifacts from gitlab, then print out instructions you can copy-paste to run a local reproducer of the CI job.
This PR includes a few other changes to the way pipelines work, see the documentation on pipelines for more details.
This PR erelies on
~- [ ] #23194 to be able to refer to uninstalled specs by DAG hash~
EDIT: that is going to take longer to come to fruition, so for now, we will continue to install specs represented by a concrete `spec.yaml` file on disk.
- [x] #22657 to support install a single spec already present in the active, concrete environment
2021-05-29 00:38:07 +08:00
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_clean() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-03-04 01:37:46 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -s --stage -d --downloads -f --failures -m --misc-cache -p --python-cache -b --bootstrap -a --all"
|
2020-01-06 15:35:23 +08:00
|
|
|
else
|
|
|
|
_all_packages
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_clone() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -r --remote"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_commands() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-24 06:48:06 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --update-completion -a --aliases --format --header --update"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY=""
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_compiler() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY="find add remove rm list info"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_compiler_find() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_compiler_add() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY=""
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_compiler_remove() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -a --all --scope"
|
|
|
|
else
|
|
|
|
_installed_compilers
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_compiler_rm() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -a --all --scope"
|
|
|
|
else
|
|
|
|
_installed_compilers
|
|
|
|
fi
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_compiler_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_compiler_info() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_compilers
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_compilers() {
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_concretize() {
|
2023-05-12 04:29:17 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -f --force --test -q --quiet -U --fresh --reuse --reuse-deps -j --jobs"
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_config() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2021-02-25 02:57:50 +08:00
|
|
|
SPACK_COMPREPLY="get blame edit list add prefer-upstream remove rm update revert"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_config_get() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_config_sections
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_config_blame() {
|
2018-12-18 03:02:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-12-18 03:02:09 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_config_sections
|
2018-12-18 03:02:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_config_edit() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --print-file"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_config_sections
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-25 09:28:20 +08:00
|
|
|
_spack_config_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
}
|
|
|
|
|
2020-06-25 15:38:01 +08:00
|
|
|
_spack_config_add() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -f --file"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-02-25 02:57:50 +08:00
|
|
|
_spack_config_prefer_upstream() {
|
|
|
|
SPACK_COMPREPLY="-h --help --local"
|
|
|
|
}
|
|
|
|
|
2020-06-25 15:38:01 +08:00
|
|
|
_spack_config_remove() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_config_rm() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-07-31 18:58:48 +08:00
|
|
|
_spack_config_update() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
else
|
|
|
|
_config_sections
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_config_revert() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
else
|
|
|
|
_config_sections
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-31 09:19:55 +08:00
|
|
|
_spack_containerize() {
|
2022-07-07 14:49:40 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --list-os --last-stage"
|
2020-01-31 09:19:55 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_create() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-07-08 15:38:42 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --keep-stage -n --name -t --template -r --repo -N --namespace -f --force --skip-editor -b --batch"
|
2020-01-06 15:35:23 +08:00
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_debug() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-04-03 14:12:03 +08:00
|
|
|
SPACK_COMPREPLY="create-db-tarball report"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_debug_create_db_tarball() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-04-03 14:12:03 +08:00
|
|
|
_spack_debug_report() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_dependencies() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -i --installed -t --transitive --deptype -V --no-expand-virtuals"
|
2018-03-25 21:03:29 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_dependents() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -i --installed -t --transitive"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_deprecate() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all -d --dependencies -D --no-dependencies -i --install-deprecator -I --no-install-deprecator -l --link-type"
|
2020-01-07 13:18:14 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_dev_build() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-03-14 16:22:20 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --deprecated --keep-prefix --skip-patch -q --quiet --drop-in --test -b --before -u --until --clean --dirty -U --fresh --reuse --reuse-deps"
|
2020-01-07 13:18:14 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-10-16 08:23:16 +08:00
|
|
|
_spack_develop() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -p --path --no-clone --clone -f --force"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-07-30 15:08:38 +08:00
|
|
|
_spack_diff() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --json --first -a --attribute"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_docs() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_edit() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -b --build-system -c --command -d --docs -t --test -m --module -r --repo -N --namespace"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
Makefile generator for parallel spack install of environments (#30254)
`make` solves a lot of headaches that would otherwise have to be implemented in Spack:
1. Parallelism over packages through multiple `spack install` processes
2. Orderly output of parallel package installs thanks to `make --sync-output=recurse` or `make -Orecurse` (works well in GNU Make 4.3; macOS is unfortunately on a 16 years old 3.x version, but it's one `spack install gmake` away...)
3. Shared jobserver across packages, which means a single `-j` to rule them all, instead of manually finding a balance between `#spack install processes` & `#jobs per package` (See #30302).
This pr adds the `spack env depfile` command that generates a Makefile with dag hashes as
targets, and dag hashes of dependencies as prerequisites, and a command
along the lines of `spack install --only=packages /hash` to just install
a single package.
It exposes two convenient phony targets: `all`, `fetch-all`. The former installs the environment, the latter just fetches all sources. So one can either use `make all -j16` directly or run `make fetch-all -j16` on a login node and `make all -j16` on a compute node.
Example:
```yaml
spack:
specs: [perl]
view: false
```
running
```
$ spack -e . env depfile --make-target-prefix env | tee Makefile
```
generates
```Makefile
SPACK ?= spack
.PHONY: env/all env/fetch-all env/clean
env/all: env/env
env/fetch-all: env/fetch
env/env: env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww
@touch $@
env/fetch: env/.fetch/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.fetch/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.fetch/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.fetch/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.fetch/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.fetch/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.fetch/73t7ndb5w72hrat5hsax4caox2sgumzu env/.fetch/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.fetch/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.fetch/c4go4gxlcznh5p5nklpjm644epuh3pzc
@touch $@
env/dirs:
@mkdir -p env/.fetch env/.install
env/.fetch/%: | env/dirs
$(info Fetching $(SPEC))
$(SPACK) -e '/tmp/tmp.7PHPSIRACv' fetch $(SPACK_FETCH_FLAGS) /$(notdir $@) && touch $@
env/.install/%: env/.fetch/%
$(info Installing $(SPEC))
+$(SPACK) -e '/tmp/tmp.7PHPSIRACv' install $(SPACK_INSTALL_FLAGS) --only-concrete --only=package --no-add /$(notdir $@) && touch $@
# Set the human-readable spec for each target
env/%/cdqldivylyxocqymwnfzmzc5sx2zwvww: SPEC = perl@5.34.1%gcc@10.3.0+cpanm+shared+threads arch=linux-ubuntu20.04-zen2
env/%/gv5kin2xnn33uxyfte6k4a3bynhmtxze: SPEC = berkeley-db@18.1.40%gcc@10.3.0+cxx~docs+stl patches=b231fcc arch=linux-ubuntu20.04-zen2
env/%/cuymc7e5gupwyu7vza5d4vrbuslk277p: SPEC = bzip2@1.0.8%gcc@10.3.0~debug~pic+shared arch=linux-ubuntu20.04-zen2
env/%/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk: SPEC = diffutils@3.8%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws: SPEC = libiconv@1.16%gcc@10.3.0 libs=shared,static arch=linux-ubuntu20.04-zen2
env/%/yfz2agazed7ohevqvnrmm7jfkmsgwjao: SPEC = gdbm@1.19%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/73t7ndb5w72hrat5hsax4caox2sgumzu: SPEC = readline@8.1%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/trvdyncxzfozxofpm3cwgq4vecpxixzs: SPEC = ncurses@6.2%gcc@10.3.0~symlinks+termlib abi=none arch=linux-ubuntu20.04-zen2
env/%/sbzszb7v557ohyd6c2ekirx2t3ctxfxp: SPEC = pkgconf@1.8.0%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/c4go4gxlcznh5p5nklpjm644epuh3pzc: SPEC = zlib@1.2.12%gcc@10.3.0+optimize+pic+shared patches=0d38234 arch=linux-ubuntu20.04-zen2
# Install dependencies
env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww: env/.install/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.install/c4go4gxlcznh5p5nklpjm644epuh3pzc
env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p: env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk
env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk: env/.install/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws
env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao: env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu
env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu: env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs
env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs: env/.install/sbzszb7v557ohyd6c2ekirx2t3ctxfxp
env/clean:
rm -f -- env/env env/fetch env/.fetch/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.fetch/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.fetch/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.fetch/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.fetch/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.fetch/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.fetch/73t7ndb5w72hrat5hsax4caox2sgumzu env/.fetch/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.fetch/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.fetch/c4go4gxlcznh5p5nklpjm644epuh3pzc env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.install/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.install/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.install/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.install/c4go4gxlcznh5p5nklpjm644epuh3pzc
```
Then with `make -O` you get very nice orderly output when packages are built in parallel:
```console
$ make -Orecurse -j16
spack -e . install --only-concrete --only=package /c4go4gxlcznh5p5nklpjm644epuh3pzc && touch c4go4gxlcznh5p5nklpjm644epuh3pzc
==> Installing zlib-1.2.12-c4go4gxlcznh5p5nklpjm644epuh3pzc
...
Fetch: 0.00s. Build: 0.88s. Total: 0.88s.
[+] /tmp/tmp.b1eTyAOe85/store/linux-ubuntu20.04-zen2/gcc-10.3.0/zlib-1.2.12-c4go4gxlcznh5p5nklpjm644epuh3pzc
spack -e . install --only-concrete --only=package /sbzszb7v557ohyd6c2ekirx2t3ctxfxp && touch sbzszb7v557ohyd6c2ekirx2t3ctxfxp
==> Installing pkgconf-1.8.0-sbzszb7v557ohyd6c2ekirx2t3ctxfxp
...
Fetch: 0.00s. Build: 3.96s. Total: 3.96s.
[+] /tmp/tmp.b1eTyAOe85/store/linux-ubuntu20.04-zen2/gcc-10.3.0/pkgconf-1.8.0-sbzszb7v557ohyd6c2ekirx2t3ctxfxp
```
For Perl, at least for me, using `make -j16` versus `spack -e . install -j16` speeds up the builds from 3m32.623s to 2m22.775s, as some configure scripts run in parallel.
Another nice feature is you can do Makefile "metaprogramming" and depend on packages built by Spack. This example fetches all sources (in parallel) first, print a message, and only then build packages (in parallel).
```Makefile
SPACK ?= spack
.PHONY: env
all: env
spack.lock: spack.yaml
$(SPACK) -e . concretize -f
env.mk: spack.lock
$(SPACK) -e . env depfile -o $@ --make-target-prefix spack
fetch: spack/fetch
@echo Fetched all packages && touch $@
env: fetch spack/env
@echo This executes after the environment has been installed
clean:
rm -rf spack/ env.mk spack.lock
ifeq (,$(filter clean,$(MAKECMDGOALS)))
include env.mk
endif
```
2022-05-06 01:45:21 +08:00
|
|
|
SPACK_COMPREPLY="activate deactivate create remove rm list ls status st loads view update revert depfile"
|
2018-12-18 03:02:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_activate() {
|
2018-12-18 03:02:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-06-28 09:26:51 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh -v --with-view -V --without-view -p --prompt --temp -d --dir"
|
2018-12-18 03:02:09 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_environments
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_deactivate() {
|
2022-01-26 06:29:17 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_create() {
|
2018-12-18 03:02:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-03-16 04:38:35 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -d --dir --keep-relative --without-view --with-view"
|
2020-01-06 15:35:23 +08:00
|
|
|
else
|
|
|
|
_environments
|
2018-12-18 03:02:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_remove() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
2020-01-07 13:18:14 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_environments
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_rm() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
else
|
|
|
|
_environments
|
|
|
|
fi
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_ls() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_status() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_st() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_loads() {
|
2021-11-12 15:34:18 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -n --module-set-name -m --module-type --input-only -p --prefix -x --exclude -r --dependencies"
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_env_view() {
|
2018-12-18 03:02:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-12-18 03:02:09 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY=""
|
2018-12-18 03:02:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-07-31 18:58:48 +08:00
|
|
|
_spack_env_update() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
else
|
|
|
|
_environments
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_env_revert() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
else
|
|
|
|
_environments
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
Makefile generator for parallel spack install of environments (#30254)
`make` solves a lot of headaches that would otherwise have to be implemented in Spack:
1. Parallelism over packages through multiple `spack install` processes
2. Orderly output of parallel package installs thanks to `make --sync-output=recurse` or `make -Orecurse` (works well in GNU Make 4.3; macOS is unfortunately on a 16 years old 3.x version, but it's one `spack install gmake` away...)
3. Shared jobserver across packages, which means a single `-j` to rule them all, instead of manually finding a balance between `#spack install processes` & `#jobs per package` (See #30302).
This pr adds the `spack env depfile` command that generates a Makefile with dag hashes as
targets, and dag hashes of dependencies as prerequisites, and a command
along the lines of `spack install --only=packages /hash` to just install
a single package.
It exposes two convenient phony targets: `all`, `fetch-all`. The former installs the environment, the latter just fetches all sources. So one can either use `make all -j16` directly or run `make fetch-all -j16` on a login node and `make all -j16` on a compute node.
Example:
```yaml
spack:
specs: [perl]
view: false
```
running
```
$ spack -e . env depfile --make-target-prefix env | tee Makefile
```
generates
```Makefile
SPACK ?= spack
.PHONY: env/all env/fetch-all env/clean
env/all: env/env
env/fetch-all: env/fetch
env/env: env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww
@touch $@
env/fetch: env/.fetch/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.fetch/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.fetch/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.fetch/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.fetch/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.fetch/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.fetch/73t7ndb5w72hrat5hsax4caox2sgumzu env/.fetch/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.fetch/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.fetch/c4go4gxlcznh5p5nklpjm644epuh3pzc
@touch $@
env/dirs:
@mkdir -p env/.fetch env/.install
env/.fetch/%: | env/dirs
$(info Fetching $(SPEC))
$(SPACK) -e '/tmp/tmp.7PHPSIRACv' fetch $(SPACK_FETCH_FLAGS) /$(notdir $@) && touch $@
env/.install/%: env/.fetch/%
$(info Installing $(SPEC))
+$(SPACK) -e '/tmp/tmp.7PHPSIRACv' install $(SPACK_INSTALL_FLAGS) --only-concrete --only=package --no-add /$(notdir $@) && touch $@
# Set the human-readable spec for each target
env/%/cdqldivylyxocqymwnfzmzc5sx2zwvww: SPEC = perl@5.34.1%gcc@10.3.0+cpanm+shared+threads arch=linux-ubuntu20.04-zen2
env/%/gv5kin2xnn33uxyfte6k4a3bynhmtxze: SPEC = berkeley-db@18.1.40%gcc@10.3.0+cxx~docs+stl patches=b231fcc arch=linux-ubuntu20.04-zen2
env/%/cuymc7e5gupwyu7vza5d4vrbuslk277p: SPEC = bzip2@1.0.8%gcc@10.3.0~debug~pic+shared arch=linux-ubuntu20.04-zen2
env/%/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk: SPEC = diffutils@3.8%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws: SPEC = libiconv@1.16%gcc@10.3.0 libs=shared,static arch=linux-ubuntu20.04-zen2
env/%/yfz2agazed7ohevqvnrmm7jfkmsgwjao: SPEC = gdbm@1.19%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/73t7ndb5w72hrat5hsax4caox2sgumzu: SPEC = readline@8.1%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/trvdyncxzfozxofpm3cwgq4vecpxixzs: SPEC = ncurses@6.2%gcc@10.3.0~symlinks+termlib abi=none arch=linux-ubuntu20.04-zen2
env/%/sbzszb7v557ohyd6c2ekirx2t3ctxfxp: SPEC = pkgconf@1.8.0%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/c4go4gxlcznh5p5nklpjm644epuh3pzc: SPEC = zlib@1.2.12%gcc@10.3.0+optimize+pic+shared patches=0d38234 arch=linux-ubuntu20.04-zen2
# Install dependencies
env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww: env/.install/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.install/c4go4gxlcznh5p5nklpjm644epuh3pzc
env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p: env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk
env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk: env/.install/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws
env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao: env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu
env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu: env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs
env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs: env/.install/sbzszb7v557ohyd6c2ekirx2t3ctxfxp
env/clean:
rm -f -- env/env env/fetch env/.fetch/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.fetch/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.fetch/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.fetch/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.fetch/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.fetch/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.fetch/73t7ndb5w72hrat5hsax4caox2sgumzu env/.fetch/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.fetch/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.fetch/c4go4gxlcznh5p5nklpjm644epuh3pzc env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.install/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.install/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.install/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.install/c4go4gxlcznh5p5nklpjm644epuh3pzc
```
Then with `make -O` you get very nice orderly output when packages are built in parallel:
```console
$ make -Orecurse -j16
spack -e . install --only-concrete --only=package /c4go4gxlcznh5p5nklpjm644epuh3pzc && touch c4go4gxlcznh5p5nklpjm644epuh3pzc
==> Installing zlib-1.2.12-c4go4gxlcznh5p5nklpjm644epuh3pzc
...
Fetch: 0.00s. Build: 0.88s. Total: 0.88s.
[+] /tmp/tmp.b1eTyAOe85/store/linux-ubuntu20.04-zen2/gcc-10.3.0/zlib-1.2.12-c4go4gxlcznh5p5nklpjm644epuh3pzc
spack -e . install --only-concrete --only=package /sbzszb7v557ohyd6c2ekirx2t3ctxfxp && touch sbzszb7v557ohyd6c2ekirx2t3ctxfxp
==> Installing pkgconf-1.8.0-sbzszb7v557ohyd6c2ekirx2t3ctxfxp
...
Fetch: 0.00s. Build: 3.96s. Total: 3.96s.
[+] /tmp/tmp.b1eTyAOe85/store/linux-ubuntu20.04-zen2/gcc-10.3.0/pkgconf-1.8.0-sbzszb7v557ohyd6c2ekirx2t3ctxfxp
```
For Perl, at least for me, using `make -j16` versus `spack -e . install -j16` speeds up the builds from 3m32.623s to 2m22.775s, as some configure scripts run in parallel.
Another nice feature is you can do Makefile "metaprogramming" and depend on packages built by Spack. This example fetches all sources (in parallel) first, print a message, and only then build packages (in parallel).
```Makefile
SPACK ?= spack
.PHONY: env
all: env
spack.lock: spack.yaml
$(SPACK) -e . concretize -f
env.mk: spack.lock
$(SPACK) -e . env depfile -o $@ --make-target-prefix spack
fetch: spack/fetch
@echo Fetched all packages && touch $@
env: fetch spack/env
@echo This executes after the environment has been installed
clean:
rm -rf spack/ env.mk spack.lock
ifeq (,$(filter clean,$(MAKECMDGOALS)))
include env.mk
endif
```
2022-05-06 01:45:21 +08:00
|
|
|
_spack_env_depfile() {
|
2022-10-20 04:57:06 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-01-19 21:58:34 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --make-prefix --make-target-prefix --make-disable-jobserver --use-buildcache -o --output -G --generator"
|
2022-10-20 04:57:06 +08:00
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
Makefile generator for parallel spack install of environments (#30254)
`make` solves a lot of headaches that would otherwise have to be implemented in Spack:
1. Parallelism over packages through multiple `spack install` processes
2. Orderly output of parallel package installs thanks to `make --sync-output=recurse` or `make -Orecurse` (works well in GNU Make 4.3; macOS is unfortunately on a 16 years old 3.x version, but it's one `spack install gmake` away...)
3. Shared jobserver across packages, which means a single `-j` to rule them all, instead of manually finding a balance between `#spack install processes` & `#jobs per package` (See #30302).
This pr adds the `spack env depfile` command that generates a Makefile with dag hashes as
targets, and dag hashes of dependencies as prerequisites, and a command
along the lines of `spack install --only=packages /hash` to just install
a single package.
It exposes two convenient phony targets: `all`, `fetch-all`. The former installs the environment, the latter just fetches all sources. So one can either use `make all -j16` directly or run `make fetch-all -j16` on a login node and `make all -j16` on a compute node.
Example:
```yaml
spack:
specs: [perl]
view: false
```
running
```
$ spack -e . env depfile --make-target-prefix env | tee Makefile
```
generates
```Makefile
SPACK ?= spack
.PHONY: env/all env/fetch-all env/clean
env/all: env/env
env/fetch-all: env/fetch
env/env: env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww
@touch $@
env/fetch: env/.fetch/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.fetch/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.fetch/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.fetch/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.fetch/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.fetch/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.fetch/73t7ndb5w72hrat5hsax4caox2sgumzu env/.fetch/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.fetch/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.fetch/c4go4gxlcznh5p5nklpjm644epuh3pzc
@touch $@
env/dirs:
@mkdir -p env/.fetch env/.install
env/.fetch/%: | env/dirs
$(info Fetching $(SPEC))
$(SPACK) -e '/tmp/tmp.7PHPSIRACv' fetch $(SPACK_FETCH_FLAGS) /$(notdir $@) && touch $@
env/.install/%: env/.fetch/%
$(info Installing $(SPEC))
+$(SPACK) -e '/tmp/tmp.7PHPSIRACv' install $(SPACK_INSTALL_FLAGS) --only-concrete --only=package --no-add /$(notdir $@) && touch $@
# Set the human-readable spec for each target
env/%/cdqldivylyxocqymwnfzmzc5sx2zwvww: SPEC = perl@5.34.1%gcc@10.3.0+cpanm+shared+threads arch=linux-ubuntu20.04-zen2
env/%/gv5kin2xnn33uxyfte6k4a3bynhmtxze: SPEC = berkeley-db@18.1.40%gcc@10.3.0+cxx~docs+stl patches=b231fcc arch=linux-ubuntu20.04-zen2
env/%/cuymc7e5gupwyu7vza5d4vrbuslk277p: SPEC = bzip2@1.0.8%gcc@10.3.0~debug~pic+shared arch=linux-ubuntu20.04-zen2
env/%/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk: SPEC = diffutils@3.8%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws: SPEC = libiconv@1.16%gcc@10.3.0 libs=shared,static arch=linux-ubuntu20.04-zen2
env/%/yfz2agazed7ohevqvnrmm7jfkmsgwjao: SPEC = gdbm@1.19%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/73t7ndb5w72hrat5hsax4caox2sgumzu: SPEC = readline@8.1%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/trvdyncxzfozxofpm3cwgq4vecpxixzs: SPEC = ncurses@6.2%gcc@10.3.0~symlinks+termlib abi=none arch=linux-ubuntu20.04-zen2
env/%/sbzszb7v557ohyd6c2ekirx2t3ctxfxp: SPEC = pkgconf@1.8.0%gcc@10.3.0 arch=linux-ubuntu20.04-zen2
env/%/c4go4gxlcznh5p5nklpjm644epuh3pzc: SPEC = zlib@1.2.12%gcc@10.3.0+optimize+pic+shared patches=0d38234 arch=linux-ubuntu20.04-zen2
# Install dependencies
env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww: env/.install/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.install/c4go4gxlcznh5p5nklpjm644epuh3pzc
env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p: env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk
env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk: env/.install/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws
env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao: env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu
env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu: env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs
env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs: env/.install/sbzszb7v557ohyd6c2ekirx2t3ctxfxp
env/clean:
rm -f -- env/env env/fetch env/.fetch/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.fetch/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.fetch/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.fetch/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.fetch/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.fetch/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.fetch/73t7ndb5w72hrat5hsax4caox2sgumzu env/.fetch/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.fetch/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.fetch/c4go4gxlcznh5p5nklpjm644epuh3pzc env/.install/cdqldivylyxocqymwnfzmzc5sx2zwvww env/.install/gv5kin2xnn33uxyfte6k4a3bynhmtxze env/.install/cuymc7e5gupwyu7vza5d4vrbuslk277p env/.install/7vangk4jvsdgw6u6oe6ob63pyjl5cbgk env/.install/hyb7ehxxyqqp2hiw56bzm5ampkw6cxws env/.install/yfz2agazed7ohevqvnrmm7jfkmsgwjao env/.install/73t7ndb5w72hrat5hsax4caox2sgumzu env/.install/trvdyncxzfozxofpm3cwgq4vecpxixzs env/.install/sbzszb7v557ohyd6c2ekirx2t3ctxfxp env/.install/c4go4gxlcznh5p5nklpjm644epuh3pzc
```
Then with `make -O` you get very nice orderly output when packages are built in parallel:
```console
$ make -Orecurse -j16
spack -e . install --only-concrete --only=package /c4go4gxlcznh5p5nklpjm644epuh3pzc && touch c4go4gxlcznh5p5nklpjm644epuh3pzc
==> Installing zlib-1.2.12-c4go4gxlcznh5p5nklpjm644epuh3pzc
...
Fetch: 0.00s. Build: 0.88s. Total: 0.88s.
[+] /tmp/tmp.b1eTyAOe85/store/linux-ubuntu20.04-zen2/gcc-10.3.0/zlib-1.2.12-c4go4gxlcznh5p5nklpjm644epuh3pzc
spack -e . install --only-concrete --only=package /sbzszb7v557ohyd6c2ekirx2t3ctxfxp && touch sbzszb7v557ohyd6c2ekirx2t3ctxfxp
==> Installing pkgconf-1.8.0-sbzszb7v557ohyd6c2ekirx2t3ctxfxp
...
Fetch: 0.00s. Build: 3.96s. Total: 3.96s.
[+] /tmp/tmp.b1eTyAOe85/store/linux-ubuntu20.04-zen2/gcc-10.3.0/pkgconf-1.8.0-sbzszb7v557ohyd6c2ekirx2t3ctxfxp
```
For Perl, at least for me, using `make -j16` versus `spack -e . install -j16` speeds up the builds from 3m32.623s to 2m22.775s, as some configure scripts run in parallel.
Another nice feature is you can do Makefile "metaprogramming" and depend on packages built by Spack. This example fetches all sources (in parallel) first, print a message, and only then build packages (in parallel).
```Makefile
SPACK ?= spack
.PHONY: env
all: env
spack.lock: spack.yaml
$(SPACK) -e . concretize -f
env.mk: spack.lock
$(SPACK) -e . env depfile -o $@ --make-target-prefix spack
fetch: spack/fetch
@echo Fetched all packages && touch $@
env: fetch spack/env
@echo This executes after the environment has been installed
clean:
rm -rf spack/ env.mk spack.lock
ifeq (,$(filter clean,$(MAKECMDGOALS)))
include env.mk
endif
```
2022-05-06 01:45:21 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_extensions() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
remove activate/deactivate support in favor of environments (#29317)
Environments and environment views have taken over the role of `spack activate/deactivate`, and we should deprecate these commands for several reasons:
- Global activation is a really poor idea:
- Install prefixes should be immutable; since they can have multiple, unrelated dependents; see below
- Added complexity elsewhere: verification of installations, tarballs for build caches, creation of environment views of packages with unrelated extensions "globally activated"... by removing the feature, it gets easier for people to contribute, and we'd end up with fewer bugs due to edge cases.
- Environment accomplish the same thing for non-global "activation" i.e. `spack view`, but better.
Also we write in the docs:
```
However, Spack global activations have two potential drawbacks:
#. Activated packages that involve compiled C extensions may still
need their dependencies to be loaded manually. For example,
``spack load openblas`` might be required to make ``py-numpy``
work.
#. Global activations "break" a core feature of Spack, which is that
multiple versions of a package can co-exist side-by-side. For example,
suppose you wish to run a Python package in two different
environments but the same basic Python --- one with
``py-numpy@1.7`` and one with ``py-numpy@1.8``. Spack extensions
will not support this potential debugging use case.
```
Now that environments are established and views can take over the role of activation
non-destructively, we can remove global activation/deactivation.
2022-11-11 16:50:07 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -l --long -L --very-long -d --deps -p --paths -s --show"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_extensions
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-05-06 08:37:34 +08:00
|
|
|
_spack_external() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
2022-04-29 01:56:26 +08:00
|
|
|
SPACK_COMPREPLY="find list read-cray-manifest"
|
2020-05-06 08:37:34 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_external_find() {
|
|
|
|
if $list_options
|
|
|
|
then
|
2023-01-22 07:43:20 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --not-buildable --exclude -p --path --scope --all -t --tag"
|
2020-05-06 08:37:34 +08:00
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-07-31 19:07:48 +08:00
|
|
|
_spack_external_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
}
|
|
|
|
|
2022-04-29 01:56:26 +08:00
|
|
|
_spack_external_read_cray_manifest() {
|
2023-05-31 09:03:44 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --file --directory --ignore-default-dir --dry-run --fail-on-error"
|
2022-04-29 01:56:26 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_fetch() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-02-10 02:51:18 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated -m --missing -D --dependencies"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_find() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-08-02 19:16:14 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --format -H --hashes --json -d --deps -p --paths --groups --no-groups -l --long -L --very-long -t --tag -N --namespaces -c --show-concretized -f --show-flags --show-full-compiler -x --explicit -X --implicit -u --unknown -m --missing -v --variants --loaded -M --only-missing --deprecated --only-deprecated --start-date --end-date"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gc() {
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_gpg() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-03-25 21:03:29 +08:00
|
|
|
else
|
2020-09-26 00:54:24 +08:00
|
|
|
SPACK_COMPREPLY="verify trust untrust sign create list init export publish"
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gpg_verify() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2020-01-07 13:18:14 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gpg_trust() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gpg_untrust() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --signing"
|
2020-01-07 13:18:14 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_keys
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
2018-03-25 21:03:29 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gpg_sign() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --output --key --clearsign"
|
2018-03-25 21:03:29 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gpg_create() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-05-29 14:32:57 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --comment --expires --export --export-secret"
|
2020-01-06 15:35:23 +08:00
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gpg_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help --trusted --signing"
|
2018-03-25 21:03:29 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gpg_init() {
|
|
|
|
SPACK_COMPREPLY="-h --help --from"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_gpg_export() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-05-29 14:32:57 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --secret"
|
2018-03-25 21:03:29 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_keys
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-09-26 00:54:24 +08:00
|
|
|
_spack_gpg_publish() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -d --directory -m --mirror-name --mirror-url --rebuild-index"
|
|
|
|
else
|
|
|
|
_keys
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_graph() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2022-12-27 22:25:53 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -a --ascii -d --dot -s --static -c --color -i --installed --deptype"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_help() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -a --all --spec"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_subcommands
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_info() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2022-03-29 06:15:38 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -a --all --detectable --maintainers --no-dependencies --no-variants --no-versions --phases --tags --tests --virtuals"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_install() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-03-14 16:22:20 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --only -u --until -j --jobs --overwrite --fail-fast --keep-prefix --keep-stage --dont-restage --use-cache --no-cache --cache-only --use-buildcache --include-build-deps --no-check-signature --show-log-on-error --source -n --no-checksum --deprecated -v --verbose --fake --only-concrete --add --no-add -f --file --clean --dirty --test --log-format --log-file --help-cdash --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp -y --yes-to-all -U --fresh --reuse --reuse-deps"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_license() {
|
2018-12-18 03:02:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-01-02 15:09:18 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --root"
|
2018-12-18 03:02:09 +08:00
|
|
|
else
|
2021-01-02 15:09:18 +08:00
|
|
|
SPACK_COMPREPLY="list-files verify update-copyright-year"
|
2018-12-18 03:02:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_license_list_files() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_license_verify() {
|
2021-01-02 15:09:18 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_license_update_copyright_year() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_list() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-01-15 08:08:40 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -d --search-description --format -v --virtuals -t --tag --count --update"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_load() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2022-01-26 06:29:17 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --first --only --list"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_location() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-05-10 18:26:29 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -m --module-dir -r --spack-root -i --install-dir -p --package-dir -P --packages -s --stage-dir -S --stages --source-dir -b --build-dir -e --env --first"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_log_parse() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --show -c --context -p --profile -w --width -j --jobs"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_maintainers() {
|
2019-07-24 15:17:06 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --maintained --unmaintained -a --all --by-user"
|
2019-07-24 15:17:06 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2019-07-24 15:17:06 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-01-09 04:48:07 +08:00
|
|
|
_spack_make_installer() {
|
|
|
|
if $list_options
|
|
|
|
then
|
2022-01-25 03:35:44 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -v --spack-version -s --spack-source -g --git-installer-verbosity"
|
2021-01-09 04:48:07 +08:00
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-11-18 19:20:56 +08:00
|
|
|
_spack_mark() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -a --all -e --explicit -i --implicit"
|
|
|
|
else
|
|
|
|
_installed_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_mirror() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-02-10 02:51:18 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2023-07-13 19:29:17 +08:00
|
|
|
SPACK_COMPREPLY="create destroy add remove rm set-url set list"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_mirror_create() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-06-04 08:43:51 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -d --directory -a --all -f --file --exclude-file --exclude-specs --skip-unstable-versions -D --dependencies -n --versions-per-spec"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-02-17 09:21:18 +08:00
|
|
|
_spack_mirror_destroy() {
|
|
|
|
SPACK_COMPREPLY="-h --help -m --mirror-name --mirror-url"
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_mirror_add() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-07-13 19:29:17 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --scope --type --s3-access-key-id --s3-access-key-secret --s3-access-token --s3-profile --s3-endpoint-url"
|
2020-01-06 15:35:23 +08:00
|
|
|
else
|
|
|
|
_mirrors
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_mirror_remove() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_mirrors
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_mirror_rm() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
|
|
|
else
|
|
|
|
_mirrors
|
|
|
|
fi
|
2018-03-25 21:03:29 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_mirror_set_url() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-07-13 19:29:17 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --push --fetch --scope --s3-access-key-id --s3-access-key-secret --s3-access-token --s3-profile --s3-endpoint-url"
|
|
|
|
else
|
|
|
|
_mirrors
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_mirror_set() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --push --fetch --type --url --scope --s3-access-key-id --s3-access-key-secret --s3-access-token --s3-profile --s3-endpoint-url"
|
2020-01-07 13:18:14 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_mirrors
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_mirror_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="lmod tcl"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_lmod() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-05-29 05:12:05 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -n --name"
|
2018-07-23 14:05:55 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="refresh find rm loads setdefault"
|
2018-07-23 14:05:55 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_lmod_refresh() {
|
2018-07-23 14:05:55 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --delete-tree --upstream-modules -y --yes-to-all"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_lmod_find() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --full-path -r --dependencies"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_lmod_rm() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
2018-07-23 14:05:55 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2018-07-23 14:05:55 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_lmod_loads() {
|
2018-07-23 14:05:55 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --input-only -p --prefix -x --exclude -r --dependencies"
|
2018-07-23 14:05:55 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2018-07-23 14:05:55 +08:00
|
|
|
fi
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
2018-07-23 14:05:55 +08:00
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_lmod_setdefault() {
|
2018-07-23 14:05:55 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-07-23 14:05:55 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2018-07-23 14:05:55 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_tcl() {
|
2018-07-23 14:05:55 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2021-05-29 05:12:05 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -n --name"
|
2018-07-23 14:05:55 +08:00
|
|
|
else
|
2021-12-17 17:05:32 +08:00
|
|
|
SPACK_COMPREPLY="refresh find rm loads setdefault"
|
2018-07-23 14:05:55 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_tcl_refresh() {
|
2018-07-23 14:05:55 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --delete-tree --upstream-modules -y --yes-to-all"
|
2018-07-23 14:05:55 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2018-07-23 14:05:55 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_tcl_find() {
|
2018-07-23 14:05:55 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --full-path -r --dependencies"
|
2018-07-23 14:05:55 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2018-07-23 14:05:55 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_tcl_rm() {
|
2018-07-23 14:05:55 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
2018-07-23 14:05:55 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2018-07-23 14:05:55 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_module_tcl_loads() {
|
2018-07-23 14:05:55 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --input-only -p --prefix -x --exclude -r --dependencies"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-12-17 17:05:32 +08:00
|
|
|
_spack_module_tcl_setdefault() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
_installed_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_patch() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-03-14 16:22:20 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated -U --fresh --reuse --reuse-deps"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_pkg() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2022-12-10 02:07:54 +08:00
|
|
|
SPACK_COMPREPLY="add list diff added changed removed grep source hash"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_pkg_add() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_pkg_list() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_pkg_diff() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_pkg_added() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_pkg_changed() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -t --type"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_pkg_removed() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2022-12-10 02:07:54 +08:00
|
|
|
_spack_pkg_grep() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="--help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-12-24 05:45:06 +08:00
|
|
|
_spack_pkg_source() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -c --canonical"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_pkg_hash() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_providers() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_providers
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_pydoc() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_python() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2022-09-08 02:12:57 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -V --version -c -u -i -m --path"
|
2020-01-06 15:35:23 +08:00
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_reindex() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_remove() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -a --all -l --list-name -f --force"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_rm() {
|
2018-12-18 03:02:09 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -a --all -l --list-name -f --force"
|
2018-12-18 03:02:09 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2018-12-18 03:02:09 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_repo() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="create list add remove rm"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_repo_create() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-05-05 05:36:21 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -d --subdirectory"
|
2020-01-06 15:35:23 +08:00
|
|
|
else
|
|
|
|
_repos
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_repo_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_repo_add() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_repo_remove() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_repos
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_repo_rm() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --scope"
|
|
|
|
else
|
|
|
|
_repos
|
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_resource() {
|
2018-12-25 05:42:15 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-12-25 05:42:15 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="list show"
|
2018-12-25 05:42:15 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_resource_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help --only-hashes"
|
2018-12-25 05:42:15 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_resource_show() {
|
2018-12-25 05:42:15 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2018-12-25 05:42:15 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_resource_hashes
|
2018-12-25 05:42:15 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_restage() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-06-08 02:48:22 +08:00
|
|
|
_spack_solve() {
|
|
|
|
if $list_options
|
|
|
|
then
|
2023-08-02 19:16:14 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --show -l --long -L --very-long -N --namespaces -I --install-status --no-install-status -y --yaml -j --json -c --cover -t --types --timers --stats -U --fresh --reuse --reuse-deps"
|
2020-06-08 02:48:22 +08:00
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_spec() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-08-02 19:16:14 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -l --long -L --very-long -N --namespaces -I --install-status --no-install-status -y --yaml -j --json --format -c --cover -t --types -U --fresh --reuse --reuse-deps"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_stage() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2023-03-14 16:22:20 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated -p --path -U --fresh --reuse --reuse-deps"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
add mypy to style checks; rename `spack flake8` to `spack style` (#20384)
I lost my mind a bit after getting the completion stuff working and
decided to get Mypy working for spack as well. This adds a
`.mypy.ini` that checks all of the spack and llnl modules, though
not yet packages, and fixes all of the identified missing types and
type issues for the spack library.
In addition to these changes, this includes:
* rename `spack flake8` to `spack style`
Aliases flake8 to style, and just runs flake8 as before, but with
a warning. The style command runs both `flake8` and `mypy`,
in sequence. Added --no-<tool> options to turn off one or the
other, they are on by default. Fixed two issues caught by the tools.
* stub typing module for python2.x
We don't support typing in Spack for python 2.x. To allow 2.x to
support `import typing` and `from typing import ...` without a
try/except dance to support old versions, this adds a stub module
*just* for python 2.x. Doing it this way means we can only reliably
use all type hints in python3.7+, and mypi.ini has been updated to
reflect that.
* add non-default black check to spack style
This is a first step to requiring black. It doesn't enforce it by
default, but it will check it if requested. Currently enforcing the
line length of 79 since that's what flake8 requires, but it's a bit odd
for a black formatted project to be quite that narrow. All settings are
in the style command since spack has no pyproject.toml and I don't
want to add one until more discussion happens. Also re-format
`style.py` since it no longer passed the black style check
with the new length.
* use style check in github action
Update the style and docs action to use `spack style`, adding in mypy
and black to the action even if it isn't running black right now.
2020-12-23 13:39:10 +08:00
|
|
|
_spack_style() {
|
|
|
|
if $list_options
|
|
|
|
then
|
style: simplify arguments with `--tool TOOL` and `--skip TOOL`
`spack style` tests were annoyingly brittle because we could not easily be
specific about which tools to run (we had to use `--no-black`, `--no-isort`,
`--no-flake8`, and `--no-mypy`). We should be able to specify what to run OR
what to skip.
Now you can run, e.g.:
spack style --tool black,flake8
or:
spack style --skip black,isort
- [x] Remove `--no-black`, `--no-isort`, `--no-flake8`, and `--no-mypy` args.
- [x] Add `--tool TOOL` argument.
- [x] Add `--skip TOOL` argument.
- [x] Allow either `--tool black --tool flake8` or `--tool black,flake8` syntax.
2022-07-31 17:42:24 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -b --base -a --all -r --root-relative -U --no-untracked -f --fix --root -t --tool -s --skip"
|
add mypy to style checks; rename `spack flake8` to `spack style` (#20384)
I lost my mind a bit after getting the completion stuff working and
decided to get Mypy working for spack as well. This adds a
`.mypy.ini` that checks all of the spack and llnl modules, though
not yet packages, and fixes all of the identified missing types and
type issues for the spack library.
In addition to these changes, this includes:
* rename `spack flake8` to `spack style`
Aliases flake8 to style, and just runs flake8 as before, but with
a warning. The style command runs both `flake8` and `mypy`,
in sequence. Added --no-<tool> options to turn off one or the
other, they are on by default. Fixed two issues caught by the tools.
* stub typing module for python2.x
We don't support typing in Spack for python 2.x. To allow 2.x to
support `import typing` and `from typing import ...` without a
try/except dance to support old versions, this adds a stub module
*just* for python 2.x. Doing it this way means we can only reliably
use all type hints in python3.7+, and mypi.ini has been updated to
reflect that.
* add non-default black check to spack style
This is a first step to requiring black. It doesn't enforce it by
default, but it will check it if requested. Currently enforcing the
line length of 79 since that's what flake8 requires, but it's a bit odd
for a black formatted project to be quite that narrow. All settings are
in the style command since spack has no pyproject.toml and I don't
want to add one until more discussion happens. Also re-format
`style.py` since it no longer passed the black style check
with the new length.
* use style check in github action
Update the style and docs action to use `spack style`, adding in mypy
and black to the action even if it isn't running black right now.
2020-12-23 13:39:10 +08:00
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-11-02 04:40:29 +08:00
|
|
|
_spack_tags() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -i --installed -a --all"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_test() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
spack test (#15702)
Users can add test() methods to their packages to run smoke tests on
installations with the new `spack test` command (the old `spack test` is
now `spack unit-test`). spack test is environment-aware, so you can
`spack install` an environment and then run `spack test run` to run smoke
tests on all of its packages. Historical test logs can be perused with
`spack test results`. Generic smoke tests for MPI implementations, C,
C++, and Fortran compilers as well as specific smoke tests for 18
packages.
Inside the test method, individual tests can be run separately (and
continue to run best-effort after a test failure) using the `run_test`
method. The `run_test` method encapsulates finding test executables,
running and checking return codes, checking output, and error handling.
This handles the following trickier aspects of testing with direct
support in Spack's package API:
- [x] Caching source or intermediate build files at build time for
use at test time.
- [x] Test dependencies,
- [x] packages that require a compiler for testing (such as library only
packages).
See the packaging guide for more details on using Spack testing support.
Included is support for package.py files for virtual packages. This does
not change the Spack interface, but is a major change in internals.
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Co-authored-by: wspear <wjspear@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-11-18 18:39:02 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
spack test (#15702)
Users can add test() methods to their packages to run smoke tests on
installations with the new `spack test` command (the old `spack test` is
now `spack unit-test`). spack test is environment-aware, so you can
`spack install` an environment and then run `spack test run` to run smoke
tests on all of its packages. Historical test logs can be perused with
`spack test results`. Generic smoke tests for MPI implementations, C,
C++, and Fortran compilers as well as specific smoke tests for 18
packages.
Inside the test method, individual tests can be run separately (and
continue to run best-effort after a test failure) using the `run_test`
method. The `run_test` method encapsulates finding test executables,
running and checking return codes, checking output, and error handling.
This handles the following trickier aspects of testing with direct
support in Spack's package API:
- [x] Caching source or intermediate build files at build time for
use at test time.
- [x] Test dependencies,
- [x] packages that require a compiler for testing (such as library only
packages).
See the packaging guide for more details on using Spack testing support.
Included is support for package.py files for virtual packages. This does
not change the Spack interface, but is a major change in internals.
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Co-authored-by: wspear <wjspear@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-11-18 18:39:02 +08:00
|
|
|
SPACK_COMPREPLY="run list find status results remove"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_test_run() {
|
|
|
|
if $list_options
|
|
|
|
then
|
2022-10-26 03:32:55 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --alias --fail-fast --fail-first --externals -x --explicit --keep-stage --log-format --log-file --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp --help-cdash --clean --dirty"
|
spack test (#15702)
Users can add test() methods to their packages to run smoke tests on
installations with the new `spack test` command (the old `spack test` is
now `spack unit-test`). spack test is environment-aware, so you can
`spack install` an environment and then run `spack test run` to run smoke
tests on all of its packages. Historical test logs can be perused with
`spack test results`. Generic smoke tests for MPI implementations, C,
C++, and Fortran compilers as well as specific smoke tests for 18
packages.
Inside the test method, individual tests can be run separately (and
continue to run best-effort after a test failure) using the `run_test`
method. The `run_test` method encapsulates finding test executables,
running and checking return codes, checking output, and error handling.
This handles the following trickier aspects of testing with direct
support in Spack's package API:
- [x] Caching source or intermediate build files at build time for
use at test time.
- [x] Test dependencies,
- [x] packages that require a compiler for testing (such as library only
packages).
See the packaging guide for more details on using Spack testing support.
Included is support for package.py files for virtual packages. This does
not change the Spack interface, but is a major change in internals.
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Co-authored-by: wspear <wjspear@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-11-18 18:39:02 +08:00
|
|
|
else
|
|
|
|
_installed_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_test_list() {
|
2021-11-02 17:00:21 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -a --all"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
spack test (#15702)
Users can add test() methods to their packages to run smoke tests on
installations with the new `spack test` command (the old `spack test` is
now `spack unit-test`). spack test is environment-aware, so you can
`spack install` an environment and then run `spack test run` to run smoke
tests on all of its packages. Historical test logs can be perused with
`spack test results`. Generic smoke tests for MPI implementations, C,
C++, and Fortran compilers as well as specific smoke tests for 18
packages.
Inside the test method, individual tests can be run separately (and
continue to run best-effort after a test failure) using the `run_test`
method. The `run_test` method encapsulates finding test executables,
running and checking return codes, checking output, and error handling.
This handles the following trickier aspects of testing with direct
support in Spack's package API:
- [x] Caching source or intermediate build files at build time for
use at test time.
- [x] Test dependencies,
- [x] packages that require a compiler for testing (such as library only
packages).
See the packaging guide for more details on using Spack testing support.
Included is support for package.py files for virtual packages. This does
not change the Spack interface, but is a major change in internals.
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Co-authored-by: wspear <wjspear@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-11-18 18:39:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
_spack_test_find() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_test_status() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_test_results() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -l --logs -f --failed"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_test_remove() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_test_env() {
|
|
|
|
if $list_options
|
|
|
|
then
|
2023-03-14 16:22:20 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --clean --dirty -U --fresh --reuse --reuse-deps --dump --pickle"
|
spack test (#15702)
Users can add test() methods to their packages to run smoke tests on
installations with the new `spack test` command (the old `spack test` is
now `spack unit-test`). spack test is environment-aware, so you can
`spack install` an environment and then run `spack test run` to run smoke
tests on all of its packages. Historical test logs can be perused with
`spack test results`. Generic smoke tests for MPI implementations, C,
C++, and Fortran compilers as well as specific smoke tests for 18
packages.
Inside the test method, individual tests can be run separately (and
continue to run best-effort after a test failure) using the `run_test`
method. The `run_test` method encapsulates finding test executables,
running and checking return codes, checking output, and error handling.
This handles the following trickier aspects of testing with direct
support in Spack's package API:
- [x] Caching source or intermediate build files at build time for
use at test time.
- [x] Test dependencies,
- [x] packages that require a compiler for testing (such as library only
packages).
See the packaging guide for more details on using Spack testing support.
Included is support for package.py files for virtual packages. This does
not change the Spack interface, but is a major change in internals.
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Co-authored-by: wspear <wjspear@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-11-18 18:39:02 +08:00
|
|
|
else
|
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-11-09 19:47:08 +08:00
|
|
|
_spack_tutorial() {
|
|
|
|
SPACK_COMPREPLY="-h --help -y --yes-to-all"
|
|
|
|
}
|
|
|
|
|
2020-10-16 08:23:16 +08:00
|
|
|
_spack_undevelop() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -a --all"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_uninstall() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
"spack uninstall": don't modify env (#33711)
"spack install foo" no longer adds package "foo" to the environment
(i.e. to the list of root specs) by default: you must specify "--add".
Likewise "spack uninstall foo" no longer removes package "foo" from
the environment: you must specify --remove. Generally this means
that install/uninstall commands will no longer modify the users list
of root specs (which many users found problematic: they had to
deactivate an environment if they wanted to uninstall a spec without
changing their spack.yaml description).
In more detail: if you have environments e1 and e2, and specs [P, Q, R]
such that P depends on R, Q depends on R, [P, R] are in e1, and [Q, R]
are in e2:
* `spack uninstall --dependents --remove r` in e1: removes R from e1
(but does not uninstall it) and uninstalls (and removes) P
* `spack uninstall -f --dependents r` in e1: will uninstall P, Q, and
R (i.e. e2 will have dependent specs uninstalled as a side effect)
* `spack uninstall -f --dependents --remove r` in e1: this uninstalls
P, Q, and R, and removes [P, R] from e1
* `spack uninstall -f --remove r` in e1: uninstalls R (so it is
"missing" in both environments) and removes R from e1 (note that e1
would still install R as a dependency of P, but it would no longer
be listed as a root spec)
* `spack uninstall --dependents r` in e1: will fail because e2 needs R
Individual unit tests were created for each of these scenarios.
2022-11-08 11:24:51 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -f --force --remove -R --dependents -y --yes-to-all -a --all --origin"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
spack test (#15702)
Users can add test() methods to their packages to run smoke tests on
installations with the new `spack test` command (the old `spack test` is
now `spack unit-test`). spack test is environment-aware, so you can
`spack install` an environment and then run `spack test run` to run smoke
tests on all of its packages. Historical test logs can be perused with
`spack test results`. Generic smoke tests for MPI implementations, C,
C++, and Fortran compilers as well as specific smoke tests for 18
packages.
Inside the test method, individual tests can be run separately (and
continue to run best-effort after a test failure) using the `run_test`
method. The `run_test` method encapsulates finding test executables,
running and checking return codes, checking output, and error handling.
This handles the following trickier aspects of testing with direct
support in Spack's package API:
- [x] Caching source or intermediate build files at build time for
use at test time.
- [x] Test dependencies,
- [x] packages that require a compiler for testing (such as library only
packages).
See the packaging guide for more details on using Spack testing support.
Included is support for package.py files for virtual packages. This does
not change the Spack interface, but is a major change in internals.
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Co-authored-by: wspear <wjspear@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-11-18 18:39:02 +08:00
|
|
|
_spack_unit_test() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help -H --pytest-help -l --list -L --list-long -N --list-names --extension -s -k --showlocals"
|
|
|
|
else
|
2022-03-09 23:09:57 +08:00
|
|
|
_unit_tests
|
spack test (#15702)
Users can add test() methods to their packages to run smoke tests on
installations with the new `spack test` command (the old `spack test` is
now `spack unit-test`). spack test is environment-aware, so you can
`spack install` an environment and then run `spack test run` to run smoke
tests on all of its packages. Historical test logs can be perused with
`spack test results`. Generic smoke tests for MPI implementations, C,
C++, and Fortran compilers as well as specific smoke tests for 18
packages.
Inside the test method, individual tests can be run separately (and
continue to run best-effort after a test failure) using the `run_test`
method. The `run_test` method encapsulates finding test executables,
running and checking return codes, checking output, and error handling.
This handles the following trickier aspects of testing with direct
support in Spack's package API:
- [x] Caching source or intermediate build files at build time for
use at test time.
- [x] Test dependencies,
- [x] packages that require a compiler for testing (such as library only
packages).
See the packaging guide for more details on using Spack testing support.
Included is support for package.py files for virtual packages. This does
not change the Spack interface, but is a major change in internals.
Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Co-authored-by: wspear <wjspear@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-11-18 18:39:02 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_unload() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2022-01-26 06:29:17 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat -a --all"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_installed_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_url() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="parse list summary stats"
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_url_parse() {
|
2018-03-25 21:03:29 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -s --spider"
|
|
|
|
else
|
|
|
|
SPACK_COMPREPLY=""
|
2018-03-25 21:03:29 +08:00
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_url_list() {
|
|
|
|
SPACK_COMPREPLY="-h --help -c --color -e --extrapolation -n --incorrect-name -N --correct-name -v --incorrect-version -V --correct-version"
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_url_summary() {
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_url_stats() {
|
2021-09-08 22:59:06 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --show-issues"
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_verify() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -l --local -j --json -a --all -s --specs -f --files"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_versions() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-12-07 23:29:10 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -s --safe --safe-only -r --remote -n --new -c --concurrency"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help -v --verbose -e --exclude -d --dependencies"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-06-04 00:45:13 +08:00
|
|
|
SPACK_COMPREPLY="symlink add soft hardlink hard copy relocate remove rm statlink status check"
|
2020-01-07 13:18:14 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_symlink() {
|
2020-01-07 13:18:14 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
|
|
|
|
else
|
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_add() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
|
|
|
|
else
|
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_soft() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
|
|
|
|
else
|
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_hardlink() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
|
|
|
|
else
|
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_hard() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-06-04 00:45:13 +08:00
|
|
|
_spack_view_copy() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
_spack_view_relocate() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --projection-file -i --ignore-conflicts"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_remove() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --no-remove-dependents -a --all"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_rm() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help --no-remove-dependents -a --all"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
2018-12-18 03:02:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_statlink() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
2020-01-07 13:18:14 +08:00
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_status() {
|
2017-02-07 04:34:35 +08:00
|
|
|
if $list_options
|
|
|
|
then
|
2020-01-06 15:35:23 +08:00
|
|
|
SPACK_COMPREPLY="-h --help"
|
2017-02-07 04:34:35 +08:00
|
|
|
else
|
2020-01-06 15:35:23 +08:00
|
|
|
_all_packages
|
2017-02-07 04:34:35 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-01-06 15:35:23 +08:00
|
|
|
_spack_view_check() {
|
|
|
|
if $list_options
|
|
|
|
then
|
|
|
|
SPACK_COMPREPLY="-h --help"
|
|
|
|
else
|
|
|
|
_all_packages
|
|
|
|
fi
|
2017-02-07 04:34:35 +08:00
|
|
|
}
|