Commit graph

4043 commits

Author SHA1 Message Date
Omar Padron
7c54aa2eb0
add workaround for gitlab ci needs limit (#17219)
* add workaround for gitlab ci needs limit

* fix style/address review comments

* convert filter obj to list

* update command completion

* remove dict comprehension

* add workaround tests

* fix sorting issue between disparate types

* add indeces to format
2020-06-25 14:27:20 -04:00
Greg Becker
096bd69a94
prevent multiple version sigils in the same spec (#17246)
* prevent multiple version sigils in the same spec

* fix packages with malformed versions
2020-06-25 12:34:09 -05:00
Greg Becker
f936e3a1db
environment spec lists: improve ability to query architecture in when clauses (#17056) 2020-06-25 19:13:26 +02:00
Massimiliano Culpo
14599f09be
Separate Apple Clang from LLVM Clang (#17110)
* Separate Apple Clang from LLVM Clang

Apple Clang is a compiler of its own. All places
referring to "-apple" suffix have been updated.

* Hack to use a dash in 'apple-clang'

To be able to use autodoc from Sphinx we need
a valid Python name for the module that contains
Apple's Clang code.

* Updated packages to account for the existence of apple-clang

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Added unit test for XCode related functions

Co-authored-by: Gregory Becker <becker33@llnl.gov>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2020-06-25 11:18:48 -05:00
Peter Scheibel
a31c115d79
Fix global activation check for upstream extendees (#17231)
* short-circuit is_activated check when the extendee is installed upstream

* add test for checking activation status of packages with an extendee installed upstream
2020-06-25 08:27:27 -05:00
Greg Becker
b26e93af3d
spack config: new subcommands add/remove (#13920)
spack config add <value>: add nested value value to the configuration scope specified
spack config remove/rm: remove specified configuration from the relevant scope
2020-06-25 09:38:01 +02:00
Tamara Dahlgren
48d3e8d350
features: Add install failure tracking removal through spack clean (#15314)
* Add ability to force removal of install failure tracking data through spack clean

* Add clean failures option to packaging guide
2020-06-24 20:28:53 -05:00
Sergey Kosukhin
bc53bb9b7c
Unset environment variables that are most commonly used by Autotools packages. (#8623) 2020-06-24 10:39:04 -05:00
Tom Payerle
fd710fc93e
Some minor fixes to set_permissions() in file_permissions.py (#17020)
* Some minor fixes to set_permissions() in file_permissions.py

The set_permissions() routine claims to prevent users from creating
world writable suid binaries.  However, it seems to only be checking
for/preventing group writable suid binaries.

This patch modifies the routine to check for both world and group
writable suid binaries, and complain appropriately.

* permissions.py: Add test to check blocks world writable SUID files

The original test_chmod_rejects_group_writable_suid tested
that the set_permissions() function in
lib/spack/spack/util/file_permissions.py
would raise an exception if changed permission on a file with
both SUID and SGID plus sticky bits is chmod-ed to g+rwx and o+rwx.

I have modified so that more narrowly tests a file with SUID
(and no SGID or sticky bit) set is chmod-ed to g+w.

I have added a second test test_chmod_rejects_world_writable_suid
that checks that exception is raised if an SUID file is chmod-ed
to o+w

* file_permissions.py: Raise exception when try to make sgid file world writable

Updated set_permissions() in file_permissions.py to also raise
an exception if try to make an SGID file world writable.  And
added corresponding unit test as well.

* Remove debugging prints from permissions.py
2020-06-23 19:50:19 -05:00
Tamara Dahlgren
e74c8e71cc
tests: check rpath presence not equality (#17216) 2020-06-23 17:17:35 -05:00
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