Commit graph

4383 commits

Author SHA1 Message Date
Matthias Wolf
0b57567824
Module index should not be unconditionally overwritten (#14837)
* Module index should not be unconditionally overwritten

Uncovered after we switched our CI to generate modules for packages
one-by-one rather than in bulk. This overwrote a complete module index
with an index with a single entry, and broke our downstream Spack
instances that needed the upstream module index.
2020-06-23 15:38:04 -05:00
Tamara Dahlgren
96932d65a8 Added support for --fail-fast install option to terminate on first failure 2020-06-23 10:22:41 -07:00
Tamara Dahlgren
f54a8a77b4 Allow a single ctrl-c to terminate an install in progress 2020-06-23 10:22:41 -07:00
Greg Becker
9067378c24
fix compiler environment handling to reset environment after (#17204)
bugfix: fix compiler environment handling to reset environment after
2020-06-23 09:26:15 -07:00
Omar Padron
224dc95159
Pre ci optimization (#16372)
* add initial optimization script

* integrate optimization in spack ci

* make optimization opt-in

* fix import error

* flake8 fixes

* update command completion

* work around vermin errors

* fix sphynx errors
2020-06-22 13:19:47 -04:00
Joseph Ciurej
42f2c168d2
swig: fix older builds on newer platforms by updating config files (#16854)
* swig: revise 'autotools' automated 'config.*' update mechanism to support 'config.sub' and adapt 'swig' accordingly
2020-06-22 10:44:29 -05:00
Axel Huebl
2fd3ab3c9c
Fetching from urls: Error Message (#16434)
* Fetching from urls: Error Message

Fix the error message when fetching from consecutive `urls` of a
package version. Each fail should show the currently failing URL,
not the first url.

Example multi-problem run that occured in real life:
```
==> 5821: Installing util-macros
curl: (28) Connection timed out after 10000 milliseconds
curl: (16) Error in the HTTP2 framing layer
curl: (22) The requested URL returned error: 403 Forbidden
==> Fetching https://www.x.org/archive/individual/util/util-macros-1.19.1.tar.bz2
==> Failed to fetch file from URL: https://www.x.org/archive/individual/util/util-macros-1.19.1.tar.bz2
    Curl failed with error 28
==> Fetching https://mirrors.ircam.fr/pub/x.org/individual/util/util-macros-1.19.1.tar.bz2
==> Failed to fetch file from URL: https://www.x.org/archive/individual/util/util-macros-1.19.1.tar.bz2
    Curl failed with error 16
==> Fetching http://xorg.mirrors.pair.com/individual/util/util-macros-1.19.1.tar.bz2
==> Failed to fetch file from URL: https://www.x.org/archive/individual/util/util-macros-1.19.1.tar.bz2
    URL https://www.x.org/archive/individual/util/util-macros-1.19.1.tar.bz2 was not found!
==> Fetching from https://www.x.org/archive/individual/util/util-macros-1.19.1.tar.bz2 failed.
==> Error: FetchError: All fetchers failed for spack-stage-util-macros-1.19.1-se2a2e74oyusj2r4esgcb7pr3qhh45ef
```

- `urls[0]`: HTTP2 layer error
- `urls[1]`: timeout
- `urls[2]`: missing file on mirror

* x.org: two more mirrors

x.org mirrors are a bit tricky, since many are out-of-sync or off.
A good package to test with is `util-macros`, which had a "recent"
release.
2020-06-18 10:37:32 +02:00
Adam J. Stewart
1f85d6eceb
Docs: fix rst link to spack ci (#17147) 2020-06-18 09:44:03 +02:00
Greg Becker
5b59e883c1
cray module do not work without CRAY_LD_LIBRARY_PATH (#17031)
Co-authored-by: Gregory Becker <becker33.llnl.gov>
2020-06-17 15:53:30 -07:00
Axel Huebl
896a14af82
Doc: E4S Build Cache Link (#16986)
Link to the E4S build cache in the according section of the docs.
2020-06-16 15:53:34 -07:00
psakievich
dc31afe67d
Yaml spec parsing corner case (#17101)
* Catch yaml filename corner case in spec parser

* improved regex and remove redundant error checking

Co-authored-by: Gregory Becker <becker33@llnl.gov>
2020-06-16 13:27:33 -05:00
Massimiliano Culpo
5fc88a7c65
Skip failing test on MacOS (#17072)
* Skip failing test on MacOS

* Update setup-python action and unpin coverage
2020-06-15 13:24:56 -05:00
Greg Becker
58332d028e
clang: add 'version_argument', remove redundant method (#17071) 2020-06-13 15:31:24 +02:00
Patrick Gartung
08c21e4e74
Buildcache: Fix bug in binary string replacement (#17075)
* Fix bug in binary string replacement that results in padding being added multiple times

* Update comment

* Update comment again
2020-06-12 13:38:33 -05:00
Massimiliano Culpo
3609f36e60 Renamed flags.py to basics.py 2020-06-11 10:06:32 -07:00
Massimiliano Culpo
bbac630aac Reworked tests on compilers to separate version detection
Tests on version detection are now separate from other
tests done on compiler.
2020-06-11 10:06:32 -07:00
Massimiliano Culpo
478a8aff0e
Move to temporary directory before running dev-build test (#17028)
Without this the test would leave spurious "spack-build-*.txt"
files in the current working directory.
2020-06-10 08:10:57 -07:00
Joseph Ciurej
9a18fbbc3e
lib/spack : expand spack config vars in 'include' section (#16210)
* Changed the 'include' config section to use 'substitute_path_variables' to allow for Spack config variables to be used (e.g. $spack).

* Fixed a bug with 'include' section path expansion and added a test case for 'include' paths with embedded config variables.
2020-06-09 16:57:27 -07:00
Massimiliano Culpo
25a837bf79
Testing: create mock executable fixture (#16999) 2020-06-09 11:00:23 -07:00
Greg Becker
2421d903b0
SpecList: fix recursion for references (#16897)
* SpecList: fix and refactor variable expansion
2020-06-09 08:52:46 -07:00
Adam J. Stewart
bcf8ebff4f
Cray: fix Blue Waters support and user-built MPIs on Cray (#16593)
* Cray: fix Blue Waters support

* pkg-config env vars needed on Blue Waters

* cray platform: fix support for user-build MPI on cray machines

* reintroduce cray environment cleaning behind cnl version guard

* cray platform: fix support for user-build MPI on cray machines

Co-authored-by: Gregory <becker33@llnl.gov>
2020-06-08 16:44:07 -07:00
Greg Becker
bd1a0a9ad4
view remove: directly check whether specs own files before removing from view (#16955)
Bugfix for hardlinks and copies
2020-06-08 06:43:52 +02:00
Greg Becker
94e77333e6
spack dev-build: Do not mark -u builds in database (#16333)
Builds can be stopped before the final install phase due to user requests. Those builds 
should not be registered as installed in the database.

We had code intended to handle this but:

  1. It caught the wrong type of exception
  2. We were catching these exceptions to suppress them at a lower level in the stack

This PR allows the StopIteration to propagate through a ChildError, and catches it
properly. Also added to an existing test to prevent regression.
2020-06-05 00:35:16 -07:00
Massimiliano Culpo
5b272e3ff3
commands: use a single ThreadPool for spack versions (#16749)
This fixes a fork bomb in `spack versions`. Recursive generation of pools
to scrape URLs in `_spider` was creating large numbers of processes.
Instead of recursively creating process pools, we now use a single
`ThreadPool` with a concurrency limit.

More on the issue: having ~10 users running at the same time spack
versions on front-end nodes caused kernel lockup due to the high number
of sockets opened (sys-admin reports ~210k distributed over 3 nodes).
Users were internal, so they had ulimit -n set to ~70k.

The forking behavior could be observed by just running:

    $ spack versions boost

and checking the number of processes spawned. Number of processes
per se was not the issue, but each one of them opens a socket
which can stress `iptables`.

In the original issue the kernel watchdog was reporting:

    Message from syslogd@login03 at May 19 12:01:30 ...
    kernel:Watchdog CPU:110 Hard LOCKUP
    Message from syslogd@login03 at May 19 12:01:31 ...
    kernel:watchdog: BUG: soft lockup - CPU#110 stuck for 23s! [python3:2756]
    Message from syslogd@login03 at May 19 12:01:31 ...
    kernel:watchdog: BUG: soft lockup - CPU#94 stuck for 22s! [iptables:5603]
2020-06-05 00:08:32 -07:00
Adam J. Stewart
dd19d6f863
Fix parsing of EvtGen URL (#16883)
* Fix parsing of EvtGen URL

* Flake8 fix
2020-06-03 22:09:22 -05:00
Peter Scheibel
24775697f5
Mirrors: add option to exclude packages from "mirror create" (#14154)
* add an --exclude-file option to 'spack mirror create' which allows a user to specify a file of specs to exclude when creating a mirror. this is anticipated to be useful especially when using the '--all' option

* allow specifying number of versions when mirroring all packages

* when mirroring all specs within an environment, include dependencies of root specs

* add '--exclude-specs' option to allow user to specify that specs should be excluded on the command line

* add test for excluding specs
2020-06-03 17:43:51 -07:00
Greg Becker
3347ef2de4
Feature: add option to create view by copying/relocating files (#16480)
* add subcommand `spack view copy/relocate`

* update bash completions

* add copy/relocate commands to view tests

* allow copied views to be removed
2020-06-03 09:45:13 -07:00
Sergey Kosukhin
7aa9cb0f7a
Implicit rpaths for NAG/GCC mixed toolchain (#14782)
* Implicit rpaths for NAG.

* set up environment when checking for implicit rpaths
2020-06-03 09:42:13 -07:00
Massimiliano Culpo
70c3b0ba09
spack uninstall: improve help message (#16886)
fixes #12527

Mention that specs  can be uninstalled by hash also in
the help message. Reference `spack gc` in case people
are looking for ways to clean the store from build time
dependencies.

Use "spec" instead of "package" to avoid ambiguity in
the error message.
2020-06-03 16:30:12 +02:00
Massimiliano Culpo
d5ffec1b2f
Unify tests for compiler command in the same file (#16891)
* Unify tests for compiler command in the same file

Tests for the "spack compiler" command were previously
scattered among different files.

* Tests should use mutable_config, since they modify the compiler list
2020-06-02 14:59:42 -07:00
Greg Becker
2795414a80
Fix satisfaction checks for excluding variants from matrices (#16893)
Because of the way abstract variants are implemented, the following 
spec matrix does not work as intended:
```
matrix:
- [foo]
- [bar=a, bar=b]
exclude:
- bar=a
```
because abstract variants always satisfy any variant of the same
name, regardless of values.

This PR converts abstract variants to whatever their appropriate 
type is before running satisfaction checks for the excludes clause 
in a matrix.

fixes #16841
2020-06-02 11:02:28 +02:00
Jonathon Anderson
feda2a3073
openmpi: add opa-psm2 dependency (#16873)
Also document with_or_without and enable_or_disable, (which are used
to configure the opa-psm2 dependency).
2020-06-01 15:33:24 -07:00
Massimiliano Culpo
2a4ca34a61
Recognize system installed gcc-10 as compilers (#16884)
Now that the version number of GCC reached double digits, an update
to the regex is needed to recognize gcc-10 as an executable to be
inspected when searching for compilers.
2020-06-01 13:59:14 -07:00
Sergey Kosukhin
9d1f71e89f
repo: fix construction of UnknownPackageError (#16865)
Also improve the error messages
2020-05-29 20:07:44 +02:00
Robert Rosca
edd075a5e1
Mention that packages can be uninstalled by hash (#16863) 2020-05-29 13:23:02 +02:00
Greg Becker
bd95b7df86
spack module_cmd: set LD_LIBRARY_PATH for python in subshell. (#16827)
* Ensure python runs with proper ld_library_path within Spack regardless of environment
2020-05-29 11:57:21 +02:00
Jane Herriman
6af3272e1d
Update error message when UnavailableCompilerVersionError is triggered (#16838)
Co-authored-by: Herriman <herriman1@panorama.llnl.gov>
2020-05-29 10:53:43 +02:00
Greg Becker
a21fab6fe4
compilers: add opt_flags and debug_flags properties (#16710) 2020-05-29 10:52:31 +02:00
Greg Becker
38ac78489a
bugfix: use flags when computing implicit rpaths (#16634)
* make verbose_flag a property

* tests
2020-05-28 17:11:28 -07:00
Massimiliano Culpo
8f208b17e2 spack containerize: allow 0.14.3 tag for next release 2020-05-27 10:21:14 -07:00
Massimiliano Culpo
187cb51b49 spack containerize: allow 0.14.1 and 0.14.2 tags
fixes #16727
2020-05-27 10:21:14 -07:00
Sergey Kosukhin
e73c39a5db
concretize: fix UnboundLocalError due to import within a function (#16809) 2020-05-27 11:45:14 +02:00
Greg Becker
e9dcab9464
backwards compatibility for naming scheme (#16812)
* backwards compatibility for naming scheme
2020-05-26 14:06:25 -07:00
Massimiliano Culpo
c01433f60a
spack.relocate: further coverage for ELF related functions (#16585)
* make_link_relative: added docstring

* make_elf_binaries_relative: added docstring, unit tests

* raise_if_not_relocatable: added docstring, added unit test for exceptional case

* relocate_links: removed unused arguments, added docstring and comments

Also fixed a possible bug that was issuing spurious
warning when a file was relocated successfully

* relocate_text: added docstring and comments, renamed arguments

* relocate_text_bin: added docstring and comments, renamed arguments, unit tests
2020-05-26 11:47:31 -07:00
Stephen Herbein
c4031f0455
lua: fix compilation on Cray (#16713)
Problem: when calling `static_to_shared_library` on the `cray` arch, it
produces a non-sensical compiler command with no input files.  For
example, when installing lua@5.2.4, it produced:
'gcc -lm -ldl -o /big-long-spack-path/liblua.so.5.2.4'

Solution: do the same thing on `cray` that is done for `linux`
2020-05-25 15:18:47 +02:00
Peter Scheibel
768fa6bc53
bugfix: schema errors without line numbers (#16765)
* account for schema validation errors where the associated instance doesn't have a line number

* fix unrelated flake error (but it must be fixed because this PR touches this file and the flake rules have been updated since the last edit to this file)
2020-05-25 15:08:47 +02:00
Tomoki, Karatsu
a9b64bcaf1
autotools: delete args from postdep objects when %fj (#16274) 2020-05-21 20:50:57 +02:00
Greg Becker
cfb6f21236
externals: allow package prefs to configure default not buildable (#16735)
Allows `all` to be configured non-buildable in packages.yaml.

The following config would only allow zlib to be built by Spack, all other packages would have to be found as externals.

```
packages:
  all:
    buildable: False
  zlib:
    buildable: True
```
2020-05-20 17:09:07 -07:00
Tamara Dahlgren
92989fbbfd
tests: check presence not equality for rpath changes (#16637)
Fixes #16636
2020-05-20 18:11:26 +02:00
Scott Wittenburg
b1f1f5dddb Pipelines: Ensure consistent spack version for entire pipeline
Also retry jobs always, as script failure is not confined to only our
spack ci rebuild command exit code.
2020-05-19 09:40:02 -06:00
Greg Becker
84889ef3a3
move source dir to last cmake arg (#16709) 2020-05-18 16:39:13 -07:00
TZ
2ebadbc267
intel-mpi: add libfabrics directory to SPACK_COMPILER_EXTRA_RPATHS (#15214)
workaround for not finding an appropriate libfabrics.so with Intel
MPI 2019+. Fixes #11140 and #12493
2020-05-16 10:40:40 -05:00
Greg Becker
32a9adcf60
modules: use projections format for naming schemes (#16629)
* update tcl naming_scheme to use projections

* add projections to lmod modules
2020-05-15 11:12:52 -07:00
Scott Wittenburg
e0572a7d96 Pipelines: Support DAG scheduling and dynamic child pipelines
This change also adds a code path through the spack ci pipelines
infrastructure which supports PR testing on the Spack repository.
Gitlab pipelines run as a result of a PR (either creation or pushing
to a PR branch) will only verify that the packages in the environment
build without error.  When the PR branch is merged to develop,
another pipeline will run which results in the generated binaries
getting pushed to the binary mirror.
2020-05-14 21:11:07 -07:00
Scott Wittenburg
47b3dda1aa Support os-specific $padding in config:install_tree
Providing only $padding or ${padding} results in an attempt to
substitute a padding of maximum system path length, while leaving
room for the parts of the install path spack generates.  Providing
$padding-<len> or ${padding-<len>} simply substitutes padding of
the specified length.
2020-05-14 21:11:07 -07:00
Greg Becker
445cae5c81
Feature: Allow lmod configuration to set core specs (#16517)
Packages built with lmod core_compiler are placed in `Core`.

Other packages may belong in `Core`. For example, python may be built with a proprietary compiler for performance, but belong on the `Core` directory.

With this PR, lmod config can include a `core_specs` list. Any package that satisfies a spec in that list is placed in `Core`, regardless of its compiler or dependencies.
2020-05-14 11:27:37 -07:00
Greg Becker
7411fe2d43
cmake build system: filter system paths from rpaths (#16612) 2020-05-13 14:31:33 -07:00
Peter Scheibel
701fc1fdb1
Update docs on "spack external find" (#16482)
This improves the documentation for `spack external find` in several ways:

* Provide a code example of implementing `determine_spec_details` for a package
* Explain how to define executables to look for (and also e.g. that they are treated as regular expressions and so can pull in unexpected files).
* Add the "why" for a couple of constraints (i.e. explain that this logic only works for build/run deps because it examines `PATH` for executables)
* Spread the docs between build customization and packaging sections
* Add cross-references
* Add a label so that `spack external find` is linked from the command reference.
2020-05-12 17:08:08 -07:00
Greg Becker
0307111dd8
bugfix: reorder variants in Spec strings (#16462)
* change print order for variants to avoid zsh parsing bugs

* change tests for new variant parse order
2020-05-12 10:23:42 -07:00
Sajid Ali
b526a90220
Charm++: fix build prefix; add ucx/pmi support (#15666)
* Add pmi support (required by ucx, ofi, and gni backends)
* Add support for ucx backend
* Add dependency on MPI for pmi=simplepmi, slurmpmi, or slurmpmi2
* Remove charmpp as an MPI provider since the changes in this PR can
  add MPI as a dependency (mentioned previously)
* Install into transport_protocol-OS-arch subdirectory to match
  default charmpp installation behavior (which helps dependents find it)
2020-05-11 16:27:38 -07:00
Massimiliano Culpo
43c9ad3421
Remove 'spack bootstrap' and associated docs (#15179)
fixes #15145

This commit removes the outdated `spack bootstrap`
command and any reference to it in the documentation
and unit tests.
2020-05-11 10:55:18 -07:00
Massimiliano Culpo
b06bc31029
Increase coverage of spack.relocate (#16475)
- add docstrings and make parameter names consistent in `relocate.py`
- Make `replace_prefix_*` and other functions private (as they are implementation details)
- remove unused function _replace_prefix_nullterm()

- Add unit tests for `relocate.py` functions
  - add patchelf to Travis and use it during tests
  - add hello_world fixture with a compiled binary, so we can test relocation
2020-05-09 10:41:50 -07:00
Todd Gamblin
7b8e5c8999 bugfix: don't use sys.stdout as a default arg value (#16541)
After migrating to `travis-ci.com`, we saw I/O issues in our tests --
tests that relied on `capfd` and `capsys` were failing. We've also seen
this in GitHub actions, and it's kept us from switching to them so far.

Turns out that the issue is that using streams like `sys.stdout` as
default arguments doesn't play well with `pytest` and output redirection,
as `pytest` changes the values of `sys.stdout` and `sys.stderr`. if these
values are evaluated before output redirection (as they are when used as
default arg values), output won't be captured properly later.

- [x] replace all stream default arg values with `None`, and only assign stream
      values inside functions.
- [x] fix tests we didn't notice were relying on this erroneous behavior
2020-05-09 00:56:18 -07:00
Axel Huebl
f5844d3d81
all_urls: add urls[0] for versions (#16435)
This adds the `url` alternative `urls` to `package.all_urls`. With
this addition, one can find again new versions with
`spack versions <package>` for packages that are populated with
from mixin mirror `urls`.

Example: `util-macros` from x.org mixin.
2020-05-08 10:12:45 +02:00
Erik Schnetter
4ebff5cef9
Documentation: typo in option description (#16518) 2020-05-07 22:23:16 -07:00
iarspider
e2d42672b7
Config option to disable setting S_ISGID bit when creating installation directory (#14479)
* Add config option to disable setting S_ISGID bit when creating installation directory. 

Co-authored-by: Ivan Razumov <ivan.razumov@cern.ch>
2020-05-07 17:21:53 -07:00
iarspider
08f449ae9a
"spack checksum" QoL (#14311)
* Non-interactive mode for spack checksum; allow passing 'package@version' to spack checksum

* Flake8 fixes

* Update checksum.py

Fix typo

* Update spack-completion script

* Automatically set non-interactive mode if more than one version passed

* Update lib/spack/spack/cmd/checksum.py

Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com>

* Add documentation and update spack-completion

* Flake8

* Rename option

* Update spack-completion

* Update lib/spack/spack/cmd/checksum.py

Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com>

* Update checksum.py

* Update stage.py

* Update create.py

Use batch mode when adding a new package

Co-authored-by: Ivan Razumov <ivan.razumov@cern.ch>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-05-07 18:34:36 -05:00
Peter Scheibel
1ed564a1e6
Testing: fix unintended interactions between tests, part 2 (#16429)
This fixes some errors with setting up test configuration. These
errors do not cause current Spack tests to fail but do create
red herring issues elsewhere (see #15666). Fixing these errors
leads to more errors in tests that depended on the original
misconfigured state, so those are also addressed here.

This is an update to #16003 which accounts for some unit tests with
conflicting config/mutable_config fixtures. These conflicts were
not exposed until the mutable_config fixture was fixed. Details are
included below. The change which builds on #16003 is prefixed with
"(new)".

* For tests that use the real Spack package repository, the config
  needs to avoid using MPI providers that are not intended to be
  installed by Spack. Without this, it is possible that Spack tests
  which concretize the MPI virtual will end up trying to use an
  implementation that it shouldn't (e.g. one that is always
  provided externally). See #15666 for an example.
* The mutable_config test fixture was not initializing the scope
  roots to the right directories (so the resulting config was empty).
* The current_host fixture in the concretize.py tests was using the
  config fixture rather than mutable_config, and was polluting the
  config cache for other tests.
* One test in concretize.py was clearing a nonexistent cache
  (PackagePrefs._packages_config_cache). This reference has been
  removed.
* The test 'test_preferred_compilers' was was depending on cross
  test config pollution to succeed. The initial spec before
  concretization has been updated to updated to be explicit about
  the desired result.
* (new) For tests that use install_mockery and mutable_config,
  replace install_mockery with a separate install_mockery_mutable_config
  fixture that is exactly the same as install_mockery but uses the
  mutable_config fixture to avoid conflicts.
2020-05-07 14:01:58 -07:00
Todd Gamblin
b196e4396a
bugfix: spack shouldn't fail in an incomplete environment (#16473)
Fixed #15884.

Spack asks every package linked into an environment to tell us how
environment variables should be modified when a spack environment is
activated. As part of this, specs in an environment are symlinked into
the environment's view (see #13249), and the package calculates
environment modifications with *the default view as the prefix*.

All of this works nicely for pointing the user's environment at the view
*if* every package is successfully linked. Unfortunately, right now we
only track what specs "should" be in a view, not which specs actually
are. So we end up calculating environment modifications on things that
aren't linked into thee view, and the exception isn't caught, so lots of
spack commands end up failing.

This fixes the issue by ignoring and warning about specs where
calculating environment modifications fails. So we can still keep using
Spack even if the current environment is incomplete.

We should probably also just avoid computing env modifications *entirely*
for unlinked packages, but right now that is a slow operation (requires a
lot of YAML parsing). We should revisit that when we have some better
state management for views, but the fix adopted here will still be
necessary, as we want spack commands to be resilient to other types of
bugs in `setup_run_environment()` and friends. That code is in packages
and we have to assume it could be buggy when we call it outside of builds
(as it might fail more than just the build).
2020-05-07 02:30:09 -07:00
Greg Becker
d0220a990c
fix underscore/dash problems for mic_knl and skylake_avx512 (#16491) 2020-05-06 12:10:08 -07:00
Peter Scheibel
b030a81a5f
Automatically find externals (#15158)
Add a `spack external find` command that tries to populate
`packages.yaml` with external packages from the user's `$PATH`. This
focuses on finding build dependencies. Currently, support has only been
added for `cmake`.

For a package to be discoverable with `spack external find`, it must define:
  * an `executables` class attribute containing a list of
    regular expressions that match executable names.
  * a `determine_spec_details(prefix, specs_in_prefix)` method

Spack will call `determine_spec_details()` once for each prefix where
executables are found, passing in the path to the prefix and the path to
all found executables. The package is responsible for invoking the
executables and figuring out what type of installation(s) are in the
prefix, and returning one or more specs (each with version, variants or
whatever else the user decides to include in the spec).

The found specs and prefixes will be added to the user's `packages.yaml`
file. Providing the `--not-buildable` option will mark all generated
entries in `packages.yaml` as `buildable: False`
2020-05-05 17:37:34 -07:00
Greg Becker
dd3762d0f9
cray platform: support cray Cluster and XC type machines (#12989)
Cray has two machine types. "XC" machines are the larger
machines more common in HPC, but "Cluster" machines are
also cropping up at some HPC sites. Cluster machines run
a slightly different form of the CrayPE programming environment,
and often come without default modules loaded. Cluster
machines also run different versions of some software, and run
a linux distro on the backend nodes instead of running Compute 
Node Linux (CNL).

Below are the changes made to support "Cluster" machines in
Spack. Some of these changes are semi-related general upkeep
of the cray platform.

* cray platform: detect properly after module purge

* cray platform: support machines running OSs other than CNL

Make Cray backend OS delegate to LinuxDistro when no cle_release file
favor backend over frontend OS when name clashes

* cray platform: target detection uses multiple strategies

This commit improves the robustness of target
detection on Cray by trying multiple strategies.

The first one that produces results wins. If
nothing is found only the generic family of the
frontend host is used as a target.

* cray-libsci: add package from NERSC

* build_env: unload cray-libsci module when not explicitly needed

cray-libsci is a package in Spack. The cray PrgEnv
modules load it implicitly when we set up the compiler.
We now unload it after setting up the compiler and
only reload it when requested via external package.

* util/module_cmd: more robust module parsing

Cray modules have documentation inside the module
that is visible to the `module show` command.
Spack module parsing is now robust to documentation 
inside modules.

* cce compiler: uses clang flags for versions >= 9.0

* build_env: push CRAY_LD_LIBRARY_PATH into everything

Some Cray modules add paths to CRAY_LD_LIBRARY_PATH
instead of LD_LIBRARY_PATH. This has performance benefits
at load time, but leads to Spack builds not finding their
dependencies from external modules.
Spack now prepends CRAY_LD_LIBRARY_PATH to
LD_LIBRARY_PATH before beginning the build.

* mvapich2: setup cray compilers when on cray

previously, mpich was the only mpi implementation to support
cray systems (because it is the MPI on Cray XC systems). 
Cray cluster systems use mvapich2, which now supports cray
compiler wrappers.

* build_env: clean pkgconf from environment

Cray modules silently add pkgconf to the user environment
This can break builds that do not user pkgconf.
Now we remove it frmo the environment and add it again if it
is in the spec. 

* cray platform: cheat modules for rome/zen2 module on naples/zen node

Cray modules for naples/zen architecture currently specify
rome/zen2. For now, we detect this and return zen for modules
named `craype-x86-rome`.

* compiler: compiler default versions

When detecting compiler default versions for target/compiler
compatibility checks, Spack previously ran the compiler without
setting up its environment. Now we setup a temporary environment
to run the compiler with its modules to detect its version.

* compilers/cce: improve logic to determine C/C++ std flags

* tests: fix existing tests to play nicely with new cray support

* tests: test new functionality

Some new functionality can only be tested on a cray system.
Add tests for what can be tested on a linux system.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2020-05-05 13:58:46 -07:00
Massimiliano Culpo
aa9c98b6a2
Make usage example consistent with current MV variants (#16468)
Since #9481 Python's None is not permitted as a value for
MV variants. The string 'none' is used instead.

Add the same fix for the amgx and lammps packages
2020-05-05 20:22:32 +02:00
Greg Becker
3ae76d8c1e
bugfix: config:install_hash_length ignored (#15919) 2020-05-04 23:10:25 -07:00
Greg Becker
8e2f5ba861
environments: allow sigils to apply to entire reference (#15245)
* environments: allow sigils to apply to entire reference
2020-05-04 15:11:10 -07:00
Oliver Breitwieser
1cff717ca8 Fix git-related commands not working in worktrees
If spack is checked out in a git worktree (see [1]), all git-related
commands fail because the `spack_is_git_repo()`-check is not thorough
enough.

When developing in a feature-branch in a seperate worktree, this is
annoying as all unittests regarding git-related spack commands fail,
cluttering the test results with false-positives.

[1]: https://git-scm.com/docs/git-worktree

Change-Id: I94b573a2c0e058e9ccc169e7ee6561626fbb06fd
2020-05-04 14:39:25 -07:00
Peter Scheibel
40df44e021
Revert "Testing: fix unintended interactions between tests (#16003)" (#16420)
This was breaking tests on develop.
2020-05-01 13:39:43 -07:00
Peter Scheibel
31d12d380f
Testing: fix unintended interactions between tests (#16003)
* For tests that use the real Spack package repository, the config
  needs to avoid using MPI providers that are not intended to be
  installed by Spack. Without this, it is possible that Spack tests
  which concretize the MPI virtual will end up trying to use an
  implementation that it shouldn't (e.g. one that is always
  provided externally). See #15666 for an example.
* The mutable_config test fixture was not initializing the scope
  roots to the right directories (so the resulting config was empty).
* The current_host fixture in the concretize.py tests was using the
  config fixture rather than mutable_config, and was polluting the
  config cache for other tests.
* One test in concretize.py was clearing a nonexistent cache
  (PackagePrefs._packages_config_cache). This reference has been
  removed.
* The test 'test_preferred_compilers' was was depending on cross
  test config pollution to succeed. The initial spec before
  concretization has been updated to updated to be explicit about
  the desired result.
2020-05-01 10:47:46 -07:00
Axel Huebl
d0dfa1ea4d
dev-build: --drop-in <shell> (#14887)
* dev-build: --drop-in <shell>

Add a `--drop-in <shell>` option to `spack dev-build`.
This option will automatically run a
`spack build-env <spec> -- <shell>` at the end of a `dev-build`, e.g.
to quickly drop-and-devel into a build phase of a package.

Example usage:
```
spack dev-build --before cmake --drop-in bash openpmd-api@develop
```

* build_env: drop in unit test

Co-authored-by: Greg Becker <becker33@llnl.gov>
2020-05-01 09:37:21 -07:00
Adam J. Stewart
022c287e47
Fix typos in new AutotoolsPackage function (#16406) 2020-04-30 15:13:04 -05:00
Chris Green
9698907e74
Spack command extensions: error-handling (#13635)
Generally speaking, errors that are encountered when attempting to load
command extensions now terminate the running Spack instance.

* Added new exceptions `spack.cmd.PythonNameError` and
  `spack.cmd.CommandNameError`.
* New functions `spack.cmd.require_python_name(pname)` and
  `spack.cmd.require_cmd_name(cname)` check that `pname` and `cname`
  respectively meet requirements, throwing the appropriate error if not.
* `spack.cmd.get_module()` uses `require_cmd_name()` and passes through
  exceptions from module load attempts.
* `spack.cmd.get_command()` uses `require_cmd_name()` and invokes
  `get_module()` with the correct command-name form rather than the
  previous (incorrect) Python name.
* Added New exceptions `spack.extensions.CommandNotFoundError` and
  `spack.extensions.ExtensionNamingError`.
* `_extension_regexp` has a new leading underscore to indicate expected
  privacy.
* `spack.extensions.extension_name()` raises an `ExtensionNamingError`
  rather than using `tty.warn()`.
* `spack.extensions.load_command_extension()` checks command source
  existence early and bails out if missing. Also, exceptions raised by
  `load_module_from_file()` are passed through.
* `spack.extensions.get_module()` raises `CommandNotFoundError` as
  appropriate.
* Spack `main()` allows `parser.add_command()` exceptions to cause
  program end.

Tests:

* More common boilerplate has been pulled out into fixtures including
  `sys.modules` dictionary cleanup and resource-managed creation of a
  simple command extension with specified contents in the source file
  for a single named command.
* "Hello, World!" test now uses a command named `hello-world` instead of
  `hello` in order to verify correct handling of commands with hyphens.
* New tests for:
  * Missing (or misnamed) command.
  * Badly-named extension.
  * Verification that errors encountered during import of a command are
    propagated upward.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2020-04-29 18:18:48 -07:00
Nathan
b6b44948b8
prefix gets removed when adding additional configure options (#16335)
* prefix gets removed when adding additional configure options

* Update waf documentation to reflect the new change
2020-04-29 10:52:23 -05:00
Axel Huebl
00d83cd79d
dev-build: stop before phase (#14699)
Add `-b,--before` option to dev-build command to stop before the phase in question.
2020-04-28 09:55:57 -07:00
Axel Huebl
7670ae468f
Docs: Limit Microarch on Travis CI (#16200)
Update the travis CI docs: limiting the microarch is essential
for caching.
2020-04-28 11:54:02 -05:00
Massimiliano Culpo
a540e36922
relocate: remove an assertion in _make_relative (#16351)
This was an oversight in #15654 since `os.path.isfile`
checks that the something is a file in the current
filesystem.
2020-04-28 14:53:22 +02:00
Massimiliano Culpo
6b648c6e89
Improve the coverage of spack.relocate (#15654)
This PR introduces trivial refactoring in:
- `get_existing_elf_rpaths`
- `get_relative_elf_rpaths`
- `get_normalized_elf_rpaths`
- `set_placeholder`

mainly to be more consistent with practices used in other 
parts of the code and to simplify functions locally. It also 
adds or reworks unit tests for these functions and extends 
their docstrings.

Co-authored-by: Patrick Gartung <gartung@fnal.gov>
Co-authored-by: Peter J. Scheibel <scheibel1@llnl.gov>
2020-04-27 12:17:32 +02:00
Axel Huebl
5828a8f7e6
spack env: activate note (#16279)
print a note on how to activate a newly created environment
2020-04-24 13:24:52 -07:00
Todd Gamblin
c6ada206af
tests: each mock package now has its own class (#16157)
Packages in Spack are classes, and we need to be able to execute class
methods on mock packages.  The previous design used instances of a single
MockPackage class; this version gives each package its own class that can
spider depenencies.  This allows us to implement class methods like
`possible_dependencies()` on mock packages.

This design change moves mock package creation into the
`MockPackageMultiRepo`, and mock packages now *must* be created from a
repo.  This is required for us to mock `possible_dependencies()`, which
needs to be able to get dependency packages from the package repo.

Changes include:

* `MockPackage` is now `MockPackageBase`
* `MockPackageBase` instances must now be created with
  `MockPackageMultiRepo.add_package()`
* add `possible_dependencies()` method to `MockPackageBase`
* refactor tests to use new code structure
* move package mocking infrastructure into `spack.util.mock_package`,
  as it's becoming a more sophisticated class and it gets lots in `conftest.py`
2020-04-23 18:21:49 -07:00
Todd Gamblin
0c0f11caf6
spack info: allow variants section to be as wide as the terminal (#16254)
The variants table in `spack info` is cramped, as the *widest* it can be
is 80 columns.  And that's actually only sort of true -- the padding
calculation is off, so it still wraps on terminals of size 80 because it
comes out *slightly* wider.

This change looks at the terminal size and calculates the width of the
description column based on it.  On larger terminals, the output looks
much nicer, and on small terminals, the output no longer wraps.

Here's an example  for `spack info qmcpack` with 110 columns.

Before:
    Name [Default]          Allowed values          Description
    ====================    ====================    ==============================

    afqmc [off]             on, off                 Install with AFQMC support.
                                                    NOTE that if used in
                                                    combination with CUDA, only
                                                    AFQMC will have CUDA.
    build_type [Release]    Debug, Release,         The build type to build
                            RelWithDebInfo
    complex [off]           on, off                 Build the complex (general
                                                    twist/k-point) version
    cuda [off]              on, off                 Build with CUDA

After:
    Name [Default]          Allowed values          Description
    ====================    ====================    ========================================================

    afqmc [off]             on, off                 Install with AFQMC support. NOTE that if used in
                                                    combination with CUDA, only AFQMC will have CUDA.
    build_type [Release]    Debug, Release,         The build type to build
                            RelWithDebInfo
    complex [off]           on, off                 Build the complex (general twist/k-point) version
    cuda [off]              on, off                 Build with CUDA
2020-04-23 12:14:40 -07:00
Massimiliano Culpo
6f9373dd66
spack info: replace "True, False" with "on, off" (#16235)
fixes #16184
2020-04-22 17:48:52 -07:00
Greg Becker
ec23e4ffe5
update compiler config with bootstrapped compiler when already installed (#16221)
Update compiler config with bootstrapped compiler when it was already installed and added config defaults to code so mutable_config test fixture works.
2020-04-22 14:26:29 -07:00
George Hartzell
63ff121980
spack environments documentation: -E -> -e (#16242)
To specify an environment for a comment, the user can specify
"spack -e <env>". The documentation incorrectly specified "-E" (which
is actually used to ignore any implicit use of environments).
2020-04-22 13:04:17 -07:00
Axel Huebl
ca4c0b97ec
Doc: Conflict Msg Pkg Guide (#16201)
Document the nice `msg=` argument in conflicts. Super useful
for less generic conflict guidance.
2020-04-21 16:22:30 -05:00
Andrew W Elble
f1050c4be2
compiler wrappers: don't override -isystem with -I (#16077)
If the Spack compiler wrapper encounters any "-isystem" option, then
when adding include directories for Spack dependencies, Spack will
use "-isystem" instead of "-I". This prevents Spack-generated "-I"
options from overriding the "-isystem" options generated by the build
system. To ensure that build-system "-isystem" directories are
searched first, Spack places all of its inserted "-isystem"
directories after.

The new ordering of -isystem includes is:

* -isystem from build system (not system directories)
* -isystem from Spack
* -isystem from build system (for directories like /usr/include)

The prior order of "-I" arguments is preserved (although as of this
commit Spack no longer generates -I if -isystem is detected):

* -I from build system (not system directories)
* -I from Spack (only if there are no "-isystem" options)
* -I from build system (for directories like /usr/include)
2020-04-21 13:56:50 -07:00
Todd Gamblin
de13ea2284
autotools: remove FORCE_UNSAFE_CONFIGURE from docs, commands, code (#16145)
Since #16132, we've consolidated the setting of FORCE_UNSAFE_CONFIGURE to
`autotools.py`, so we don't need to use it in packages like `coreutils`,
in our commands, or in our container recipes.

- [x] Remove FORCE_UNSAFE_CONFIGURE from packages
- [x] Remove FORCE_UNSAFE_CONFIGURE from container recipes
- [x] Remove FORCE_UNSAFE_CONFIGURE from `spack ci` command
2020-04-20 08:32:03 -07:00
George Hartzell
c62f18304d
Typo: vew -> view (#16155) 2020-04-19 20:13:44 -05:00
Diego Magdaleno
d640bf899a
autotools: set FORCE_UNSAFE_CONFIGURE to 1 in autotools.py (#16132)
This commit sets the `FORCE_UNSAFE_CONFIGURE` environment variable to 1 in autotools builds.

We see a lot of builds popping up and complaining about `FORCE_UNSAFE_CONFIGURE`.  This behavior is not actually part of `autoconf` per se.  It comes from this patch to `mknod.m4`, which is used by a lot of autoconf builds:

    * https://lists.gnu.org/archive/html/bug-gnulib/2010-07/msg00282.html

Which originated from this problem that someone had on AIX:

    * https://lists.gnu.org/archive/html/bug-gnulib/2010-07/msg00279.html

The gist of the problem seems to be that they want to check whether `mknod` can do something as root, but instead of checking whether they're running as root and using `su` or something to test this, they just made it harder to run `configure` as root.

This seems very ad hoc and this is one of many checks that are run as root in `configure`.  Many of them run before this check, so it's not clear that the `FORCE_UNSAFE_CONFIGURE` thing is even preventing bad things from happening.

So:
1. This only happens in `autotools` builds, so we should go ahead and put it into `autotools.py` instead of in the global build environment, and

2. The variable does too little and provides a false sense of security in the first place, so we'll just disable it and avoid the nuisance.  If we really feel strongly about this we can put some warnings in Spack about running as root, but at the top level, not in the middle of an already running script like `configure`.
2020-04-18 14:25:19 -07:00
Todd Gamblin
eaccc58156
remove files accidentally committed with 0.14.0 (#16138) 2020-04-17 22:28:33 -07:00
Adam J. Stewart
ea8793f8f5
AutotoolsPackage: add aclocal for all build deps (#15784) 2020-04-17 16:30:21 -05:00
Adam J. Stewart
284e450c91
Language-specific PIC flags (#15474)
* Language-specific PIC flags

* Add tests for every compiler flag

* Fix bad rebase

* pic_flag -> cxx_pic_flag
2020-04-17 16:28:51 -05:00
Axel Huebl
abbc47823d
SourceForge: Mirror Mixin (#16112)
* SourceForge: Mirror Mixin

Add a mixing class for direct `CNAME`s to sourceforge mirrors.
Since the main gateway servers are often down, this could reduce
timeouts and fetch errors for sourceforge.net hosted software.

* SourceForge: unspectacular mirror replacement

add mirrors to all sourceforge packages with trivial
download logic.

tested fetch of latest version of each of these packages
with various mirrors before committing.

* SourceForge: xz

the author homepage is chronocially overrun and this is the offical
upload with many mirrors.
2020-04-16 21:35:30 -07:00
Todd Gamblin
f6d26db939 macos: use DYLD_FALLBACK_LIBRARY_PATH instead of DYLD_LIBRARY_PATH
`DYLD_LIBRARY_PATH` can frequently break builtin macOS software when
pointed at Spack libraries.  This is because it takes *higher* precedence
than the default library search paths, which are used by system software.

`DYLD_FALLBACK_LIBRARY_PATH`, on the other hand, takes lower precedence.
At first glance, this might seem bad, because the software installed by
Spack in an environment needs to find *its* libraries, and it should not
use the defaults.  However, Spack's isntallations are always `RPATH`'d,
so they do not have this problem.

`DYLD_FALLBACK_LIBRARY_PATH` is thus useful for things built in an
environment that need to use Spack's libraries, that don't set *their*
RPATHs correctly for whatever reason. We now prefer it to
`DYLD_LIBRARY_PATH` in modules and in environments because it helps a
little bit, and it is much less intrusive.
2020-04-16 17:23:33 -07:00
Marc Allen
a704922c29
Bugfix: For spack buildcache check, Handle specs where only the hash is (#15663)
provided (#15662).

Prior to this fix, the checked Spec object would not be populated, and
concretization would fail.

Co-authored-by: Marc Allen <mrcall@amazon.com>
2020-04-16 14:06:13 -07:00
Todd Gamblin
bd3f24afe1 Merge branch 'releases/v0.14' into develop 2020-04-15 15:27:00 -07:00
Michael Kuhn
277350ceed Make tags case insensitive
Currently, tags are case sensitive, which is unintuitive:
```console
$ spack list -t hpc
==> 2 packages.
nek5000  nektools
$ spack list -t HPC
==> 1 packages.
mfem
$ spack list -t Hpc
==> 0 packages.
```

This change makes them case insensitive:
```console
$ spack list -t hpc
==> 3 packages.
mfem  nek5000  nektools
$ spack list -t HPC
==> 3 packages.
mfem  nek5000  nektools
$ spack list -t Hpc
==> 3 packages.
mfem  nek5000  nektools
```
2020-04-15 14:56:25 -07:00
Todd Gamblin
a3bcd88f8d version bump: 0.14.2 2020-04-15 14:30:58 -07:00
Todd Gamblin
740f8fe1a9 bugfix: spack test should not output [+] for mock installs (#15609)
`spack test` has a spurious '[+] ' in the output:

```
lib/spack/spack/test/install.py .........[+] ......
```

Output is properly suppressed:

```
lib/spack/spack/test/install.py ...............
```
2020-04-15 14:30:58 -07:00
Todd Gamblin
430ca7c7cf spack install terminal output handling in foreground/background (#15723)
Makes the following changes:

* (Fixes #15620) tty configuration was failing when stdout was 
  redirected. The implementation now creates a pseudo terminal for
  stdin and checks stdout properly, so redirections of stdin/out/err
  should be handled now.
* Handles terminal configuration when the Spack process moves between
  the foreground and background (possibly multiple times) during a
  build.
* Spack adjusts terminal settings to allow users to to enable/disable
  build process output to the terminal using a "v" toggle, abnormal
  exit cases (like CTRL-C) could leave the terminal in an unusable
  state. This is addressed here with a special-case handler which
  restores terminal settings.

Significantly extend testing of process output logger:

* New PseudoShell object for setting up a master and child process
  and configuring file descriptor inheritance between the two
* Tests for "v" verbosity toggle making use of the added PseudoShell
  object
* Added `uniq` function which takes a list of elements and replaces
  any consecutive sequence of duplicate elements with a single
  instance (e.g. "112211" -> "121")

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-04-15 12:47:41 -07:00
Massimiliano Culpo
55f5afaf3c database: maintain in-memory consistency on remove (#15777)
The performance improvements done in #14693 where leaving the DB in an inconsistent state when specs were removed from it. This PR updates the DB internal state whenever the DB is written to a file.

Note that we still cannot properly enumerate installed dependents, so there is a TODO in this code. Fixing that will require the dependents dictionaries in specs to be re-keyed (either by hash, or not keyed at all -- a list would do).  See #11983 for details.
2020-04-15 12:47:16 -07:00
Andrew W Elble
6b559912c1 performance: add a verification file to the database (#14693)
Reading the database repeatedly can be quite slow.  We need a way to speed
up Spack when it reads the DB multiple times, but the DB has not been
modified between reads (which is nearly all the time).

- [x] Add a file containing a unique uuid that is regenerated at database
    write time. Use this uuid to suppress re-parsing the database
    contents if we know a previous uuid and the uuid has not changed.

- [x] Fix mutable_database fixture so that it resets the last seen
    verifier when it resets.

- [x] Enable not rereading the database immediately after a write. Make
    the tests reset the last seen verifier in between tests that use the
    database fixture.

- [x] make presence of uuid module optional
2020-04-15 12:47:00 -07:00
Peter Scheibel
9b5805a5cd Remove DB conversion of old index.yaml (#15298)
Removed the code that was converting the old index.yaml format into
index.json. Since the change happened in #2189 it should be
considered safe to drop this (untested) code.
2020-04-15 12:45:57 -07:00
Peter Scheibel
b9688a8c35 Environments/views: only override spec prefix for non-external packages (#15475)
* only override spec prefix for non-external packages

* add test that environment shell modifications respect explicitly-specified prefixes for external packages

* add clarifying comment
2020-04-15 12:37:37 -07:00
Jonathon Anderson
ed2781973c Source devnull in environment_after_sourcing_files (closes #15775) (#15791)
spack.util.environment_after_sourcing_files compares the local
environment against a shell environment after having sourced a
file; but this ends up including the default shell profile and
rc, which might differ from the local environment.

To change this, compare against the default shell environment,
expressed here as 'source /dev/null'.
2020-04-15 12:37:16 -07:00
Todd Gamblin
99bb88aead bugfix: TERM may not be in the environment on Cray (#15630) 2020-04-15 12:37:03 -07:00
Massimiliano Culpo
a85cce05a1 Blacklist Lmod variable modifications when sourcing files (#15778)
fixes #15775

Add all the variables listed here:

https://lmod.readthedocs.io/en/latest/090_configuring_lmod.html

to the list of those blacklisted when constructing environment
modifications by sourcing files.
2020-04-15 12:36:53 -07:00
Axel Huebl
e1e804168a Tests: Mirror Mixin Classes 2020-04-15 11:44:14 -07:00
Axel Huebl
7e5257e44a x.org: mirror mixin
According to my nightly CI/CD tests, x.org is another large provider
of software in common build chains that is often down.

Added a hand-selected amount of mirrors that is well up-to-sync.
Tested with `util-macros` that has a quite "recent" patch release.

Other packages to follow in an individual PR.
2020-04-15 11:44:14 -07:00
Todd Gamblin
a563884af3
spack install terminal output handling in foreground/background (#15723)
Makes the following changes:

* (Fixes #15620) tty configuration was failing when stdout was 
  redirected. The implementation now creates a pseudo terminal for
  stdin and checks stdout properly, so redirections of stdin/out/err
  should be handled now.
* Handles terminal configuration when the Spack process moves between
  the foreground and background (possibly multiple times) during a
  build.
* Spack adjusts terminal settings to allow users to to enable/disable
  build process output to the terminal using a "v" toggle, abnormal
  exit cases (like CTRL-C) could leave the terminal in an unusable
  state. This is addressed here with a special-case handler which
  restores terminal settings.

Significantly extend testing of process output logger:

* New PseudoShell object for setting up a master and child process
  and configuring file descriptor inheritance between the two
* Tests for "v" verbosity toggle making use of the added PseudoShell
  object
* Added `uniq` function which takes a list of elements and replaces
  any consecutive sequence of duplicate elements with a single
  instance (e.g. "112211" -> "121")

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-04-15 11:05:41 -07:00
Massimiliano Culpo
a11de1d29d
Package extensions: fixed a link in docs (#16040)
* Moved link to the right place in the docs

* Fixed a few minor issues in extensions docs

Fixed a typo, added a subsubsection for better
navigation, reworded "modules in Python" as
"Python packages"
2020-04-14 12:54:53 -05:00
Axel Huebl
5acea35e82
sourceware.org: mirror urls (#15992)
sourceware.org is often quite overrun and times out or results in
certificate errors.

Since libffi, bzip2, elfutils, etc. are quite fundamental in
build chains, lets add some official mirrors.

libffi, bzip2, elfutils, lvm2, valgrind: add mirrors
2020-04-14 11:09:30 -05:00
Massimiliano Culpo
7e46da73dd
database: maintain in-memory consistency on remove (#15777)
The performance improvements done in #14693 where leaving the DB in an inconsistent state when specs were removed from it. This PR updates the DB internal state whenever the DB is written to a file.

Note that we still cannot properly enumerate installed dependents, so there is a TODO in this code. Fixing that will require the dependents dictionaries in specs to be re-keyed (either by hash, or not keyed at all -- a list would do).  See #11983 for details.
2020-04-12 13:14:59 -07:00
Tomoki, Karatsu
08a491b062
fujitsu compiler: Delete custom environment function. (#15988) 2020-04-10 09:38:02 -05:00
Peter Scheibel
75640f0ed9
NAG compiler fix: skip implicit RPATH detection (#15902)
* Skip collection of compiler link paths if compiler does not define a verbose flag

* modules config bug: allow user to configure a compiler without an explicit entry for loaded modules
2020-04-09 10:48:29 +02:00
Scott Wittenburg
de95a9f5f3 pipelines: Document dynamic generation limitations 2020-04-07 15:20:01 -06:00
LPettey-Arm
da9ba2b254
Add build number to Arm compiler version identification (#15809)
* Add capability for detecting build number for Arm compilers

* Fixing fleck8 errors and updating test_arm_version_detection function for more detailed Arm compielr version detection

* Ran flake8 locally and corrected errors

* Altering Arm compielr version check to remove else clause and be more consistent with other compielr version checks. Added test case so both the 'if' and 'else' conditionals of the Arm compiler version check have a test case

Co-authored-by: EC2 Default User <ec2-user@ip-172-31-7-135.us-east-2.compute.internal>
2020-04-07 10:58:54 -05:00
Adam J. Stewart
fab1f68399
Docs: fix Spack Environments command (#15891) 2020-04-06 11:54:22 -05:00
Massimiliano Culpo
06f3381dfd
Blacklist Lmod variable modifications when sourcing files (#15778)
fixes #15775

Add all the variables listed here:

https://lmod.readthedocs.io/en/latest/090_configuring_lmod.html

to the list of those blacklisted when constructing environment
modifications by sourcing files.
2020-04-06 10:02:03 +02:00
Jonathon Anderson
359d7adf7e
Source devnull in environment_after_sourcing_files (closes #15775) (#15791)
spack.util.environment_after_sourcing_files compares the local
environment against a shell environment after having sourced a
file; but this ends up including the default shell profile and
rc, which might differ from the local environment.

To change this, compare against the default shell environment,
expressed here as 'source /dev/null'.
2020-04-06 10:00:42 +02:00
Stephen McDowell
51fbe518b8
verify other.exe attr exists before use in __eq__ (#15882) 2020-04-05 14:08:13 -05:00
G-Ragghianti
bae4f91bfe
Add option "--first" for "spack load" (#15622)
* Implemented --first option for "spack load"

* added test for "spack load --first"

Co-authored-by: gragghia <gragghia@localhost.localdomain>
2020-04-03 13:33:20 -07:00
Peter Scheibel
0b99cc2261
Environments/views: only override spec prefix for non-external packages (#15475)
* only override spec prefix for non-external packages

* add test that environment shell modifications respect explicitly-specified prefixes for external packages

* add clarifying comment
2020-04-03 13:26:33 -07:00
Adam J. Stewart
75a2f8046a
Add commands to facilitate Spack/Python/OS reporting (#15834)
* Add --version arg to spack python command
* Add `spack debug report` command
2020-04-02 23:12:03 -07:00
Greg Sjaardema
c3e8825f8e
Spelling fixes (#15805)
* Spelling fixes

* spelling fixes

* spelling fixes

* spelling fixes

* spelling fix

* spelling fix

* spelling fix

* spelling fixes

* spelling fix
2020-04-01 12:02:26 -05:00
Greg Becker
336191c251
packages.yaml: allow virtuals to specify buildable: false (#14934)
Currently, to force Spack to use an external MPI, you have to specify `buildable: False`
for every MPI provider in Spack in your packages.yaml file. This is both tedious and
fragile, as new MPI providers can be added and break your workflow when you do a
git pull.

This PR allows you to specify an entire virtual dependency as non-buildable, and
specify particular implementations to be built:

```
packages:
all:
    providers:
        mpi: [mpich]
mpi:
    buildable: false
    paths:
        mpich@3.2 %gcc@7.3.0: /usr/packages/mpich-3.2-gcc-7.3.0
```
will force all Spack builds to use the specified `mpich` install.
2020-03-31 16:09:08 -07:00
Massimiliano Culpo
7357b7023e
Update link for codecov's browser extensions (#15779) 2020-03-31 09:49:25 -05:00
Axel Huebl
3f50b9e08d
CUDA 10.1+ supports ICC 19.0 (#15764)
Fix the CUDA-ICC conflict check.
Simplify the XL 17 check.
2020-03-30 16:24:05 -05:00
Patrick Gartung
cbcac72254
Buildcache keys command speed up (#15727)
* Limit the spidering to depth=0 for keys

* depth=0 is default argument
2020-03-28 16:49:34 -05:00
Massimiliano Culpo
b42a96df98
provider index: removed import from + refactored a few parts (#15570)
Removed provider_index use of 'import from' and refactored a few routines to a further subclassing of _IndexBase for implementing user defined bindings of provider specs.
2020-03-25 09:48:05 -07:00
Massimiliano Culpo
1a5e4232ed
spack.repo: remove "import from" statements (#15505)
spack.repo: remove "import from" statements
2020-03-24 14:26:35 -07:00
Massimiliano Culpo
1b4de7813a
spack.relocate: add unit test (#15610)
* relocate: removed import from statements
* relocate: renamed *Exception to *Error

This aims at consistency in naming with both
the standard library (ValueError, AttributeError,
etc.) and other errors in 'spack.error'.

Improved existing docstrings

* relocate: simplified search function by un-nesting conditionals

The search function that searches for patchelf has been
refactored to remove deeply nested conditionals.

Extended docstring.

* relocate: removed a condition specific to unit tests
* relocate: added test for _patchelf
2020-03-24 09:02:54 +01:00
Peter Scheibel
8283068438
Bugfix: remove unit tests that install real packages (#15646)
Our unit tests run many times. Any unit test which actually installs
a package (which involves fetching code on the internet) is a severe
bug because it runs an installation many times (i.e. re-downloading
the same package for each version of Python that we run unit tests
for).

This reverts commit 25893f1, which added tests that install real
packages.
2020-03-23 18:10:44 -07:00
Todd Gamblin
cde4375c96
Vendoring: remove dependency on Setuptools from vendored pytest (#15612)
If the Python used by Spack does not include Setuptools, then
'spack test' will fail because Spack's vendored pytest dependency
imports and uses Setuptools in some of its functions. It turns out
that Spack doesn't use the functionality those methods enable, so
this PR removes those functions and thereby allows 'spack test' to
run without Setuptools.
2020-03-23 16:55:07 -07:00
Todd Gamblin
54a6c25da6
Bugfix (config): enable "spack test" when in an active environment (#15618)
For any Spack test using Spack's YAML configuration, avoid using real
Spack configuration that has been cached by other tests and Spack
startup logic. Previously this was only done for tests using
'mutable_config' (i.e. those which expected to *change* the
configuration of Spack), but in fact all tests that read Spack config
should use it.

This was an issue when running tests within an environment, because
compiler configuration ends up being queried earlier, and the user's
real config "leaks" into the cache. Outside an environment, the cache
is never set until tests touch it, so we weren't seeing this issue.
2020-03-23 15:15:36 -07:00
Todd Gamblin
0323f84e79
bugfix: TERM may not be in the environment on Cray (#15630) 2020-03-22 20:47:04 -07:00
Todd Gamblin
d9c5b7de10
bugfix: spack test should not output [+] for mock installs (#15609)
`spack test` has a spurious '[+] ' in the output:

```
lib/spack/spack/test/install.py .........[+] ......
```

Output is properly suppressed:

```
lib/spack/spack/test/install.py ...............
```
2020-03-22 15:46:54 -07:00
Patrick Gartung
25893f154f
Buildcache: attempt to build and install buildcaches in test environment (#15577)
* Put bindist.py on it's own branch

* Working on SL7 with python 3.6

* Flake8

* Put back clearing of compiler cache
2020-03-21 13:26:37 -05:00
Todd Gamblin
5df9dd2b48 Merge branch 'releases/v0.14' into develop 2020-03-20 23:12:45 -07:00
Andrew W Elble
e4d225043f
performance: add a verification file to the database (#14693)
Reading the database repeatedly can be quite slow.  We need a way to speed
up Spack when it reads the DB multiple times, but the DB has not been
modified between reads (which is nearly all the time).

- [x] Add a file containing a unique uuid that is regenerated at database
    write time. Use this uuid to suppress re-parsing the database
    contents if we know a previous uuid and the uuid has not changed.

- [x] Fix mutable_database fixture so that it resets the last seen
    verifier when it resets.

- [x] Enable not rereading the database immediately after a write. Make
    the tests reset the last seen verifier in between tests that use the
    database fixture.

- [x] make presence of uuid module optional
2020-03-20 17:05:51 -07:00
Patrick Gartung
e2125c26ce
Buildcache: add unit tests for normalized path functions in relocate.py (#15607) 2020-03-20 16:54:27 -05:00
Ryan Mast
76c9e6d871
fix: change typo dependnecies to dependencies (#15602) 2020-03-20 16:02:01 -05:00
Todd Gamblin
ff0abb9838 version bump: 0.14.1 2020-03-20 12:29:36 -07:00
Greg Becker
3826cdf139 multiprocessing: allow Spack to run uninterrupted in background (#14682)
Spack currently cannot run as a background process uninterrupted because some of the logging functions used in the install method (especially to create the dynamic verbosity toggle with the v key) cause the OS to issue a SIGTTOU to Spack when it's backgrounded.

This PR puts the necessary gatekeeping in place so that Spack doesn't do anything that will cause a signal to stop the process when operating as a background process.
2020-03-20 12:23:55 -07:00
Greg Becker
75fafcece9
multiprocessing: allow Spack to run uninterrupted in background (#14682)
Spack currently cannot run as a background process uninterrupted because some of the logging functions used in the install method (especially to create the dynamic verbosity toggle with the v key) cause the OS to issue a SIGTTOU to Spack when it's backgrounded.

This PR puts the necessary gatekeeping in place so that Spack doesn't do anything that will cause a signal to stop the process when operating as a background process.
2020-03-20 12:22:32 -07:00
Michael Kuhn
545fae8407
spack checksum: Use package's fetch_options (#15481)
This makes sure that a package's fetch_options are used when fetching
new versions to checksum. This allows working around problems with
slow servers or those requiring a cookie to be set.
2020-03-20 12:11:42 -07:00
Greg Becker
30b4704522 Cray bugfix: TERM missing while reading default target (#15381)
Bug: Spack hangs on some Cray machines

Reason: The TERM environment variable is necessary to run bash -lc "echo $CRAY_CPU_TARGET", but we run that command within env -i, which wipes the environment.

Fix: Manually forward the TERM environment variable to env -i /bin/bash -lc "echo $CRAY_CPU_TARGET"
2020-03-20 11:47:10 -07:00
Kai Germaschewski
09e13cf7cf Upstreams: don't write metadata directory to upstream DB (#15526)
When trying to use an upstream Spack repository, as of f2aca86 Spack
was attempting to write to the upstream DB based on a new metadata
directory added in that commit. Upstream DBs are read-only, so this
should not occur.

This adds a check to prevent Spack from writing to the upstream DB
2020-03-20 11:46:23 -07:00
Massimiliano Culpo
296d58ef6b Creating versions from urls doesn't modify class attributes (#15452)
fixes #15449

Before this PR a call to pkg.url_for_version was modifying
class attributes determining different results for subsequents
calls and an error when the urls was empty.
2020-03-20 11:45:40 -07:00
Greg Becker
ec720bf28d bugfix: fix install_missing_compilers option bug from v0.14.0 (#15416)
* bugfix: ensure bootstrapped compilers built before packages using the compiler
2020-03-20 11:44:59 -07:00
Todd Gamblin
1e42f0a545 bugfix: installer.py shouldn't be executable (#15386)
This is a minor permission fix on the new installer.py introduced in #13100.
2020-03-20 11:44:23 -07:00
Patrick Gartung
62683eb4bf Add function replace_prefix_nullterm for use on mach-o rpaths. (#15347)
This recovers the old behavior of replace_prefix_bin that was
modified to work with elf binaries by prefixing os.sep to new prefix
until length is the same as old prefix.
2020-03-20 11:43:54 -07:00
Massimiliano Culpo
901bed48ec ArchSpec: fix semantics of satisfies when not concrete and strict is true (#15319) 2020-03-20 11:42:22 -07:00
Tamara Dahlgren
1c8f792bb5 testing: increase installer coverage (#15237) 2020-03-20 11:40:52 -07:00
Tamara Dahlgren
9a1ce36e44 bugfix: resolve undefined source_pkg_dir failure (#15339) 2020-03-20 11:40:39 -07:00
Massimiliano Culpo
59a7963785 Bugfix: resolve StopIteration message attribute failure (#15341)
Testing the install StopIteration exception resulted in an attribute error:

AttributeError: 'StopIteration' object has no attribute 'message'

This PR adds a unit test and resolves that error.
2020-03-20 11:39:28 -07:00
Tamara Dahlgren
733f9f8cfa Recover coverage from subprocesses during unit tests (#15354)
* Recover coverage from subprocesses during unit tests
2020-03-20 11:38:28 -07:00
Massimiliano Culpo
fa0a5e44aa Correct pytest.raises matches to match (#15346) 2020-03-20 11:35:49 -07:00
Tamara Dahlgren
5406e1f43d bugfix: Add dependents when initializing spec from yaml (#15220)
The new build process, introduced in #13100 , relies on a spec's dependents in addition to their dependencies. Loading a spec from a yaml file was not initializing the dependents.

- [x] populate dependents when loading from yaml
2020-03-20 11:34:23 -07:00
Seth R. Johnson
f3a1a8c6fe Uniquify suffixes added to module names (#14920) 2020-03-20 11:33:07 -07:00
Tamara Dahlgren
b02981f10c bugfix: ensure proper dependency handling for package-only installs (#15197)
The distributed build PR (#13100) -- did not check the install status of dependencies when using the `--only package` option so would refuse to install a package with the claim that it had uninstalled dependencies whether that was the case or not.

- [x] add install status checks for the `--only package` case.
- [x] add initial set of tests
2020-03-20 11:23:28 -07:00
Andrew W Elble
654914d53e Fix for being able to 'spack load' packages that have been renamed. (#14348)
* Fix for being able to 'spack load' packages that have been renamed.

* tests: add test for 'spack load' of a installed, but renamed/deleted package
2020-03-20 11:21:40 -07:00
Michael Kuhn
3753424a87 modules: store configure args during build (#11084)
This change stores packages' configure arguments during build and makes
use of them while refreshing module files. This fixes problems such as in
#10716.
2020-03-20 11:16:39 -07:00
Greg Becker
32a3d59bfa fetch_strategy: remove vestigial code (#15431) 2020-03-20 11:14:37 -07:00
Dr. Christian Tacke
03945c2541
Show the packaga name for a missing patch sha256 (#15441)
When a patches sha256 is missing, also show the
packagename, so that analyzing is easier.
2020-03-20 11:39:04 -05:00
Greg Becker
e5f8b093a9
Cray bugfix: TERM missing while reading default target (#15381)
Bug: Spack hangs on some Cray machines

Reason: The TERM environment variable is necessary to run bash -lc "echo $CRAY_CPU_TARGET", but we run that command within env -i, which wipes the environment.

Fix: Manually forward the TERM environment variable to env -i /bin/bash -lc "echo $CRAY_CPU_TARGET"
2020-03-19 15:11:50 -07:00
Todd Gamblin
3255eaba0d refactor: spack.package.possible_dependencies() handles virtuals
- [x] move some logic for handling virtual packages from the `spack
  dependencies` command into `spack.package.possible_dependencies()`

- [x] rework possible dependencies tests so that expected and actual
  output are on the left/right respectively
2020-03-19 09:00:40 -07:00
Todd Gamblin
7cfa497912 bugfix: spack.package.possible_dependencies() should return virtuals
`spack.package.possible_dependencies()` was forgetting to pass the
`visited` dict to recursive calls; this fixes it
2020-03-19 09:00:40 -07:00
Patrick Gartung
8bffa57ac4
Buildcache: fix relocation of binaries with relative rpaths (#15558) 2020-03-18 22:37:09 -05:00
Kai Germaschewski
3df712a385
Upstreams: don't write metadata directory to upstream DB (#15526)
When trying to use an upstream Spack repository, as of f2aca86 Spack
was attempting to write to the upstream DB based on a new metadata
directory added in that commit. Upstream DBs are read-only, so this
should not occur.

This adds a check to prevent Spack from writing to the upstream DB
2020-03-18 16:41:18 -07:00
Sinan
056fc99676
Use python extend_path as pyqt sip fix (#15297)
* try extend path to solve PyQt5.sip not found issue

* disable private sip installation in sippackage class

* undo manual PyQt5 dir creation in py-sip site-packages dir

* fix typo

* fix typo

* also apply fix to PyQt4

* tidy up

* flake8 and tidy up

* tidy and undo hardcoding of python_include_dir

* replace hardcoded python inc dir

* fix minor issues

* rethink include dir variable name

* improve style

* add new versions

* implement new sip setup to qsci installation

* set sip-incdir correctly for the new setup

* setup extend_path thing before qsci python bindings

* take care of conflict

* flake8

* also extend for PyQt4

* improve style

* improve style

* SipPackage build sys should depend on py-sip

* consolidate extend_path fixes into SipPackage

* fix typo

* fix bugs

* flake8

* revert sip doc to pre-resource setup

* import os module

* flake8

Co-authored-by: Sinan81 <sbulut@3vgeomatics.com>
2020-03-18 13:19:27 -05:00
Patrick Gartung
be8841cbc5
Remove PatchelfError and change patchelf error message to a warning. (#15518) 2020-03-17 10:49:24 -05:00
Patrick Gartung
e48d24ee45
Warn only if link target is not relative and outside of the install prefix (#15512) 2020-03-16 18:43:11 -05:00
Patrick Gartung
3029dde7ec
When replacing path text in ELF binaries do not include null byte padding in search string (#15508) 2020-03-16 14:49:55 -05:00
Seth R. Johnson
a8706cc89b
CMakePackage: convert variants to CMake arguments (#14376)
Add a 'define_from_variant` helper function to CMake-based Spack
packages to convert package variants into CMake arguments. For
example:

  args.append('-DFOO=%s' % ('ON' if '+foo' in self.spec else 'OFF'))

can be replaced with:

  args.append(self.define_from_variant('foo'))

The following conversions are handled automatically:

* Flag variants will be converted to CMake booleans
* Multivalued variants will be converted to semicolon-separated strings
* Other variant values are converted to CMake string arguments

This also adds a 'define' helper method to convert any variable to
a CMake argument. It has the same conversion rules as
'define_from_variant' (but operates directly on values rather than
requiring the user to supply the name of a package variant).
2020-03-16 11:41:19 -07:00
Patrick Gartung
17e4df1e41
Buildcache: Install into non-default directory layouts (#13797)
* Buildcache: Install into non-default directory layouts

Store a dictionary mapping of original dependency prefixes to dependency hashes

Use the loaded spec to grab the new dependency prefixes in the new directory layout.

Map the original dependency prefixes to the new dependency prefixes using the dependency hashes.

Use the dependency prefixes map to replace original rpaths with new rpaths preserving the order.
For mach-o binaries, use the dependency prefixes map to replace the dependency library entires for libraries and executables and the replace the library id for libraries.

On Linux, patchelf is used to replace the rpaths of elf binaries.
On macOS, install_name_tool is used to replace the rpaths and  dependency libraries  of mach-o binaries and the id of mach-o libraries.
On Linux, macholib is used to replace the dependency libraries of mach-o binaries and the id of mach-o libraries.

Binary text with padding replacement is attempted for all binaries for the following paths:
spack layout root
spack prefix
sbang script location
dependency prefixes
package prefix
 Text replacement is attempted for all text files using the paths above.

Symbolic links to the absolute path of the package install prefix are replaced, all others produce warnings.
2020-03-16 08:42:23 -05:00
Michael Kuhn
14441e00dc
package: Add fetch_options variable (#15317)
PR #15212 added a new connect_timeout option that can be overridden
using fetch_options but had to specified per-version. This adds a new
per-package variable that can be used to override fetch_options for
all versions in the package. This includes connect_timeout as well
as 'cookie' (e.g. for the jdk package).

Packages can combine package-level fetch_options with per-version
fetch_options, in which case the version fetch_options completely
override the package-level fetch_options.

This commit includes tests for the added behavior.
2020-03-13 11:41:19 -07:00
Tamara Dahlgren
f2a13af43e
testing: increase installer coverage (#15237) 2020-03-12 21:20:20 +01:00
Massimiliano Culpo
59b6822a47
Creating versions from urls doesn't modify class attributes (#15452)
fixes #15449

Before this PR a call to pkg.url_for_version was modifying
class attributes determining different results for subsequents
calls and an error when the urls was empty.
2020-03-12 09:21:19 +01:00
Tamara Dahlgren
20c77cade5
bugfix: resolve undefined source_pkg_dir failure (#15339) 2020-03-11 11:39:23 +01:00
Greg Becker
299fa6b5ca
fetch_strategy: remove vestigial code (#15431) 2020-03-11 11:24:38 +01:00
Greg Becker
bbbee6700b
bugfix: fix install_missing_compilers option bug from v0.14.0 (#15416)
* bugfix: ensure bootstrapped compilers built before packages using the compiler
2020-03-10 10:35:20 -07:00
Christoph Junghans
577860761b
decompressor: add support for bz2 (#15424) 2020-03-10 10:46:45 -06:00
Patrick Gartung
c7dda38826
Revert to gzip as the default buildcache compression as bzip2 is not always available. (#15412)
* Revert to gzip as the default buildcache compression as bzip2 is not always available.

* Flake8
2020-03-09 16:46:54 -05:00
Todd Gamblin
49ec260a9a
bugfix: installer.py shouldn't be executable (#15386)
This is a minor permission fix on the new installer.py introduced in #13100.
2020-03-07 23:48:18 -08:00
Massimiliano Culpo
b444fd25bb
ArchSpec: fix semantics of satisfies when not concrete and strict is true (#15319) 2020-03-07 13:58:33 +01:00
Peter Scheibel
697719c181
Only use stable versions for public mirror (#15100)
* add --skip-unstable-versions option to 'spack mirror create' which skips sources/resource for packages if their version is not stable (i.e. if they are the head of a git branch rather than a fixed commit)

* '--skip-unstable-versions' should skip all VCS sources/resources, not just those which are not cachable
2020-03-07 13:38:08 +01:00
Andrew W Elble
5b44a65881
Fix for being able to 'spack load' packages that have been renamed. (#14348)
* Fix for being able to 'spack load' packages that have been renamed.

* tests: add test for 'spack load' of a installed, but renamed/deleted package
2020-03-06 16:29:01 -08:00
Chris Green
da5144793e
Allow overrides for spack.config set() and override(). (#14432)
Allows spack.config InternalConfigScope and Configuration.set() to
handle keys with trailing ':' to indicate replacement vs merge
behavior with respect to lower priority scopes.

Lists may now be replaced rather than merged (this behavior was
previously only available for dictionaries).

This commit adds tests for the new behavior.
2020-03-05 19:25:01 -08:00
Tamara Dahlgren
b2e7e7edaa
Recover coverage from subprocesses during unit tests (#15354)
* Recover coverage from subprocesses during unit tests
2020-03-05 16:54:29 -08:00
Patrick Gartung
820d147e08
Allow buildcaches keys to find public keys on the e4s mirror (#15361) 2020-03-05 15:15:40 -06:00
Massimiliano Culpo
752092f46a
Correct pytest.raises matches to match (#15346) 2020-03-05 11:16:02 +01:00
Massimiliano Culpo
d9626cca50
Bugfix: resolve StopIteration message attribute failure (#15341)
Testing the install StopIteration exception resulted in an attribute error:

AttributeError: 'StopIteration' object has no attribute 'message'

This PR adds a unit test and resolves that error.
2020-03-05 10:26:50 +01:00
Patrick Gartung
e2b3d52999
Add function replace_prefix_nullterm for use on mach-o rpaths. (#15347)
This recovers the old behavior of replace_prefix_bin that was
modified to work with elf binaries by prefixing os.sep to new prefix
until length is the same as old prefix.
2020-03-04 19:21:15 -06:00
Peter Scheibel
cf7dbbf65c
Remove DB conversion of old index.yaml (#15298)
Removed the code that was converting the old index.yaml format into
index.json. Since the change happened in #2189 it should be
considered safe to drop this (untested) code.
2020-03-04 16:39:10 -08:00
Patrick Gartung
3ea0e91533
use os.sep instead of null byte to pad replacement paths in binaries (#15338)
* use os.sep instead of null byte to pad replacement paths in binaries

* Prefix the pading os.sep's
2020-03-04 17:15:09 -06:00
Sergey Kosukhin
b472c13803
Fix FCFLAGS handling for Autotools packages (#14788)
Spack's fflags are meant for both f77 and fc. Therefore, they must
be passed as FFLAGS and FCFLAGS to the configure scripts of
Autotools-based packages.
2020-03-03 13:13:38 -08:00
Tamara Dahlgren
73f7301ec4
bugfix: ensure proper dependency handling for package-only installs (#15197)
The distributed build PR (#13100) -- did not check the install status of dependencies when using the `--only package` option so would refuse to install a package with the claim that it had uninstalled dependencies whether that was the case or not.

- [x] add install status checks for the `--only package` case.
- [x] add initial set of tests
2020-03-02 11:16:20 -08:00
Adam J. Stewart
513f9235c3
Fix detection of redhat enterprise compute node (#15253)
* Fix detection of redhat enterprise compute node

* Add comma

* Remove space
2020-02-28 11:27:15 -06:00
Michael Kuhn
f580b340f8 Add new timeout fetch_option
This allows packages to override the global connect_timeout.
2020-02-27 10:52:52 -08:00
Michael Kuhn
b7cfd05ef7 Generalize curl_options into fetch_options
This allows us to support higher-level concepts such as 'cookie' and
'timeout' without users having to specify curl options.
2020-02-27 10:52:52 -08:00
Michael Kuhn
7325c20794 config: Add a new option connect_timeout
connect_timeout can be used to increase the time Spack waits for the
server to answer. This can be used to work around slow connections or
servers.

Fixes #14700
2020-02-27 10:52:52 -08:00
Adam J. Stewart
6153eea2c2
CudaPackage: add support for Tesla K80 and older CUDA (#15031)
* CudaPackage: add support for Tesla K80 and older CUDA

* Flake8 fixes

* Fix cuda_arch when no arch is set

* Fine-tune cuda_arch=37,50 supported CUDA versions

* CUDA 6.5+ supports SM_37

* Add @svenevs as a maintainer
2020-02-27 12:16:20 -06:00
TZ
d6d095a868
Docs: "spack env" is in the meantime called "spack build-env" (#15233) 2020-02-27 09:13:09 +01:00
Tamara Dahlgren
ed15adbb9e
bugfix: Add dependents when initializing spec from yaml (#15220)
The new build process, introduced in #13100 , relies on a spec's dependents in addition to their dependencies. Loading a spec from a yaml file was not initializing the dependents.

- [x] populate dependents when loading from yaml
2020-02-26 18:49:29 -08:00
Seth R. Johnson
6c445a2c0f
Uniquify suffixes added to module names (#14920) 2020-02-26 18:03:28 +01:00
Glenn Johnson
a568db00b8
A few edits for the Basic Usage Doc page (#15215)
This PR corrects a few minor things and adds a note about colorized
output.
2020-02-26 10:03:03 +01:00
Patrick Gartung
ae87828520
buildcache cmd: add explicit message with default output dir for buildcaches. (#15090)
* Make -d directory a required option. Print messages about where buildcaches will be written.

* Add mutually exclusive required options

* spack commands --update-completion

* Apply @opadron's patch

* Update share/spack/spack-completion.bash

* Incorporate @opadron's suggestions
2020-02-25 17:49:25 -06:00
Omar Padron
00090f8f97
add --only option to buildcache create cmd (#14921)
* add --only option to buildcache create cmd

replaces the --no-deps option
2020-02-25 17:32:20 -05:00
Omar Padron
8d750db9de
remove catch-all exception handling in buildcache command (#15185)
* remove catch-all exception handling in buildcache command

* fix test
2020-02-25 14:10:50 -06:00
Patrick Gartung
676eb56ab2
Buildcache cmd: add install -o/--otherarch option for installing macOS buildcaches on linux (#15192)
* Buildcache command: add install option -o/--otherarch
This will allow matching specs from other archs, for example
installing macOS buildcaches on linux hosts.

* spack commands --update-completion
2020-02-25 11:01:59 -06:00
Michael Kuhn
45306206c7
docs: Fix tiny typo (#15181) 2020-02-24 10:58:21 -06:00
Michael Kuhn
94acd8f235
cmd/load: Fix usage output (#15180)
args.specs is a list, which results in output like this:
```
eval `spack load --sh ['libxml2', 'xz']`
```

We want this instead:
```
eval `spack load --sh libxml2 xz`
```
2020-02-24 09:46:41 -06:00
Michael Kuhn
a38eb70e30
modules: store configure args during build (#11084)
This change stores packages' configure arguments during build and makes
use of them while refreshing module files. This fixes problems such as in
#10716.
2020-02-24 15:34:57 +01:00
Todd Gamblin
5aa1739bfa Merge branch 'releases/v0.14' into develop 2020-02-23 17:32:12 -08:00
Todd Gamblin
388960f044 version bump: 0.14.0 2020-02-23 17:08:15 -08:00
Michael Kuhn
b935d88282
create: Mention that python dependency does not have to be added (#15173)
A generic python dependency is already added implicitly by the
PythonPackage class.
2020-02-23 10:22:50 -08:00
Massimiliano Culpo
82be8965f2
Emit a sensible error message if compiler's target is overly specific (#14888)
* Emit a sensible error message if compiler's target is overly specific

fixes #14798
fixes #13733

Compiler specifications require a generic architecture family as
their target. This commit improves the error message that is
displayed to users if they edit compilers.yaml and use an overly
specific name.
2020-02-21 14:50:54 -08:00
Tamara Dahlgren
38fc441a36
Updated installer module copyright (#15138)
Update the copyright for `installer.py`.
2020-02-20 16:55:42 -08:00
Tamara Dahlgren
a03b252522
Restore package-related unsigned binary changes from PR 11107 (#15134)
Restore package-related unsigned binary changes from PR 11107
2020-02-20 14:03:47 -08:00
Peter Scheibel
2e387ef585
Package hashing: fix detection of directives (#14763)
The hashing logic looks for function calls that are Spack directives.
It expects that when a Spack directive is used that it is referenced
directly by name, and that the directive function is not itself
retrieved by calling another function. When the hashing logic
encountered a function call where the function was determined
dynamically, it would fail (attempting to access a name attribute
that does not happen to exist in this case).

This updates the hashing logic to filter out function calls where the
function is determined dynamically when looking for uses of Spack
directives.
2020-02-20 13:45:58 -08:00
Patrick Gartung
dd0e18d7b8
Use get_spec in relocated _try_install_from_binary_cache (#15131)
* Use get_spec in relocated _try_install_from_binary_cache
2020-02-20 13:07:32 -08:00
Massimiliano Culpo
d1929b2ea7
Compilers require an exact match on version during concretization (#14752)
Spack now requires an exact match of the compiler version
requested by the user. A loose constraint can be given to
Spack by using a version range instead of a concrete version
(e.g. 4.5: instead of 4.5).
2020-02-20 12:20:12 -08:00
Dr. Christian Tacke
22a56a89c7
Use shutil.copy2 in install_tree (#15058)
Sometimes one needs to preserve the (relative order) of
mtimes on installed files.  So it's better to just copy
over all the metadata from the source tree to the install
tree. If permissions need fixing, that will be done anyway
afterwards.

One major use case are resource()s:
They're unpacked in one place and then copied to their
final place using install_tree(). If the resource is a
source tree using autoconf/automake, resetting mtimes
uncorrectly might force unwanted autoconf/etc calls.
2020-02-19 23:09:26 -06:00
Adam J. Stewart
7a60a04402
Docs: configure_args -> cmake_args (#15102) 2020-02-19 22:48:56 -06:00
Oliver Breitwieser
65133daad7
Fix relocate.mime_type if slashes in subtype (#11788)
If the mimetype returned from `file -h -b --mime-type` contains slashes
in its subtype, the tuple returned from `spack.relocate.mime_type` will
have a size larger than two, which leads to errors.

Change-Id: I31de477e69f114ffdc9ae122d00c573f5f749dbb
2020-02-19 17:30:17 -06:00
Patrick Gartung
14025e89f6
Buildcache: join rpaths returned by get_existing_elf_rpaths with ':'. (#15086)
This reproduces the behavior expected by patchelf_is_relocatable test.
2020-02-19 11:41:02 -06:00
Tamara Dahlgren
f2aca86502
Distributed builds (#13100)
Fixes #9394
Closes #13217.

## Background
Spack provides the ability to enable/disable parallel builds through two options: package `parallel` and configuration `build_jobs`.  This PR changes the algorithm to allow multiple, simultaneous processes to coordinate the installation of the same spec (and specs with overlapping dependencies.).

The `parallel` (boolean) property sets the default for its package though the value can be overridden in the `install` method.

Spack's current parallel builds are limited to build tools supporting `jobs` arguments (e.g., `Makefiles`).  The number of jobs actually used is calculated as`min(config:build_jobs, # cores, 16)`, which can be overridden in the package or on the command line (i.e., `spack install -j <# jobs>`).

This PR adds support for distributed (single- and multi-node) parallel builds.  The goals of this work include improving the efficiency of installing packages with many dependencies and reducing the repetition associated with concurrent installations of (dependency) packages.

## Approach
### File System Locks
Coordination between concurrent installs of overlapping packages to a Spack instance is accomplished through bottom-up dependency DAG processing and file system locks.  The runs can be a combination of interactive and batch processes affecting the same file system.  Exclusive prefix locks are required to install a package while shared prefix locks are required to check if the package is installed.

Failures are communicated through a separate exclusive prefix failure lock, for concurrent processes, combined with a persistent store, for separate, related build processes.  The resulting file contains the failing spec to facilitate manual debugging.

### Priority Queue
Management of dependency builds changed from reliance on recursion to use of a priority queue where the priority of a spec is based on the number of its remaining uninstalled dependencies.  

Using a queue required a change to dependency build exception handling with the most visible issue being that the `install` method *must* install something in the prefix.  Consequently, packages can no longer get away with an install method consisting of `pass`, for example.

## Caveats
- This still only parallelizes a single-rooted build.  Multi-rooted installs (e.g., for environments) are TBD in a future PR.

Tasks:
- [x] Adjust package lock timeout to correspond to value used in the demo
- [x] Adjust database lock timeout to reduce contention on startup of concurrent
    `spack install <spec>` calls
- [x] Replace (test) package's `install: pass` methods with file creation since post-install 
    `sanity_check_prefix` will otherwise error out with `Install failed .. Nothing was installed!`
- [x] Resolve remaining existing test failures
- [x] Respond to alalazo's initial feedback
- [x] Remove `bin/demo-locks.py`
- [x] Add new tests to address new coverage issues
- [x] Replace built-in package's `def install(..): pass` to "install" something
    (i.e., only `apple-libunwind`)
- [x] Increase code coverage
2020-02-19 00:04:22 -08:00
Patrick Gartung
6f95967e95
buildcache: Check for tar.bz2 and set tar.gz if not found (#15054)
* Check for tar.bz2 and set tar.gz if not found

* Move check for tarfile after it is extracted
2020-02-18 15:49:55 -06:00
Greg Becker
82f76c44a0
skip gpg tests when no gpg executable (#14935)
* skip gpg tests when no gpg executable

* flake
2020-02-18 09:20:14 -08:00
Adam J. Stewart
342200774b
spack extensions prints list of extendable packages (#14473)
* spack extensions prints list of extendable packages

* Update tab completion scripts
2020-02-17 17:41:47 -06:00
Patrick Gartung
baafa7ec84
Buildcache creation/extraction use temp tarfile to preserve hardlinks during copy to/from prefix. (#15003)
* Buildcache creation change the way prefix is copied to workdir.
* install_tree copies hardlinked files
* tarfile creates hardlinked files on extraction.
* create a temporary tarfile from prefix and extract it to workdir

* Use temp tarfile to move workdir to prefix to preserve hardlinks instead of copying
2020-02-14 16:10:28 -06:00
Paul
e65aa7569e
docs: fix typo in arch in build settings examples (#14998) 2020-02-14 19:06:10 +01:00
Massimiliano Culpo
8c05221bc6
spack compiler info: quick fix for failing command (#14928)
fixes #14927
2020-02-13 20:32:55 -06:00
Patrick Gartung
4dc67b79aa
Replace direct call to patchelf with get_existing_elf_rpaths which handles exceptions. (#14929)
* Replace direct call to patchelf with get_existing_elf_rpaths which handles exceptions.

* Remove unused patchelf definition.

* Convert to set.
2020-02-13 11:34:20 -06:00
Todd Gamblin
a7b43f1015 spack python: add -m option to run modules as scripts
It's often useful to run a module with `python -m`, e.g.:

    python -m pyinstrument script.py

Running a python script this way was hard, though, as `spack python` did
not have a similar `-m` option.  This PR adds a `-m` option to `spack
python` so that we can do things like this:

    spack python -m pyinstrument ./test.py

This makes it easy to write a script that uses a small part of Spack and
then profile it.  Previously thee easiest way to do this was to write a
custom Spack command, which is often overkill.
2020-02-12 16:45:41 -08:00
Todd Gamblin
c56c4b334d bugfix: spack -V should use working_dir() instead of git -C
- `git -C` doesn't work on git before 1.8.5
- `working_dir` gets us the same effect
2020-02-11 16:52:06 -08:00
Massimiliano Culpo
357786ce6b
Spack find: fix queries that specify dependencies (#14757)
Fixes #10019

If multiple instances of a package were installed in a single
instance of Spack, and they differed in terms of dependencies, then
"spack find" would not distinguish specs based on their dependencies.
For example if two instances of X were installed, one with Y and one
with Z, then "spack find X ^Y" would display both instances of X.
2020-02-10 11:22:21 -08:00
Todd Gamblin
6d2e6e1f4d Merge branch 'releases/v0.13' into develop 2020-02-09 15:51:39 -08:00
Todd Gamblin
a8d5c6ccf2 version bump: 0.13.4 2020-02-07 16:51:44 -06:00
Massimiliano Culpo
010f9451c9 bugfix: make _source_single_file work in venvs (#14569)
Using `sys.executable` to run Python in a sub-shell doesn't always work in a virtual environment as the `sys.executable` Python is not necessarily compatible with any loaded spack/other virtual environment.

- revert use of sys.executable to print out subshell environment (#14496)
- try instead to use an available python, then if there *is not* one, use `sys.executable`
- this addresses RHEL8 (where there is no `python` and `PYTHONHOME` issue in a simpler way
2020-02-07 16:36:23 -06:00
Adam J. Stewart
f9f28e8fba Fix use of sys.executable for module/env commands (#14496)
* Fix use of sys.executable for module/env commands

* Fix unit tests

* More consistent quotation, less duplication

* Fix import syntax
2020-02-07 16:36:18 -06:00
Sajid Ali
4da8f7fcef RHEL8 bugfix for module_cmd (#14349) 2020-02-07 16:35:57 -06:00
Jeffrey Salmond
5397d500c8 Remove extensions from view in the correct order (#12961)
When removing packages from a view, extensions were being deactivated
in an arbitrary order. Extensions must be deactivated in preorder
traversal (dependents before dependencies), so when this order was
violated the view update would fail.

This commit ensures that views deactivate extensions based on a
preorder traversal and adds a test for it.
2020-02-07 16:12:20 -06:00
Todd Gamblin
b442b21751 bugfix: hashes should use ordered dictionaries (#14390)
Despite trying very hard to keep dicts out of our hash algorithm, we seem
to still accidentally add them in ways that the tests can't catch. This
can cause errors when hashes are not computed deterministically.

This fixes an error we saw with Python 3.5, where dictionary iteration
order is random.  In this instance, we saw a bug when reading Spack
environment lockfiles -- The load would fail like this:

```
...
File "/sw/spack/lib/spack/spack/environment.py", line 1249, in concretized_specs
  yield (s, self.specs_by_hash[h])
KeyError: 'qcttqplkwgxzjlycbs4rfxxladnt423p'
```

This was because the hashes differed depending on whether we wrote `path`
or `module` first when recomputing the build hash as part of reading a
Spack lockfile.  We can fix it by ensuring a determistic iteration order.

- [x] Fix two places (one that caused an issue, and one that did
  not... yet) where our to_node_dict-like methods were using regular python
  dicts.

- [x] Also add a check that statically analyzes our to_node_dict
  functions and flags any that use Python dicts.

The test found the two errors fixed here, specifically:

```
E       AssertionError: assert [] == ['Use syaml_dict instead of ...pack/spack/spec.py:1495:28']
E         Right contains more items, first extra item: 'Use syaml_dict instead of dict at /Users/gamblin2/src/spack/lib/spack/spack/spec.py:1495:28'
E         Full diff:
E         - []
E         + ['Use syaml_dict instead of dict at '
E         +  '/Users/gamblin2/src/spack/lib/spack/spack/spec.py:1495:28']
```

and

```
E       AssertionError: assert [] == ['Use syaml_dict instead of ...ack/architecture.py:359:15']
E         Right contains more items, first extra item: 'Use syaml_dict instead of dict at /Users/gamblin2/src/spack/lib/spack/spack/architecture.py:359:15'
E         Full diff:
E         - []
E         + ['Use syaml_dict instead of dict at '
E         +  '/Users/gamblin2/src/spack/lib/spack/spack/architecture.py:359:15']
```
2020-02-07 16:11:06 -06:00
Oliver Breitwieser
22c9f5cbd8
Allow installing unsigned binary packages (#11107)
This commit introduces a `--no-check-signature` option for
`spack install` so that unsigned packages can be installed. It is
off by default (signatures required).
2020-02-06 18:59:16 -08:00
Matt Belhorn
b43f658c39
Adds fma and vsx features to entire power arch family. (#14759)
VSX alitvec extensions are supported by PowerISA from v2.06 (Power7+), but might
not be listed in features.

FMA has been supported by PowerISA since Power1, but might not be listed in
features.

This commit adds these features to all the power ISA family sets.
2020-02-06 16:42:05 +01:00
Andrew W Elble
4accc78409
Git fetching: add option to remove submodules (#14370)
Add an optional 'submodules_delete' field to Git versions in Spack
packages that allows them to remove specific submodules.

For example: the nervanagpu submodule has become unavailable for the
PyTorch project (see issue 19457 at
https://github.com/pytorch/pytorch/issues/). Removing this submodule
allows 0.4.1 to build.
2020-02-03 19:02:45 -08:00
Patrick Gartung
5ad44477b2
buildcache list: restore original behavior of allowing constraints like @version. (#14732) 2020-02-03 13:40:14 -06:00
Patrick Gartung
ab36008635
binary_distribution: Initialize _cached_specs at the module level and only search the mirrors in get_spec if spec is not in _cached_specs. (#14714)
* Initialize _cached_specs at the file level and check for spec in it before searching mirrors in try_download_spec.

* Make _cached_specs a set to avoid duplicates

* Fix packaging test

* Ignore build_cache in stage when spec.yaml files are downloaded.
2020-01-31 20:08:47 -06:00
Todd Gamblin
c029c8ff89 spack -V is now more descriptive for dev branches
`spack -V` previously always returned the version of spack from
`spack.spack_version`.  This gives us a general idea of what version
users are on, but if they're on `develop` or on some branch, we have to
ask more questions.

This PR makes `spack -V` check whether this instance of Spack is a git
repository, and if it is, it appends useful information from `git
describe --tags` to the version.  Specifically, it adds:

  - number of commits since the last release tag
  - abbreviated (but unique) commit hash

So, if you're on `develop` you might get something like this:

    $ spack -V
    0.13.3-912-3519a1762

This means you're on commit 3519a1762, which is 912 commits ahead of
the 0.13.3 release.

If you are on a release branch, or if you are using a tarball of Spack,
you'll get the usual `spack.spack_version`:

    $ spack -V
    0.13.3

This should help when asking users what version they are on, since a lot
of people use the `develop` branch.
2020-01-31 20:59:21 +01:00
Adam J. Stewart
09e318fc84
Document how to use Spack to replace Homebrew/Conda (#13083)
* Document how to use Spack to replace Homebrew/Conda
* Initial draft; can iterate more as features become available
2020-01-31 19:31:14 +01:00
Massimiliano Culpo
9635ff3d20
spack containerize generates containers from envs (#14202)
This PR adds a new command to Spack:
```console
$ spack containerize -h
usage: spack containerize [-h] [--config CONFIG]

creates recipes to build images for different container runtimes

optional arguments:
  -h, --help       show this help message and exit
  --config CONFIG  configuration for the container recipe that will be generated
```
which takes an environment with an additional `container` section:
```yaml
spack:
  specs:
  - gromacs build_type=Release 
  - mpich
  - fftw precision=float
  packages:
    all:
      target: [broadwell]

  container:
    # Select the format of the recipe e.g. docker,
    # singularity or anything else that is currently supported
    format: docker
    
    # Select from a valid list of images
    base:
      image: "ubuntu:18.04"
      spack: prerelease

    # Additional system packages that are needed at runtime
    os_packages:
    - libgomp1
```
and turns it into a `Dockerfile` or a Singularity definition file, for instance:
```Dockerfile
# Build stage with Spack pre-installed and ready to be used
FROM spack/ubuntu-bionic:prerelease as builder

# What we want to install and how we want to install it
# is specified in a manifest file (spack.yaml)
RUN mkdir /opt/spack-environment \
&&  (echo "spack:" \
&&   echo "  specs:" \
&&   echo "  - gromacs build_type=Release" \
&&   echo "  - mpich" \
&&   echo "  - fftw precision=float" \
&&   echo "  packages:" \
&&   echo "    all:" \
&&   echo "      target:" \
&&   echo "      - broadwell" \
&&   echo "  config:" \
&&   echo "    install_tree: /opt/software" \
&&   echo "  concretization: together" \
&&   echo "  view: /opt/view") > /opt/spack-environment/spack.yaml

# Install the software, remove unecessary deps and strip executables
RUN cd /opt/spack-environment && spack install && spack autoremove -y
RUN find -L /opt/view/* -type f -exec readlink -f '{}' \; | \
    xargs file -i | \
    grep 'charset=binary' | \
    grep 'x-executable\|x-archive\|x-sharedlib' | \
    awk -F: '{print $1}' | xargs strip -s


# Modifications to the environment that are necessary to run
RUN cd /opt/spack-environment && \
    spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh

# Bare OS image to run the installed executables
FROM ubuntu:18.04

COPY --from=builder /opt/spack-environment /opt/spack-environment
COPY --from=builder /opt/software /opt/software
COPY --from=builder /opt/view /opt/view
COPY --from=builder /etc/profile.d/z10_spack_environment.sh /etc/profile.d/z10_spack_environment.sh

RUN apt-get -yqq update && apt-get -yqq upgrade                                   \
 && apt-get -yqq install libgomp1 \
 && rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l"]
```
2020-01-30 17:19:55 -08:00
Patrick Gartung
ed501eaab2
Bypass build_cache/index.html read when trying to download spec.yaml for concretized spec. (#14698)
* Add binary_distribution::get_spec which takes concretized spec
Add binary_distribution::try_download_specs for downloading of spec.yaml files to cache
get_spec is used by package::try_install_from_binary_cache to download only the spec.yaml
for the concretized spec if it exists.
2020-01-30 16:06:50 -06:00
Patrick Gartung
12a99f4a2d
Use non-mutable default for names in binary_distribution::get_specs call (#14696)
* Use non-mutable default for names

* Make suggested change
2020-01-30 15:17:55 -06:00
Peter Scheibel
7b2895109c
Document how to add conditional dependencies (#14694)
* add short docs section on conditional dependencies
* add reference to spec syntax
* add note that conditional dependencies can save time
2020-01-30 12:34:54 -08:00
Peter Scheibel
b2adcdb389
Bugfix: put environment lock in the right place (#14692)
Locate the environment lock in the hidden environment directory
rather than the root of the environment.
2020-01-30 11:13:36 -08:00
Patrick Gartung
23a7feb917
Limit the number of spec files downloaded to find matches for buildcaches (#14659)
* Limit the number of spec flies downloaded to find matches
2020-01-30 10:56:10 -06:00
Todd Gamblin
3519a17624 specs: avoid traversing specs when parsing
The Spec parser currently calls `spec.traverse()` after every parse, in
order to set the platform if it's not set.  We don't need to do a full
traverse -- we can just check the platforrm as new specs are parsed.

This takes about a second off the time required to import all packages in
Spack (from 8s to 7s).

- [x] simplify platform-setting logic in `SpecParser`.
2020-01-29 21:15:58 -08:00
Todd Gamblin
a2f8a2321d repo: avoid unnecessary spec parsing in filename_for_package_name()
`filename_for_package_name()` and `dirname_for_package_name()`
automatically construct a Spec from their arguments, which adds a fair
amount of overhead to importing lots of packages.  Removing this removes
about 11% of the runtime of importing all packages in Spack (9s -> 8s).

- [x] `filename_for_package_name()` and `dirname_for_package_name()` now
  take a string `pkg_name` arguments instead of specs.
2020-01-29 21:15:58 -08:00
Peter Scheibel
85ef1be780
environments: synchronize read and uninstall (#14676)
* `Environment.__init__` is now synchronized with all writing operations
* `spack uninstall` now synchronizes its updates to any associated environment
  * A side effect of this is that the environment is no longer updated piecemeal as specs are uninstalled - all specs are removed from the environment before they are uninstalled
2020-01-29 17:22:44 -08:00
Tamara Dahlgren
60ed6d2012
bugfix: correct exception message matching in tests (#14655)
This commit makes two fundamental corrections to tests:
1) Changes 'matches' to the correct 'match' argument for 'pytest.raises' (for all affected tests except those checking for 'SystemExit');
2) Replaces the 'match' argument for tests expecting 'SystemExit' (since the exit code is retained instead) with 'capsys' error message capture.

Both changes are needed to ensure the associated exception message is actually checked.
2020-01-28 22:57:26 -08:00
t-karatsu
f7ec09d30b
Fujitsu compiler: Defining option that is always added. (#14657) 2020-01-28 21:02:40 -06:00
Peter Scheibel
69feea280d
env: synchronize updates to environments (#14621)
Updates to environments were not multi-process safe, which prevented them from taking advantage of parallel builds as implemented in #13100.  This is a minimal set of changes to enable `spack install` in an environment to be parallelized:

- [x] add an internal lock, stored in the `.spack-env` directory, 
      to synchronize updates to `spack.yaml` and `spack.lock`
- [x] add `Environment.write_transaction` interface for this lock
- [x] makes use of `Environment.write_transaction` in `install`, 
      `add`, and `remove` commands

- `uninstall` is not synchronized yet; that is left for a future PR.
2020-01-28 17:26:26 -08:00
Glenn Johnson
48a12c8773 Note about Intel compiler segfault with long paths (#14652)
This PR adds a note about segfaults with the Intel compiler when the
install paths are long and the dependencies many.
2020-01-28 14:57:06 -06:00
Greg Becker
52ab2421bb
Fix handling of filter_file exceptions (#14651) 2020-01-28 12:49:26 -08:00
Andrew W Elble
3f5bed2e36 make the new 'spack load' faster (#14628)
before, a 'time spack load singularity'
4.129u 0.346s 0:04.47 99.7%	0+0k 0+8io 0pf+0w

after, a 'time spack load singularity'
0.844u 0.319s 0:01.16 99.1%	0+0k 0+16io 0pf+0w
2020-01-27 20:53:52 -08:00
Owen Solberg
f58004e436 fix spack env loads example (#14558) 2020-01-27 20:49:53 -08:00
Andrew W Elble
d86816bc1a Fix: hash-based references to upstream specs (#14629)
Spack commands referring to upstream-installed specs by hash have
been broken since 6b619da (merged September 2019), which added a new
Database function specifically for parsing hashes from command-line
specs; this function was inappropriately attempting to acquire locks
on upstream databases.

This PR updates the offending function to avoid locking upstream
databases and also updates associated tests to catch regression
errors: the upstream database created for these tests was not
explicitly set as an upstream (i.e. initialized with upstream=True)
so it was not guarding against inappropriate accesses.
2020-01-27 18:25:23 -08:00
Patrick Gartung
7badd69d1e
Package source ID cannot be determined when the url can't be extrapolated for older version. (#14237) 2020-01-27 20:10:01 -06:00
Patrick Gartung
d0523ca087
Follow the example of spack arch (#14642) 2020-01-27 20:04:48 -06:00
Patrick Gartung
0ce4eef256
Only set tcl default. Remove lmod default. (#14640) 2020-01-27 14:55:09 -06:00
Patrick Gartung
9ffa053f18
Fix bug introduced by pull request 14467 being merged (#14639)
* Fix bug introduced by pull request 14467 being merged

* Only filter on platform and OS
2020-01-27 14:17:15 -06:00
Patrick Gartung
893b0792e4
Set module_roots in test/config/config.yaml to defaults. (#14517) 2020-01-27 14:03:15 -06:00
Massimiliano Culpo
b9629c36f2 Unified environment modifications in config files (#14372)
* Unified environment modifications in config files

fixes #13357

This commit factors all the code that is involved in
the validation (schema) and parsing of environment modifications
from configuration files in a single place. The factored out
code is then used for module files and compiler configuration.

Attributes were separated by dashes in `compilers.yaml` files and
by underscores in `modules.yaml` files. This PR unifies the syntax
on attributes separated by underscores.

Unit testing of environment modifications in compilers
has been refactored and simplified.
2020-01-27 08:40:47 -08:00
Adam J. Stewart
eb79c82cba Fix Python version compatibility tests for vermin 0.10.0 (#14632) 2020-01-26 22:31:13 -08:00
Patrick Gartung
d2098d337a
When spack install checks for buildcaches only add urls for current arch. (#14467) 2020-01-25 21:15:12 -06:00
Adam J. Stewart
dcd8d7a620 Add spack config list command for tab completion (#14474)
* Add spack config list command for tab completion
* Update tab completion scripts
2020-01-24 17:28:20 -08:00
Massimiliano Culpo
4d7d657366 bugfix: make _source_single_file work in venvs (#14569)
Using `sys.executable` to run Python in a sub-shell doesn't always work in a virtual environment as the `sys.executable` Python is not necessarily compatible with any loaded spack/other virtual environment.

- revert use of sys.executable to print out subshell environment (#14496)
- try instead to use an available python, then if there *is not* one, use `sys.executable`
- this addresses RHEL8 (where there is no `python` and `PYTHONHOME` issue in a simpler way
2020-01-24 16:49:45 -08:00
Seth R. Johnson
ca6e75c9f6 Use Spack target architecture to determine OpenBLAS target (#14380)
Openblas target is now determined automatically upon inspection of
`TargetList.txt`. If the spack target is a generic architecture family
(like x86_64 or aarch64) the DYNAMIC_ARCH setting is used
instead of targeting a specific microarchitecture.
2020-01-24 15:19:05 +01:00
Todd Gamblin
04a6a55cf8
commands: add simple spack commands --update-completion argument (#14607)
Instead of another script, this adds a simple argument to `spack
commands` that updates the completion script.  Developers can now just
run:

    spack commands --update-completion

This should make it simpler for developers to remember to run this
*before* the tests fail.  Also, this version tab-completes.
2020-01-23 14:48:06 -08:00
Greg Becker
c9e01ff9d7 shell support: spack load no longer needs modules (#14062)
Previously the `spack load` command was a wrapper around `module load`. This required some bootstrapping of modules to make `spack load` work properly.

With this PR, the `spack` shell function handles the environment modifications necessary to add packages to your user environment. This removes the dependence on environment modules or lmod and removes the requirement to bootstrap spack (beyond using the setup-env scripts).

Included in this PR is support for MacOS when using Apple's System Integrity Protection (SIP), which is enabled by default in modern MacOS versions. SIP clears the `LD_LIBRARY_PATH` and `DYLD_LIBRARY_PATH` variables on process startup for executables that live in `/usr` (but not '/usr/local', `/System`, `/bin`, and `/sbin` among other system locations. Spack cannot know the `LD_LIBRARY_PATH` of the calling process when executed using `/bin/sh` and `/usr/bin/python`. The `spack` shell function now manually forwards these two variables, if they are present, as `SPACK_<VAR>` and recovers those values on startup.

- [x] spack load/unload no longer delegate to modules
- [x] refactor user_environment modification calculations
- [x] update documentation for spack load/unload

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2020-01-22 22:36:02 -08:00
Adam J. Stewart
11f2b61261 Use spack commands --format=bash to generate shell completion (#14393)
This PR adds a `--format=bash` option to `spack commands` to
auto-generate the Bash programmable tab completion script. It can be
extended to work for other shells.

Progress:

- [x] Fix bug in superclass initialization in `ArgparseWriter`
- [x] Refactor `ArgparseWriter` (see below)
- [x] Ensure that output of old `--format` options remains the same
- [x] Add `ArgparseCompletionWriter` and `BashCompletionWriter`
- [x] Add `--aliases` option to add command aliases
- [x] Standardize positional argument names
- [x] Tests for `spack commands --format=bash` coverage
- [x] Tests to make sure `spack-completion.bash` stays up-to-date
- [x] Tests for `spack-completion.bash` coverage
- [x] Speed up `spack-completion.bash` by caching subroutine calls

This PR also necessitates a significant refactoring of
`ArgparseWriter`. Previously, `ArgparseWriter` was mostly a single
`_write` method which handled everything from extracting the information
we care about from the parser to formatting the output. Now, `_write`
only handles recursion, while the information extraction is split into a
separate `parse` method, and the formatting is handled by `format`. This
allows subclasses to completely redefine how the format will appear
without overriding all of `_write`.

Co-Authored-by: Todd Gamblin <tgamblin@llnl.gov>
2020-01-22 21:31:12 -08:00
Todd Gamblin
8011fedd9c bugfix: gpg2 is called 'gpg' on macOS
The gpg2 command isn't always around; it's sometimes called gpg.  This is
the case with the brew-installed version, and it's breaking our tests.

- [x] Look for both 'gpg2' and 'gpg' when finding the command
- [x] If we find 'gpg', ensure the version is 2 or higher
- [x] Add tests for version detection.
2020-01-22 17:34:31 -08:00
Massimiliano Culpo
74266ea789 tests: removed code duplication (#14596)
- [x] Factored to a common place the fixture `testing_gpg_directory`, renamed it as 
      `mock_gnupghome`
- [x] Removed altogether the function `has_gnupg2`

For `has_gnupg2`, since we were not trying to parse the version from the output of:
```console
$ gpg2 --version
```
this is effectively equivalent to check if `spack.util.gpg.GPG.gpg()` was found. If we need to ensure version is `^2.X` it's probably better to do it in `spack.util.gpg.GPG.gpg()` than in a separate function.
2020-01-22 14:04:16 -08:00
Todd Gamblin
2eadfa24e9
bugfix: hashes should use ordered dictionaries (#14390)
Despite trying very hard to keep dicts out of our hash algorithm, we seem
to still accidentally add them in ways that the tests can't catch. This
can cause errors when hashes are not computed deterministically.

This fixes an error we saw with Python 3.5, where dictionary iteration
order is random.  In this instance, we saw a bug when reading Spack
environment lockfiles -- The load would fail like this:

```
...
File "/sw/spack/lib/spack/spack/environment.py", line 1249, in concretized_specs
  yield (s, self.specs_by_hash[h])
KeyError: 'qcttqplkwgxzjlycbs4rfxxladnt423p'
```

This was because the hashes differed depending on whether we wrote `path`
or `module` first when recomputing the build hash as part of reading a
Spack lockfile.  We can fix it by ensuring a determistic iteration order.

- [x] Fix two places (one that caused an issue, and one that did
  not... yet) where our to_node_dict-like methods were using regular python
  dicts.

- [x] Also add a check that statically analyzes our to_node_dict
  functions and flags any that use Python dicts.

The test found the two errors fixed here, specifically:

```
E       AssertionError: assert [] == ['Use syaml_dict instead of ...pack/spack/spec.py:1495:28']
E         Right contains more items, first extra item: 'Use syaml_dict instead of dict at /Users/gamblin2/src/spack/lib/spack/spack/spec.py:1495:28'
E         Full diff:
E         - []
E         + ['Use syaml_dict instead of dict at '
E         +  '/Users/gamblin2/src/spack/lib/spack/spack/spec.py:1495:28']
```

and

```
E       AssertionError: assert [] == ['Use syaml_dict instead of ...ack/architecture.py:359:15']
E         Right contains more items, first extra item: 'Use syaml_dict instead of dict at /Users/gamblin2/src/spack/lib/spack/spack/architecture.py:359:15'
E         Full diff:
E         - []
E         + ['Use syaml_dict instead of dict at '
E         +  '/Users/gamblin2/src/spack/lib/spack/spack/architecture.py:359:15']
```
2020-01-21 23:36:10 -08:00
Scott Wittenburg
8283d87f6a pipelines: spack ci command with env-based workflow (#12854)
Rework Spack's continuous integration workflow to be environment-based.

- Add the `spack ci` command, which replaces the many scripts in `bin/`

- `spack ci` decouples the CI workflow from the spack instance:
  - CI is defined in a spack environment
  - environment is in its own (single) git repository, separate from Spack
  - spack instance used to run the pipeline is up to the user
  - A new `gitlab-ci` section in environments allows users to configure how
    specs in the environment should be mapped to runners
  - Compilers can be bootstrapped in the new pipeline workflow

- Add extensive documentation on pipelines (see `pipelines.rst` for further details)
- Add extensive tests for pipeline code
2020-01-21 22:35:18 -08:00
Dr. Christian Tacke
5eed196f74 Use util.url.join for URLs in GNU Mirrors / reorder Mirrors (#14395)
* Reorder GNU mirrors (#14395)

As @adamjstewart commented in #14395, GNU suggests to use
their mirror. So reorder the mirror to the top.

GNU Doc: https://www.gnu.org/prep/ftp.en.html

* Use spack.util.url.join for URLs in GNU mirrors (#14395)

One should not use os.path.join for URLs. This does only
work on POSIX systems.

Instead use spack.util.url.join.
So every part in spack uses the same url joining method.
2020-01-21 13:14:38 -06:00
Adam J. Stewart
808c80d65a
Fix use of sys.executable for module/env commands (#14496)
* Fix use of sys.executable for module/env commands

* Fix unit tests

* More consistent quotation, less duplication

* Fix import syntax
2020-01-16 15:46:18 -06:00
Adam J. Stewart
3cd6938d80
Fix typo in modules docstring (#14521) 2020-01-15 15:16:12 -06:00
Adam J. Stewart
240a9e6284
Fix parsing of rocketmq URL (#14490) 2020-01-14 11:59:10 -06:00
Tamara Dahlgren
eb7a4e1029 Fixes #14402 (#14483)
Check if patchelf is executable, not binary, in case a site is wrapping it.
2020-01-13 13:00:14 -08:00
Jeffrey Salmond
6b3e173331 Remove extensions from view in the correct order (#12961)
When removing packages from a view, extensions were being deactivated
in an arbitrary order. Extensions must be deactivated in preorder
traversal (dependents before dependencies), so when this order was
violated the view update would fail.

This commit ensures that views deactivate extensions based on a
preorder traversal and adds a test for it.
2020-01-08 15:52:39 -08:00
Tim Haines
2028687efe spack.compilers.clang: add new version check (#14365) 2020-01-08 07:13:36 +01:00
eugeneswalker
7546ca6d4d bugfix: Issue #14346, buildcache create s3 push fails when package w same DAG hash already exists at mirror (#14412) 2020-01-07 12:40:37 -06:00
Massimiliano Culpo
08d0267c9a Spack can automatically remove unused specs (#13534)
* Spack can uninstall unused specs

fixes #4382

Added an option to spack uninstall that removes all unused specs i.e.
build dependencies or transitive dependencies that are left
in the store after the specs that pulled them in have been removed.

* Moved the functionality to its own command

The command has been named 'spack autoremove' to follow the naming used
for the same functionality by other widely known package managers i.e.
yum and apt.

* Speed-up autoremoving specs by not locking and re-reading the scratch DB

* Make autoremove work directly on Spack's store

* Added unit tests for the new command

* Display a terser output to the user

* Renamed the "autoremove" command "gc"

Following discussion there's more consensus around
the latter name.

* Preserve root specs in env contexts

* Instead of preserving specs, restrict gc to the active environment

* Added docs

* Added a unit test for gc within an environment

* Updated copyright to 2020

* Updated documentation according to review

Rephrased a couple of sentences, added references to
`spack find` and dependency types.

* Updated function naming and docstrings

* Simplified computation of unused specs

Since the new approach uses private attributes of the DB
it has been coded as a method of that class rather than a
freestanding function.
2020-01-07 08:16:54 -08:00
Adam J. Stewart
adffa45264 Reference spack help --spec in spack spec --help 2020-01-06 00:20:19 -08:00
Sajid Ali
c3c1cf13e7 RHEL8 bugfix for module_cmd (#14349) 2020-01-02 15:30:11 -06:00
Adam J. Stewart
3f190a432e
MKL: set appropriate CMake env vars (#14274) 2020-01-02 12:41:42 -06:00
Todd Gamblin
6e828206b6 refactor: cleanup imports in spec.py
The imports in `spec.py` are getting to be pretty unwieldy.

- [x] Remove all of the `import from` style imports and replace them with
  `import` or `import as`
- [x] Remove a number names that were exported by `spack.spec` that
  weren't even in `spack.spec`
2020-01-02 08:05:00 -08:00
Todd Gamblin
9ed34f686f bugfix: cdash tests shoudln't modify working directory
The latest cdash test creates a local cdash_reports directory, but it
should do that in a tmpdir.
2020-01-02 00:01:15 -08:00
Todd Gamblin
4beb9fc5d3 tests: improved spack test command line options
Previously, `spack test` automatically passed all of its arguments to
`pytest -k` if no options were provided, and to `pytest` if they were.
`spack test -l` also provided a list of test filenames, but they didn't
really let you completely narrow down which tests you wanted to run.

Instead of trying to do our own weird thing, this passes `spack test`
args directly to `pytest`, and omits the implicit `-k`.  This means we
can now run, e.g.:

```console
$ spack test spec_syntax.py::TestSpecSyntax::test_ambiguous
```

This wasn't possible before, because we'd pass the fully qualified name
to `pytest -k` and get an error.

Because `pytest` doesn't have the greatest ability to list tests, I've
tweaked the `-l`/`--list`, `-L`/`--list-long`, and `-N`/`--list-names`
options to `spack test` so that they help you understand the names
better.  you can combine these options with `-k` or other arguments to do
pretty powerful searches.

This one makes it easy to get a list of names so you can run tests in
different orders (something I find useful for debugging `pytest` issues):

```console
$ spack test --list-names -k "spec and concretize"
cmd/env.py::test_concretize_user_specs_together
concretize.py::TestConcretize::test_conflicts_in_spec
concretize.py::TestConcretize::test_find_spec_children
concretize.py::TestConcretize::test_find_spec_none
concretize.py::TestConcretize::test_find_spec_parents
concretize.py::TestConcretize::test_find_spec_self
concretize.py::TestConcretize::test_find_spec_sibling
concretize.py::TestConcretize::test_no_matching_compiler_specs
concretize.py::TestConcretize::test_simultaneous_concretization_of_specs
spec_dag.py::TestSpecDag::test_concretize_deptypes
spec_dag.py::TestSpecDag::test_copy_concretized
```

You can combine any list option with keywords:

```console
$ spack test --list -k microarchitecture
llnl/util/cpu.py  modules/lmod.py
```

```console
$ spack test --list-long -k microarchitecture
llnl/util/cpu.py::
    test_generic_microarchitecture

modules/lmod.py::TestLmod::
    test_only_generic_microarchitectures_in_root
```

Or just list specific files:

```console
$ spack test --list-long cmd/test.py
cmd/test.py::
    test_list                       test_list_names_with_pytest_arg
    test_list_long                  test_list_with_keywords
    test_list_long_with_pytest_arg  test_list_with_pytest_arg
    test_list_names
```

Hopefully this stuff will help with debugging test issues.

- [x] make `spack test` send args directly to `pytest` instead of trying
  to do fancy things.
- [x] rework `--list`, `--list-long`, and add `--list-names` to make
  searching for tests easier.
- [x] make it possible to mix Spack's list args with `pytest` args
  (they're just fancy parsing around `pytest --collect-only`)
- [x] add docs
- [x] add tests
- [x] update spack completion
2020-01-01 21:37:02 -08:00
Glenn Johnson
1ac0c51dad Modify create clue list so R packages are detected (#12277)
R packages can contain configure scripts so R needs to be before
autotools in the clue list.
2019-12-31 16:44:31 -06:00
Todd Gamblin
ffc91bd86e tests: move mock config.yaml files to common directory
Test configuration files (except modules.yaml) were in the root level of
test/data, but should really just be in their own directory.  The absence
of modules.yaml was also breaking module tests if we got module
preferences after tests started, as the mock modules.yaml was not in the
test directory.
2019-12-31 13:48:01 -08:00
Todd Gamblin
3017584c48 config: remove all module-scope calls to spack.config.get()
This avoids parsing modules.yaml on startup.
2019-12-31 13:48:01 -08:00
Todd Gamblin
9cc013cc0f modules: make the module hook more robust
The module hook would previously fail if there were no enabled module types.

- Instead of looking for a `KeyError`, default to empty list when the
  config variable is not present.

- Convert lambdas to real functions for clarity.
2019-12-31 13:48:01 -08:00
Todd Gamblin
58cb4e5241 hooks: remove pre_run hook to improve startup time.
- Remove legacy yaml_version_check() hook
- Remove the pre_run hook from `hook/__init__.py` and `main.py`

We want to discourage the use of pre-run hooks because they have to run
at startup.  To keep Spack fast, we should do things like this lazily
instead of in hooks that require spidering directories full of modules.
2019-12-31 13:48:01 -08:00
Todd Gamblin
4af6303086
copyright: update copyright dates for 2020 (#14328) 2019-12-30 22:36:56 -08:00
Todd Gamblin
98ad6e39b5
bugfix: add required fixture for CDash authentication test (#14325) 2019-12-30 16:55:05 -08:00
Zack Galbreath
cc96758fdc Add support for authenticated CDash uploads (#14200) 2019-12-30 15:54:56 -08:00
Todd Gamblin
65ef6d5dcb refactor: rename mock_config fixture to mock_low_high_config
This avoids confusion with mock_configuration.
2019-12-30 13:01:31 -08:00
Todd Gamblin
b2e9696052 argparse: lazily construct common arguments
Continuing to shave small bits of time off startup --
`spack.cmd.common.arguments` constructs many `Args` objects at module
scope, which has to be done for all commands that import it.  Instead of
doing this at load time, do it lazily.

- [x] construct Args objects lazily

- [x] remove the module-scoped argparse fixture

- [x] make the mock config scope set dirty to False by default (like the
  regular scope)

This *seems* to reduce load time slightly
2019-12-30 13:01:31 -08:00
Todd Gamblin
e7dc8a2bea tests: refactor tests to avoid persistent global state
Previously, fixtures like `config`, `database`, and `store` were
module-scoped, but frequently used as test function arguments.  These
fixtures swap out global on setup and restore them on teardown.  As
function arguments, they would do the right set-up, but they'd leave the
global changes in place for the whole module the function lived in.  This
meant that if you use `config` once, other functions in the same module
would inadvertently inherit the mock Spack configuration, as it would
only be torn down once all tests in the module were complete.

In general, we should module- or session-scope the *STATE* required for
these global objects (as it's expensive to create0, but we shouldn't
module-or session scope the activation/use of them, or things can get
really confusing.

- [x] Make generic context managers for global-modifying fixtures.

- [x] Make session- and module-scoped fixtures that ONLY build filesystem
  state and create objects, but do not swap out any variables.

- [x] Make seeparate function-scoped fixtures that *use* the session
  scoped fixtures and actually swap out (and back in) the global
  variables like `config`, `database`, and `store`.

These changes make it so that global changes are *only* ever alive for a
singlee test function, and we don't get weird dependencies because a
global fixture hasn't been destroyed.
2019-12-30 13:01:31 -08:00
Todd Gamblin
e839432472 tests: make env tests that use configs non-destructive
Environment tests pushed config scopes but didn't properly remove them.

- [x] use `with env:` context manager instead of `env.prepare_config_scopes()`
2019-12-30 13:01:31 -08:00
Todd Gamblin
8e8235043d package_prefs: move class-level cache to PackagePref instance
`PackagePrefs` has had a class-level cache of data from `packages.yaml` for
a long time, but it complicates testing and leads to subtle errors,
especially now that we frequently manipulate custom config scopes and
environments.

Moving the cache to instance-level doesn't slow down concretization or
the test suite, and it just caches for the life of a `PackagePrefs`
instance (i.e., for a single cocncretization) so we don't need to worry
about global state anymore.

- [x] Remove class-level caches from `PackagePrefs`
- [x] Add a cached _spec_order object on each `PackagePrefs` instance
- [x] Remove all calls to `PackagePrefs.clear_caches()`
2019-12-30 13:01:31 -08:00
Todd Gamblin
4d6462247e
externals: avoid importing jinja2 on startup (#14308)
Jinja2 costs a tenth to a few tenths of a second to import, so we should avoid importing it on startup.

- [x] only import jinja2 within functions
2019-12-28 14:43:23 -08:00
Todd Gamblin
2dafeaf819
bugfix: colify_table should not revert to 1 column for non-tty (#14307)
Commands like `spack blame` were printig poorly when redirected to files,
as colify reverts to a single column when redirected.  This works for
list data but not tables.

- [x] Force a table by always passing `tty=True` from `colify_table()`
2019-12-28 11:26:31 -08:00
Dr. Christian Tacke
8ee75e19bd Improve info variant header (#14275)
In "spack info" the Variants header currently has two blank
lines under it. That's too much. It looks like the actual
content belongs to something else.

Instead underline the headers to make things more obvious.
2019-12-27 15:21:15 -08:00
Todd Gamblin
61b4ad1837
tests: finish removing pyqver from the repository (#14294)
Remove a few remaining mentions of the pyqver package, which was removed in #14289.
2019-12-24 17:37:03 -08:00
Massimiliano Culpo
d333e14721 tests: check min required python version with vermin (#14289)
This commit removes the `python_version.py` unit test module
and the vendored dependencies `pyqver2.py` and `pyqver3.py`.
It substitutes them with an equivalent check done using
`vermin` that is run as a separate workflow via Github Actions.

This allows us to delete 2 vendored dependencies that are unmaintained
and substitutes them with a maintained tool.

Also, updates the list of vendored dependencies.
2019-12-24 09:28:33 -08:00
t-karatsu
1e2c9d960c a64fx: fix typo in GCC flags (#14286) 2019-12-24 17:45:03 +01:00
Todd Gamblin
7652d1a4c1
Merge branch 'releases/v0.13' into develop 2019-12-24 01:04:41 -08:00
Todd Gamblin
231e237764
version bump: 0.13.3 2019-12-23 23:48:11 -08:00
Todd Gamblin
e22d3250dd
performance: dont' read spec.yaml files twice in view regeneration
`ViewDescriptor.regenerate()` calls `get_all_specs()`, which reads
`spec.yaml` files, which is slow.  It's fine to do this once, but
`view.remove_specs()` *also* calls it immediately afterwards.

- [x] Pass the result of `get_all_specs()` as an optional parameter to
  `view.remove_specs()` to avoid reading `spec.yaml` files twice.
2019-12-23 23:18:47 -08:00
Todd Gamblin
e3939b0c72
performance: don't recompute hashes when regenerating environments
`ViewDescriptor.regenerate()` was copying specs and stripping build
dependencies, which clears `_hash` and other cached fields on concrete
specs, which causes a bunch of YAML hashes to be recomputed.

- [x] Preserve the `_hash` and `_normal` fields on stripped specs, as
  these will be unchanged.
2019-12-23 23:18:46 -08:00
Todd Gamblin
f013687397
performance: reduce system calls required for remove_dead_links
`os.path.exists()` will report False if the target of a symlink doesn't
exist, so we can avoid a costly call to realpath here.
2019-12-23 23:18:46 -08:00
Todd Gamblin
79ddf6cf0d
performance: only regenerate env views once in spack install
`spack install` previously concretized, writes the entire environment
out, regenerated views, then wrote and regenerated views
again. Regenerating views is slow, so ensure that we only do that once.

- [x] add an option to env.write() to skip view regeneration

- [x] add a note on whether regenerate_views() shouldn't just be a
  separate operation -- not clear if we want to keep it as part of write
  to ensure consistency, or take it out to avoid performance issues.
2019-12-23 23:18:45 -08:00
Todd Gamblin
be6d7db2a8
performance: add read transactions for install_all() and install()
Environments need to read the DB a lot when installing all specs.

- [x] Put a read transaction around `install_all()` and `install()`
  to avoid repeated locking
2019-12-23 23:18:45 -08:00
Todd Gamblin
d87ededddc
lock transactions: avoid redundant reading in write transactions
Our `LockTransaction` class was reading overly aggressively.  In cases
like this:

```
1  with spack.store.db.read_transaction():
2    with spack.store.db.write_transaction():
3      ...
```

The `ReadTransaction` on line 1 would read in the DB, but the
WriteTransaction on line 2 would read in the DB *again*, even though we
had a read lock the whole time.  `WriteTransaction`s were only
considering nested writes to decide when to read, but they didn't know
when we already had a read lock.

- [x] `Lock.acquire_write()` return `False` in cases where we already had
       a read lock.
2019-12-23 23:18:45 -08:00
Todd Gamblin
b3a5f2e3c3
lock transactions: ensure that nested write transactions write
If a write transaction was nested inside a read transaction, it would not
write properly on release, e.g., in a sequence like this, inside our
`LockTransaction` class:

```
1  with spack.store.db.read_transaction():
2    with spack.store.db.write_transaction():
3      ...
4  with spack.store.db.read_transaction():
   ...
```

The WriteTransaction on line 2 had no way of knowing that its
`__exit__()` call was the last *write* in the nesting, and it would skip
calling its write function.

The `__exit__()` call of the `ReadTransaction` on line 1 wouldn't know
how to write, and the file would never be written.

The DB would be correct in memory, but the `ReadTransaction` on line 4
would re-read the whole DB assuming that other processes may have
modified it.  Since the DB was never written, we got stale data.

- [x] Make `Lock.release_write()` return `True` whenever we release the
      *last write* in a nest.
2019-12-23 23:18:44 -08:00
Todd Gamblin
98577e3af5
lock transactions: fix non-transactional writes
Lock transactions were actually writing *after* the lock was
released. The code was looking at the result of `release_write()` before
writing, then writing based on whether the lock was released.  This is
pretty obviously wrong.

- [x] Refactor `Lock` so that a release function can be passed to the
      `Lock` and called *only* when a lock is really released.

- [x] Refactor `LockTransaction` classes to use the release function
  instead of checking the return value of `release_read()` / `release_write()`
2019-12-23 23:18:44 -08:00
Todd Gamblin
a85b9070cb
performance: avoid repeated DB locking on view generation
`ViewDescriptor.regenerate()` checks repeatedly whether packages are
installed and also does a lot of DB queries.  Put a read transaction
around the whole thing to avoid repeatedly locking and unlocking the DB.
2019-12-23 23:18:44 -08:00
Todd Gamblin
91ea90c253
performance: speed up spack find in environments
`Environment.added_specs()` has a loop around calls to
`Package.installed()`, which can result in repeated DB queries.  Optimize
this with a read transaction in `Environment`.
2019-12-23 23:17:59 -08:00
Todd Gamblin
5bdba98837
performance: spack spec should use a read transacction with -I
`spack spec -I` queries the database for installation status and should
use a read transaction around calls to `Spec.tree()`.
2019-12-23 23:17:59 -08:00
Todd Gamblin
cbf8553406
concretization: improve performance by avoiding database locks
Checks for deprecated specs were repeatedly taking out read locks on the
database, which can be very slow.

- [x] put a read transaction around the deprecation check
2019-12-23 23:17:58 -08:00
Todd Gamblin
48befd67b5
performance: memoize spack.architecture.get_platform()
`get_platform()` is pretty expensive and can be called many times in a
spack invocation.

- [x] memoize `get_platform()`
2019-12-23 23:17:58 -08:00
Sajid Ali
37eac1a226
use sys.executable instead of python in _source_single_file (#14252) 2019-12-23 23:16:30 -08:00
Peter Josef Scheibel
639156130b
Patch fetching: remove unnecessary argument 2019-12-23 23:03:10 -08:00
Peter Josef Scheibel
587c650b88
Mirrors: skip attempts to fetch BundlePackages
BundlePackages use a noop fetch strategy. The mirror logic was assuming
that the fetcher had a resource to cach after performing a fetch. This adds
a special check to skip caching if the stage is associated with a
BundleFetchStrategy. Note that this should allow caching resources
associated with BundlePackages.
2019-12-23 23:03:10 -08:00
Peter Josef Scheibel
d71428622b
Mirrors: avoid re-downloading patches
When updating a mirror, Spack was re-retrieving all patches (since the
fetch logic for patches is separate). This updates the patch logic to
allow the mirror logic to avoid this.
2019-12-23 23:03:10 -08:00
Peter Josef Scheibel
a69b3c85b0
Mirrors: perform checksum of fetched sources
Since cache_mirror does the fetch itself, it also needs to do the
checksum itself if it wants to verify that the source stored in the
mirror is valid. Note that this isn't strictly required because fetching
(including from mirrors) always separately verifies the checksum.
2019-12-23 23:03:09 -08:00
Peter Josef Scheibel
98b498c671
Mirrors: fix cosmetic symlink targets
The targets for the cosmetic paths in mirrrors were being calculated
incorrectly as of fb3a3ba: the symlinks used relative paths as targets,
and the relative path was computed relative to the wrong directory.
2019-12-23 23:03:09 -08:00
Peter Josef Scheibel
64209dda97
Allow repeated invocations of 'mirror create'
When creating a cosmetic symlink for a resource in a mirror, remove
it if it already exists. The symlink is removed in case the logic to
create the symlink has changed.
2019-12-23 23:03:09 -08:00
Paul Ferrell
c15e55c668
mirror bug fixes: symlinks, duplicate patch names, and exception handling (#13789)
* Some packages (e.g. mpfr at the time of this patch) can have patches
  with the same name but different contents (which apply to different
  versions of the package). This appends part of the patch hash to the
  cache file name to avoid conflicts.
* Some exceptions which occur during fetching are not a subclass of
  SpackError and therefore do not have a 'message' attribute. This
  updates the logic for mirroring a single spec (add_single_spec)
  to produce an appropriate error message in that case (where before
  it failed with an AttributeError)
* In various circumstances, a mirror can contain the universal storage
  path but not a cosmetic symlink; in this case it would not generate
  a symlink. Now "spack mirror create" will create a symlink for any
  package that doesn't have one.
2019-12-23 23:03:03 -08:00
Todd Gamblin
d7f2a32887 performance: dont' read spec.yaml files twice in view regeneration
`ViewDescriptor.regenerate()` calls `get_all_specs()`, which reads
`spec.yaml` files, which is slow.  It's fine to do this once, but
`view.remove_specs()` *also* calls it immediately afterwards.

- [x] Pass the result of `get_all_specs()` as an optional parameter to
  `view.remove_specs()` to avoid reading `spec.yaml` files twice.
2019-12-23 18:36:56 -08:00
Todd Gamblin
78b84e4ade performance: don't recompute hashes when regenerating environments
`ViewDescriptor.regenerate()` was copying specs and stripping build
dependencies, which clears `_hash` and other cached fields on concrete
specs, which causes a bunch of YAML hashes to be recomputed.

- [x] Preserve the `_hash` and `_normal` fields on stripped specs, as
  these will be unchanged.
2019-12-23 18:36:56 -08:00
Todd Gamblin
9b90d7e801 performance: reduce system calls required for remove_dead_links
`os.path.exists()` will report False if the target of a symlink doesn't
exist, so we can avoid a costly call to realpath here.
2019-12-23 18:36:56 -08:00
Todd Gamblin
c83e365c59 performance: only regenerate env views once in spack install
`spack install` previously concretized, writes the entire environment
out, regenerated views, then wrote and regenerated views
again. Regenerating views is slow, so ensure that we only do that once.

- [x] add an option to env.write() to skip view regeneration

- [x] add a note on whether regenerate_views() shouldn't just be a
  separate operation -- not clear if we want to keep it as part of write
  to ensure consistency, or take it out to avoid performance issues.
2019-12-23 18:36:56 -08:00
Todd Gamblin
0fb3280011 performance: add read transactions for install_all() and install()
Environments need to read the DB a lot when installing all specs.

- [x] Put a read transaction around `install_all()` and `install()`
  to avoid repeated locking
2019-12-23 18:36:56 -08:00
Todd Gamblin
6c9467e8c6 lock transactions: avoid redundant reading in write transactions
Our `LockTransaction` class was reading overly aggressively.  In cases
like this:

```
1  with spack.store.db.read_transaction():
2    with spack.store.db.write_transaction():
3      ...
```

The `ReadTransaction` on line 1 would read in the DB, but the
WriteTransaction on line 2 would read in the DB *again*, even though we
had a read lock the whole time.  `WriteTransaction`s were only
considering nested writes to decide when to read, but they didn't know
when we already had a read lock.

- [x] `Lock.acquire_write()` return `False` in cases where we already had
       a read lock.
2019-12-23 18:36:56 -08:00
Todd Gamblin
bb517fdb84 lock transactions: ensure that nested write transactions write
If a write transaction was nested inside a read transaction, it would not
write properly on release, e.g., in a sequence like this, inside our
`LockTransaction` class:

```
1  with spack.store.db.read_transaction():
2    with spack.store.db.write_transaction():
3      ...
4  with spack.store.db.read_transaction():
   ...
```

The WriteTransaction on line 2 had no way of knowing that its
`__exit__()` call was the last *write* in the nesting, and it would skip
calling its write function.

The `__exit__()` call of the `ReadTransaction` on line 1 wouldn't know
how to write, and the file would never be written.

The DB would be correct in memory, but the `ReadTransaction` on line 4
would re-read the whole DB assuming that other processes may have
modified it.  Since the DB was never written, we got stale data.

- [x] Make `Lock.release_write()` return `True` whenever we release the
      *last write* in a nest.
2019-12-23 18:36:56 -08:00
Todd Gamblin
eb8fc4f3be lock transactions: fix non-transactional writes
Lock transactions were actually writing *after* the lock was
released. The code was looking at the result of `release_write()` before
writing, then writing based on whether the lock was released.  This is
pretty obviously wrong.

- [x] Refactor `Lock` so that a release function can be passed to the
      `Lock` and called *only* when a lock is really released.

- [x] Refactor `LockTransaction` classes to use the release function
  instead of checking the return value of `release_read()` / `release_write()`
2019-12-23 18:36:56 -08:00
Todd Gamblin
779ac9fe3e performance: avoid repeated DB locking on view generation
`ViewDescriptor.regenerate()` checks repeatedly whether packages are
installed and also does a lot of DB queries.  Put a read transaction
around the whole thing to avoid repeatedly locking and unlocking the DB.
2019-12-23 18:36:56 -08:00
Sajid Ali
96063f9168 use sys.executable instead of python in _source_single_file (#14252) 2019-12-21 00:02:28 -08:00
Massimiliano Culpo
80495d83ed microarchitectures: fix ppc flags for clang (#14196) 2019-12-20 14:40:54 -08:00
Massimiliano Culpo
497fddfcb9 Fetching from URLs falls back to mirrors if they exist (#13881)
Users can now list mirrors of the main url in packages.

- [x] Instead of just a single `url` attribute, users can provide a list (`urls`) in the package, and these will be tried by in order by the fetch strategy.

- [x] To handle one of the most common mirror cases, define a `GNUMirrorPackage` mixin to handle all the standard GNU mirrors.  GNU packages can set `gnu_mirror_path` to define the path within a mirror, and the mixin handles setting up all the requisite GNU mirror URLs.

- [x] update all GNU packages in `builtin` to use the `GNUMirrorPackage` mixin.
2019-12-20 14:32:18 -08:00
Chris Green
dc17d548c8 Add missing __init__.py under test, and correct bad file name from #13889. (#14228) 2019-12-19 17:27:53 -06:00
Todd Gamblin
af249d3cf6 package_sanity: add a test to enforce no nonexisting dependencies in builtin
We shouldn't allow packages to have missing dependencies in the mainline.

- [x] Add a test to enforce this.
2019-12-18 21:10:31 -08:00
Todd Gamblin
531f370e0d possible_dependencies() now reports missing dependencies
- Add an optional argument so that `possible_dependencies()` will report
  missing dependencies.
- Add a test to ensure it works.
- Ignore missing dependencies in `possible_dependencies()` by default.
2019-12-18 21:10:31 -08:00
Todd Gamblin
81b147cc0a package: add spack.package.possible_dependencies method
- this version allows getting possible dependencies of multiple packages
  or specs at once.

- New method handles calling `PackageBase.possible_dependencies` multiple
  times and passing `visited` dict around.
2019-12-18 21:10:31 -08:00
Todd Gamblin
a3799b2c7b performance: speed up spack find in environments
`Environment.added_specs()` has a loop around calls to
`Package.installed()`, which can result in repeated DB queries.  Optimize
this with a read transaction in `Environment`.
2019-12-18 16:07:28 -08:00
Todd Gamblin
0e9c8d236c performance: spack spec should use a read transacction with -I
`spack spec -I` queries the database for installation status and should
use a read transaction around calls to `Spec.tree()`.
2019-12-18 16:07:28 -08:00
Todd Gamblin
f73cdac731 concretization: improve performance by avoiding database locks
Checks for deprecated specs were repeatedly taking out read locks on the
database, which can be very slow.

- [x] put a read transaction around the deprecation check
2019-12-18 16:07:28 -08:00
Todd Gamblin
33335c9d0a performance: memoize spack.architecture.get_platform()
`get_platform()` is pretty expensive and can be called many times in a
spack invocation.

- [x] memoize `get_platform()`
2019-12-18 16:07:28 -08:00
Todd Gamblin
52ebc19b4e bugfix: don't fail if checking for "real" compiler version
doesn't understand a custom, user-defined compiler version.  However, if
the compiler's version check fails, you can't build anything with the
custom compiler.

- [x] Be more lenient: fall back to the custom compiler version and use
  it verbatim if the version check fails.
2019-12-18 11:37:59 -08:00
Todd Gamblin
4eb54b6358 bugfix: pgcc -V returns 2 on power machines
`pgcc -V` was failing on power machines because it returns 2 (despite
correctly printing version information).  On x86_64 machines the same
command returns 0 and doesn't cause an error.

- [x] Ignore return value of 2 for pgcc when doign a version check
2019-12-18 11:37:59 -08:00
Adam J. Stewart
18c2029fef Fix argparse rST parsing of help messages (#14014)
Thanks!
2019-12-17 10:23:22 -08:00
Massimiliano Culpo
5eca4f1470 microarchitectures: readable names for AArch64 vendors (#13825)
Vendors for ARM come out of `/proc/cpuinfo` as hex numbers instead of readable strings.

- Add support for associating vendor names with the hex numbers.
- Also move these mappings from Python code to `microarchitectures.json`
- Move darwin feature name mappings to `microarchitectures.json` as well
2019-12-17 00:47:50 -08:00
Greg Becker
9f1d728646 match bootstrapped compiler to architecture (#14059) 2019-12-14 16:42:46 -08:00
Peter Scheibel
60580f5871 package hash: gracefully handle @when with non-string args (#14153)
* when constructing package hash, default to including a method in the content hash if we can't determine whether it would be included by examining the AST
* add a test for updated content-hash calculations
* refactor content hash tests to eliminate repeated lines
2019-12-14 14:31:39 -08:00
Zack Galbreath
0f5724e908 Split out CDash options to a separate help document (#13704)
Prevent `spack help install` from getting too cluttered with CDash-specific documentation.
2019-12-13 10:15:22 -08:00
Peter Josef Scheibel
8c2305e867 Patch fetching: remove unnecessary argument 2019-12-13 08:38:50 +01:00
Peter Josef Scheibel
8199f22e7c Mirrors: skip attempts to fetch BundlePackages
BundlePackages use a noop fetch strategy. The mirror logic was assuming
that the fetcher had a resource to cach after performing a fetch. This adds
a special check to skip caching if the stage is associated with a
BundleFetchStrategy. Note that this should allow caching resources
associated with BundlePackages.
2019-12-13 08:38:50 +01:00
Peter Josef Scheibel
b62ba7609d Mirrors: avoid re-downloading patches
When updating a mirror, Spack was re-retrieving all patches (since the
fetch logic for patches is separate). This updates the patch logic to
allow the mirror logic to avoid this.
2019-12-13 08:38:50 +01:00
Peter Josef Scheibel
754dd6eb1f Mirrors: perform checksum of fetched sources
Since cache_mirror does the fetch itself, it also needs to do the
checksum itself if it wants to verify that the source stored in the
mirror is valid. Note that this isn't strictly required because fetching
(including from mirrors) always separately verifies the checksum.
2019-12-13 08:38:50 +01:00
Peter Josef Scheibel
b2cc50aa6a Mirrors: fix cosmetic symlink targets
The targets for the cosmetic paths in mirrrors were being calculated
incorrectly as of fb3a3ba: the symlinks used relative paths as targets,
and the relative path was computed relative to the wrong directory.
2019-12-13 08:38:50 +01:00
Peter Josef Scheibel
b64f458102 Allow repeated invocations of 'mirror create'
When creating a cosmetic symlink for a resource in a mirror, remove
it if it already exists. The symlink is removed in case the logic to
create the symlink has changed.
2019-12-13 08:38:50 +01:00
Greg Becker
917224cb3c pytest: add __init__ files for all test subdirs (#13889)
* pytest: add __init__ files for all test subdirs

* add licenses to empty files

* Fix Sphinx warning message about comment within docstring

* Further fixes to Sphinx docstring
2019-12-10 15:19:09 -06:00
Massimiliano Culpo
59d222c172 Better error message when setting unknown variants during concretization (#13128)
fixes #13124
2019-12-10 11:21:45 -08:00
Omar Padron
0592c58030
Follow up/11117 fixes and testing (#13607)
* fix docstring in generate_package_index() refering to "public" keys as "signing" keys

* use explicit kwargs in push_to_url()

* simplify url_util.parse() per tgamblin's suggestion

* replace standardize_header_names() with the much simpler get_header()

* add some basic tests

* update s3_fetch tests

* update S3 list code to strip leading slashes from prefix

* correct minor warning regression introduced in #11117

* add more tests

* flake8 fixes

* add capsys fixture to mirror_crud test

* add get_header() tests

* use get_header() in more places

* incorporate review comments
2019-12-09 17:23:33 -05:00
Greg Becker
da9a562182 environments: allow 'add' command to add virtuals (#13787)
This PR allows virtual packages to be added to the specs list using
the add command.

Virtual packages are already allowed in named lists in spack
environments/stacks, and they are already allowed in the specs list
when added using the yaml directly.
2019-12-09 12:23:03 -08:00
Andras Wacha
b33b8a3e29 Apply URLFetchStrategy to ftp:// and ftps:// url schemes (#13939)
* Apply URLFetchStrategy to ftp:// and ftps:// url schemes

* Corrected trailing whitespace error
2019-12-09 11:18:08 -06:00
George Hartzell
1d06949306 Tuneup docs re setting up sphinx for building docs (#14005)
I have, more than once, tried to install the list of things that need
to build the docs, only to discover that the list doesn't use Spack's
package names.  I'm tired of facepalming....

While I was there I touched up the prose about activating the new
Python packages; activating a python package doesn't add anything to
your PYTHONPATH, it links things into a directory that's *already* on
your PYTHONPATH.  Note that this all presupposes that you're using
that same python....
2019-12-08 16:22:25 -06:00
Axel Huebl
d705e96a63
Spec Header Dirs: Only first include/ (#13991)
* CUDA HeaderList: Unit Test

* Spec Header Dirs: Only first include/

Avoid matching recurringly nested include paths that usually
refer to internally shipped libraries in packages.
Example in CUDA Toolkit, shipping a libc++ fork internally
with libcu++ since 10.2.89:
`<prefix>/include/cuda/some/more/details/include/` or
`<prefix>/include/cuda/std/detail/libcxx/include`

regex: non-greedy first match of include

Co-Authored-By: Massimiliano Culpo <massimiliano.culpo@gmail.com>

* CUDA: Re-Enable 10.2.89 as Default
2019-12-06 23:47:03 -08:00
Tamara Dahlgren
842e9d9375 docs: Alphabetize create cmd template options (#13993)
* Bugfix: Display template options for create command.

* Alphabetize "spack create" template options for readability

* Revert template choices format; alphabetize list

* flake8 fix
2019-12-06 18:07:45 -06:00
Greg Becker
99c9365974 Bugfix: spack find -p fails in environment (#13972)
* force spack find -p to print abstract specs without prefixes
* hashes have the same issue; improve handling of find -L to match find -l
2019-12-06 12:29:57 -08:00
Tamara Dahlgren
b0f59484d3 docs: Minimal BundlePackage build system doc (#13992)
* Minimal BundlePackage build system doc

* Add link to new bundlepackage file

* Fixed link bug and added create command example
2019-12-06 07:26:59 -08:00
Scott Wittenburg
a288449f0b cdash: fix reporting issue with python 3 2019-12-05 11:37:03 -07:00
Peter Scheibel
e9ee9eaf50 patching: do strict version range checking (#13989)
* apply strict constraint checks for patches, otherwise Spack may incorrectly treat a version range constraint as satisfied when mixing x.y and x.y.z versions
* add mixed version checks to version comparison tests
2019-12-04 22:27:08 -08:00
Todd Gamblin
3fee65cb92
version bump: 0.13.2 2019-12-04 21:36:42 -08:00
Todd Gamblin
46b68263d8
version bump: 0.13.2 2019-12-04 21:20:09 -08:00
Peter Scheibel
03a5771b9d
Bugfix: allow missing modules if they are blacklisted (#13540)
`spack module loads` and `spack module find` previously failed if any upstream modules were missing.  This prevented it from being used with upstreams (or, really, any spack instance) that blacklisted modules.

This PR makes module finding is now more lenient (especially for blacklisted modules).

- `spack module find` now does not report an error if the spec is blacklisted
  - instead, it prints a single warning if any modules will be omitted from the loads file
  - It comments the missing modules out of the loads file so the user can see what's missing
  - Debug messages are also printed so users can check this with `spack -d...`

- also added tests for new functionality
2019-12-04 20:55:50 -08:00
Peter Scheibel
e5f04f9abc Bugfix: allow missing modules if they are blacklisted (#13540)
`spack module loads` and `spack module find` previously failed if any upstream modules were missing.  This prevented it from being used with upstreams (or, really, any spack instance) that blacklisted modules.

This PR makes module finding is now more lenient (especially for blacklisted modules).

- `spack module find` now does not report an error if the spec is blacklisted
  - instead, it prints a single warning if any modules will be omitted from the loads file
  - It comments the missing modules out of the loads file so the user can see what's missing
  - Debug messages are also printed so users can check this with `spack -d...`

- also added tests for new functionality
2019-12-04 19:17:40 -08:00
Adam J. Stewart
ba7ac53b75
Fix spack test when SPACK_ROOT isn't set (#13980) 2019-12-04 18:05:08 -06:00
Massimiliano Culpo
e9f027210f Fixed x86-64 optimization flags for clang (#13913)
* Fixed x86-64 optimization flags for clang
* Fixed expected results in unit tests

Before the flags used where the one for llc, the underlying compiler from LLVM IR to machine assembly. It turns out that the semantic of `-march`, `-mtune` and `-mcpu` changes from clang front-end to llc.

I found no definitive reference for the flags submitted in this PR, but I checked the assembly on a vectorizable function using Godbolt's web-site.
2019-12-04 09:11:34 -08:00
Massimiliano Culpo
a93a613668
Speedup environment activation (#13557)
* Add a transaction around repeated calls to `spec.prefix` in the activation process
* cache the computation of home in the python package to speed up setting deps
* ensure that module-scope variables are only set *once* per module
2019-12-02 14:05:35 -08:00
Massimiliano Culpo
bca59f8d83 Speedup environment activation (#13557)
* Add a transaction around repeated calls to `spec.prefix` in the activation process
* cache the computation of home in the python package to speed up setting deps
* ensure that module-scope variables are only set *once* per module
2019-12-02 14:05:02 -08:00
Adam J. Stewart
71eaffa46b Version bump: 1.13.1 (#13942) 2019-12-02 06:58:30 -08:00
Todd Gamblin
c36d9f297f
bugfix: mirror path works for unknown versions (#13626)
`mirror_archive_path` was failing to account for the case where the fetched version isn't known to Spack.

- [x] don't require the fetched version to be in `Package.versions`
- [x] add regression test for mirror paths when package does not have a version
2019-12-01 20:23:06 -08:00
Adam J. Stewart
b44df29316
environments: don't try to modify run-env if a spec is not installed (#13589)
Fixes #13529
Fixes #13509
2019-12-01 20:22:31 -08:00
Greg Becker
fba963f1d1
use semicolons instead of newlines in module/python command (#13904) 2019-12-01 20:21:34 -08:00
Daryl W. Grunau
9c5b583508
verify.py: os.path.exists exception handling (#13656) 2019-12-01 20:21:08 -08:00
Chris Green
c5da94eb58 Armor test script against shebang character limit if appropriate. (#12447) 2019-11-30 13:00:08 -06:00
Adam J. Stewart
ab98ef1765
Mass conversion of setup_(dependent_)?environment (#13924)
* Mass conversion of setup_(dependent_)?environment

* prefix -> self.prefix
2019-11-29 15:00:44 -06:00
Greg Becker
1450c30656 use semicolons instead of newlines in module/python command (#13904) 2019-11-26 17:09:24 -08:00
Adam J. Stewart
ad1ad83664
IntelPackage: setup_env -> setup_build_env (#13888) 2019-11-26 16:48:32 -06:00
Massimiliano Culpo
f6781d65f0 buildcache list: do not display duplicate specs (#13758)
fixes #13757
2019-11-26 13:24:15 -07:00
Massimiliano Culpo
77c206185b Remove warning from the "Custom Extensions" section of the docs (#13804)
Extensions have been available for a while and the overall design
seems solid enough to be feasible for extensions without losing
backward compatibility.
2019-11-26 09:30:49 -08:00
René Widera
9c10b80591 add package cuda@10.2.89 (#13819)
* add package cuda@10.2.89

add CUDA 10.2 support

* CudaPackage: Add 10.2 Conflicts

* CUDA: Modernize Run Environment

See #11115
2019-11-25 13:23:48 -06:00
Greg Becker
6c55a7c85f
cmd/install: remove unused install_status option (#13751)
* cmd/install: remove unused install_status option

* update bash completions for spack install
2019-11-22 11:17:37 -07:00
Massimiliano Culpo
0684a58d16 Fixed detection for cascadelake microarchitecture (#13820)
fixes #13803
2019-11-21 13:09:48 -07:00
Paul Ferrell
fb3a3ba95e mirror bug fixes: symlinks, duplicate patch names, and exception handling (#13789)
* Some packages (e.g. mpfr at the time of this patch) can have patches
  with the same name but different contents (which apply to different
  versions of the package). This appends part of the patch hash to the
  cache file name to avoid conflicts.
* Some exceptions which occur during fetching are not a subclass of
  SpackError and therefore do not have a 'message' attribute. This
  updates the logic for mirroring a single spec (add_single_spec)
  to produce an appropriate error message in that case (where before
  it failed with an AttributeError)
* In various circumstances, a mirror can contain the universal storage
  path but not a cosmetic symlink; in this case it would not generate
  a symlink. Now "spack mirror create" will create a symlink for any
  package that doesn't have one.
2019-11-20 17:00:44 -07:00
t-karatsu
513fe55fc3 Features/expand microarch for aarch64 (#13780)
* Add process to determine aarch64 microarchitecture

* add microarchitectures for thunderx2 and a64fx

* Add optimize flags for gcc on aarch64 family processors thunderx2 and a64fx.

* Add optimize flags for clang on aarch64 family processors thunderx2 and a64fx

* Add testing for thunderx2 and a64fx microarchitectures
2019-11-20 00:01:12 -07:00
Greg Becker
99dfff4475
binary distribution: relocate text files properly in relative binaries (#13578)
* Make relative binaries relocate text files properly
* rb strings aren't valid in python 2
* move perl to new interface for setup_environment family methods
2019-11-18 14:13:42 -07:00
Adam J. Stewart
eb22abc521 Document use of the maintainers field (#13748) 2019-11-17 15:30:08 -07:00
Greg Becker
aa83c483f7
Bugfix/config caching 13754 (#13759)
* remove reference to `spack.store` in method definition

Referencing `spack.store` in method definition will cache the `spack.config.config` singleton variable too early, before we have a chance to add command line and environment scopes.
2019-11-15 13:55:51 -08:00
Tim Fuller
3dbafb5ee7 Fix for issue #13754 (#13755)
* remove reference to `spack.store` in method definition

Referencing `spack.store` in method definition will cache the `spack.config.config` singleton variable too early, before we have a chance to add command line and environment scopes.
2019-11-15 13:32:58 -08:00
Adam J. Stewart
5510bba1fd
Document use of the maintainers field (#12270)
* Document use of the maintainers field

* Use fake GitHub usernames

* GitHub action is not automatic yet
2019-11-15 13:58:24 -06:00
Greg Becker
74e04b7e20 Config option to allow gpg warning suppression (#13744)
Add a configuration option to suppress gpg warnings during binary
package verification. This only suppresses warnings: a gpg failure
will still fail the install. This allows users who have already
explicitly trusted the gpg key they are using to avoid seeing
repeated warnings that it is self-signed.
2019-11-14 16:22:19 -08:00
Greg Becker
c587c76537 Config option to allow gpg warning suppression (#13743)
Add a configuration option to suppress gpg warnings during binary
package verification. This only suppresses warnings: a gpg failure
will still fail the install. This allows users who have already
explicitly trusted the gpg key they are using to avoid seeing
repeated warnings that it is self-signed.
2019-11-14 16:22:01 -08:00
Peter Scheibel
28163cb34f determine target relative to the link directory rather than the full link path (which includes the file name) (#13727) 2019-11-14 12:15:47 -08:00
Peter Scheibel
3f861e18b0 symlink relativization: determine target relative to the link directory (#13710)
when making a package relative, relocate links relative to link directory

rather than the full link path (which includes the file name) because `os.path.relpath` expects a directory.
2019-11-13 17:51:57 -08:00
Greg Becker
43b0356e14 Allow binary relocation of strings in relative binaries (#13725)
Binaries with relative RPATHS currently do not relocate strings
hard-coded in binaries

This PR extends the best-effort relocation of strings hard-coded
in binaries to those whose RPATHs have been relativized.
2019-11-13 16:03:35 -08:00
Greg Becker
b280034380 Allow binary relocation of strings in relative binaries (#13724)
Binaries with relative RPATHS currently do not relocate strings
hard-coded in binaries

This PR extends the best-effort relocation of strings hard-coded
in binaries to those whose RPATHs have been relativized.
2019-11-13 16:03:16 -08:00
William F Godoy
d6274e1a1d Docs update for deprecated spack sha256 (#13701)
* Docs update for deprecated `spack sha256`

* Added macOS shasum

* Update lib/spack/docs/packaging_guide.rst

Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com>
2019-11-13 15:21:27 -06:00
Todd Gamblin
da386b560a docs: use nicer looking code blocks in docs (#13708)
- [x] Use higher contrast terminal output font
- [x] Use higher contrast code block background color than default
- [x] Use a noticeable prompt character

See also https://github.com/spack/spack-tutorial/pull/10.
2019-11-12 18:18:41 -08:00
Daryl W. Grunau
5a9389a528 verify.py: os.path.exists exception handling (#13656) 2019-11-11 17:47:47 -06:00
Adam J. Stewart
bd9907809e environments: don't try to modify run-env if a spec is not installed (#13589)
Fixes #13529
Fixes #13509
2019-11-11 13:02:36 +01:00
Adam J. Stewart
60070759a0
Improve spack checksum formatting (#13666)
* Improve spack checksum formatting

* Add colon

* Fix Python 2 bug
2019-11-10 16:47:56 -06:00
Todd Gamblin
c9c267518f
bugfix: mirror path works for unknown versions (#13626)
`mirror_archive_path` was failing to account for the case where the fetched version isn't known to Spack.

- [x] don't require the fetched version to be in `Package.versions`
- [x] add regression test for mirror paths when package does not have a version
2019-11-07 17:13:51 -07:00
Andreas Baumbach
7a0bed7893 add depends_on(python) to PythonPackage stub (#13595) 2019-11-05 13:18:17 -06:00
Todd Gamblin
a6ccb5b2fa
bugfix: uninstall should find concrete specs by DAG hash (#13598)
This fixes a regression introduced in #10792.  `spack uninstall` in an
environment would not match concrete query specs properly after the index
hash of enviroments changed.

- [x] Search by DAG hash for specs to remove instead of by build hash
2019-11-05 06:12:12 -07:00
Todd Gamblin
b77974e986
spack find now displays variants and other spec constraints (#13596)
If you do this in a spack environment:

    spack add hdf5+hl

hdf5+hl will be the root added to the `spack.yaml` file, and you should
really expect `hdf5+hl` to display as a root in the environment.

- [x] Add decoration to roots so that you can see the details about what
      is required to build.
- [x] Add a test.
2019-11-05 05:39:56 -07:00
Todd Gamblin
b4501c4586
spack find now displays variants and other spec constraints
If you do this in a spack environment:

    spack add hdf5+hl

hdf5+hl will be the root added to the `spack.yaml` file, and you should
really expect `hdf5+hl` to display as a root in the environment.

- [x] Add decoration to roots so that you can see the details about what
      is required to build.
- [x] Add a test.
2019-11-05 02:49:17 -07:00
Todd Gamblin
ecfe84def7
bugfix: uninstall should find concrete specs by DAG hash
This fixes a regression introduced in #10792.  `spack uninstall` in an
environment would not match concrete query specs properly after the index
hash of enviroments changed.

- [x] Search by DAG hash for specs to remove instead of by build hash
2019-11-05 02:47:27 -07:00
Greg Becker
fbb5cf944b
environments: make shell modifications partially unconditional (#13523)
* environments: make shell modifications partially unconditional

* flake

* missing module name

* add regression test

* flake
2019-11-04 23:35:23 -07:00
Greg Becker
385e41d70b binary distribution: relocate text files properly in relative binaries (#13578)
* Make relative binaries relocate text files properly
* rb strings aren't valid in python 2
* move perl to new interface for setup_environment family methods
2019-11-04 22:03:35 -07:00
Omar Padron
edf9548310
bugfix: fetch prefers to fetch local mirrors over remote resources (#13545)
- [x] insert at beginning of list so fetch grabs local mirrors before remote resources
- [x] update the S3FetchStrategy so that it throws a SpackError if the fetch fails.  
      Before, it was throwing URLError, which was not being caught in stage.py.
- [x] move error handling out of S3FetchStrategy and into web_util.read_from_url()
- [x] pass string instead of URLError to SpackWebError
2019-11-03 17:13:02 -08:00
Omar Padron
0784ec1a6d bugfix: fetch prefers to fetch local mirrors over remote resources (#13545)
- [x] insert at beginning of list so fetch grabs local mirrors before remote resources
- [x] update the S3FetchStrategy so that it throws a SpackError if the fetch fails.  
      Before, it was throwing URLError, which was not being caught in stage.py.
- [x] move error handling out of S3FetchStrategy and into web_util.read_from_url()
- [x] pass string instead of URLError to SpackWebError
2019-11-03 17:11:30 -08:00
Greg Becker
7cdb241f80
environments: only write when necessary (#13546)
This changes Spack environments so that the YAML file associated with the environment is *only* written when necessary (i.e., if it is changed *by spack*).  The lockfile is still written out as before.

There is a larger question here of which part of Spack should be responsible for setting defaults in config files, and how we can get rid of empty lists and data structures currently cluttering files like `compilers.yaml`.  But that probably requires a rework of the default-setting validator in `spack.config`, as well as the code that uses `spack.config`.  This will at least help for `spack.yaml`.
2019-11-03 15:47:19 -08:00
Greg Becker
aa7c229c8f environments: only write when necessary (#13546)
This changes Spack environments so that the YAML file associated with the environment is *only* written when necessary (i.e., if it is changed *by spack*).  The lockfile is still written out as before.

There is a larger question here of which part of Spack should be responsible for setting defaults in config files, and how we can get rid of empty lists and data structures currently cluttering files like `compilers.yaml`.  But that probably requires a rework of the default-setting validator in `spack.config`, as well as the code that uses `spack.config`.  This will at least help for `spack.yaml`.
2019-11-03 15:46:41 -08:00
Adam J. Stewart
a8228e1aec
spack create: http -> https (#13547) 2019-11-01 17:40:49 -05:00