Commit graph

3156 commits

Author SHA1 Message Date
Massimiliano Culpo
c4521535e7 Multi-valued variants: better support for combinations (#9481)
This enforces conventions that allow for correct handling of
multi-valued variants where specifying no value is an option,
and adds convenience functionality for specifying multi-valued
variants with conflicting sets of values. This also adds a notion
of "feature values" for variants, which are those that are understood
by the build system (e.g. those that would appear as configure
options). In more detail:

* Add documentation on variants to the packaging guide
* Forbid usage of '' or None as a possible variant value, in
  particular as a default. To indicate choosing no value, the user
  must explicitly define an option like 'none'. Without this,
  multi-valued variants with default set to None were not parsable
  from the command line (Fixes #6314)
* Add "disjoint_sets" function to support the declaration of
  multi-valued variants with conflicting sets of options. For example
  a variant "foo" with possible values "a", "b", and "c" where "c"
  is exclusive of the other values ("foo=a,b" and "foo=c" are
  valid but "foo=a,c" is not).
* Add "any_combination_of" function to support the declaration of
  multi-valued variants where it is valid to choose none of the
  values. This automatically defines "none" as an option (exclusive
  with all other choices); this value does not appear when iterating
  over the variant's values, for example in "with_or_without" (which
  constructs autotools option strings from variant values).
* The "disjoint_sets" and "any_combination_of" methods return an
  object which tracks the possible values. It is also possible to
  indicate that some of these values do not correspond to options
  understood by the package's build system, such that methods like
  "with_or_without" will not define options for those values (this
  occurs automatically for "none")
* Add documentation for usage of new functions for specifying
  multi-valued variants
2019-01-04 19:02:34 -08:00
Peter Josef Scheibel
64deda1b0c Add tests for expanding/non-expanding resources 2019-01-04 17:04:28 -08:00
Michael Kuhn
41ef02ee10 stage: fix resources being deleted from local cache (#10152)
Non-expanded resources were being deleted from the cache on account
of two behaviors:

* ResourceStage was moving files rather than copying them, and uses
  "os.path.realpath" to resolve symlinks
* CacheFetchStrategy creates a symlink to a cached resource rather
  than copying it

This alters the first behavior: ResourceStage now copies the file
rather than moving it.
2019-01-04 17:04:28 -08:00
Ben Zwick
7d9dbc5fd2 Add missing code block (#10243)
Otherwise the `--` in `--dot` is rendered as a single en-dash.
2019-01-03 09:41:14 -06:00
Michael Kuhn
802dc4a03a patch: split up fetch and clean into separate methods (#10150)
"mirror create" was invoking a package's do_patch method in order to
retrieve and archive URL patches. If a package implements a "patch"
method, this is also called as part of do_patch; this failed when the
package-specific implementation referred to environment variables
that are only available at the time the package is built
(e.g. "spack_cc").

This change introduces fetch and clean methods for patches. They are
no-ops for FilePatch but perform the appropriate actions for
UrlPatch. This allows "mirror create" to invoke do_fetch, which does
not call the package's patch method.
2019-01-02 11:44:50 -08:00
Massimiliano Culpo
8540d5390e
Removed an extra comma after a dict literal (#10236)
The extra comma was turning a dict into a tuple, and caused errors
during validation of the schema.
2019-01-02 01:15:15 +01:00
Todd Gamblin
5425a3dad4 flake8: fix flake8 issues with invalid escapes
- in many files, regular strings were used in places where raw strings
  should've been used.

- convert these to raw strings and get rid of new flake8 errors
2019-01-01 00:44:28 -08:00
Todd Gamblin
6f50cd52ed copyright: update license headers for 2013-2019 copyright. 2019-01-01 00:44:28 -08:00
Todd Gamblin
e82992ae32 license: license command prints sorted, non-redundant results
- spack license command now ignores symlinks

- spack license list-files now prints sorted output, and checks for files
  we've already seen.
2019-01-01 00:44:28 -08:00
Massimiliano Culpo
3b8b13809e Improve validation of modules.yaml (#9878)
This PR improves the validation of `modules.yaml` by introducing a custom validator that checks if an attribute listed in `properties` or `patternProperties` is a valid spec. This new check applied to the test case in #9857 gives:

```console
$ spack install szip
==> Error: /home/mculpo/.spack/linux/modules.yaml:5: "^python@2.7@" is an invalid spec [Invalid version specifier]
```

Details: 
* Moved the set-up of a custom validator class to spack.schema
  * In Spack we use `jsonschema` to validate configuration files 
    against a schema. We also need custom validators to enforce
    writing default values within "properties" or "patternProperties"
    attributes.

  * Currently, validators were customized at the place of use and with the
    recent introduction of environments that meant we were setting-up and
    using 2 different validator classes in two different modules.

  * This commit moves the set-up of a custom validator class in the
    `spack.schema` module and refactors the code in `spack.config` and
    `spack.environments` to use it.

* Added a custom validator to check if an attribute is a valid spec
  * Added a custom validator that can be used on objects, which yields an
    error if the attribute is not a valid spec.

* Updated the schema for modules.yaml

* Updated modules.yaml to fix a few inconsistencies:
  - a few attributes were not tested properly using 'anyOf'
  - suffixes has been updated to also check that the attribute is a spec
  - hierarchical_scheme has been updated to hierarchy

* Removed $ref from every schema
  * $ref is not composable or particularly legible
  * Use python dicts and regular old variables instead.
2019-01-01 00:11:49 -08:00
Todd Gamblin
2e3303abd0 bugfix: nested directives were broken in python 3
- The nested directive implementation was broken for python 3

- directive results were not properly removed from the directive list
  when it was processed in the DirectiveMeta metaclass.

- the issue was that remove_directives only descended into a list or
  tuple, but in Python3, the initial value passed to the function is a
  view of dictionary values.

- make it a list to fix things, and add a regression test.
2018-12-30 00:19:08 -08:00
Todd Gamblin
d763e92141 commands: add spack resource command to inspect downloadable files
- currently just looks at patches
  - allows you to find out which package applied a patch to a spec

- intended to work with tarballs and resources in the future.

- add tab completion for `spack resource` and subcommands
2018-12-30 00:19:08 -08:00
Todd Gamblin
d2db978c7f tests: add a test to make sure that patched specs can be round-tripped
- previously, if a concrete sub-DAG with patched specs was written out
  and read back in, its patches would not be found because the dependent
  that patched it was no longer in the DAG.

- Add a test to ensure that the PatchCache handles this case.

- Also add tests to ensure that patch objects are properly created from
  Specs -- previously we only checked that the patches were on the Spec.
2018-12-30 00:19:08 -08:00
Todd Gamblin
d3ee6c977b patches: add a per-repository patch index
- this fixes a bug where if we save a concretized sug-DAG where a package
  had been patched by a dependent, and the dependent was not in the DAG,
  we would not read in all patches correctly.

- Rather than looking up patches in the DAG, we look them up globally
  from an index created from the entire repository.

- The patch cache is a bit tricky for several reasons:

  - we have to cache information from packages, specifically, the patch
    level and working directory.

  - FilePatches need to know which package owns them, so that they can
    figure out where the patch lives.  The repo can change locations from
    run to run, so we have to store relative paths and restore them when
    the cache is reloaded.

  - Patch files can change underneath the cache, because repo indexes
    only update on package changes.  We currently punt on this -- there
    are stub methods for needs_update() that will need to check patch
    files when packages are loaded.  There isn't an easy way to do this
    at global indexing time without making the FastPackageChecker a lot
    slower.  This is TBD for a future commit.

  - Currently, the same patch can only be used one way in a package. That
    is, if it appears twice with different level/working_dir settings,
    bad things will happen.  There's no package that current uses the
    same patch two different ways, so we've punted on this as well, but
    we may need to fix this in the future by moving a lot of the metdata
    (level, working dir) to the spec, and *only* caching sha256sums in
    the PatchCache.  That would require some much more complicated tweaks
    to the Spec, so we're holding off on that til later.

- This required patches to be refactored somewhat -- the difference
  between a UrlPatch and a FilePatch is still not particularly clean.
2018-12-30 00:19:08 -08:00
Todd Gamblin
a9b69fa902 ProviderIndex uses json instead of YAML
- indexes should use json, not YAML, to optimize for speed
- only use YAML in human-editable files
- this makes ProviderIndex consistent with other indexes
2018-12-30 00:19:08 -08:00
Todd Gamblin
c1d7adaaac repo: refactor indexes to be more extensible
- virtual provider cache and tags were previously generated by nearly
  identical but separate methods.

- factor out an Indexer interface for updating repository caches, and
  provide implementations for each type of index (TagIndex,
  ProviderIndex) so that more can be added if needed.

- Among other things, this allows all indexes to be updated at once.
  This is an advantage because loading package files is the real
  overhead, and building the indexes once the packages are loaded is
  trivial. We avoid extra bulk read-ins by generating all package indexes
  at once.

- This can be extended for dependents (reverse dependencies) and patches
  later.
2018-12-30 00:19:08 -08:00
Todd Gamblin
527ff860f0 patches: clean up patch.py, directives, and package class properties
- cleanup patch.py:
  - make patch.py constructors more understandable
  - loosen coupling of patch.py with package

- in Package: make package_dir, module, and namespace class properties

  - These were previously instance properties and couldn't be called from
    directives, e.g. in patch.create()

  - make them class properties so that they can be used in class definition

  - also add some instance properties to delegate to class properties so
    that prior usage on Package objects still works
2018-12-30 00:19:08 -08:00
Massimiliano Culpo
28fd1baa86 tests: run 'test_compiler_add' serially in Python 2 (#10127)
* Don't spawn processes during python 2.6/2.7 'test_compiler_add' unit tests
* Travis seems to choke on the excessive parallelism in `compiler find`
2018-12-25 23:47:46 -08:00
Denis Davydov
39b23d277b environment: ignore invalid files names in var/spack/environments (#10198) 2018-12-25 22:22:21 -08:00
Todd Gamblin
35dd929651
bugfix: handle unicode properly in spack.util.executable (#10186)
- When returning string output, use text_type and decode utf-8 in Python
  2 instead of using `str`

- This properly handles unicode, whereas before we would pass bad strings
  to colify in `spack blame` when reading git output

- add a test that round-trips some unicode through an Executable object
2018-12-23 23:59:58 -08:00
Elsa Gonsiorowski, PhD
74a5d92f07 Remove /nfs/tmp2 from default build_stage locations (#10170)
* Remove /nfs/tmp2 from default configuration
* /nfs/tmp2 is going away from LC... and doesn’t exist for the rest of the world.
* update documentation to remove /nfs/tmp2 as well
2018-12-21 02:03:54 -08:00
Zack Galbreath
b90f619037 Performance improvements for CDash reporter
* Record build output as an array of lines rather than concatenating to a
  single large string.
* Use string.find to avoid running re.search on every line of output.
2018-12-20 09:23:08 -08:00
Zack Galbreath
6355ee208c Include accurate build time in CDash report 2018-12-20 09:23:08 -08:00
Zack Galbreath
8d0872083c Report current git commit of Spack to CDash
When using the CDash reporter, upload a Update.xml file that
indicates the hash of Spack's current git commit.
2018-12-20 09:23:08 -08:00
Scott Wittenburg
7217b4a4b9 Make sure to urlencode cdash submit parameters 2018-12-20 09:23:08 -08:00
Zack Galbreath
aed9a532c6 Get buildId from CDash at submit time
Pass extra data when submitting to CDash.  If CDash responds with a buildId,
construct and display helpful URL that links to the uploaded report.
2018-12-20 09:23:08 -08:00
Zack Galbreath
738d2bd77a Allow more customization for CDash reporter
Add new command line arguments to `spack install` that allow users
to set the build name, site name, and track in their CDash report.
2018-12-20 09:23:08 -08:00
Zack Galbreath
0bae6626a4 Avoid UnboundLocalError
Make sure cdash_phase is defined before referring to it.
2018-12-20 09:23:08 -08:00
Todd Gamblin
207c37759c env: all commands that disambiguate specs should be env-aware
- some commands were missed in the rollout of spack environments

- this makes all commands that need to disambiguate specs restrict the
  disambiguation to installed packages in the active environment, as
  users would expect
2018-12-19 17:49:51 -08:00
Michael Kuhn
67ab73d381 fetch_strategy: improve GitFetchStrategy (#10153)
Currently, only the Git repsository's URL shows up in the `spack info`
output, which makes it hard to distinguish different versions:
```
Safe versions:
    develop    [git] https://github.com/LLNL/H5Z-ZFP.git
    0.8.0      [git] https://github.com/LLNL/H5Z-ZFP.git
    0.7.0      [git] https://github.com/LLNL/H5Z-ZFP.git
```

This change adds additional information as shown when cloning a Git
repository:
```
Safe versions:
    develop    [git] https://github.com/LLNL/H5Z-ZFP.git on branch master
    0.8.0      [git] https://github.com/LLNL/H5Z-ZFP.git at commit af165c4
    0.7.0      [git] https://github.com/LLNL/H5Z-ZFP.git at commit 58ac811
```
2018-12-19 14:33:58 -08:00
Adam J. Stewart
c1a99bf8ec
Add additional info to MesonPackage docs (#10133)
* Add additional info to MesonPackage docs

* No Pygments lexer for Meson code, default to none
2018-12-18 21:51:42 -06:00
Adam J. Stewart
2d0ddd5d11
Add help messages to spack gpg subcommands (#10117) 2018-12-17 13:02:51 -06:00
Adam J. Stewart
d5d64bdf3b
spack buildcache: --allow_root -> --allow-root (#10115) 2018-12-17 13:02:28 -06:00
Peter Scheibel
0217a651c8 mirrors: patches are now properly added to mirrors (#8993)
* This fixes a number of bugs:

  * Patches were not properly downloaded and added to mirrors.

  * Mirror create didn't respect `list_url` in packages

  * Update the `spack mirror` command to add all packages in the
    concretized DAG (where originally it only added the package specified
    by the user). This is required in order to collect patches that are specified
    by dependents. Example:
      * if X->Y and X requires a patch on Y called Pxy, then Pxy will only
        be discovered if you create a mirror with X.

  * replace confusing --one-version-per-spec option for `spack mirror create`
    with --versions-per-spec; support retrieving multiple versions for 
    concrete specs

* Implementation details:

  * `spack mirror create` now uses regular staging logic to download files 
    into a mirror, instead of reimplementing it in `add_single_spec`.

  * use a separate resource caching object to keep track of new
    resources and already-existing resources; also accepts storing
    resources retrieved from a cache (unlike the local cache)

  * mirror cache object now stores resources that are considered
    non-cachable, like (e.g. the tip of a branch);

  * the 'create' function of the mirror module no longer traverses
    dependencies since this was already handled by the 'mirror' command; 

  * Change handling of `--no-checksum`:

    * now that 'mirror create' uses stages, the mirror tests disable
      checksums when creating the mirror

    * remove `no_checksum` argument from library functions - this is now
      handled at the Spack-command-level (like for 'spack install')
2018-12-16 10:15:22 -08:00
Adam J. Stewart
1424830378 spack pkg add: add help message (#10116) 2018-12-15 11:44:37 +01:00
Greg Becker
d2d0ab06b7 Fix spack package inheritance for module variables (#10097)
* we weren't properly setting module variables for the root package in a DAG -- just for transitive dependencies.
2018-12-14 08:37:22 -08:00
Adam J. Stewart
ad046402b6 Make downloads from list_url deterministic (#10047) 2018-12-10 14:36:55 +01:00
Gregory Becker
b072c9b457 multimethod: slight refactoring, documentation for code review 2018-12-06 15:48:23 -08:00
Gregory Becker
2621af41d1 fix MRO for multimethod.__call__ using iterative algorithm.
Add tests MRO for inherited multimethods with multiple inheritance
Add tests for inherited and overridden multimethods
2018-12-06 15:48:23 -08:00
Todd Gamblin
43d94d4a30 tests: fully parametrize multimethod test
- all multimethod tests are now run for both `multimethod` and
  `multimethod-inheritor`

- do this with a parameterized fixture (pkg_name) that runs the same
  tests on both
2018-12-06 15:48:23 -08:00
Todd Gamblin
61b859193d multimethod uses Spec() instead of parse_anonymous_spec()
- simplify logic in multimethod
- remove the requirement of multimethod invocations to walk up the stack.
2018-12-06 15:48:23 -08:00
Todd Gamblin
88cb11758b spec: refactor and clean up Spec initialization
- Since early Spack versions, the SpecParser has (weirdly) been
  responsible for initializing Spec fields.

- This refactors initialization to take place in Spec.__init__, as it
  probably should have originally.

- This makes the code easier to read, the parser easier to understand,
  and removes the use of __new__ in the parser to initialize the Spec.

- This also makes it possible to make a completely empty Spec with
  `Spec()` -- this is an abstract Spec that will match anything.
2018-12-06 15:48:23 -08:00
Gregory Becker
7bb7b94666 Added test for multimethod inheritance 2018-12-06 15:48:23 -08:00
Peter Scheibel
34f64f1f3f improved constraint conflict error message (#9975) 2018-12-04 14:19:57 +01:00
Massimiliano Culpo
e998a399da Injected flags have a consistent order (#9960)
Fixes #9908

Spack was assembling flags in a manner that could in different
orderings for repeated concretizations of the same spec and config
2018-11-28 10:23:38 -08:00
Scott Wittenburg
33b112a60d Expose option to save all dependencies when writing spec.yaml (#9965) 2018-11-27 17:13:39 -08:00
Denis Davydov
abd7b185f7 intel-mkl: fix usage of openmp_libs and tbb_libs (#9863)
* intel-mkl: fix usage of openmp_libs and tbb_libs
* intel-mkl: remove trailing whitespace from openmp lib
2018-11-16 10:25:15 -08:00
Adam J. Stewart
b771b4015a Fix bugs in Modules Tutorial (#9821)
Found a couple bugs while trying to copy and paste the exact
tutorial content.
2018-11-13 09:31:09 -06:00
Adam J. Stewart
7bca5b9c61 Fix typos in Build Systems Tutorial (#9822) 2018-11-12 18:32:13 -06:00
Todd Gamblin
2efaf1b6f7 docs: update tutorial slide link for SC18 2018-11-12 09:44:47 -06:00
Todd Gamblin
d079a5c73e version bump: v0.12.0 2018-11-12 06:04:17 -06:00
Todd Gamblin
f92349ff8c docs: add environments tutorial
- tutorial goes through three sections:
  - installing and uninstalling environments
  - dealing with many specs
  - spack.yaml and spack.lock and workflows
2018-11-12 05:57:08 -06:00
Adam J. Stewart
a1676ab012 Updates to Configuration Tutorial for SC18 (#9811)
* Updates to Configuration Tutorial for SC18

* Suggested rewording
2018-11-11 22:50:59 -08:00
Adam J. Stewart
71561f9d2b Consistent capitalization of Build Caches docs for SC18 (#9810) 2018-11-11 21:13:01 -08:00
Adam J. Stewart
49c66db2fa Minor changes to Build Settings docs (#9808) 2018-11-11 21:12:37 -08:00
Adam J. Stewart
c227e1f02e Minor changes to Basic Settings docs for SC18 (#9809)
Grammar/spelling issues
2018-11-11 23:10:05 -06:00
Greg Becker
dfd0e96508 Update basic usage and modules tutorial (#9807)
* "spack install" now uses cache by default, update examples accordingly
* Replace some example packages with others
* Packing tutorial reference to "spack env" replaced with "spack build-env"
* Command line prompts in examples are shortened
* Example output (including paths) are updated to be more relevant to training environment
2018-11-11 22:58:50 -06:00
Peter Scheibel
2a5d5fda26
Advanced packaging tutorial: reorganize for binary caches (#9804)
Update all examples that need an MPI provider to build with MPICH; reorganize so that fixing MPICH (as part of environment section) comes first in the tutorial (most examples in the tutorial use an MPI provider).
2018-11-11 21:31:51 -06:00
Todd Gamblin
a8e8d80750 env: uninstall just removes specs that are still needed by other envs
- previously, uninstall would complain if a spec was needed by an
  environment.

- Now, we analyze dependents and dependent environments and simply remove
  (not uninstall) specs that are needed by environments
2018-11-11 18:32:24 -06:00
Todd Gamblin
87aec4134d bugfix: preserve abstract specs when installing an environment
- `spack install` was setting the root to be the concrete spec
- abstract spec is now preserved
2018-11-11 18:32:24 -06:00
Todd Gamblin
0f2bfd7492 env: fix display of concretized specs in spack find
- fix highlighting of roots in concretized specs in `spack find`
- tighten up the `spack find` output in environments
2018-11-11 18:32:24 -06:00
Todd Gamblin
8d92fd6640 env: make spack config edit and spack config get environment-aware
- with no arguments, these commands will now edit or dump the
  environment's `spack.yaml` file.

- users may not know where named environments live

- this makes it convenient for users to get to the spack.yaml
  configuration file for their named environment.
2018-11-11 18:32:24 -06:00
Todd Gamblin
25f8abb963 bugfix: make defaults consistent --use-cache and --no-cache (#9803) 2018-11-11 17:18:21 -06:00
Mario Melara
7d98c73e40 Update buildsystem tut (#9795)
* Update Makefile to use property methods ("build_targets"/"install_targets")
  to demonstrate their usage
* Fix highlighting
* Change cbench example to ESMF:
  CBench package file was changed and no longer uses the example shown in
  the old docs
2018-11-11 14:21:54 -06:00
Adam J. Stewart
d366e642e4 Updates to Configuration Files docs for SC18 (#9801)
Scopes added with -C are now referred to as "custom scopes"
rather than "command line scopes". "command line scope" now refers
to specific config options that are set on the command line (like
"--insecure")
2018-11-11 10:57:46 -08:00
Todd Gamblin
6141ae49fd
install: add --use-cache back so that existing tooling does not break (#9797)
- default is still to use the cache, but we've added back the
  `--use-cache` argument so that scripts that used it are still correct.

- `--no-cache` is stil present and is mutually exclusive with `--use-cache`
2018-11-09 16:41:48 -08:00
Nichols A. Romero
236b34f3df Introduce fftw-api virtual package for Intel-MKL and FFTW (#9618)
* Introduce FFTW2 and FFT3 providers for Intel-MKL and FFTW Spack packages.

* make fftw default package for fftw-api virtual package

* virtual package test assertion now provides location of default virtual packages.

* Change name of virtual package to fftw-api and used versioned interface.
2018-11-09 08:16:11 -08:00
Greg Becker
988d37757f buildcache: update spack install to use build cache by default (#9772) 2018-11-09 00:59:28 -08:00
Todd Gamblin
423d3e75ab env: clean up command access to the active environment
- all commands (except `spack find`, through `ConstraintAction`) now go
  through get_env() to get the active environment

- ev.active was hard to read -- and the name wasn't descriptive.
  - rename it to _active_environment to be more descriptive and to strongly
    indicate that spack.environment manages it
2018-11-09 00:31:24 -08:00
Todd Gamblin
562482d9cc env: only add concrete attribute to abstract specs
- to aovid changing spec hashes drastically, only add this attribute to
  differentiated abstract specs.

- othherwise assume that read-in specs are concrete
2018-11-09 00:31:24 -08:00
Todd Gamblin
13164b114a env: make environment search more consistent; simplify code
- spack.yaml files in the current directory were picked up inconsistently
  -- make this a sure thing by moving that logic into find_environment()
  and moving find_environment() to main()

- simplify arguments to Spack command:
  - remove short args for infrequently used commands (--pdb/-D, -P, -s)
  - `spack -D` now forces an env with a directory
2018-11-09 00:31:24 -08:00
Todd Gamblin
3f68d8c53a externals: bugfix in ruamel for ordereddict in Python 2.6
- args weren't being delegated properly from CommentedMap to OrderedDict
2018-11-09 00:31:24 -08:00
Todd Gamblin
62f8ea1a75 env: rename EnvError to SpackEnvironmentError 2018-11-09 00:31:24 -08:00
Todd Gamblin
13aca774e3 bugfix: preserve patch ordering when specs are copied
- The `Spec` class maintains a special `_patches_in_order_of_appearance`
  attribute on patch variants, but it is was preserved when specs are
  copied.

- This caused issues for some builds

- Add special logic to `Spec` to preserve this variant on copy

- TODO: in the long term we should get rid of the special variant and
  make it the responsibility of one of the variant classes.
2018-11-09 00:31:24 -08:00
Todd Gamblin
a41bce2148 fix bad regular expressions and docstrings with '\' 2018-11-09 00:31:24 -08:00
Todd Gamblin
1137b183e3 commands: rework command categories and arguments
- split 'environment' section into 'environments' and 'modules'
- move location to 'query packages' section
- move cd to developer section

- --env-dir no longer has a short optino (was -E)
- -E now means "run without an environment" (no longer same as --env-dir)
- -D now means "run with this directory environment"
- remove short options for may infrequently used top-level commands
2018-11-09 00:31:24 -08:00
Todd Gamblin
efad7ac81b env: consolidate most of spack env status into spack find
- `spack env status` used to show install status; consolidate that into
  `spack find`.

- `spack env status` will still print out whether there is an active
  environment
2018-11-09 00:31:24 -08:00
Todd Gamblin
26a55ff749 env: move env uninstall into spack uninstall
- uninstall now:
  - restricts its spec search to the current environment
  - removes uninstalled specs from the current environment
  - reports envs that still need specs you're trying to uninstall

- removed spack env uninstall command
- updated tests
2018-11-09 00:31:24 -08:00
Todd Gamblin
7136274f4b env: move spack env stage into spack stage command 2018-11-09 00:31:24 -08:00
Todd Gamblin
e62506571f env: spack env destroy is now spack env remove 2018-11-09 00:31:24 -08:00
Todd Gamblin
8b549f664c env: move add, remove, and concretize to top-level commands 2018-11-09 00:31:24 -08:00
Todd Gamblin
e63b45b293 env: moved all spack env install functionality into spack install
- moved get_env from cmd/env.py to environment.py

- spack install will now install into the active environment when no
  arguments are provided.  It looks:
  1. at the command line
  2. for a local spack.yaml file
  3. for any currently activated environment
2018-11-09 00:31:24 -08:00
Todd Gamblin
08e4720ed9 env: remove all -e arguments on subcommands
- add and remove now require an active environment
- update tests to use with <ENV> instead of -e
2018-11-09 00:31:24 -08:00
Todd Gamblin
d483e6e17b env: currently activated environment cannot be destroyed 2018-11-09 00:31:24 -08:00
Todd Gamblin
40af955b94 env: prevent any active environments from interfering with tests
- ensure that `SPACK_ENV` is unset before tests
- ensure that `spack.environment.active` is deactivated if set
2018-11-09 00:31:24 -08:00
Todd Gamblin
c27b78ee36 env: remove upgrade() and relocate() for now
- these won't be in the first release of environments
- they'll be added back in later
2018-11-09 00:31:24 -08:00
Todd Gamblin
36623a27fd env: add test to ensure config precedence is high-to-low 2018-11-09 00:31:24 -08:00
Todd Gamblin
66aa3426ac env: make install_status output more concise 2018-11-09 00:31:24 -08:00
Todd Gamblin
a1818f971f env: environments can be named or created in directories
- `spack env create <name>` works as before

- `spack env create <path>` now works as well -- environments can be
  created in their own directories outside of Spack.

- `spack install` will look for a `spack.yaml` file in the current
  directory, and will install the entire project from the environment

- The Environment class has been refactored so that it does not depend on
  the internal Spack environment root; it just takes a path and operates
  on an environment in that path (so internal and external envs are
  handled the same)

- The named environment interface has been hoisted to the
  spack.environment module level.

- env.yaml is now spack.yaml in all places.  It was easier to go with one
  name for these files than to try to handle logic for both env.yaml and
  spack.yaml.
2018-11-09 00:31:24 -08:00
Todd Gamblin
9fb37dfd76 env: spack install SPEC installs into currently active environment.
- install will now add (if necessary), concretize, and install a single
  spec into the active environment.
2018-11-09 00:31:24 -08:00
Todd Gamblin
3fd9fc8994 env: spack env install automatically concretizes specs 2018-11-09 00:31:24 -08:00
Todd Gamblin
d14f7b82bb env: add spack env activate/deactivate and shell support
- `spack env activate foo`: sets SPACK_ENV to the current active env name

- `spack env deactivate`: unsets SPACK_ENV, deactivates the environment

- added support to setup_env.sh and setup_env.csh

- other env commands work properly with SPACK_ENV, as with an environment
  arguments.

- command-line --env arguments take precedence over the active
  environment, if given.
2018-11-09 00:31:24 -08:00
Todd Gamblin
15c5c36eaf env: bugfix: spack env list won't fail if var/spack/environments doesn't exist 2018-11-09 00:31:24 -08:00
Todd Gamblin
ce230fa3f4 env: rework environments
- env.yaml is now meaningful; it contains authoritative user specs

  - concretize diffs user specs in env.yaml and env.json to allow user to
    add/remove by simply updating env.yaml

  - comments are preserved when env.yaml is updated by add/unadd

  - env.yaml can contain configuration and include external configuration
    either from merged files or from config scopes

  - there is only one file format to remember (env.yaml, no separate init
    format)

- env.json is now env.lock, and it stores the *last* user specs to be
  concretized, along with full provenance.
  - internal structure was modified slightly for readability
  - env.lock contains a _meta section with metadata, in case needed

- added more tests for environments

- env commands follow Spack conventions; no more `spack env foo install`
2018-11-09 00:31:24 -08:00
Todd Gamblin
6af5dfbbc2 config: allow env.yaml to contain configuration in a single file
- add `SingleFileScope` to configuration, which allows us to pull config
  sections from a single file.

- update `env.yaml` and tests to ensure that the env.yaml schema works
  when pulling configurtion from the env file.
2018-11-09 00:31:24 -08:00
Todd Gamblin
9ee2623486 env: rename spack env list to spack env status 2018-11-09 00:31:24 -08:00
Todd Gamblin
c19000038b schemas: rework schemas so that they can be included from other files
- Each schema now has a top-level `properties` and `schema` attribute.

- The `properties` is a fragment that can be included in other
  jsonschemas, via Python, not via '$ref'

- Th `schema` is a complete `jsonschema` with `title` and `$schema`
  properties.
2018-11-09 00:31:24 -08:00
Todd Gamblin
83323f4e71 bugfix: Avoid KeyError in compilers.yaml version check 2018-11-09 00:31:24 -08:00
Todd Gamblin
84140c6cd3 env: add -e as global spack argument, make spack -e <env> spec work
- add -E/--exact-env instead of --use-env-repo
- simplify env handling in `spack find`
2018-11-09 00:31:24 -08:00
Todd Gamblin
180d804615 env: add --env argument to spack location 2018-11-09 00:31:24 -08:00