diff options
Diffstat (limited to 'share')
30 files changed, 781 insertions, 129 deletions
diff --git a/share/spack/bash/spack-completion.in b/share/spack/bash/spack-completion.in index 80ba94ed87..ae9cbc555c 100755 --- a/share/spack/bash/spack-completion.in +++ b/share/spack/bash/spack-completion.in @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -37,6 +37,17 @@ # # See `man bash` for more details. +if test -n "${ZSH_VERSION:-}" ; then + if [[ "$(emulate)" = zsh ]] ; then + # ensure base completion support is enabled, ignore insecure directories + autoload -U +X compinit && compinit -i + # ensure bash compatible completion support is enabled + autoload -U +X bashcompinit && bashcompinit + emulate sh -c "source '$0:A'" + return # stop interpreting file + fi +fi + # Bash programmable completion for Spack _bash_completion_spack() { # In all following examples, let the cursor be denoted by brackets, i.e. [] @@ -44,7 +55,7 @@ _bash_completion_spack() { # 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. - local COMP_WORDS_NO_FLAGS=() + local -a COMP_WORDS_NO_FLAGS local index=0 while [[ "$index" -lt "$COMP_CWORD" ]] do @@ -117,7 +128,9 @@ _bash_completion_spack() { #_test_vars >> temp # Make sure function exists before calling it - if [[ "$(type -t $subfunction)" == "function" ]] + local rgx #this dance is necessary to cover bash and zsh regex + rgx="$subfunction.*function.* " + if [[ "$(type $subfunction 2>&1)" =~ $rgx ]] then $subfunction COMPREPLY=($(compgen -W "$SPACK_COMPREPLY" -- "$cur")) diff --git a/share/spack/csh/pathadd.csh b/share/spack/csh/pathadd.csh index 0f8a04ba62..ec394e8990 100644 --- a/share/spack/csh/pathadd.csh +++ b/share/spack/csh/pathadd.csh @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/csh/spack.csh b/share/spack/csh/spack.csh index ce3308067e..7b6bcbf929 100644 --- a/share/spack/csh/spack.csh +++ b/share/spack/csh/spack.csh @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/docker/amazonlinux-2.dockerfile b/share/spack/docker/amazonlinux-2.dockerfile new file mode 100644 index 0000000000..70a99388a2 --- /dev/null +++ b/share/spack/docker/amazonlinux-2.dockerfile @@ -0,0 +1,70 @@ +FROM public.ecr.aws/amazonlinux/amazonlinux:2.0.20201111.0 +MAINTAINER Spack Maintainers <maintainers@spack.io> + +ENV DOCKERFILE_BASE=centos \ + DOCKERFILE_DISTRO=centos \ + DOCKERFILE_DISTRO_VERSION=7 \ + SPACK_ROOT=/opt/spack \ + DEBIAN_FRONTEND=noninteractive \ + CURRENTLY_BUILDING_DOCKER_IMAGE=1 \ + container=docker + +RUN yum update -y \ + && yum groupinstall -y "Development Tools" \ + && yum install -y \ + curl \ + findutils \ + gcc-c++ \ + gcc \ + gcc-gfortran \ + git \ + gnupg2 \ + hostname \ + iproute \ + Lmod \ + make \ + patch \ + python \ + python-pip \ + python-setuptools \ + tcl \ + unzip \ + which \ + && pip install boto3 \ + && rm -rf /var/cache/yum \ + && yum clean all + +COPY bin $SPACK_ROOT/bin +COPY etc $SPACK_ROOT/etc +COPY lib $SPACK_ROOT/lib +COPY share $SPACK_ROOT/share +COPY var $SPACK_ROOT/var +RUN mkdir -p $SPACK_ROOT/opt/spack + +RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \ + /usr/local/bin/docker-shell \ + && ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \ + /usr/local/bin/interactive-shell \ + && ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \ + /usr/local/bin/spack-env + +RUN mkdir -p /root/.spack \ + && cp $SPACK_ROOT/share/spack/docker/modules.yaml \ + /root/.spack/modules.yaml \ + && rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git + +# [WORKAROUND] +# https://superuser.com/questions/1241548/ +# xubuntu-16-04-ttyname-failed-inappropriate-ioctl-for-device#1253889 +RUN [ -f ~/.profile ] \ + && sed -i 's/mesg n/( tty -s \\&\\& mesg n || true )/g' ~/.profile \ + || true + +WORKDIR /root +SHELL ["docker-shell"] + +# TODO: add a command to Spack that (re)creates the package cache +RUN spack spec hdf5+mpi + +ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"] +CMD ["interactive-shell"] diff --git a/share/spack/docker/entrypoint.bash b/share/spack/docker/entrypoint.bash index fbd7baf2bc..bc240cd57a 100755 --- a/share/spack/docker/entrypoint.bash +++ b/share/spack/docker/entrypoint.bash @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/docker/leap-15.dockerfile b/share/spack/docker/leap-15.dockerfile new file mode 100644 index 0000000000..1da72615ad --- /dev/null +++ b/share/spack/docker/leap-15.dockerfile @@ -0,0 +1,61 @@ +FROM opensuse/leap:15.2 +MAINTAINER Christian Goll <cgoll@suse.com> + +ENV DOCKERFILE_BASE=opensuse \ + DOCKERFILE_DISTRO=opensuse_leap \ + DOCKERFILE_DISTRO_VERSION=15.2 \ + SPACK_ROOT=/opt/spack \ + DEBIAN_FRONTEND=noninteractive \ + CURRENTLY_BUILDING_DOCKER_IMAGE=1 \ + container=docker + +RUN zypper ref && \ + zypper up -y && \ + zypper in -y python3-base python3-boto3\ + xz gzip tar bzip2 curl patch \ + gcc-c++ gcc-fortran make cmake automake &&\ + zypper clean + +# clean up manpages +RUN rm -rf /var/cache/zypp/* \ + rm -rf /usr/share/doc/packages/* \ + rm -rf /usr/share/doc/manual/* + +# copy spack into container +COPY bin $SPACK_ROOT/bin +COPY etc $SPACK_ROOT/etc +COPY lib $SPACK_ROOT/lib +COPY share $SPACK_ROOT/share +COPY var $SPACK_ROOT/var +RUN mkdir -p $SPACK_ROOT/opt/spack + +RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \ + /usr/local/bin/docker-shell \ + && ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \ + /usr/local/bin/interactive-shell \ + && ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \ + /usr/local/bin/spack-env + +RUN mkdir -p /root/.spack \ + && cp $SPACK_ROOT/share/spack/docker/modules.yaml \ + /root/.spack/modules.yaml \ + && rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git + +# [WORKAROUND] +# https://superuser.com/questions/1241548/ +# xubuntu-16-04-ttyname-failed-inappropriate-ioctl-for-device#1253889 +RUN [ -f ~/.profile ] \ + && sed -i 's/mesg n/( tty -s \\&\\& mesg n || true )/g' ~/.profile \ + || true + +WORKDIR /root +SHELL ["docker-shell"] + +# Find tools which are in distro +RUN ${SPACK_ROOT}/bin/spack external find --scope system + +# TODO: add a command to Spack that (re)creates the package cache +RUN ${SPACK_ROOT}/bin/spack spec hdf5+mpi + +ENTRYPOINT ["/bin/bash", "/opt/spack/share/spack/docker/entrypoint.bash"] +CMD ["interactive-shell"] diff --git a/share/spack/docker/package-index/split.sh b/share/spack/docker/package-index/split.sh index c82d8045f6..a44b96dbc5 100755 --- a/share/spack/docker/package-index/split.sh +++ b/share/spack/docker/package-index/split.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/docs/docker/module-file-tutorial/spack.sh b/share/spack/docs/docker/module-file-tutorial/spack.sh index b025bda979..65920826b7 100644 --- a/share/spack/docs/docker/module-file-tutorial/spack.sh +++ b/share/spack/docs/docker/module-file-tutorial/spack.sh @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/gitlab/cloud_e4s_pipelines.yml b/share/spack/gitlab/cloud_e4s_pipelines.yml deleted file mode 100644 index 67a74cf971..0000000000 --- a/share/spack/gitlab/cloud_e4s_pipelines.yml +++ /dev/null @@ -1,24 +0,0 @@ -pr_pipeline: - only: - - /^github\/pr[\d]+_.*$/ - variables: - SPACK_REF: ${CI_COMMIT_SHA} - SPACK_PR_BRANCH: ${CI_COMMIT_REF_NAME} - SPACK_IS_PR_PIPELINE: "True" - AWS_ACCESS_KEY_ID: ${PR_MIRRORS_AWS_ACCESS_KEY_ID} - AWS_SECRET_ACCESS_KEY: ${PR_MIRRORS_AWS_SECRET_ACCESS_KEY} - trigger: - project: spack/e4s - strategy: depend - -develop_pipeline: - only: - - /^github\/develop$/ - variables: - SPACK_REF: ${CI_COMMIT_SHA} - AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} - AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} - SPACK_SIGNING_KEY: ${SPACK_SIGNING_KEY} - trigger: - project: spack/e4s - strategy: depend diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml new file mode 100644 index 0000000000..579d7b56f3 --- /dev/null +++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml @@ -0,0 +1,125 @@ +stages: [ "generate", "build" ] + +default: + image: { "name": "ghcr.io/scottwittenburg/ecpe4s-ubuntu18.04-runner-x86_64:2020-09-01", "entrypoint": [""] } + +######################################## +# Job templates +######################################## + +.pr: + only: + - /^github\/pr[\d]+_.*$/ + variables: + SPACK_PR_BRANCH: ${CI_COMMIT_REF_NAME} + SPACK_IS_PR_PIPELINE: "True" + +.develop: + only: + - /^github\/develop$/ + variables: + SPACK_IS_PR_PIPELINE: "False" + +.generate: + stage: generate + script: + - . "./share/spack/setup-env.sh" + - spack --version + - cd share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME} + - spack env activate --without-view . + - spack ci generate --check-index-only + --output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml" + artifacts: + paths: + - "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml" + tags: ["spack", "public", "medium", "x86_64"] + interruptible: true + +.pr-generate: + extends: [ ".pr", ".generate" ] + +.develop-generate: + extends: [ ".develop", ".generate" ] + +.build: + stage: build + +.pr-build: + extends: [ ".pr", ".build" ] + variables: + AWS_ACCESS_KEY_ID: ${PR_MIRRORS_AWS_ACCESS_KEY_ID} + AWS_SECRET_ACCESS_KEY: ${PR_MIRRORS_AWS_SECRET_ACCESS_KEY} + +.develop-build: + extends: [ ".develop", ".build" ] + variables: + AWS_ACCESS_KEY_ID: ${MIRRORS_AWS_ACCESS_KEY_ID} + AWS_SECRET_ACCESS_KEY: ${MIRRORS_AWS_SECRET_ACCESS_KEY} + SPACK_SIGNING_KEY: ${PACKAGE_SIGNING_KEY} + +######################################## +# TEMPLATE FOR ADDING ANOTHER PIPELINE +######################################## +# +# First add a new spack.yml defining the pipline to run in +# share/spack/gitlab/cloud_pipelines/stacks/my-super-cool-stack/spack.yaml +# +# Then add the following entries at the bottom of this file: +# +######################################## +# My Super Cool Pipeline +######################################## +# .my-super-cool-stack: +# variables: +# SPACK_CI_STACK_NAME: my-super-cool-stack +# +# my-super-cool-stack-pr-generate: +# extends: [ ".my-super-cool-stack", ".pr-generate"] +# +# my-super-cool-stack-develop-generate: +# extends: [ ".my-super-cool-stack", ".develop-generate"] +# +# my-super-cool-stack-pr-build: +# extends: [ ".my-super-cool-stack", ".pr-build" ] +# trigger: +# include: +# - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml +# job: my-super-cool-stack-pr-generate +# strategy: depend +# +# my-super-cool-stack-develop-build: +# extends: [ ".my-super-cool-stack", ".develop-build" ] +# trigger: +# include: +# - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml +# job: my-super-cool-stack-develop-generate +# strategy: depend + +######################################## +# E4S pipeline +######################################## +.e4s: + variables: + SPACK_CI_STACK_NAME: e4s + +e4s-pr-generate: + extends: [ ".e4s", ".pr-generate"] + +e4s-develop-generate: + extends: [ ".e4s", ".develop-generate"] + +e4s-pr-build: + extends: [ ".e4s", ".pr-build" ] + trigger: + include: + - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml + job: e4s-pr-generate + strategy: depend + +e4s-develop-build: + extends: [ ".e4s", ".develop-build" ] + trigger: + include: + - artifact: jobs_scratch_dir/cloud-ci-pipeline.yml + job: e4s-develop-generate + strategy: depend diff --git a/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml b/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml new file mode 100644 index 0000000000..f187b2c6b3 --- /dev/null +++ b/share/spack/gitlab/cloud_pipelines/stacks/e4s/spack.yaml @@ -0,0 +1,151 @@ +spack: + view: false + concretization: separately + + config: + install_tree: + root: /home/software/spack + padded_length: 512 + projections: + all: '{architecture}/{compiler.name}-{compiler.version}/{name}-{version}-{hash}' + + packages: + all: + target: [x86_64] + providers: + blas: + - openblas + mpi: + - mpich + variants: +mpi + binutils: + variants: +gold+headers+libiberty~nls + version: + - 2.33.1 + cmake: + version: [3.18.4] + hdf5: + variants: +fortran + mpich: + variants: ~wrapperrpath + openblas: + version: [0.3.10] + slepc: + version: [3.14.0] + + definitions: + - e4s: + # - adios + # - adios2 + # - aml + # - amrex + # - arborx + - argobots + # - ascent + # - axom + # - bolt + # - caliper + # - darshan-runtime + - darshan-util + # - dyninst + # - faodel + # - flecsi+cinch + # - flit + # - gasnet + # - ginkgo + # - globalarrays + # - gotcha + # - hdf5 + # - hpctoolkit + # - hpx + # - hypre + # - kokkos-kernels+openmp + # - kokkos+openmp + # - legion + # - libnrm + # - libquo + # - magma cuda_arch=70 ^cuda@10.2.89 + # - mercury + # - mfem + # - mpifileutils@develop~xattr + # - ninja + # - omega-h + # - openmpi + # - openpmd-api + # - papi + # - papyrus@1.0.1 + # - parallel-netcdf + # - pdt + # - petsc + # - phist + # - plasma + # - precice + # - pumi + # - py-jupyterhub + # - py-libensemble + # - py-petsc4py + # - qthreads scheduler=distrib + # - raja + # - rempi + # - scr + # - slate ^openblas@0.3.6 threads=openmp ^cuda@10.2.89 + # - slepc + # - stc + # - strumpack ~slate ^openblas@0.3.6 threads=openmp + # - sundials + # - superlu + # - superlu-dist + - swig + # - sz + # - tasmanian + # - tau + # - trilinos + # - turbine + # - umap + # - umpire + # - unifyfs + # - upcxx + # - veloc + # - zfp + - arch: + - '%gcc@7.5.0 arch=linux-ubuntu18.04-x86_64' + + specs: + - matrix: + - - $e4s + - - $arch + + mirrors: { "mirror": "s3://spack-binaries-develop/e4s-new-cluster" } + + gitlab-ci: + script: + - . "./share/spack/setup-env.sh" + - spack --version + - cd share/spack/gitlab/cloud_pipelines/stacks/e4s + - spack env activate --without-view . + - spack -d ci rebuild + mappings: + - match: [cuda, dyninst, hpx, precice, strumpack, sundials, trilinos, vtk-h, vtk-m] + runner-attributes: + image: { "name": "ghcr.io/scottwittenburg/ecpe4s-ubuntu18.04-runner-x86_64:2020-09-01", "entrypoint": [""] } + tags: ["spack", "public", "xlarge", "x86_64"] + - match: ['os=ubuntu18.04'] + runner-attributes: + image: { "name": "ghcr.io/scottwittenburg/ecpe4s-ubuntu18.04-runner-x86_64:2020-09-01", "entrypoint": [""] } + tags: ["spack", "public", "large", "x86_64"] + temporary-storage-url-prefix: "s3://spack-binaries-prs/pipeline-storage" + service-job-attributes: + before_script: + - . "./share/spack/setup-env.sh" + - spack --version + - cd share/spack/gitlab/cloud_pipelines/stacks/e4s + - spack env activate --without-view . + image: { "name": "ghcr.io/scottwittenburg/ecpe4s-ubuntu18.04-runner-x86_64:2020-09-01", "entrypoint": [""] } + tags: ["spack", "public", "medium", "x86_64"] + + cdash: + build-group: New PR testing workflow + url: https://cdash.spack.io + project: Spack Testing + site: Cloud Gitlab Infrastructure + diff --git a/share/spack/gitlab/ascent_pipeline.yml b/share/spack/gitlab/nersc_pipeline.yml index 4b00ec19e2..5edcb70c78 100644 --- a/share/spack/gitlab/ascent_pipeline.yml +++ b/share/spack/gitlab/nersc_pipeline.yml @@ -5,5 +5,5 @@ merge_pipeline: SPACK_REPO: ${CI_PROJECT_URL} SPACK_REF: ${CI_COMMIT_SHA} trigger: - project: ecpcitest/e4s + project: ecp/e4s/e4s strategy: depend diff --git a/share/spack/qa/completion-test.sh b/share/spack/qa/completion-test.sh index 59a5181b98..0777002f0a 100755 --- a/share/spack/qa/completion-test.sh +++ b/share/spack/qa/completion-test.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -31,13 +31,18 @@ title "Testing spack-completion.$_sp_shell with $_sp_shell" succeeds which spack title 'Testing all subcommands' -while IFS= read -r line +# read line into an array portably +READ="read -ra line" +if [ -n "${ZSH_VERSION:-}" ]; then + READ=(read -rA line) +fi +while IFS=' ' $READ do # Test that completion with no args works - succeeds _spack_completions ${line[*]} '' + succeeds _spack_completions "${line[@]}" '' # Test that completion with flags works - contains '-h --help' _spack_completions ${line[*]} - + contains '-h --help' _spack_completions "${line[@]}" - done <<- EOF $(spack commands --aliases --format=subcommands) EOF @@ -58,32 +63,39 @@ contains 'hdf5' _spack_completions spack install -v '' # XFAIL: Fails for Python 2.6 because pkg_resources not found? #contains 'compilers.py' _spack_completions spack unit-test '' -title 'Testing debugging functions' - -# This is a particularly tricky case that involves the following situation: -# `spack -d [] install ` -# Here, [] represents the cursor, which is in the middle of the line. -# We should tab-complete optional flags for `spack`, not optional flags for -# `spack install` or package names. -COMP_LINE='spack -d install ' -COMP_POINT=9 -COMP_WORDS=(spack -d install) -COMP_CWORD=2 -COMP_KEY=9 -COMP_TYPE=64 - -_bash_completion_spack -contains "--all-help" echo "${COMPREPLY[@]}" - -contains "['spack', '-d', 'install', '']" _pretty_print COMP_WORDS[@] - -# Set the rest of the intermediate variables manually -COMP_WORDS_NO_FLAGS=(spack install) -COMP_CWORD_NO_FLAGS=1 -subfunction=_spack -cur= - -list_options=true -contains "'True'" _test_vars -list_options=false -contains "'False'" _test_vars +_test_debug_functions() { + title 'Testing debugging functions' + + if [ -n "${ZSH_VERSION:-}" ]; then + emulate -L sh + fi + + # This is a particularly tricky case that involves the following situation: + # `spack -d [] install ` + # Here, [] represents the cursor, which is in the middle of the line. + # We should tab-complete optional flags for `spack`, not optional flags for + # `spack install` or package names. + COMP_LINE='spack -d install ' + COMP_POINT=9 + COMP_WORDS=(spack -d install) + COMP_CWORD=2 + COMP_KEY=9 + COMP_TYPE=64 + + _bash_completion_spack + contains "--all-help" echo "${COMPREPLY[@]}" + + contains "['spack', '-d', 'install', '']" _pretty_print COMP_WORDS[@] + + # Set the rest of the intermediate variables manually + COMP_WORDS_NO_FLAGS=(spack install) + COMP_CWORD_NO_FLAGS=1 + subfunction=_spack + cur= + + list_options=true + contains "'True'" _test_vars + list_options=false + contains "'False'" _test_vars +} +_test_debug_functions diff --git a/share/spack/qa/flake8_formatter.py b/share/spack/qa/flake8_formatter.py new file mode 100644 index 0000000000..73aa986af2 --- /dev/null +++ b/share/spack/qa/flake8_formatter.py @@ -0,0 +1,147 @@ +import re +import sys +import pycodestyle +from collections import defaultdict +from flake8.formatting.default import Pylint +from flake8.style_guide import Violation + +#: This is a dict that maps: +#: filename pattern -> +#: flake8 exemption code -> +#: list of patterns, for which matching lines should have codes applied. +#: +#: For each file, if the filename pattern matches, we'll add per-line +#: exemptions if any patterns in the sub-dict match. +pattern_exemptions = { + # exemptions applied only to package.py files. + r"package.py$": { + # Allow 'from spack import *' in packages, but no other wildcards + "F403": [ + r"^from spack import \*$", + r"^from spack.pkgkit import \*$", + ], + # Exempt lines with urls and descriptions from overlong line errors. + "E501": [ + r"^\s*homepage\s*=", + r"^\s*url\s*=", + r"^\s*git\s*=", + r"^\s*svn\s*=", + r"^\s*hg\s*=", + r"^\s*pypi\s*=", + r"^\s*list_url\s*=", + r"^\s*version\(", + r"^\s*variant\(", + r"^\s*provides\(", + r"^\s*extends\(", + r"^\s*depends_on\(", + r"^\s*conflicts\(", + r"^\s*resource\(", + r"^\s*patch\(", + ], + # Exempt '@when' decorated functions from redefinition errors. + "F811": [ + r"^\s*@when\(.*\)", + ], + }, + # exemptions applied to all files. + r".py$": { + "E501": [ + r"(https?|ftp|file)\:", # URLs + r'([\'"])[0-9a-fA-F]{32,}\1', # long hex checksums + ] + }, +} + + +# compile all regular expressions. +pattern_exemptions = dict( + ( + re.compile(file_pattern), + dict( + (code, [re.compile(p) for p in patterns]) + for code, patterns in error_dict.items() + ), + ) + for file_pattern, error_dict in pattern_exemptions.items() +) + + +class SpackFormatter(Pylint): + def __init__(self, options): + self.spack_errors = {} + self.error_seen = False + super().__init__(options) + + def after_init(self): # type: () -> None + """Overriding to keep format string from being unset in Default""" + pass + + def beginning(self, filename): + self.filename = filename + self.file_lines = None + self.spack_errors = defaultdict(list) + for file_pattern, errors in pattern_exemptions.items(): + if file_pattern.search(filename): + for code, pat_arr in errors.items(): + self.spack_errors[code].extend(pat_arr) + + def handle(self, error): # type: (Violation) -> None + """Handle an error reported by Flake8. + + This defaults to calling :meth:`format`, :meth:`show_source`, and + then :meth:`write`. This version implements the pattern-based ignore + behavior from `spack flake8` as a native flake8 plugin. + + :param error: + This will be an instance of + :class:`~flake8.style_guide.Violation`. + :type error: + flake8.style_guide.Violation + """ + + # print(error.code) + # print(error.physical_line) + # get list of patterns for this error code + pats = self.spack_errors.get(error.code, None) + # if any pattern matches, skip line + if pats is not None and any( + (pat.search(error.physical_line) for pat in pats) + ): + return + + # Special F811 handling + # Prior to Python 3.8, `noqa: F811` needed to be placed on the `@when` + # line + # Starting with Python 3.8, it must be placed on the `def` line + # https://gitlab.com/pycqa/flake8/issues/583 + # we can only determine if F811 should be ignored given the previous + # line, so get the previous line and check it + if ( + self.spack_errors.get("F811", False) + and error.code == "F811" + and error.line_number > 1 + ): + if self.file_lines is None: + if self.filename in {"stdin", "-", "(none)", None}: + self.file_lines = pycodestyle.stdin_get_value().splitlines( + True + ) + else: + self.file_lines = pycodestyle.readlines(self.filename) + for pat in self.spack_errors["F811"]: + if pat.search(self.file_lines[error.line_number - 2]): + return + + self.error_seen = True + line = self.format(error) + source = self.show_source(error) + self.write(line, source) + + def stop(self): + """Override stop to check whether any errors we consider to be errors + were reported. + + This is a hack, but it makes flake8 behave the desired way. + """ + if not self.error_seen: + sys.exit(0) diff --git a/share/spack/qa/run-build-tests b/share/spack/qa/run-build-tests index c714c59440..d64aa061fa 100755 --- a/share/spack/qa/run-build-tests +++ b/share/spack/qa/run-build-tests @@ -1,6 +1,6 @@ #!/bin/bash -e # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/qa/run-doc-tests b/share/spack/qa/run-doc-tests index eeba12d8d6..61d18288d0 100755 --- a/share/spack/qa/run-doc-tests +++ b/share/spack/qa/run-doc-tests @@ -1,6 +1,6 @@ #!/bin/bash -e # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/qa/run-shell-tests b/share/spack/qa/run-shell-tests index 9c5302ec89..83838ff5ef 100755 --- a/share/spack/qa/run-shell-tests +++ b/share/spack/qa/run-shell-tests @@ -1,6 +1,6 @@ #!/bin/bash -e # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -18,7 +18,11 @@ ORIGINAL_PATH="$PATH" . "$(dirname $0)/setup.sh" -check_dependencies $coverage kcov git hg svn +if [ "$COVERAGE" = true ]; then + check_dependencies $coverage kcov git hg svn +else + echo "COVERAGE not set to 'true' [skipping coverage]" +fi # Clean the environment by removing Spack from the path and getting rid of # the spack shell function @@ -43,6 +47,7 @@ fi # Run the test scripts for their output (these will print nicely) zsh "$QA_DIR/setup-env-test.sh" +zsh "$QA_DIR/completion-test.sh" dash "$QA_DIR/setup-env-test.sh" # Run fish tests diff --git a/share/spack/qa/run-flake8-tests b/share/spack/qa/run-style-tests index d6077fceb8..23d756a3bc 100755 --- a/share/spack/qa/run-flake8-tests +++ b/share/spack/qa/run-style-tests @@ -1,6 +1,6 @@ #!/bin/bash -e # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -15,10 +15,10 @@ # run-flake8-tests # . "$(dirname $0)/setup.sh" -check_dependencies flake8 +check_dependencies flake8 mypy # verify that the code style is correct -spack flake8 +spack style # verify that the license headers are present spack license verify diff --git a/share/spack/qa/run-unit-tests b/share/spack/qa/run-unit-tests index ec8aaf76b9..8384edee0c 100755 --- a/share/spack/qa/run-unit-tests +++ b/share/spack/qa/run-unit-tests @@ -1,6 +1,6 @@ #!/bin/bash -e # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -37,9 +37,14 @@ bin/spack -h bin/spack help -a # Profile and print top 20 lines for a simple call to spack spec -spack -p --lines 20 spec mpileaks%gcc ^elfutils@0.170 +spack -p --lines 20 spec mpileaks%gcc ^dyninst@10.0.0 ^elfutils@0.170 #----------------------------------------------------------- # Run unit tests with code coverage #----------------------------------------------------------- +if [[ "$ONLY_PACKAGES" == "true" ]]; then + echo "ONLY PACKAGE RECIPES CHANGED [skipping slow unit tests]" + export PYTEST_ADDOPTS='-k "package_sanity" -m "not maybeslow"' +fi + $coverage_run $(which spack) unit-test -x --verbose diff --git a/share/spack/qa/setup-env-test.csh b/share/spack/qa/setup-env-test.csh index 02dda30bca..b49f531942 100755 --- a/share/spack/qa/setup-env-test.csh +++ b/share/spack/qa/setup-env-test.csh @@ -1,6 +1,6 @@ #!/bin/csh # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/qa/setup-env-test.fish b/share/spack/qa/setup-env-test.fish index 964d876fe9..c0738515d1 100755 --- a/share/spack/qa/setup-env-test.fish +++ b/share/spack/qa/setup-env-test.fish @@ -1,6 +1,6 @@ #!/usr/bin/env fish # -# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/qa/setup-env-test.sh b/share/spack/qa/setup-env-test.sh index da4fb9657d..bef94dfe1f 100755 --- a/share/spack/qa/setup-env-test.sh +++ b/share/spack/qa/setup-env-test.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -109,7 +109,6 @@ succeeds spack -m load b fails spack -m load -l # test a variable MacOS clears and one it doesn't for recursive loads contains "export LD_LIBRARY_PATH=$(spack -m location -i a)/lib:$(spack -m location -i b)/lib" spack -m load --sh a -contains "export LIBRARY_PATH=$(spack -m location -i a)/lib:$(spack -m location -i b)/lib" spack -m load --sh a succeeds spack -m load --only dependencies a succeeds spack -m load --only package a fails spack -m load d diff --git a/share/spack/qa/setup.sh b/share/spack/qa/setup.sh index e614bae909..b15d3a4021 100755 --- a/share/spack/qa/setup.sh +++ b/share/spack/qa/setup.sh @@ -1,6 +1,6 @@ #!/bin/bash -e # -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -66,6 +66,10 @@ check_dependencies() { spack_package=py-flake8 pip_package=flake8 ;; + mypy) + spack_package=py-mypy + pip_package=mypy + ;; dot) spack_package=graphviz ;; diff --git a/share/spack/qa/test-framework.sh b/share/spack/qa/test-framework.sh index 14b58bbecf..4df37cd906 100755 --- a/share/spack/qa/test-framework.sh +++ b/share/spack/qa/test-framework.sh @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh index b70036456d..4ac0503947 100755 --- a/share/spack/setup-env.csh +++ b/share/spack/setup-env.csh @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -58,6 +58,18 @@ alias spack 'set _sp_args = (\!*); source $_spack_share_dir/csh/spack.c alias spacktivate 'spack env activate' alias _spack_pathadd 'set _pa_args = (\!*) && source $_spack_share_dir/csh/pathadd.csh' +# Identify and lock the python interpreter +if (! $?SPACK_PYTHON) then + setenv SPACK_PYTHON "" +endif +foreach cmd ("$SPACK_PYTHON" python3 python python2) + command -v "$cmd" >& /dev/null + if ($status == 0) then + setenv SPACK_PYTHON `command -v "$cmd"` + break + endif +end + # Set variables needed by this script _spack_pathadd PATH "$SPACK_ROOT/bin" eval `spack --print-shell-vars csh` diff --git a/share/spack/setup-env.fish b/share/spack/setup-env.fish index b74eae34d6..7bbc8f8485 100755 --- a/share/spack/setup-env.fish +++ b/share/spack/setup-env.fish @@ -1,4 +1,4 @@ -# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -253,7 +253,7 @@ function match_flag -d "checks all combinations of flags ocurring inside of a st set -l _a (string sub -s 2 (string trim "x$argv[1]")) set -l _b (string sub -s 2 (string trim "x$argv[2]")) - if test -z "$_a" || test -z "$_b" + if test -z "$_a"; or test -z "$_b" return 0 end @@ -668,6 +668,19 @@ set -l sp_source_file (status -f) # name of current file # +# Identify and lock the python interpreter +# +for cmd in "$SPACK_PYTHON" python3 python python2 + set -l _sp_python (command -v "$cmd") + if test $status -eq 0 + set -x SPACK_PYTHON $_sp_python + break + end +end + + + +# # Find root directory and add bin to path. # set -l sp_share_dir (realpath (dirname $sp_source_file)) diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index 5761d16362..a64e371f0c 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -303,12 +303,12 @@ _spack_pathadd PATH "${_sp_prefix%/}/bin" # Check whether a function of the given name is defined # _spack_fn_exists() { - LANG= type $1 2>&1 | grep -q 'function' + LANG= type $1 2>&1 | grep -q 'function' } need_module="no" if ! _spack_fn_exists use && ! _spack_fn_exists module; then - need_module="yes" + need_module="yes" fi; # Define the spack shell function with some informative no-ops, so when users @@ -326,6 +326,14 @@ if [ "$_sp_shell" = bash ]; then export -f _spack_shell_wrapper fi +# Identify and lock the python interpreter +for cmd in "${SPACK_PYTHON:-}" python3 python python2; do + if command -v > /dev/null "$cmd"; then + export SPACK_PYTHON="$(command -v "$cmd")" + break + fi +done + # # make available environment-modules # @@ -371,7 +379,7 @@ _sp_multi_pathadd MODULEPATH "$_sp_tcl_roots" # Add programmable tab completion for Bash # -if [ "$_sp_shell" = bash ]; then +if test "$_sp_shell" = bash || test -n "${ZSH_VERSION:-}"; then source $_sp_share_dir/spack-completion.bash fi diff --git a/share/spack/setup-tutorial-env.sh b/share/spack/setup-tutorial-env.sh index 1f46f15c2d..16c34ecd43 100755 --- a/share/spack/setup-tutorial-env.sh +++ b/share/spack/setup-tutorial-env.sh @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -95,16 +95,16 @@ INSTANCEID=$(curl http://169.254.169.254/latest/meta-data//instance-id) # Get the ID of the Amazon EBS volume associated with the instance. VOLUMEID=$(aws ec2 describe-instances \ - --instance-id $INSTANCEID \ - --query "Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId" \ - --output text) + --instance-id $INSTANCEID \ + --query "Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId" \ + --output text) # Resize the EBS volume. aws ec2 modify-volume --volume-id $VOLUMEID --size $SIZE # Wait for the resize to finish. while [ \ - "$(aws ec2 describe-volumes-modifications \ + "$(aws ec2 describe-volumes-modifications \ --volume-id $VOLUMEID \ --filters Name=modification-state,Values="optimizing","completed" \ --query "length(VolumesModifications)"\ diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 5cf32c0cab..6fb681afe3 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) @@ -37,6 +37,17 @@ # # See `man bash` for more details. +if test -n "${ZSH_VERSION:-}" ; then + if [[ "$(emulate)" = zsh ]] ; then + # ensure base completion support is enabled, ignore insecure directories + autoload -U +X compinit && compinit -i + # ensure bash compatible completion support is enabled + autoload -U +X bashcompinit && bashcompinit + emulate sh -c "source '$0:A'" + return # stop interpreting file + fi +fi + # Bash programmable completion for Spack _bash_completion_spack() { # In all following examples, let the cursor be denoted by brackets, i.e. [] @@ -44,7 +55,7 @@ _bash_completion_spack() { # 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. - local COMP_WORDS_NO_FLAGS=() + local -a COMP_WORDS_NO_FLAGS local index=0 while [[ "$index" -lt "$COMP_CWORD" ]] do @@ -117,7 +128,9 @@ _bash_completion_spack() { #_test_vars >> temp # Make sure function exists before calling it - if [[ "$(type -t $subfunction)" == "function" ]] + local rgx #this dance is necessary to cover bash and zsh regex + rgx="$subfunction.*function.* " + if [[ "$(type $subfunction 2>&1)" =~ $rgx ]] then $subfunction COMPREPLY=($(compgen -W "$SPACK_COMPREPLY" -- "$cur")) @@ -318,9 +331,9 @@ _spacktivate() { _spack() { if $list_options then - SPACK_COMPREPLY="-h --help -H --all-help --color -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 -p --profile --sorted-profile --lines -v --verbose --stacktrace -V --version --print-shell-vars" + 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 -p --profile --sorted-profile --lines -v --verbose --stacktrace -V --version --print-shell-vars" else - SPACK_COMPREPLY="activate add arch blame build-env buildcache cd checksum ci clean clone commands compiler compilers concretize config containerize create deactivate debug dependencies dependents deprecate dev-build develop docs edit env extensions external fetch find flake8 gc gpg graph help info install license list load location log-parse maintainers mark mirror module patch pkg providers pydoc python reindex remove rm repo resource restage setup solve spec stage test test-env tutorial undevelop uninstall unit-test unload url verify versions view" + SPACK_COMPREPLY="activate add analyze arch blame build-env buildcache cd checksum ci clean clone commands compiler compilers concretize config containerize create deactivate debug dependencies dependents deprecate dev-build develop docs edit env extensions external fetch find flake8 gc gpg graph help info install license list load location log-parse maintainers mark mirror module patch pkg providers pydoc python reindex remove rm repo resource restage solve spec stage style test test-env tutorial undevelop uninstall unit-test unload url verify versions view" fi } @@ -342,6 +355,28 @@ _spack_add() { fi } +_spack_analyze() { + if $list_options + then + SPACK_COMPREPLY="-h --help --monitor --monitor-no-auth --monitor-tags --monitor-keep-going --monitor-host --monitor-prefix" + else + SPACK_COMPREPLY="list-analyzers run" + fi +} + +_spack_analyze_list_analyzers() { + SPACK_COMPREPLY="-h --help" +} + +_spack_analyze_run() { + if $list_options + then + SPACK_COMPREPLY="-h --help --overwrite -p --path -a --analyzers" + else + _all_packages + fi +} + _spack_arch() { SPACK_COMPREPLY="-h --help --known-targets -p --platform -o --operating-system -t --target -f --frontend -b --backend" } @@ -460,18 +495,22 @@ _spack_ci() { then SPACK_COMPREPLY="-h --help" else - SPACK_COMPREPLY="generate rebuild" + SPACK_COMPREPLY="generate rebuild rebuild-index" fi } _spack_ci_generate() { - SPACK_COMPREPLY="-h --help --output-file --copy-to --optimize --dependencies" + SPACK_COMPREPLY="-h --help --output-file --copy-to --optimize --dependencies --prune-dag --no-prune-dag --check-index-only" } _spack_ci_rebuild() { SPACK_COMPREPLY="-h --help" } +_spack_ci_rebuild_index() { + SPACK_COMPREPLY="-h --help" +} + _spack_clean() { if $list_options then @@ -562,7 +601,7 @@ _spack_compilers() { } _spack_concretize() { - SPACK_COMPREPLY="-h --help -f --force" + SPACK_COMPREPLY="-h --help -f --force --test" } _spack_config() { @@ -570,7 +609,7 @@ _spack_config() { then SPACK_COMPREPLY="-h --help --scope" else - SPACK_COMPREPLY="get blame edit list add remove rm update revert" + SPACK_COMPREPLY="get blame edit list add prefer-upstream remove rm update revert" fi } @@ -614,6 +653,10 @@ _spack_config_add() { fi } +_spack_config_prefer_upstream() { + SPACK_COMPREPLY="-h --help --local" +} + _spack_config_remove() { if $list_options then @@ -719,7 +762,7 @@ _spack_deprecate() { _spack_dev_build() { if $list_options then - SPACK_COMPREPLY="-h --help -j --jobs -d --source-path -i --ignore-dependencies -n --no-checksum --keep-prefix --skip-patch -q --quiet --drop-in --test -b --before -u --until --clean --dirty" + 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" else _all_packages fi @@ -772,7 +815,7 @@ _spack_env_deactivate() { _spack_env_create() { if $list_options then - SPACK_COMPREPLY="-h --help -d --dir --without-view --with-view" + SPACK_COMPREPLY="-h --help -d --dir --keep-relative --without-view --with-view" else _environments fi @@ -869,7 +912,7 @@ _spack_external() { _spack_external_find() { if $list_options then - SPACK_COMPREPLY="-h --help --not-buildable --scope" + SPACK_COMPREPLY="-h --help --not-buildable --scope -t --tag" else _all_packages fi @@ -882,7 +925,7 @@ _spack_external_list() { _spack_fetch() { if $list_options then - SPACK_COMPREPLY="-h --help -n --no-checksum -m --missing -D --dependencies" + SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated -m --missing -D --dependencies" else _all_packages fi @@ -891,7 +934,7 @@ _spack_fetch() { _spack_find() { if $list_options then - SPACK_COMPREPLY="-h --help --format --json -d --deps -p --paths --groups --no-groups -l --long -L --very-long -t --tags -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 -N --namespace --start-date --end-date -b --bootstrap" + SPACK_COMPREPLY="-h --help --format --json -d --deps -p --paths --groups --no-groups -l --long -L --very-long -t --tag -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 -N --namespace --start-date --end-date -b --bootstrap" else _installed_packages fi @@ -900,7 +943,7 @@ _spack_find() { _spack_flake8() { if $list_options then - SPACK_COMPREPLY="-h --help -b --base -k --keep-temp -a --all -o --output -r --root-relative -U --no-untracked" + SPACK_COMPREPLY="-h --help -b --base -a --all -o --output -r --root-relative -U --no-untracked --no-flake8 --no-mypy --black" else SPACK_COMPREPLY="" fi @@ -1020,7 +1063,7 @@ _spack_info() { _spack_install() { if $list_options then - SPACK_COMPREPLY="-h --help --only -u --until -j --jobs --overwrite --fail-fast --keep-prefix --keep-stage --dont-restage --use-cache --no-cache --cache-only --no-check-signature --require-full-hash-match --show-log-on-error --source -n --no-checksum -v --verbose --fake --only-concrete -f --file --clean --dirty --test --run-tests --log-format --log-file --help-cdash --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp -y --yes-to-all" + SPACK_COMPREPLY="-h --help --only -u --until -j --jobs --overwrite --fail-fast --keep-prefix --keep-stage --dont-restage --use-cache --no-cache --cache-only --monitor --monitor-no-auth --monitor-tags --monitor-keep-going --monitor-host --monitor-prefix --include-build-deps --no-check-signature --require-full-hash-match --show-log-on-error --source -n --no-checksum --deprecated -v --verbose --fake --only-concrete --no-add -f --file --clean --dirty --test --run-tests --log-format --log-file --help-cdash --cdash-upload-url --cdash-build --cdash-site --cdash-track --cdash-buildstamp -y --yes-to-all" else _all_packages fi @@ -1029,9 +1072,9 @@ _spack_install() { _spack_license() { if $list_options then - SPACK_COMPREPLY="-h --help" + SPACK_COMPREPLY="-h --help --root" else - SPACK_COMPREPLY="list-files verify" + SPACK_COMPREPLY="list-files verify update-copyright-year" fi } @@ -1040,13 +1083,17 @@ _spack_license_list_files() { } _spack_license_verify() { - SPACK_COMPREPLY="-h --help --root" + SPACK_COMPREPLY="-h --help" +} + +_spack_license_update_copyright_year() { + SPACK_COMPREPLY="-h --help" } _spack_list() { if $list_options then - SPACK_COMPREPLY="-h --help -d --search-description --format --update -v --virtuals -t --tags" + SPACK_COMPREPLY="-h --help -d --search-description --format --update -v --virtuals -t --tag" else _all_packages fi @@ -1100,9 +1147,9 @@ _spack_mark() { _spack_mirror() { if $list_options then - SPACK_COMPREPLY="-h --help -n --no-checksum" + SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated" else - SPACK_COMPREPLY="create add remove rm set-url list" + SPACK_COMPREPLY="create destroy add remove rm set-url list" fi } @@ -1115,6 +1162,10 @@ _spack_mirror_create() { fi } +_spack_mirror_destroy() { + SPACK_COMPREPLY="-h --help -m --mirror-name --mirror-url" +} + _spack_mirror_add() { if $list_options then @@ -1266,7 +1317,7 @@ _spack_module_tcl_loads() { _spack_patch() { if $list_options then - SPACK_COMPREPLY="-h --help -n --no-checksum" + SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated" else _all_packages fi @@ -1356,7 +1407,7 @@ _spack_pydoc() { _spack_python() { if $list_options then - SPACK_COMPREPLY="-h --help -V --version -c -m" + SPACK_COMPREPLY="-h --help -V --version -c -i -m --path" else SPACK_COMPREPLY="" fi @@ -1464,39 +1515,39 @@ _spack_restage() { fi } -_spack_setup() { +_spack_solve() { if $list_options then - SPACK_COMPREPLY="-h --help -i --ignore-dependencies -n --no-checksum -v --verbose --clean --dirty" + SPACK_COMPREPLY="-h --help --show --models -l --long -L --very-long -I --install-status -y --yaml -j --json -c --cover -N --namespaces -t --types --timers --stats" else _all_packages fi } -_spack_solve() { +_spack_spec() { if $list_options then - SPACK_COMPREPLY="-h --help --show --models -l --long -L --very-long -I --install-status -y --yaml -j --json -c --cover -N --namespaces -t --types --timers --stats" + SPACK_COMPREPLY="-h --help -l --long -L --very-long -I --install-status -y --yaml -j --json -c --cover -N --namespaces --hash-type -t --types" else _all_packages fi } -_spack_spec() { +_spack_stage() { if $list_options then - SPACK_COMPREPLY="-h --help -l --long -L --very-long -I --install-status -y --yaml -j --json -c --cover -N --namespaces -t --types" + SPACK_COMPREPLY="-h --help -n --no-checksum --deprecated -p --path" else _all_packages fi } -_spack_stage() { +_spack_style() { if $list_options then - SPACK_COMPREPLY="-h --help -n --no-checksum -p --path" + SPACK_COMPREPLY="-h --help -b --base -a --all -o --output -r --root-relative -U --no-untracked --no-flake8 --no-mypy --black" else - _all_packages + SPACK_COMPREPLY="" fi } @@ -1519,7 +1570,7 @@ _spack_test_run() { } _spack_test_list() { - SPACK_COMPREPLY="-h --help" + SPACK_COMPREPLY="-h --help -a --all" } _spack_test_find() { @@ -1649,7 +1700,7 @@ _spack_verify() { _spack_versions() { if $list_options then - SPACK_COMPREPLY="-h --help -s --safe-only -c --concurrency" + SPACK_COMPREPLY="-h --help -s --safe --safe-only -r --remote -n --new -c --concurrency" else _all_packages fi diff --git a/share/spack/templates/misc/coconcretization.pyt b/share/spack/templates/misc/coconcretization.pyt index 56f671cb73..fc0ec94cea 100644 --- a/share/spack/templates/misc/coconcretization.pyt +++ b/share/spack/templates/misc/coconcretization.pyt @@ -1,4 +1,4 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) |