Commit graph

5316 commits

Author SHA1 Message Date
Vanessasaurus
c6edfa3f31
Update spack monitor to support new spec (#25928)
This PR coincides with tiny changes to spack to support spack monitor using the new spec
the corresponding spack monitor PR is at https://github.com/spack/spack-monitor/pull/31.
Since there are no changes to the database we can actually update the current server
fairly easily, so either someone can test locally or we can just update and then
test from that (and update as needed).

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-09-14 08:02:04 -06:00
Greg Becker
dad69e7d7c
Fix environment reading from lockfile to trust written hashes (#25879)
#22845 revealed a long-standing bug that had never been triggered before, because the
hashing algorithm had been stable for multiple years while the bug was in production. The
bug was that when reading a concretized environment, Spack did not properly read in the
build hashes associated with the specs in the environment. Those hashes were recomputed
(and as long as we didn't change the algorithm, were recomputed identically). Spack's
policy, though, is never to recompute a hash. Once something is installed, we respect its
metadata hash forever -- even if internally Spack changes the hashing method. Put
differently, once something is concretized, it has a concrete hash, and that's it -- forever.

When we changed the hashing algorithm for performance in #22845 we exposed the bug.
This PR fixes the bug at its source, but properly reading in the cached build hash attributes
associated with the specs. I've also renamed some variables in the Environment class
methods to make a mistake of this sort more difficult to make in the future.

* ensure environment build hashes are never recomputed
* add comment clarifying reattachment of env build hashes
* bump lockfile version and include specfile version in env meta
* Fix unit-test for v1 to v2 conversion

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2021-09-13 15:25:48 -06:00
Massimiliano Culpo
e9f1cfdaaf
Avoid hidden circular dependencies in spack.architecture (#25873)
* Refactor platform etc. to avoid circular dependencies

All the base classes in spack.architecture have been
moved to the corresponding specialized subpackages,
e.g. Platform is now defined within spack.platforms.

This resolves a circular dependency where spack.architecture
was both:
- Defining the base classes for spack.platforms, etc.
- Collecting derived classes from spack.platforms, etc.
Now it dopes only the latter.

* Move a few platform related functions to "spack.platforms"

* Removed spack.architecture.sys_type()

* Fixup for docs

* Rename Python modules according to review
2021-09-13 11:04:42 -07:00
Tamara Dahlgren
a1d792af4c
Bugfix: Correct checksum's sha256 when retrieve from remote (#25831) 2021-09-13 08:08:00 +00:00
Tamara Dahlgren
5fa075f5b4
Bugfix: spack test debug requires Spack tty (#25897) 2021-09-13 08:57:16 +02:00
Stephen McDowell
3a9028427c
[docs] document official gfortran macOS precompiled binaries (#25818)
* document official gfortran macOS precompiled binaries

* compile without -vvv ;) {squash this}
2021-09-10 14:11:26 -05:00
Harmen Stoppels
729726d157
Remove dead code in installer (#24035)
Currently as part of installing a package, we lock a prefix, check if
it exists, and create it if not; the logic for creating the prefix
included a check for the existence of that prefix (and raised an
exception if it did), which was redundant.

This also includes removal of tests which were not verifying
anything (they pass with or without the modifications in this PR).
2021-09-10 11:32:46 -07:00
albestro
59d8031076
CUDA official GCC conflicts (#25054)
* update CUDA 11 / GCC compatibility range

* additional unofficial conflict

* minor changes to comments
2021-09-09 15:03:16 -07:00
Massimiliano Culpo
5fddd48f80
Refactor unit-tests in test/architecture.py (#25848)
Modifications:
- Export platforms from spack.platforms directly, so that client modules don't have to import submodules
- Use only plain imports in test/architecture.py
- Parametrized test in test/architecture.py and put most of the setup/teardown in fixtures
2021-09-09 09:34:47 -06:00
Nathan Hanford
d83f7110d5
specs: move to new spec.json format with build provenance (#22845)
This is a major rework of Spack's core core `spec.yaml` metadata format.  It moves from `spec.yaml` to `spec.json` for speed, and it changes the format in several ways. Specifically:

1. The spec format now has a `_meta` section with a version (now set to version `2`).  This will simplify major changes like this one in the future.
2. The node list in spec dictionaries is no longer keyed by name. Instead, it is a list of records with no required key. The name, hash, etc. are fields in the dictionary records like any other.
3. Dependencies can be keyed by any hash (`hash`, `full_hash`, `build_hash`).
4. `build_spec` provenance from #20262 is included in the spec format. This means that, for spliced specs, we preserve the *full* provenance of how to build, and we can reproduce a spliced spec from the original builds that produced it.

**NOTE**: Because we have switched the spec format, this PR changes Spack's hashing algorithm.  This means that after this commit, Spack will think a lot of things need rebuilds.

There are two major benefits this PR provides:
* The switch to JSON format speeds up Spack significantly, as Python's builtin JSON implementation is orders of magnitude faster than YAML. 
* The new Spec format will soon allow us to represent DAGs with potentially multiple versions of the same dependency -- e.g., for build dependencies or for compilers-as-dependencies.  This PR lays the necessary groundwork for those features.

The old `spec.yaml` format continues to be supported, but is now considered a legacy format, and Spack will opportunistically convert these to the new `spec.json` format.
2021-09-09 01:48:30 -07:00
Massimiliano Culpo
e47f0d486c Account for bootstrapping from sources niche case
This modification accounts for:
1. Bootstrapping from sources using system, non-standard Python
2. Using later an ABI compatible standard Python interpreter
2021-09-08 11:13:37 -07:00
Massimiliano Culpo
fd0884c273 Fix clingo bootstrapping on rhel + ppc64le
The system Python interpreter on rhel is patched to have
slightly different names for some architectures. This
makes it incompatible with manylinux generated extensions
for ppc64le.

To fix this issue when bootstrapping Spack we generate
on-the-fly symbolic links to the name expected by the
current interpreter if it differs from the default.

Links:
  https://github.com/pypa/manylinux/issues/687
  https://src.fedoraproject.org/fork/churchyard/rpms/python3/blame/00274-fix-arch-names.patch?identifier=test_email-mktime
2021-09-08 11:13:37 -07:00
Massimiliano Culpo
4033cc0250 Disable module generation during bootstrapping 2021-09-08 11:13:16 -07:00
Todd Gamblin
c309adb4b3
url stats: add --show-issues option (#25792)
* tests: make `spack url [stats|summary]` work on mock packages

Mock packages have historically had mock hashes, but this means they're also invalid
as far as Spack's hash detection is concerned.

- [x] convert all hashes in mock package to md5 or sha256
- [x] ensure that all mock packages have a URL
- [x] ignore some special cases with multiple VCS fetchers

* url stats: add `--show-issues` option

`spack url stats` tells us how many URLs are using what protocol, type of checksum,
etc., but it previously did not tell us which packages and URLs had the issues. This
adds a `--show-issues` option to show URLs with insecure (`http`) URLs or `md5` hashes
(which are now deprecated by NIST).
2021-09-08 07:59:06 -07:00
bernhardkaindl
4e4b199f16
lib/spack/env/cc: tolerate trailing / in elements of $PATH (#25733)
Fixes removal of SPACK_ENV_PATH from PATH in the presence of trailing
slashes in the elements of PATH:

The compiler wrapper has to ensure that it is not called nested like
it would happen when gcc's collect2 uses PATH to call the linker ld,
or else the compilation fails.

To prevent nested calls, the compiler wrapper removes the elements
of SPACK_ENV_PATH from PATH.

Sadly, the autotest framework appends a slash to each element
of PATH when adding AUTOTEST_PATH to the PATH for the tests,
and some tests like those of GNU bison run cc inside the test.

Thus, ensure that PATH cleanup works even with trailing slashes.

This fixes the autotest suite of bison, compiling hundreds of
bison-generated test cases in a autotest-generated testsuite.

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2021-09-08 12:09:07 +02:00
Stephen McDowell
83298160cc
docs: minor grammar fix (#25814) 2021-09-07 09:51:14 +00:00
Harmen Stoppels
64407e253c Always disable leftover active environment after tests 2021-09-03 07:27:19 -07:00
Harmen Stoppels
de492e73d5 Don't error when removing scope that does not exist 2021-09-03 07:27:19 -07:00
Vanessasaurus
8e61f54260
start of work to add spack audit packages-https checker (#25670)
This PR will add a new audit, specifically for spack package homepage urls (and eventually
other kinds I suspect) to see if there is an http address that can be changed to https.

Usage is as follows:

```bash
$ spack audit packages-https <package>
```
And in list view:

```bash
$ spack audit list
generic:
  Generic checks relying on global variables

configs:
  Sanity checks on compilers.yaml
  Sanity checks on packages.yaml

packages:
  Sanity checks on specs used in directives

packages-https:
  Sanity checks on https checks of package urls, etc.
```

I think it would be unwise to include with packages, because when run for all, since we do requests it takes a long time. I also like the idea of more well scoped checks - likely there will be other addresses for http/https within a package that we eventually check. For now, there are two error cases - one is when an https url is tried but there is some SSL error (or other error that means we cannot update to https):

```bash
$ spack audit packages-https zoltan
PKG-HTTPS-DIRECTIVES: 1 issue found
1. Error with attempting https for "zoltan": 
    <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'www.cs.sandia.gov'. (_ssl.c:1125)>
```
This is either not fixable, or could be fixed with a change to the url or (better) contacting the site owners to ask about some certificate or similar.

The second case is when there is an http that needs to be https, which is a huge issue now, but hopefully not after this spack PR.

```bash
$ spack audit packages-https xman
Package "xman" uses http but has a valid https endpoint.
```

And then when a package is fixed:

```bash
$ spack audit packages-https zlib
PKG-HTTPS-DIRECTIVES: 0 issues found.
```
And that's mostly it. :)

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-09-02 08:46:27 +02:00
David Beckingsale
aabece46ba
Add variant to allow unsupported compiler & CUDA combinations (#19736)
Sometimes users need to be able to override the conflicts in `CudaPacakge`.  This introduces a variant to enable/disable them.
2021-09-01 11:34:20 -07:00
Harmen Stoppels
4c23059017
Speed-up two unit tests by using builtin.mock instead of builtin (#25544) 2021-09-01 11:58:29 +02:00
kwryankrattiger
9be81ac4d9
Add documentation on compiler environment (#25508) 2021-08-30 11:17:03 +02:00
Massimiliano Culpo
40788cf49a
Add a __reduce__ method to Spec (#25658)
* Add a __reduce__ method to Spec

fixes #23892

The recursion limit seems to be due to the default
way in which a Spec is serialized, following all
the attributes. It's still not clear to me why this
is related to being in an environment, but in any
case we already have methods to serialize Specs to
disk in JSON and YAML format. Here we use them to
pickle a Spec instance too.

* Downgrade to build-hash

Hopefully nothing will change the package in
between serializing the spec and sending it
to the child process.

* Add support for Python 2
2021-08-28 07:31:16 -07:00
Harmen Stoppels
f5ab3ad82a
Fix: --overwrite backs up old install dir, but it gets destroyed anyways (#25583)
* Make sure PackageInstaller does not remove the just-restored
  install dir after failure in spack install --overwrite
* Remove cryptic error message and rethrow actual error
2021-08-27 12:41:24 -07:00
Tamara Dahlgren
b5d3c48824
Load package environment prior to stand-alone/smoke test execution (#25619) 2021-08-27 18:46:26 +00:00
Jordan Galby
97ea57e59f
Add ld.gold and ld.lld compiler wrapper (#25626)
The gcc compiler can be configured to use `ld.gold` by default. It will
then call `ld.gold` explicitly when linking. When so, spack need to have
a ld.gold wrapper in PATH to inject rpaths link flags etc...

Also I wouldn't be surprised to see some package calling `ld.gold`
directly.

As for ld.gold, the argument could be made that we want to support any
package that could call ld.lld.
2021-08-27 13:16:26 +02:00
Massimiliano Culpo
c152e558e9
Make SpecBuildInterface pickleable (#25628)
* Add a __reduce__ method to SpecBuildInterface

This class was confusing pickle when being serialized,
due to its scary nature of being an object that disguise
as another type.

* Add more MacOS tests, switch them to clingo

* Fix condition syntax

* Remove Python v3.6 and v3.9 with macOS
2021-08-27 09:10:03 +00:00
Harmen Stoppels
74389472ab
Make env (de)activate error with -e, -E, -D flags (#25625)
* Make sure that spack -e. env activate b and spack -e. env deactivate error
* Add a test
2021-08-26 16:54:58 -07:00
Paul Kuberry
abfd8fa70b
Conditionally remove 'context' from kwargs in _urlopen (#25316)
* Conditionally remove 'context' from kwargs in _urlopen

Previously, 'context' is purged from kwargs in _urlopen to
conform to varying support for 'context' in different versions
of urllib. This fix tries to use 'context', and then removes
it if an exception is thrown and tries again.

* Specify error type in try statement in _urlopen

Specify TypeError when checking if 'context' is in kwargs
for _urlopen. Also, if try fails, check that 'context' is
in the error message before removing from kwargs.
2021-08-26 13:51:08 -07:00
Adam J. Stewart
6eb942cf45
Speedup environment activation, part 2 (#25633)
This is a direct followup to #13557 which caches additional attributes that were added in #24095 that are expensive to compute. I had to reopen #25556 in another PR to invalidate the GitLab CI cache, but see #25556 for prior discussion.

### Before

```console
$ time spack env activate .

real	2m13.037s
user	1m25.584s
sys	0m43.654s
$ time spack env view regenerate
==> Updating view at /Users/Adam/.spack/.spack-env/view

real	16m3.541s
user	10m28.892s
sys	4m57.816s
$ time spack env deactivate

real	2m30.974s
user	1m38.090s
sys	0m49.781s
```

### After
```console
$ time spack env activate .

real	0m8.937s
user	0m7.323s
sys	0m1.074s
$ time spack env view regenerate
==> Updating view at /Users/Adam/.spack/.spack-env/view

real	2m22.024s
user	1m44.739s
sys	0m30.717s
$ time spack env deactivate

real	0m10.398s
user	0m8.414s
sys	0m1.630s
```

Fixes #25555
Fixes #25541 

* Speedup environment activation, part 2
* Only query distutils a single time
* Fix KeyError bug
* Make vermin happy
* Manual memoize
* Add comment on cross-compiling
* Use platform-specific include directory
* Fix multiple bugs
* Fix python_inc discrepancy
* Fix import tests
2021-08-26 20:44:31 +00:00
Harmen Stoppels
23106ac0f5
Set pubkey trust to ultimate during gpg trust (#24976)
* Set pubkey trust to ultimate during `gpg trust`

Tries to solve the same problem as #24760 without surpressing stderr
from gpg commands.

This PR makes every imported key trusted in the gpg database.

Note: I've outlined
[here](https://github.com/spack/spack/pull/24760#issuecomment-883183175)
that gpg's trust model makes sense, since how can we trust a random
public key we download from a binary cache?

* Fix test
2021-08-26 12:59:44 -07:00
Massimiliano Culpo
29d1bc6546
Ensure environment are deactivated when bootstrapping (#25607)
Fixes #25603

This commit adds a new context manager to temporarily
deactivate active environments. This context manager
is used when setting up bootstrapping configuration to
make sure that the current environment is not affected
by operations on the bootstrap store.

* Preserve exit code 1 if nothing is found
* Use context manager for the environment
2021-08-26 12:20:05 -07:00
Tamara Dahlgren
8664abc178
Remove references to self.install_test_root from packaging guide (#25238) 2021-08-26 19:22:40 +02:00
Massimiliano Culpo
a3d8e95e76
Avoid double loop in subprocess_context.store_patches (#25621)
fixes #21643

As far as I can see the double loop is not needed, since
"patch" is never used and the items in the list are tuples
of three values.
2021-08-26 09:46:01 -07:00
Massimiliano Culpo
1ab6f30fdd
Remove fork_context from llnl.util.lang (#25620)
This object was introduced in #18124, and was later superseded by
#18205 and removed any use if the object.
2021-08-26 09:39:59 -07:00
Massimiliano Culpo
7dd3592eab
Regression test for version selection with preferences (#25602)
This commit adds a regression test for version selection
with preferences in `packages.yaml`. Before PR 25585 we
used negative weights in a minimization to select the
optimal version. This may lead to situations where a
dependency may make the version score of dependents
"better" if it is preferred in packages.yaml.
2021-08-26 09:28:47 -07:00
Harmen Stoppels
73005166ef
Bugfix: reinstalling updated develop specs (#25579)
PackageInstaller and Package.installed disagree over what it means
for a package to be installed: PackageInstaller believes it should be
enough for a database entry to exist, whereas Package.installed
requires a database entry & a prefix directory.

This leads to the following niche issue:

* a develop spec in an environment is successfully installed
* then somehow its install prefix is removed (e.g. through a bug fixed
  in #25583)
* you modify the sources and reinstall the environment
  1. spack checks pkg.installed and realizes the develop spec is NOT
     installed, therefore it doesn't need to have 'overwrite: true'
  2. the installer gets the build task and checks the database and
      realizes the spec IS installed, hence it doesn't have to install it.
  3. the develop spec is not rebuilt.

The solution is to make PackageInstaller and pkg.installed agree over
what it means to be installed, and this PR does that by dropping the
prefix directory check from pkg.installed, so that it only checks the
database.

As a result, spack will create a build task with overwrite: true for
the develop spec, and the installer in fact handles overwrite requests
fine even if the install prefix doesn't exist (it just does a normal
install).
2021-08-25 18:14:11 -07:00
Massimiliano Culpo
af2f07852c
environment: match concrete specs only if they have the same build hash (#25575)
see #25563

When we have a concrete environment and we ask to install a
concrete spec from a file, currently Spack returns a list of
specs that are all the one that match the argument DAG hash.

Instead we want to compare build hashes, which also account
for build-only dependencies.
2021-08-25 10:56:16 -07:00
Todd Gamblin
d27e0bff5a
installation: filter padding from binary installs, too (#25600)
#25303 filtered padding from build output, but it's still there in binary install/relocate output,
so our CI logs are still quite long and frequently hit the limit.

- [x] add context handler from #25303 to buildcache installation as well
2021-08-25 17:39:00 +02:00
Todd Gamblin
fafe1cb7e8
Make spack graph -i environment-aware (#25599)
This allows you to run `spack graph --installed` from within an environment and get a dot graph of
its concrete specs.

- [x] make `spack graph -i` environment-aware

- [x] add code to the generated dot graph to ensure roots have min rank (i.e., they're all at the
      top or left of the DAG)
2021-08-25 07:41:04 -07:00
Todd Gamblin
df10e88e97
bootstrap: use sys.exec_prefix to set up external python correctly (#25593)
Bootstrapping clingo on macOS on `develop` gives errors like this:

```
==> Error: RuntimeError: Unable to locate python command in /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/bin

/Users/gamblin2/Workspace/spack/var/spack/repos/builtin/packages/python/package.py:662, in command:
        659                return Executable(path)
        660        else:
        661            msg = 'Unable to locate {0} command in {1}'
  >>    662            raise RuntimeError(msg.format(self.name, self.prefix.bin))
```

On macOS, `python` is laid out differently. In particular, `sys.executable` is here:

```console
Python 2.7.16 (default, May  8 2021, 11:48:02)
[GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python'
```

Based on that, you'd think that
`/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents` would be
where you'd look for a `bin` directory, but you (and Spack) would be wrong:

```console
$ ls /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/
Info.plist      MacOS/          PkgInfo         Resources/      _CodeSignature/ version.plist
```

You need to look in `sys.exec_prefix`

```
>>> sys.exec_prefix
'/System/Library/Frameworks/Python.framework/Versions/2.7'
```

Which looks much more like a standard prefix, with understandable `bin`, `lib`, and `include`
directories:

```console
$ ls /System/Library/Frameworks/Python.framework/Versions/2.7
Extras/         Mac/            Resources/      bin/            lib/
Headers@        Python*         _CodeSignature/ include/
$ ls -l /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python
lrwxr-xr-x  1 root  wheel     7B Jan  1  2020 /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python@ -> python2
```

- [x] change `bootstrap.py` to use the `sys.exec_prefix` as the external prefix, instead of just
      getting the parent directory of the executable.
2021-08-24 21:44:26 -07:00
Tamara Dahlgren
99076660d4
bugfix: Correct source of PID for -ddd installation outputs (#25596) 2021-08-25 00:21:48 +00:00
Todd Gamblin
80713e234c
bootstrap: fix printing for python 2 (#25592) 2021-08-24 21:31:30 +00:00
Todd Gamblin
1374fea5d9
locks: only open lockfiles once instead of for every lock held (#24794)
This adds lockfile tracking to Spack's lock mechanism, so that we ensure that there
is only one open file descriptor per inode.

The `fcntl` locks that Spack uses are associated with an inode and a process.
This is convenient, because if a process exits, it releases its locks.
Unfortunately, this also means that if you close a file, *all* locks associated
with that file's inode are released, regardless of whether the process has any
other open file descriptors on it.

Because of this, we need to track open lock files so that we only close them when
a process no longer needs them.  We do this by tracking each lockfile by its
inode and process id.  This has several nice properties:

1. Tracking by pid ensures that, if we fork, we don't inadvertently track the parent
   process's lockfiles. `fcntl` locks are not inherited across forks, so we'll
   just track new lockfiles in the child.
2. Tracking by inode ensures that referencs are counted per inode, and that we don't
   inadvertently close a file whose inode still has open locks.
3. Tracking by both pid and inode ensures that we only open lockfiles the minimum
   number of times necessary for the locks we have.

Note: as mentioned elsewhere, these locks aren't thread safe -- they're designed to
work in Python and assume the GIL.

Tasks:
- [x] Introduce an `OpenFileTracker` class to track open file descriptors by inode.
- [x] Reference-count open file descriptors and only close them if they're no longer
      needed (this avoids inadvertently releasing locks that should not be released).
2021-08-24 14:08:34 -07:00
Harmen Stoppels
73208f5835
Fix bindist network issues (#25587)
* Fix bindist network issues

* Another one using the network
2021-08-24 12:09:23 -05:00
Massimiliano Culpo
31dcdf7262
ASP-based solver: rework version facts (#25585)
This commit rework version facts so that:
1. All the information on versions is collected
   before emitting the facts
2. The same kind of atom is emitted for versions
   stemming from different origins (package.py
   vs. packages.yaml)

In the end all the possible versions for a given
package are totally ordered and they are given
different and increasing weights staring from zero.

This refactor allow us to avoid using negative
weights, which in some configurations may make
parent node score "better" and lead to unexpected
"optimal" results.
2021-08-24 09:24:18 -07:00
Paul Spencer
01cbf3b81c
Spelling fixes (#25570) 2021-08-23 21:29:20 +02:00
Adam J. Stewart
1212847eee
Document how to handle changing build systems (#25174) 2021-08-21 11:05:42 -07:00
Paul Spencer
caed90fcf2
Fix spelling mistake in the word "monitor" (#25486) 2021-08-20 13:52:02 +00:00
Scott Wittenburg
84100afc91
Pipelines: use shared pr mirror for pipeline generation and builds (#25529)
Once PR binary graduation is deployed, the shared PR mirror will
contain binaries just built by a merged PR, before the subsequent
develop pipeline has had time to finish.  Using the shared PR mirror
as a source of binaries will reduce the number of times we have to
rebuild the same full hash.
2021-08-20 07:45:23 -06:00
Harmen Stoppels
d52a1b8279
Fix broken develop as CI didn't run on latest merge commit (#25531)
* CI for #25439 was not run on the latest merge commit, and fails after #25470
* Make it consistent
2021-08-20 08:06:47 +00:00
Harmen Stoppels
220a87812c
New spack.environment.active_environment api, and make spack.environment not depend on spack.cmd. (#25439)
* Refactor active environment getters

- Make `spack.environment.active_environment` a trivial getter for the active
environment, replacing `spack.environment.get_env` when the arguments are
not needed
- New method `spack.cmd.require_active_environment(cmd_name)` for 
commands that require an environment (rather than abusing 
get_env/active_environment)
- Clean up calling code to call spack.environment.active_environment or
spack.cmd.require_active_environment as appropriate
- Remove the `-e` parsing from `active_environment`, because `main.py` is
responsible for processing `-e` and already activates the environment.
- Move `spack.environment.find_environment` to
`spack.cmd.find_environment`, to avoid having spack.environment aware
of argparse.
- Refactor `spack install` command so argument parsing is all handled in the
command, no argparse in spack.environment or spack.installer
- Update documentation

* Python 2: toplevel import errors only with 'as ev'

In two files, `import spack.environment as ev` leads to errors
These errors are not well understood ("'module' object has no attribute
'environment'"). All other files standardize on the above syntax.
2021-08-19 19:01:37 -07:00
Scott Wittenburg
350372e3bf
buildcache: Add environment-aware buildcache sync command (#25470) 2021-08-19 12:15:40 -06:00
Massimiliano Culpo
4318ceb2b3
Bootstrap clingo from binaries (#22720)
* Bootstrap clingo from binaries

* Move information on clingo binaries to a JSON file

* Add support to bootstrap on Cray

Bootstrapping on Cray requires, at the moment, to
swap the platform when looking for binaries - due
to #22800.

* Add SHA256 verification for bootstrapped software

Use sha256 verification for binaries necessary to bootstrap
the concretizer and gpg for signature verification

* patchelf: use Spec._old_concretize() to bootstrap

As noted in #24450 we may happen to need the
concretizer when bootstrapping clingo. In that case
only the old concretizer is available.

* Add a schema for bootstrapping methods

Two fields have been added to bootstrap.yaml:
  "sources" which lists the methods available for
       bootstrapping software
  "trusted" which records if a source is trusted or not

A subcommand has been added to "spack bootstrap" to list
the sources currently available.

* Methods used for bootstrapping are configurable from bootstrap:sources

The function that tries to ensure a given Python module
is importable now tries bootstrapping methods in the same
order as they are defined in `bootstrap.yaml`

* Permit to trust/untrust bootstrapping methods

* Add binary tests for MacOS, Ubuntu

* Add documentation

* Add a note on bash
2021-08-18 11:14:02 -07:00
Harmen Stoppels
b22728d55c
Support older py-pygments (#25456)
`markdown` is only supported since py-pygments@2.8.0:, see
9647d2ae50

Let's allow old versions too again.
2021-08-18 09:49:51 +02:00
Erik Schnetter
c869f3639d
cmake.py: Improve documentation (#25467)
Add missing `self.` prefixes when calling `define_from_variant`
2021-08-17 23:30:55 +02:00
psakievich
d00fc55e41
Add link_type documentation (#25451) 2021-08-17 09:47:26 -07:00
Massimiliano Culpo
09378f56c0
Use a patched argparse only in Python 2.X (#25376)
Spack is internally using a patched version of `argparse` mainly to backport Python 3 functionality
into Python 2. This PR makes it such that for the supported Python 3 versions we use `argparse`
from the standard Python library. This PR has been extracted from #25371 where it was needed
to be able to use recent versions of `pytest`.

* Fixed formatting issues when using a pristine argparse.py
* Fix error message for Python 3.X when missing positional arguments
* Account for the change of API in Python 3.7
* Layout multi-valued args into columns in error messages
* Seamless transition in develop if argparse.pyc is in external
* Be more defensive in case we can't remove the file.
2021-08-17 08:52:51 -07:00
psakievich
a81ec88c6c
Allow environment views to be sym/hard link and copy types (#24832)
Add link type to spack.yaml format

Add tests to verify link behavior is correct for installed files
for all three view types

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-08-16 19:21:57 -07:00
robgics
657a5c85cc
Improve license err msg (#24117)
* Add to the error message to help determine failure source.

* Break up long line to keep under 80 chars.

Co-authored-by: Rob Groner <rug262@psu.edu>
2021-08-16 14:25:41 -07:00
Massimiliano Culpo
f0875b2fef
Remove handling for deprecated module commands (#25411)
The commands have been deprecated in #7098, and have
been failing with an error message since then.

Cleaning the code since it is unlikely that somebody
is still using them.
2021-08-13 07:51:56 -07:00
Harmen Stoppels
920f695d1d
Mention bash in prerequisites (#25379)
Isn't installed on Alpine.
2021-08-13 07:28:29 -07:00
Massimiliano Culpo
78850f38eb
Fix typos in fixture use. Mention fixtures in pytest.ini (#25381) 2021-08-12 12:08:53 +00:00
Tamara Dahlgren
fb8c954e2e
Switch to settings option used in latest *and* oldest listed version (#25340) 2021-08-11 07:30:22 +00:00
Axel Huebl
41ae83463e
doc: def llnl.util.filesystem.find fix rst (#25350)
The star was not rendered in the docs.
2021-08-11 09:14:04 +02:00
Massimiliano Culpo
371bc37dd4
Rework rules for provider weights (#25331)
Preferred providers had a non-zero weight because in an earlier formulation of the logic program that was needed to prefer external providers over default providers. With the current formulation for externals this is not needed anymore, so we can give a weight of zero to both default choices and providers that are externals. _Using zero ensures that we don't introduce any drift towards having less providers, which was happening when minimizing positive weights_.

Modifications:

- [x] Default weight for providers starts at 0 (instead of 10, needed before to prefer externals)
- [x] Rules to compute the `provider_weight` have been refactored. There are multiple possible weights for a given `Virtual`. Only one gets selected by the solver (the one that minimizes the objective function).
- [x] `provider_weight` are now accounting for each different `Virtual`. Before there was a single weight per provider, even if the package was providing multiple virtuals.

* Give preferred providers a weight of zero

Preferred providers had a non-zero weight because in an earlier
formulation of the logic program that was needed to prefer
external providers over default providers.

With the current formulation for externals this is not needed anymore,
so we can give a weight of zero to default choices. Using zero
ensures that we don't introduce any drift towards having
less providers, which was happening when minimizing positive weights.

* Simplify how we compute weights for providers

Rewrite rules so that specific events (i.e. being
an external) unlock the possibility to use certain
weights. The weight being considered is then selected
by the minimization process to be the one that gives
the best score.

* Allow providers to have different weights for different virtuals

Before this change we didn't differentiate providers based on
the virtual they provide, which meant that packages providing
more than one virtual had nonetheless a single weight.

With this change there will be a weight per virtual.
2021-08-10 14:15:45 -07:00
Harmen Stoppels
81be31aee0
Make spack env activate x idempotent (#25222)
* Make spack env activate x idempotent

* Update lib/spack/spack/cmd/env.py
2021-08-09 07:07:39 -07:00
Todd Gamblin
7ddd6ad461 installation: filter padding from all tty output
This is both a bugfix and a generalization of #25168. In #25168, we attempted to filter padding
*just* from the debug output of `spack.util.executable.Executable` objects. It turns out we got it
wrong -- filtering the command line string instead of the arg list resulted in output like this:

```
==> [2021-08-05-21:34:19.918576] ["'", '/', 'b', 'i', 'n', '/', 't', 'a', 'r', "'", ' ', "'", '-', 'o', 'x', 'f', "'", ' ', "'", '/', 't', 'm', 'p', '/', 'r', 'o', 'o', 't', '/', 's', 'p', 'a', 'c', 'k', '-', 's', 't', 'a', 'g', 'e', '/', 's', 'p', 'a', 'c', 'k', '-', 's', 't', 'a', 'g', 'e', '-', 'p', 'a', 't', 'c', 'h', 'e', 'l', 'f', '-', '0', '.', '1', '3', '-', 'w', 'p', 'h', 'p', 't', 'l', 'h', 'w', 'u', 's', 'e', 'i', 'a', '4', 'k', 'p', 'g', 'y', 'd', 'q', 'l', 'l', 'i', '2', '4', 'q', 'b', '5', '5', 'q', 'u', '4', '/', 'p', 'a', 't', 'c', 'h', 'e', 'l', 'f', '-', '0', '.', '1', '3', '.', 't', 'a', 'r', '.', 'b', 'z', '2', "'"]
```

Additionally, plenty of builds output padded paths in other plcaes -- e.g., not just command
arguments, but in other `tty` messages via `llnl.util.filesystem` and other places. `Executable`
isn't really the right place for this.

This PR reverts the changes to `Executable` and moves the filtering into `llnl.util.tty`. There is
now a context manager there that you can use to install a filter for all output.
`spack.installer.build_process()` now uses this context manager to make `tty` do path filtering
when padding is enabled.

- [x] revert filtering in `Executable`
- [x] add ability for `tty` to filter output
- [x] install output filter in `build_process()`
- [x] tests
2021-08-09 01:42:07 -07:00
Todd Gamblin
0a6e98cdb5
refactor: rename colorful kwarg to color (#25292)
`compare_specs()` had a `colorful` keyword argument, but everything else in
spack uses `color` for this.

- [x] rename the argument
- [x] make the default follow spack's `--color=always/never/auto` setting
2021-08-06 06:29:49 +00:00
Adam J. Stewart
e2fe415ae6
Spack version: 0.16.1 -> 0.16.2 (#25255)
17473a08ff merged `v0.16.1` back into `develop` but somehow lost the version bump.  Fix it here.
2021-08-04 14:37:40 -07:00
Harmen Stoppels
468823d1b9
Fix typo (#25223) 2021-08-03 18:00:29 +00:00
Massimiliano Culpo
0026d60b60
Test bootstrapping in a workflow (#25138)
Add a workflow to test bootstrapping clingo on 
different platforms so that we can detect changes 
that break it.

Compute `site_packages_dir` in `bootstrap.py` as it was
before #24095, until we figure a better way to override
that attribute.
2021-08-03 16:53:40 +02:00
AMD Toolchain Support
5698850dc4
aocc 3.1.0: fix version detection for v3.1.0 (#25084) 2021-08-03 13:48:19 +02:00
Todd Gamblin
fc840c904b
executable: filter long paths from debug output (#25168)
Long, padded install paths can get to be very long in the verbose install
output. This has to be filtered out by the Executable class, as it
generates these debug messages.

- [x] add ability to filter paths from Executable output.
- [x] add a context manager that can enable path filtering
- [x] make `build_process` in `installer.py`

This should hopefully allow us to see most of the build output in
Gitlab pipeline builds again.
2021-08-03 10:00:33 +00:00
Todd Gamblin
cf8d1b0387
refactor: convert build_process to use BuildProcessInstaller (#25167)
`build_process` has been around a long time but it's become a very large,
unwieldy method. It's hard to work with because it has a lot of local
variables that need to persist across all of the code.

- [x] To address this, convert it its own `BuildInfoProcess` class.
- [x] Start breaking the method apart by factoring out the main
      installation logic into its own function.
2021-08-03 10:24:24 +02:00
Todd Gamblin
0a0338ddfa bugfix: ensure all bootstrap context managers are exception-safe
When context managers are used to save and restore values, we need to remember
to use try/finally around the yield in case an exception is thrown.  Otherwise,
the cleanup will be skipped.
2021-08-03 10:07:11 +02:00
Todd Gamblin
693c4d8f3a spack style: improve tests for failure cases
This fixes the bad bootstrap test for spack style, and it refines the
asserrtions on other failure cases.
2021-08-03 10:07:11 +02:00
Dylan Simon
507d3c841c
don't spin writer daemon when < /dev/null (#25170) 2021-08-02 21:39:38 -07:00
Adam J. Stewart
6d810cb2e7
Docs: add link to source code (#25088) 2021-08-02 12:36:40 -07:00
Harmen Stoppels
ac8521e9b3
Do not issue a warning for a missing source id when installing from local sources (#24960) 2021-08-02 14:17:41 +02:00
loulawrence
be3e6a0e9b
document config option "url_fetch_method" (#24638)
- Change config from the undocumented `use_curl: true/false` to `url_fetch_method: urllib/curl`.
- Documentation of `url_fetch_method` in `defaults/config.yaml`
- Default fetch option explicitly set to `urllib` for users who may not have curl on their system

To upgrade from `use_curl` to `url_fetch_method`, run `spack config update config`
2021-08-02 10:30:25 +02:00
Todd Gamblin
ab5954520f
spack diff: make output order deterministic (#25169)
The output order for `spack diff` is nondeterministic for larger diffs -- if you
ran it several times it will not put the fields in the spec in the same order on
successive invocations.

This makes a few fixes to `spack diff`:

- [x] Implement the change discussed in https://github.com/spack/spack/pull/22283#discussion_r598337448
      to make `AspFunction` comparable in and of itself and to eliminate the need for `to_tuple()`

- [x] Sort the lists of diff properties so that the output is always in the same order.

- [x] Make the output for different fields the same as what we use in the solver. Previously, we
      would use `Type(value)` for non-string values and `value` for strings.  Now we just use
      the value.  So the output looks a little cleaner:

      ```
      == Old ==========================        == New ====================
      @@ node_target @@                        @@ node_target @@
      -  gdbm Target(x86_64)                   -  gdbm x86_64
      +  zlib Target(skylake)                  +  zlib skylake
      @@ variant_value @@                      @@ variant_value @@
      -  ncurses symlinks bool(False)          -  ncurses symlinks False
      +  zlib optimize bool(True)              +  zlib optimize True
      @@ version @@                            @@ version @@
      -  gdbm Version(1.18.1)                  -  gdbm 1.18.1
      +  zlib Version(1.2.11)                  +  zlib 1.2.11
      @@ node_os @@                            @@ node_os @@
      -  gdbm catalina                         -  gdbm catalina
      +  zlib catalina                         +  zlib catalina
      ```

I suppose if we want to use `repr()` in the output we could do that and could be
consistent but we don't do that elsewhere -- the types of things in Specs are
all stringifiable so the string and the name of the attribute (`version`, `node_os`,
etc.) are sufficient to know what they are.
2021-08-01 05:15:33 +00:00
Scott Wittenburg
f591e9788d
pipelines: Store details about specs broken on develop (#24637)
When a spec fails to build on `develop`, instead of storing an empty file as the entry in the broken specs list, this change stores the full spec yaml as well as links to the failing  pipeline and job.
2021-07-30 09:11:00 -06:00
Vanessasaurus
54e8e19a60
adding spack diff command (#22283)
A `spack diff` will take two specs, and then use the spack.solver.asp.SpackSolverSetup to generate
lists of facts about each (e.g., nodes, variants, etc.) and then take a set difference between the
two to show the user the differences.

Example output:

    $ spack diff python@2.7.8 python@3.8.11
     ==> Warning: This interface is subject to change.

     --- python@2.7.8/tsxdi6gl4lihp25qrm4d6nys3nypufbf
     +++ python@3.8.11/yjtseru4nbpllbaxb46q7wfkyxbuvzxx
     @@ variant_value @@
     -  python patches a8c52415a8b03c0e5f28b5d52ae498f7a7e602007db2b9554df28cd5685839b8
     +  python patches 0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87
     @@ version @@
     -  openssl Version(1.0.2u)
     +  openssl Version(1.1.1k)
     -  python Version(2.7.8)
     +  python Version(3.8.11)

Currently this uses diff-like output but we will attempt to improve on this in the future.

One use case for `spack diff` is whenever a user has a disambiguate situation and cannot 
remember how two different installs are different. The command can also output `--json` in
the case of a more analysis type use case where we want to save complete data with all
diffs and the intersection. However, the command is really more intended for a command
line use case, and we likely will have an analyzer more suited to saving data

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2021-07-30 00:08:38 -07:00
Zack Galbreath
e8f284bf52
ci: automatically prune the broken-specs list (#24809)
When a develop pipeline successfully finishes a `spack install`, check if
the spec that was just built is on the broken-specs list. If so, remove it.
2021-07-29 13:47:10 -06:00
Zack Galbreath
d7771f190f
Catch ConnectionError from CDash reporter (#24818)
* Catch ConnectionError from CDash reporter

Catch ConnectionError when attempting to upload the results of `spack install`
to CDash. This follows in the spirit of #24299. We do not want `spack install`
to exit with a non-zero status when something goes wrong while attempting to
report results to CDash.

* Catch HTTP Error 400 (Bad Request) in relate_cdash_builds()
2021-07-29 13:46:17 -06:00
Todd Gamblin
6104c31556 bugfix: be careful about GITHUB_BASE_REF in spack style
`spack style` previously used a Travis CI variable to figure out
what the base branch of a PR was, and this was apparently also set
on `develop`.  We switched to `GITHUB_BASE_REF` to support GitHub
Actions, but it looks like this is set to `""` in pushes to develop,
so `spack style` breaks there.

This PR does two things:

- [x] Remove `GITHUB_BASE_REF` knowledge from `spack style` entirely

- [x] Handle `GITHUB_BASE_REF` in style scripts instead, and explicitly
      pass the base ref if it is present, but don't otherwise.

This makes `spack style` *not* dependent on the environment and fixes
handling of the base branch in the right place.
2021-07-27 17:57:17 -07:00
Todd Gamblin
c8efec0295
spack style: add --root option (#25085)
This adds a `--root` option so that `spack style` can check style for
a spack instance other than its own.

We also change the inner workings of `spack style` so that `--config FILE`
(and similar options for the various tools) options are used. This ensures
that when `spack style` runs, it always uses the config from the running spack,
and does *not* pick up configuration from the external root.

- [x] add `--root` option to `spack style`
- [x] add `--config` (or similar) option when invoking style tools
- [x] add a test that verifies we can check an external instance
2021-07-27 15:09:17 -06:00
Adam J. Stewart
520a465190 Documentation does not build with Sphinx 4.1.2 2021-07-26 13:46:27 -07:00
Adam J. Stewart
ab39f548dc Confirm that the docstring is the issue 2021-07-26 13:46:27 -07:00
Adam J. Stewart
26c3df20f1 Docs: attempt to fix doc tests for sphinx 4.1.2 2021-07-26 13:46:27 -07:00
Dylan Simon
1c350854f8
intel-oneapi: fix parallel installer errors (#24911)
Intel oneAPI installs maintain a lock file in XDG_RUNTIME_DIR,
which by default exists in /tmp (and is shared by all component
installs). This prevented multiple oneAPI components from being
installed in parallel. This commit sets XDG_RUNTIME_DIR to exist
within Spack's installation Stage, so allows multiple components
to be installed at the same time.
2021-07-26 10:39:35 -07:00
vsoch
4208cf66be spack style: automatically bootstrap dependencies
This uses our bootstrapping logic to automatically install dependencies for
`spack style`. Users should no longer have to pre-install all of the tools
(`isort`, `mypy`, `black`, `flake8`). The command will do it for them.

- [x] add logic to bootstrap specs with specific version requirements in `spack style`
- [x] remove style tools from CI requirements (to ensure we test bootstrapping)
- [x] rework dependencies for `mypy` and `py-typed-ast`
      - `py-typed-ast` needs to be a link dependency
      - it needs to be at 1.4.1 or higher to work with python 3.9

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-07-24 07:07:35 -07:00
Massimiliano Culpo
a30e6c6158
Bump codecov/action to v2.0.2 (#24983)
* build(deps): bump codecov/codecov-action from 1 to 2.0.1

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 1 to 2.0.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v1...v2.0.1)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update arguments to codecov action

* Try to delete the symbolic link to root folder

Hopefully this should get rid of the ELOOP error

* Delete also for shell tests and MacOS

* Bump to v2.0.2

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-07-24 07:23:56 -04:00
Massimiliano Culpo
a68abc15c5 Fix bootstrap from sources
#24095 introduced a couple of bugs, which are fixed here:

1. The module path is computed incorrectly for bootstrapped clingo
2. We remove too many paths for `sys.path` in case of failures
2021-07-21 07:22:07 -07:00
Harmen Stoppels
fc50e04b59
Fix S3 urlparse scheme error and add test (#24952) 2021-07-19 13:39:17 +02:00
Adam J. Stewart
c56f2a935d Sphinx 3.4+ required for correct reference target linking 2021-07-16 08:30:56 -07:00
Adam J. Stewart
b8afc0fd29 API Docs: fix broken reference targets 2021-07-16 08:30:56 -07:00
Adam J. Stewart
c37df94932
Python: query distutils to find site-packages directory (#24095)
Third-party Python libraries may be installed in one of several directories:

1. `lib/pythonX.Y/site-packages` for Spack-installed Python
2. `lib64/pythonX.Y/site-packages` for system Python on RHEL/CentOS/Fedora
3. `lib/pythonX/dist-packages` for system Python on Debian/Ubuntu

Previously, Spack packages were hard-coded to use the (1). Now, we query the Python installation itself and ask it which to use. Ever since #21446 this is how we've been determining where to install Python libraries anyway.

Note: there are still many packages that are hard-coded to use (1). I can change them in this PR, but I don't have the bandwidth to test all of them.

* Python: handle dist-packages and site-packages
* Query Python to find site-packages directory
* Add try-except statements for when distutils isn't installed
* Catch more errors
* Fix root directory used in import tests
* Rely on site_packages_dir property
2021-07-16 08:28:00 -07:00
Massimiliano Culpo
fd55d627a7
archspec: added support for arm compiler on graviton2 (#24904) 2021-07-15 13:27:13 +00:00
Greg Becker
3004f33c58
spec may be a string, use precomputed namespace (#24867) 2021-07-14 11:58:31 -07:00
eugeneswalker
09540d411e
binary_distribution: relocate x-pie-executable files (#24854) 2021-07-13 07:53:35 -07:00
Adam J. Stewart
60765d38d0 Fix KeyboardInterrupt signal for Python 2 2021-07-13 01:17:51 -07:00
Massimiliano Culpo
3228c35df6
Enable/disable bootstrapping and customize store location (#23677)
* Permit to enable/disable bootstrapping and customize store location

This PR adds configuration handles to allow enabling
and disabling bootstrapping, and to customize the store
location.

* Move bootstrap related configuration into its own YAML file

* Add a bootstrap command to manage configuration
2021-07-12 19:00:37 -04:00
Todd Gamblin
f58b2e03ca
build output: filter padding out of console output when padded_length is used (#24514)
Spack allows users to set `padded_length` to pad out the installation path in
build farms so that any binaries created are more easily relocatable. The issue
with this is that the padding dominates installation output and makes it
difficult to see what is going on. The padding also causes logs to easily
exceed size limits for things like GitLab artifacts.

This PR fixes this by adding a filter in the logger daemon. If you use a
setting like this:

config:
    install_tree:
        padded_length: 512

Then lines like this in the output:

==> [2021-06-23-15:59:05.020387] './configure' '--prefix=/Users/gamblin2/padding-log-test/opt/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_pla/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga

will be replaced with the much more readable:

==> [2021-06-23-15:59:05.020387] './configure' '--prefix=/Users/gamblin2/padding-log-test/opt/[padded-to-512-chars]/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga

You can see that the padding has been replaced with `[padded-to-512-chars]` to
indicate the total number of characters in the padded prefix. Over a long log
file, this should save a lot of space and allow us to see error messages in
GitHub/GitLab log output.

The *actual* build logs still have full paths in them. Also lines that are
output by Spack and not by a package build are not filtered and will still
display the fully padded path. There aren't that many of these, so the change
should still help reduce file size and readability quite a bit.
2021-07-12 21:48:52 +00:00
Matthew Fernandez
112c1751d7
docs: fix reference to count of system packages (#24821)
015e29efe1 that introduced this section to the
documentation said “two” here instead of the actual count, three.
9f54cea5c5 then added a fourth, BLAS/LAPACK.
Rather than trying to keep this leading count in sync, this change just replaces
the wording with something more generic/stable.
2021-07-11 18:49:19 +00:00
Scott Wittenburg
e0017a6666
Fix out of date remote spec.yamls while updating the index (#24811) 2021-07-10 06:49:09 +00:00
Vanessasaurus
775c8223c3
debug: initial global debug flag support (#24285)
The developer can export environment variables that
are seen by the compiler wrapper to then add the flags
2021-07-09 21:22:26 -04:00
Greg Becker
ebf2076755
spec.splice: properly handle cached hash invalidations (#24795)
* spec.splice: properly handle cached hash invalidations

* make package_hash a cached hash on the spec
2021-07-10 01:16:48 +00:00
Zack Galbreath
0e177cb95f
ci: tolerate 'InvalidAccessKeyId' (#24741)
Add 'InvalidAccessKeyId' to the list of error messages we expect
and tolerate in push_mirror_contents()
2021-07-09 09:39:16 -07:00
Chris White
4037a94d1e
Remove unnecessary compiler id override for XL (#24799) 2021-07-09 09:20:54 -07:00
Todd Gamblin
24c01d57cf
imports: sort imports everywhere in Spack (#24695)
* fix remaining flake8 errors

* imports: sort imports everywhere in Spack

We enabled import order checking in #23947, but fixing things manually drives
people crazy. This used `spack style --fix --all` from #24071 to automatically
sort everything in Spack so PR submitters won't have to deal with it.

This should go in after #24071, as it assumes we're using `isort`, not
`flake8-import-order` to order things. `isort` seems to be more flexible and
allows `llnl` mports to be in their own group before `spack` ones, so this
seems like a good switch.
2021-07-08 22:12:30 +00:00
Todd Gamblin
a22686279c cvs tests: don't use dateutil at all
`dateutil.parser` was an optional dependency for CVS tests. It was failing on macOS
beacuse the dateutil types were not being installed, and mypy was failing *even when the
CVS tests were skipped*. This seems like it was an oversight on macOS --
`types-dateutil-parser` was not installed there, though it was on Linux unit tests.

It takes 6 lines of YAML and some weird test-skipping logic to get `python-dateutil` and
`types-python-dateutil` installed in all the tests where we need them, but it only takes
4 lines of code to write the date parser we need for CVS, so I just did that instead.

Note that CVS date format can vary from system to system, but it seems like it's always
pretty similar for the parts we care about.

- [x] Replace dateutil.parser with a simpler date regex
- [x] Lose the dependency on `dateutil.parser`
2021-07-07 17:27:31 -07:00
Todd Gamblin
0dd04ffbfb style: get close to full coverage of spack style
Previous tests of `spack style` didn't really run the tools --
they just ensure that the commands worked enough to get coverage.

This adds several real tests and ensures that we hit the corner
cases in `spack style`.  This also tests sucess as well as failure
cases.
2021-07-07 17:27:31 -07:00
Todd Gamblin
24a4d81097 style: clean up and restructure spack style command
This consolidates code across tools in `spack style` so that each
`run_<tool>` function can be called indirecty through a dictionary
of handlers, and os that checks like finding the executable for the
tool can be shared across commands.

- [x] rework `spack style` to use decorators to register tools
- [x] define tool order in one place in `spack style`
- [x] fix python 2/3 issues to Get `isort` checks working
- [x] make isort error regex more robust across versions
- [x] remove unused output option
- [x] change vestigial `TRAVIS_BRANCH` to `GITHUB_BASE_REF`
- [x] update completion
2021-07-07 17:27:31 -07:00
Todd Gamblin
b5d2c30d26 style: Move isort configuration to pyproject.toml
- [x] Remove flake8-import-order checks, as we only need isort for this
- [x] Clean up configuration and requirements
2021-07-07 17:27:31 -07:00
Danny McClanahan
7a9fe189e1 style: add support for isort and --fix 2021-07-07 17:27:31 -07:00
Vasily Danilin
ea2d4b05bc
oneAPI packages: add 2021.3 release (#24617) 2021-07-06 10:11:24 -07:00
Harmen Stoppels
545f971bec
fix buffered download (#24623)
* Use shutil to do a buffered copy from http response to file

* Fix flake8...

* Somehow flake8 still complains about unrelated files
2021-07-06 06:12:35 -06:00
eugeneswalker
e450612188
installer: fix double print of exception (#24697) 2021-07-06 08:40:24 +02:00
Adam J. Stewart
3b94e22ad4
Fix fetching for Python 3.9.6 (#24686)
When using Python 3.9.6, Spack is no longer able to fetch anything. Commands like `spack fetch` and `spack install` all break.

Python 3.9.6 includes a [new change](https://github.com/python/cpython/pull/25853/files#diff-b3712475a413ec972134c0260c8f1eb1deefb66184f740ef00c37b4487ef873eR462) that means that `scheme` must be a string, it cannot be None. The solution is to use an empty string like the method default.

Fixes #24644. Also see https://github.com/Homebrew/homebrew-core/pull/80175 where this issue was discovered by CI. Thanks @branchvincent for reporting such a serious issue before any actual users encountered it!

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2021-07-02 22:20:09 -07:00
Scott Wittenburg
c895332284
Pipelines: Improve broken specs check (#24643)
We should not fail the generate stage simply due to the presence of
a broken-spec somewhere in the DAG.  Only fail if the known broken
spec needs to be rebuilt.
2021-07-02 10:49:49 -07:00
Massimiliano Culpo
3d11716e54
Add when context manager to group common constraints in packages (#24650)
This PR adds a context manager that permit to group the common part of a `when=` argument and add that to the context:
```python
class Gcc(AutotoolsPackage):
    with when('+nvptx'):
        depends_on('cuda')
        conflicts('@:6', msg='NVPTX only supported in gcc 7 and above')
        conflicts('languages=ada')
        conflicts('languages=brig')
        conflicts('languages=go')
```
The above snippet is equivalent to:
```python
class Gcc(AutotoolsPackage):
    depends_on('cuda', when='+nvptx')
    conflicts('@:6', when='+nvptx', msg='NVPTX only supported in gcc 7 and above')
    conflicts('languages=ada', when='+nvptx')
    conflicts('languages=brig', when='+nvptx')
    conflicts('languages=go', when='+nvptx')
```
which needs a repetition of the `when='+nvptx'` argument. The context manager might help improving readability and permits to group together directives related to the same semantic aspect (e.g. all the directives needed to model the behavior of `gcc` when `+nvptx` is active). 

Modifications:

- [x] Added a `when` context manager to be used with package directives
- [x] Add unit tests and documentation for the new feature
- [x] Modified `cp2k` and `gcc` to show the use of the context manager
2021-07-02 08:43:15 -07:00
Harmen Stoppels
4a8a6b4c9d
meson: fix typo (libs instead of default_library) (#24649) 2021-07-01 14:37:36 -06:00
Zack Galbreath
c8868f1922
ci: only write to broken-specs list on SpackError (#24618)
ci: only write to broken-specs list on SpackError

Only write to the broken-specs list when `spack install` raises a SpackError,
instead of writing to this list unnecessarily when infrastructure-related problems
prevent a develop job from completing successfully.
2021-06-30 12:16:15 -06:00
Zack Galbreath
0bbd71d561
ci: Don't raise an exception if we fail to relate CDash builds (#24299)
ci: Do not allow cdash-related errors to cause pipeline failure
2021-06-30 10:26:26 -06:00
Adam J. Stewart
a2b7f9997d
spack style: warn if flake8-import-order is missing (#24590) 2021-06-29 23:49:18 +00:00
Harmen Stoppels
304249604a
Fix prefix-collision detection for projections (#24049)
If two Specs have the same hash (and prefix) but are not equal, Spack
originally had logic to detect this and raise an error (since both
cannot be installed in the same place). Recently this has eroded and
the check no-longer works; moreover, when defining projections (which
may truncate the hash or other distinguishing properties from the
prefix) Spack was also failing to detect collisions (in both of these
cases, Spack would overwrite the old prefix with the new Spec).

This PR maintains a list of all "taken" prefixes: if a hash is not
registered (i.e. recorded as installed in the database) but the prefix
is occupied, that is a collision. This can detect collisions created
by defining projections (specifically when they omit the hash).

The PR does not detect collisions where specs have the same hash
(and prefix) but are not equal.
2021-06-29 14:44:56 -07:00
Adam J. Stewart
2284007db9
Use flake8-import-order to enforce PEP-8 compliance (#23947) 2021-06-28 08:03:20 -05:00
Axel Huebl
c06db97970
CUDA: 11.0.3 (11.0 "Update 1") (#24481)
Add CUDA 11.0.3.

This release adds new features such as NVCC flags
`--forward-unknown-to-host-compiler` and
`--forward-unknown-to-host-linker`
2021-06-28 10:53:47 +02:00
Dylan Simon
963b931309
docs: link projections docs to spec format (#24478) 2021-06-27 08:38:28 +00:00
Massimiliano Culpo
b12cee32de
Update archspec to support arm compiler on a64fx (#24524) 2021-06-26 09:18:48 +02:00
Adrien Bernede
6b852bc170
Doc: Note on required changes after merge of reproducible builds (#24347)
* Suggestion of a note for conversion of existing pipelines.

* Wording

* Fix format in .rst note

* Wording
2021-06-25 11:02:26 -06:00
Adam J. Stewart
2bc0c0ea59
Add support for .tbz file extensions (#24479) 2021-06-25 09:37:23 -06:00
Peter Scheibel
916cdfbb56
Environment modifications: de-prioritize external packages (#23824)
Prior to any Spack build, Spack modifies PATH etc. to help the build
find the dependencies it needs. It also allows any package to define
custom environment modifications (and furthermore a package can
specify environment modifications to apply when it is used as a
dependency). If an external package defines custom environment
modifications that alter PATH, and the external package is in a merged
or system prefix, then that prefix could "override" the Spack-built
packages.

This commit reorders environment modifications so that PrependPath
actions which expose Spack-built packages override PrependPath actions
for custom environment modifications of external packages.

In more detail, the original order of environment modifications is:

* Modules
* Compiler flag variables
* PATH, CMAKE_PREFIX_PATH, and PKG_CONFIG_PATH for dependencies
* Custom package.py modifications in the following order:
  * dependencies
  * root

This commit changes the order:

* Modules
* Compiler flag variables
* For each external dependency
  * PATH, CMAKE_PREFIX_PATH, and PKG_CONFIG_PATH modifications
  * Custom modifications
* For each Spack-built dependency
  * PATH, CMAKE_PREFIX_PATH, and PKG_CONFIG_PATH modifications
  * Custom modifications
2021-06-24 16:13:46 -07:00
Scott Wittenburg
d7405ddd39
Pipelines: Set a pipeline type variable (#24505)
Spack pipelines need to take specific actions internally that depend
on whether the pipeline is being run on a PR to spack or a merge to
the develop branch.  Pipelines can also run in other repositories,
which represents other possible use cases than just the two mentioned
above.  This PR creates a "SPACK_PIPELINE_TYPE" gitlab variable which
is propagated to rebuild jobs, and is also used internally to determine
which pipeline-specific tasks to run.

One goal of the PR is fix an issue where rebuild jobs which failed on
develop pipelines did not properly report the broken full hash to the
"broken-specs-url".
2021-06-24 16:15:19 -06:00
Asher Mancinelli
010b431692
Add Externally Findable section to info command (#24503)
* Add Externally Findable section to info command

* Use comma delimited detection attributes in addition to boolean value

* Unit test externally detectable part of spack info
2021-06-24 22:12:45 +00:00
Massimiliano Culpo
4985215072
Update command to setup tutorial (#24488) 2021-06-23 17:19:20 -07:00
Scott Wittenburg
db403391c8
spack ci: use return codes to signal exit status (#24090) 2021-06-23 17:09:19 -07:00
Massimiliano Culpo
1bccd866ae
Fix broken CI for package only PRs, make dateutil not strictly required (#24484)
* Force the Python interpreter with an env variable

This commit forces the Python interpreter with an
environment variable, to ensure that the Python set
by the "setup-python" action is the one being used.

Due to the policy adopted by Spack to prefer python3
over python we may end up picking a Python 3.X
interpreter where Python 2.7 was meant to be used.

* Revert "Update conftest.py (#24473)"

This reverts commit 477c8ce820.

* Make python-dateutil a soft dependency for unit tests

Before #23212 people could clone spack and run
```
spack unit-tests
```
while now this is not possible, since python-dateutil is
a required but not vendored dependency. This change makes
it not a hard requirement, i.e. it will be used if found
in the current interpreter.

* Workaround mypy complaint
2021-06-23 07:56:07 -04:00
eugeneswalker
2db858e9c4
filter_compiler_wrappers: include realpath of compiler wrappers (#24456) 2021-06-22 23:37:07 +00:00
loulawrence
4da0561496
Add config option to use urllib to fetch if curl missing (#21398)
* Use Python module urllib to fetch in the case that curl is missing
2021-06-22 13:38:37 -07:00
Peter Scheibel
477c8ce820
Update conftest.py (#24473) 2021-06-22 12:57:35 -07:00
Massimiliano Culpo
acc11f676d
ASP-based solver: fix provider logic (#24351)
This commit fixes a subtle bug that may occur when
a package is a "possible_provider" of a virtual but
no "provides_virtual" can be deduced. In that case
the cardinality constraint on "provides_virtual"
may arbitrarily assign a package the role of provider
even if the constraints for it to be one are not fulfilled.

The fix reworks the logic around three concepts:
- "possible_provider": a package may provide a virtual if some constraints are met
- "provides_virtual": a package meet the constraints to provide a virtual
- "provider": a package selected to provide a virtual
2021-06-22 11:37:24 -07:00
Massimiliano Culpo
02b92dbf10
ASP-based solver: fix facts for default providers (#24380)
Facts used to compute weights for providers only need
the package name, since the other attributes are computed
as part of the solve.
2021-06-22 11:33:44 -07:00
Erik Schnetter
e3b220f699
Implement CVS fetcher (#23212)
Spack packages can now fetch versions from CVS repositories. Note
this fetch mechanism is unsafe unless using :extssh:. Most public
CVS repositories use an insecure protocol implemented as part of CVS.
2021-06-22 09:51:31 -07:00
Vanessasaurus
8e249c03de
adding save of build times on install (#24350)
Here we are adding an install_times.json into the spack install metadata folder.
We record a total, global time, along with the times for each phase. The type
of phase or install start / end is included (e.g., build or fail)

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-06-22 03:01:15 -06:00
Peter Scheibel
c83f4b01aa
Fetching: git on Mac OS (#24247)
Extend the changes in #24163 to unit tests.
2021-06-21 17:53:12 -07:00
Massimiliano Culpo
32f1aa607c
Add an audit system to Spack (#23053)
Add a new "spack audit" command. This command can check for issues
with configuration or with packages and is intended to help a
user debug a failed Spack build. 

In some cases the reported issues are always errors but are too
costly to check for (e.g. packages that specify missing variants on
dependencies). In other cases the issues may be legitimate but
uncommon usage of Spack and we want to be sure the user intended the
behavior (e.g. duplicate compiler definitions).

Audits are grouped by theme, and for now the two themes are packages
and configuration. For example you can run all available audits
on packages with "spack audit packages". It is intended that in
the future users will be able to define their own audits.

The package audits are good candidates for running in package_sanity
(i.e. they could catch bugs in user-submitted packages before they
are merged) but that is left for a later PR.
2021-06-18 07:52:08 -06:00
Frank Willmore
2c1e9cc7b7
oneAPI compiler: update openmp flag (#23771) 2021-06-17 17:26:46 -07:00
Vanessasaurus
e7ac422982
Adding support for spack monitor with containerize (#23777)
This should get us most of the way there to support using monitor during a spack container build, for both Singularity and Docker. Some quick notes:

### Docker
Docker works by way of BUILDKIT and being able to specify --secret. What this means is that you can prefix a line with a mount of type secret as follows:

```bash
# Install the software, remove unnecessary deps
RUN --mount=type=secret,id=su --mount=type=secret,id=st cd /opt/spack-environment && spack env activate . && export SPACKMON_USER=$(cat /run/secrets/su) && export SPACKMON_TOKEN=$(cat /run/secrets/st) && spack install --monitor --fail-fast && spack gc -y
```
Where the id for one or more secrets corresponds to the file mounted at `/run/secrets/<name>`. So, for example, to build this container with su (spackmon user) and sv (spackmon token) defined I would export them on my host and do:

```bash
$ DOCKER_BUILDKIT=1 docker build --network="host" --secret id=st,env=SPACKMON_TOKEN --secret id=su,env=SPACKMON_USER -t spack/container . 
```
And when we add `env` to the secret definition that tells the build to look for the secret with id "st" in the environment variable `SPACKMON_TOKEN` for example.

If the user is building locally with a local spack monitor, we also need to set the `--network` to be the host, otherwise you can't connect to it (a la isolation of course.)

## Singularity

Singularity doesn't have as nice an ability to clearly specify secrets, so (hoping this eventually gets implemented) what I'm doing now is providing the user instructions to write the credentials to a file, add it to the container to source, and remove when done.

## Tags

Note that the tags PR https://github.com/spack/spack/pull/23712 will need to be merged before `--monitor-tags` will actually work because I'm checking for the attribute (that doesn't exist yet):

```bash
"tags": getattr(args, "monitor_tags", None)
```
So when that PR is merged to update the argument group, it will work here, and I can either update the PR here to not check if the attribute is there (it will be) or open another one in the case this PR is already merged. 

Finally, I added a bunch of documetation for how to use monitor with containerize. I say "mostly working" because I can't do a full test run with this new version until the container base is built with the updated spack (the request to the monitor server for an env install was missing so I had to add it here).

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-06-17 17:15:22 -07:00
Scott Wittenburg
ee9b1a6ea5
ci: add all locally computed hashes as job variables (#24359) 2021-06-17 03:37:31 -06:00
Harmen Stoppels
e4d80c997a
Unset LD_PRELOAD and DYLD_INSERT_LIBRARIES (#24177)
When running executables from build dependencies, we want to avoid that
`LD_PRELOAD` and `DYLD_INSERT_LIBRARIES` any of their shared libs build
by spack with system libraries.
2021-06-17 09:25:19 +00:00
Vanessasaurus
53dae0040a
adding spack upload command (#24321)
this will first support uploads for spack monitor, and eventually could be
used for other kinds of spack uploads

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-06-15 14:36:02 -07:00
Vanessasaurus
5521aae4f7
extending example for buildcaches (#22504)
* extending example for buildcaches

I was attempting to create a local build cache from a directory, and I found the
docs for both buildcaches and mirrors, but did not connect the docs that the
url variable could be the local filesystem variable. I am extending the docs for
buildcaches with an example of creating and interacting with one on the filesystem
because I suspect other users will run into this need and possibly not find what
they are looking for.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

* adding as follows to spack mirror list

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
2021-06-14 21:46:27 -07:00
Vanessasaurus
39cdd085c9
adding more description to binary caches (#23934)
It is currently kind of confusing to the reader to distinguish spack buildcache install
and spack install, and it is not clear how to use a build cache once a mirror is added.
Hopefully this little big of description can help (and I hope I got it right!)

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-06-14 13:17:35 -07:00
Robert Cohn
d993ee7972
oneAPI packages: fix install for python2 (#24296)
Fix platform detection logic to work for Python 2 and 3
2021-06-14 10:47:44 -07:00
Dominik Gresch
dc8626b801
IntelPackage: use 'version_yearlike' in check for libfabrics RPATH. (#16700)
Use the 'version_yearlike' attribute instead of 'version' to
check if the SPACK_COMPILER_EXTRA_RPATHS should be set to include
the built-in 'libfabrics'.
When using the bare 'version', the comparison is wrong when
building with 'intel-parallel-studio', which has the version
format '<edition>.YYYY.Nupdate', due to the leading '<edition>'.
2021-06-12 10:02:56 +00:00
Greg Becker
95c9a031ee
Ensure all roots of an installed environment are marked explicit in db (#24277) 2021-06-12 10:23:13 +02:00
Adam J. Stewart
11f370e7be
setup-env: allow users to skip module function setup (#24236)
* setup-env: allow users to skip module function setup

* Add documentation on SPACK_SKIP_MODULES
2021-06-11 19:19:24 +00:00
iarspider
ea08e93f2f
Display proper message when patch checksum doesn't match (#24229) 2021-06-11 10:31:33 +02:00
Scott Wittenburg
92bef1da6f
Pipelines: Fix default generated rebuild job script (#24185) 2021-06-08 14:33:45 -06:00
Massimiliano Culpo
f33c4e7280
ASP-based solver: permit to use virtual specs in environments (#24199)
Extracting specs for the result of a solve has been factored
as a method into the asp.Result class. The method account for
virtual specs being passed as initial requests.
2021-06-08 19:04:49 +02:00
Massimiliano Culpo
e321578bbe
ASP-based solver: reordered low priority optimization criteria (#24184)
Minimizing compiler mismatches in the DAG and preferring newer 
versions of packages are now higher priority than trying to use as 
many default values as possible in multi-valued variants.
2021-06-08 16:10:49 +02:00
Todd Gamblin
beed6047e8
macOS: add monterey as macOS version 12. (#24192) 2021-06-08 10:07:34 +00:00
Massimiliano Culpo
729d66a3f8
Fix brittle unit-tests on providers (#24186)
These tests were broken by #24176
2021-06-07 22:16:14 +02:00
Michael Kuhn
4d55203ce5
build_systems: Make autotools builds verbose (#24161)
This is also what our other build systems are doing.
2021-06-07 14:05:35 -04:00
Adam J. Stewart
3d0bad465b
Docs: fix missing backtick in Environments docs (#24109) 2021-06-07 19:05:09 +02:00
Adam J. Stewart
7449d6950a
Fix git_version on macOS (#24163) 2021-06-05 23:30:28 +00:00
Michael Kuhn
7d3a3af621
main, modules: fix module roots not being found (#24135)
Since the module roots were removed from the config file,
`--print-shell-vars` cannot find the module roots anymore. Fix it by
using the new `root_path` function. Moreover, the roots for lmod and
modules seems to have been flipped by accident.
2021-06-04 15:33:18 -07:00
Joe Heaton
13978d68ea
enable std c++14 (#24127) 2021-06-04 18:47:32 +00:00
Michael Kuhn
d5d1d9548f
cmd/stage: print stage path (#24019)
This is a small quality of life improvement so that users can easily
copy and paste the stage path after executing `spack stage spec`.
2021-06-04 11:18:55 +00:00
Greg Becker
d8fc38a467
bugfix: modules relative to view use top-level view root, not implementation root (#24124) 2021-06-04 10:13:14 +02:00
Adam J. Stewart
c09eea5947
Don't warn about missing source id for external packages (#24125) 2021-06-04 09:55:09 +02:00
Tom Scogland
b63a8b3e27
Speed-up version parsing and comparison (#22973)
The VALID_VERSION regex didn't check that the version string was
completely valid, only that a prefix of it was. This version ensures
the entire string represents a valid version.

This makes a few related changes.

1. Make the SEGMENT_REGEX identify *which* arm it matches by what groups
   are populated, including whether it's a string or int component or a
   separator all at once.

2. Use the updated regex to parse the input once with a findall rather
   than twice, once with findall and once with split, since the version
   components and separators can be distinguished by their group status.

3. Rather than "convert to int, on exception stay string," if the int
   group is set then convert to int, if not then construct an instance
   of the VersionStrComponent class

4. VersionStrComponent now implements all of the special string
   comparison logic as part of its __lt__ and __eq__ methods to deal
   with infinity versions and also overloads comparison with integers.

5. Version now uses direct tuple comparison since it has no per-element
   special logic outside the VersionStrComponent class.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2021-06-04 09:23:37 +02:00
Scott Wittenburg
9903d05be9
Pipelines: Fix generation when dep and pkg arch differ (#24089) 2021-06-03 19:26:43 -04:00
Harmen Stoppels
473e9aa08e
Extend cuda conflicts to cray platform (#24057)
The CUDA compiler conflicts are valid on Cray too, and likely 
on Darwin x86_64 with %gcc and %clang too, so drop platform=linux
2021-06-03 03:46:27 -06:00
Scott Wittenburg
28517deeeb
Pipelines: pass relative artifact paths to child jobs (#24085)
Passing absolute paths from pipeline generate job to downstream rebuild jobs
causes problems when the CI_PROJECT_DIR is not the same for the generate and
rebuild jobs.  This has happened, for example, when gitlab checks out the
project into a runner-specific directory and different runners are chosen
for the generate and rebuild jobs.
2021-06-02 14:20:57 -06:00
Danny McClanahan
b369ff461a
ensure the staging dir exists for spack stage -p <PATH> (#23963)
* ensure that the stage root exists for `spack stage -p <PATH>`

* add test to verify `spack stage -p <PATH>` works!

* move out shared tmp staging path setup to a fixture to fix the test
2021-06-02 09:56:51 -07:00
Harmen Stoppels
e8afc5db15
Fix bug where cmake prefix path on the command line does not include transitive deps (#23965) 2021-06-01 12:45:52 -07:00
Massimiliano Culpo
707a3f7df8
Simplified the spack.util.gpg implementation (#23889)
* Simplified the spack.util.gpg implementation

All the classes defined in this Python module,
which were previously used to construct singleton
instances, have been removed in favor of four
global variables. These variables are initialized
lazily, like before.

The API of the module has been unchanged for the
most part. A few tests have been modified to use
the new global names.
2021-06-01 10:05:42 -07:00
Harmen Stoppels
bb5fd5c567
Fix leading / during spack buildcache -f ... (#24028)
For me the buildcache force overwrite option does not work. It tries to
delete a file, but errors with a key error, apparently because the
leading / has to be removed.
2021-06-01 01:10:32 -06:00
Tom Scogland
4a7b0afde2
Log performance improvement (#23925)
* util.tty.log: read up to 100 lines if ready

Rework to read up to 100 lines from the captured stdin as long as data
is ready to be read immediately.  Adds a helper function to poll with
`select` for ready data.  This showed a roughly 5-10x perf improvement
for high-rate writes through the logger with relatively short lines.

* util.tty.log: Defer flushes to end of ready reads

Rather than flush per line, flush per set of reads.  Since this is a
non-blocking loop, the total perceived wait is short.

* util.tty.log: only scan each line once, usually

Rather than always find all control characters then substitute them all,
use `subn` to count the number of control characters replaced.  Only if
control characters exist find out what they are.  This could be made
truly single pass with sub with a function, but it's a more intrusive
change and this got 99%ish of the performance improvement (roughly
another 2x in some cases).

* util.tty.log: remove check for `readable`

Python < 3 does not support a readable check on streams, should not be
necessary here since we control the only use and it's explicitly a
stream to be read.
2021-05-31 20:33:14 -07:00
Vanessasaurus
6f534acbef
adding support for export of private gpg key (#22557)
This PR allows users to `--export`, `--export-secret`, or both to  export GPG keys
from Spack. The docs are updated that include a warning that this usually does not
need to be done.

This addresses an issue brought up in slack, and also represented in #14721.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-05-28 23:32:57 -07:00
Harmen Stoppels
f6febd2ef5
Cache compiler lookup per package (#23988)
Before:

```
$ hyperfine '~/spack/bin/spack -e . build-env rocfft'
Benchmark #1: ~/spack/bin/spack -e . build-env rocfft
  Time (mean ± σ):      1.593 s ±  0.016 s    [User: 1.468 s, System: 0.126 s]
  Range (min … max):    1.575 s …  1.628 s    10 runs
```

After:

```
$ hyperfine '~/spack/bin/spack -e . build-env rocfft'
Benchmark #1: ~/spack/bin/spack -e . build-env rocfft
  Time (mean ± σ):      1.407 s ±  0.020 s    [User: 1.280 s, System: 0.127 s]
  Range (min … max):    1.393 s …  1.455 s    10 runs
```
2021-05-28 21:36:34 +00:00
Greg Becker
7490d63c38
Separable module configuration -- without the bugs this time (#23703)
Currently, module configurations are inconsistent because modulefiles are generated with the configs for the active environment, but are shared among all environments (and spack outside any environment).

This PR fixes that by allowing Spack environments (or other spack config scopes) to define additional sets of modules to generate. Each set of modules can enable either lmod or tcl modules, and contains all of the previously available module configuration. The user defines the name of each module set -- the set configured in Spack by default is named "default", and is the one returned by module manipulation commands in the absence of user intervention.

As part of this change, the module roots configuration moved from the config section to inside each module configuration.

Additionally, it adds a feature that the modulefiles for an environment can be configured to be relative to an environment view rather than the underlying prefix. This will not be enabled by default, as it should only be enabled within an environment and for non-default views constructed with separate projections per-spec.
2021-05-28 14:12:05 -07:00
Scott Wittenburg
91f66ea0a4
Pipelines: reproducible builds (#22887)
### Overview

The goal of this PR is to make gitlab pipeline builds (especially build failures) more reproducible outside of the pipeline environment.  The two key changes here which aim to improve reproducibility are: 

1. Produce a `spack.lock` during pipeline generation which is passed to child jobs via artifacts.  This concretized environment is used both by generated child jobs as well as uploaded as an artifact to be used when reproducing the build locally.
2. In the `spack ci rebuild` command, if a spec needs to be rebuilt from source, do this by generating and running an `install.sh` shell script which is then also uploaded as a job artifact to be run during local reproduction.  

To make it easier to take advantage of improved build reproducibility, this PR also adds a new subcommand, `spack ci reproduce-build`, which, given a url to job artifacts:

- fetches and unzips the job artifacts to a local directory
- looks for the generated pipeline yaml and parses it to find details about the job to reproduce
- attempts to provide a copy of the same version of spack used in the ci build
- if the ci build used a docker image, the command prints a `docker run` command you can run to get an interactive shell for reproducing the build

#### Some highlights

One consequence of this change will be much smaller pipeline yaml files.  By encoding the concrete environment in a `spack.lock` and passing to child jobs via artifacts, we will no longer need to encode the concrete root of each spec and write it into the job variables, greatly reducing the size of the generated pipeline yaml.

Additionally `spack ci rebuild` output (stdout/stderr) is no longer internally redirected to a log file, so job output will appear directly in the gitlab job trace.  With debug logging turned on, this often results in log files getting truncated because they exceed the maximum amount of log output gitlab allows.  If this is a problem, you still have the option to `tee` command output to a file in the within the artifacts directory, as now each generated job exposes a `user_data` directory as an artifact, which you can fill with whatever you want in your custom job scripts.

There are some changes to be aware of in how pipelines should be set up after this PR:

#### Pipeline generation

Because the pipeline generation job now writes a `spack.lock` artifact to be consumed by generated downstream jobs, `spack ci generate` takes a new option `--artifacts-root`, inside which it creates a `concrete_env` directory to place the lockfile.  This artifacts root directory is also where the `user_data` directory will live, in case you want to generate any custom artifacts.  If you do not provide `--artifacts-root`, the default is for it to create a `jobs_scratch_dir` within your `CI_PROJECT_DIR` (a gitlab predefined environment variable) or whatever is your current working directory if that variable isn't set. Here's the diff of the PR testing `.gitlab-ci.yml` taking advantage of the new option:

```
$ git diff develop..pipelines-reproducible-builds share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
diff --git a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
index 579d7b56f3..0247803a30 100644
--- a/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
+++ b/share/spack/gitlab/cloud_pipelines/.gitlab-ci.yml
@@ -28,10 +28,11 @@ default:
     - cd share/spack/gitlab/cloud_pipelines/stacks/${SPACK_CI_STACK_NAME}
     - spack env activate --without-view .
     - spack ci generate --check-index-only
+      --artifacts-root "${CI_PROJECT_DIR}/jobs_scratch_dir"
       --output-file "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
   artifacts:
     paths:
-      - "${CI_PROJECT_DIR}/jobs_scratch_dir/cloud-ci-pipeline.yml"
+      - "${CI_PROJECT_DIR}/jobs_scratch_dir"
   tags: ["spack", "public", "medium", "x86_64"]
   interruptible: true
```

Notice how we replaced the specific pointer to the generated pipeline file with its containing folder, the same folder we passed as `--artifacts-root`.  This way anything in that directory (the generated pipeline yaml, as well as the concrete environment directory containing the `spack.lock`) will be uploaded as an artifact and available to the downstream jobs.

#### Rebuild jobs

Rebuild jobs now must activate the concrete environment created by `spack ci generate` and provided via artifacts.  When the pipeline is generated, a directory called `concrete_environment` is created within the artifacts root directory, and this is where the `spack.lock` file is written to be passed to the generated rebuild jobs.  The artifacts root directory can be specified using the `--artifacts-root` option to `spack ci generate`, otherwise, it is assumed to be `$CI_PROJECT_DIR`.  The directory containing the concrete environment files (`spack.yaml` and `spack.lock`) is then passed to generated child jobs via the `SPACK_CONCRETE_ENV_DIR` variable in the generated pipeline yaml file.

When you don't provide custom `script` sections in your `mappings` within the `gitlab-ci` section of your `spack.yaml`, the default behavior of rebuild jobs is now to change into `SPACK_CONCRETE_ENV_DIR` and activate that environment.   If you do provide custom rebuild scripts in your `spack.yaml`, be aware those scripts should do the same thing: assume `SPACK_CONCRETE_ENV_DIR` contains the concretized environment to activate.  No other changes to existing custom rebuild scripts should be required as a result of this PR. 

As mentioned above, one key change made in this PR is the generation of the `install.sh` script by the rebuild jobs, as that same script is both run by the CI rebuild job as well as exported as an artifact to aid in subsequent attempts to reproduce the build outside of CI.  The generated `install.sh` script contains only a single `spack install` command with arguments computed by `spack ci rebuild`.  If the install fails, the job trace in gitlab will contain instructions on how to reproduce the build locally:

```
To reproduce this build locally, run:
  spack ci reproduce-build https://gitlab.next.spack.io/api/v4/projects/7/jobs/240607/artifacts [--working-dir <dir>]
If this project does not have public pipelines, you will need to first:
  export GITLAB_PRIVATE_TOKEN=<generated_token>
... then follow the printed instructions.
```

When run locally, the `spack ci reproduce-build` command shown above will download and process the job artifacts from gitlab, then print out instructions you  can copy-paste to run a local reproducer of the CI job.

This PR includes a few other changes to the way pipelines work, see the documentation on pipelines for more details.

This  PR erelies on 
~- [ ] #23194 to be able to refer to uninstalled specs by DAG hash~
EDIT: that is going to take longer to come to fruition, so for now, we will continue to install specs represented by a concrete `spec.yaml` file on disk.
- [x] #22657 to support install a single spec already present in the active, concrete environment
2021-05-28 09:38:07 -07:00
Greg Becker
405314195e
aocc version detection (#23907) 2021-05-28 10:13:40 -05:00
Greg Becker
b91dff4aaf
bugfix: mirror index shows missing packages (#23939)
- [x] add `in_buildcache` field to DB records to indicate what parts of an index, 
       which includes roots and dependencies, are in the buildcache.
- [x] add `mark()` method to DB for setting values on single nodes of the DAG.
2021-05-27 20:38:13 +00:00
Greg Becker
b9a66966a8
only readlink on links (#23948) 2021-05-27 09:20:57 -07:00
Greg Becker
b7f7d901d1
allow whitespace formatting in variant descriptions (#23853) 2021-05-26 14:34:13 -06:00
Vanessasaurus
3cef5663d8
adding json export for spack blame (#23417)
I would like to be able to export (and save and then load programatically)
spack blame metadata, so this commit adds a spack blame --json argument,
along with developer docs for it

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-05-25 12:40:08 -06:00
Vanessasaurus
b44bb952eb
first set of work to allow for saving local results with spack monitor (#23804)
This work will come in two phases. The first here is to allow saving of a local result
with spack monitor, and the second will add a spack monitor command so the user can
do spack monitor upload.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-05-25 11:29:34 -07:00
Robert Cohn
c5389c430b
Fix cross references in inteloneapipackage doc (#23744)
Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
2021-05-25 09:57:49 -07:00
Tamara Dahlgren
929d1de3e5
Stand-alone/Smoke tests: copy cached test sources to test stage (#23713) 2021-05-25 07:24:32 -07:00
Harmen Stoppels
56e7e2a406
MesonPackage: make "default_library" a multi-valued variant (#23540)
Currently if one package does `depends_on('pkg default_library=shared')`
and another does `depends_on('pkg default_library=both')`, you'd get a
concretization error.

With this PR one package can do `depends_on('pkg default_library=shared')` 
and another depends_on('default_library=static'), and it would concretize to 
`pkg default_library=shared,static`

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2021-05-25 12:07:00 +02:00
Tamara Dahlgren
bed1644d52
Fix packaging guide table's build system links (#23879) 2021-05-25 07:13:00 +02:00
HDF-EOS Tools Information Center
00963149e1
Fix hyperlink formatting in docs (#23846) 2021-05-25 07:09:07 +02:00
Seth R. Johnson
d8cbd37aaa
Fix makefile filter suggestions (#23856)
Bash has a builtin `fc` that will override the compiler if you use "fc",
so it's better to use the full spack-supplied compiler path.

Additionally, the filter regex in the docs was wrong: it replaced the
entire assignment operation with the RHS.
2021-05-22 18:47:43 +00:00
Glenn Johnson
71b9e67b3c
Modification to R environment (#23623)
* Modification to R environment

This PR modifies how the R environmnet is presented, and fixes
installing the standalone Rmath library.

- The Rmath build and install methods are combined into one
- Set parallel=False when installing Rmath
- remove the run environment that set up variables for libraries and
  headers that are not really needed, and pollute the environment.

* Add setup_run_environment back

- Add back the setup_run_environment with LD_LIBRARY_PATH and
  PKG_CONFIG_PATH.
- Adjust documentation to reflect the current code.
2021-05-21 09:34:15 +02:00
Massimiliano Culpo
4c4a584a9c spack: update archspec
This fixes the detection of Apple M1 and adds
virtual levels for x86_64 architectures
2021-05-20 14:56:04 -07:00
Valentin Volkl
b27ccd524e
versions: do not drop 2.0.X if 2.0 is a declared version in the package (#23217) 2021-05-20 19:16:46 +00:00
Harmen Stoppels
5846079028
Cray: fix extracting paths from module files (#23472)
Co-authored-by: Tiziano Müller <tm@dev-zero.ch>
2021-05-20 14:35:35 +02:00
Valentin Volkl
88192bfd4a
Write junit-report to reports directory to allow installation from read-only spack (#20158) 2021-05-19 16:28:14 +00:00
vsoch
f2b362b5b3 adding support to tag a build
This will be useful to run multiple build experiments and organize by name

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-05-19 07:01:18 -07:00
Jamie Finney
b3004e1dd0
Add caret/hat to spack spec help documentation (#23758)
Co-authored-by: Jamie Finney <finneyjm@ornl.gov>
2021-05-19 09:49:07 +02:00
Vanessasaurus
8bed109e41
monitor: fix issue with attribute lookup (#23773)
Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-05-19 07:33:09 +02:00
Tamara Dahlgren
5bd42d1b31
docs/packaging guide: Reference test stage directory (#23707) 2021-05-18 17:56:38 -07:00
Michael Kuhn
9410d99153
Bugfix: fetching oddly-named resources from local mirrors (#23300)
Spack uses curl to fetch URL resources. For locally-stored resources
it uses curl's file protocol; when using this protocol, curl expects
that the URL encoding conforms to RFC 3986 (which reserves characters
like '?' and '=' for special use).

We were not performing this encoding, and found a resource where
curl was interpreting this in an unfavorable way (succeeding, but
producing an empty file). This commit properly encodes URLs when
using curl's file protocol.

This error did not likely come up before because in most contexts
Spack was either fetching via http or it was using URLs without
offending characters (for example, the sha-based URLs in mirrors
never contain these characters).
2021-05-18 15:26:49 -07:00
Harmen Stoppels
8446bebdd9
Revert "Separable module configurations (#22588)" (#23674)
This reverts commit cefbe48c89.
2021-05-17 06:42:48 -07:00
Todd Gamblin
fdfd1fed41
performance: speed up existence checks in packages (#23661)
Spack doesn't require users to manually index their repos; it reindexes the indexes automatically when things change. To determine when to do this, it has to `stat()` all package files in each repository to make sure that indexes up to date with packages. We currently index virtual providers, patches by sha256, and tags on packages.

When this was originally implemented, we ran the checker all the time, at startup, but that was slow (see #7587). But we didn't go far enough -- it still consults the checker and does all the stat operations just to see if a package exists (`Repo.exists()`).  That might've been a wash in 2018, but as the number of packages has grown, it's gotten slower -- checking 5k packages is expensive and users see this for small operations.  It's a win now to make `Repo.exists()` check files directly.

**Fix:**

This PR does a number of things to speed up `spack load`, `spack info`, and other commands:

- [x] Make `Repo.exists()` check files directly again with `os.path.exists()` (this is the big one)
- [x] Refactor `Spec.satisfies()` so that a checking for virtual packages only happens if needed
      (avoids some calls to exists())
- [x] Avoid calling `Repo.exists(spec)` in `Repo.get()`. `Repo.get()` will ultimately try to load
      a `package.py` file anyway; we can let the failure to load it indicate that the package doesn't
      exist, and avoid another call to exists().
- [x] Fix up some comments in spec parsing
- [x] Call `UnknownPackageError` more consistently in `repo.py`
2021-05-17 01:20:17 -07:00
Todd Gamblin
379a1fd23b
some fixes for command help strings (#23658)
- [x] `analyze` isn't commonly used; move it to long help
      (`spack -H` vs `spack -h`). Give it its own section.

- [x] make it clear from `spack -h` that `spack module` can generate
      module files

- [x] shorten help for `spack style`
2021-05-15 20:48:00 +00:00
Greg Becker
2202ce27fa
do not sort projections alphabetically (#23649)
* do not sort projections alphabetically
* add assertion for ordered dict
2021-05-15 10:19:10 -06:00
Greg Becker
cefbe48c89
Separable module configurations (#22588)
Currently, module configurations are inconsistent because modulefiles are generated with the configs for the active environment, but are shared among all environments (and spack outside any environment).

This PR fixes that by allowing Spack environments (or other spack config scopes) to define additional sets of modules to generate. Each set of modules can enable either lmod or tcl modules, and contains all of the previously available module configuration. The user defines the name of each module set -- the set configured in Spack by default is named "default", and is the one returned by module manipulation commands in the absence of user intervention.

As part of this change, the module roots configuration moved from the `config` section to inside each module configuration.

Additionally, it adds a feature that the modulefiles for an environment can be configured to be relative to an environment view rather than the underlying prefix. This will not be enabled by default, as it should only be enabled within an environment and for non-default views constructed with separate projections per-spec.

TODO:
- [x] code changes to support multiple module sets
- [x] code changes to support modules relative to a view
- [x] Tests for multiple module configurations
- [x] Tests for modules relative to a view
- [x] Backwards compatibility for module roots from config section
- [x] Backwards compatibility for default module set without the name specified
- [x] Tests for backwards compatibility
2021-05-14 15:03:28 -07:00
Massimiliano Culpo
f47066967b
spec: simplify __str__ implementation (#23593)
The implementation for __str__ has been simplified to traverse the spec directly, 
and doesn't call anymore the flat_dependencies method. Dead code has been 
removed.
2021-05-13 21:51:41 -07:00
Frank Willmore
b70bf073b5
cc: change mode to ccld for loopopt edit (#23482)
For configure (e.g. for hdf5) to pass, this option needs to be pulled out when invoked in ccld mode.

I thought it had fixed the issue but I still saw it after that. After some digging, my guess is that I was able
to get hdf5 to build with ifort instead of ifx. Lot of overlapping changes occurring at the time, as it were.
There are still outstanding issues building hdf5 with ifx, and Intel is looking into what appears to be a
compiler bug, but this manifests during build and is likely a separate issue.

I have verified that the making the edit in 'ccld' mode removes the -loopopt=0 and enables hdf5 to pass
configure. It should be fine to make the edit in 'ld' mode as well, but I have not tested that and didn't
include an -or- condition for it.
2021-05-13 21:31:20 -07:00
Greg Becker
190b043161
config key error: fix format string (#23610) 2021-05-13 11:20:32 +02:00
Greg Becker
f8740c8c75
env views: make view updates atomic (#23476)
Currently, environment views blink out of existence during the view regeneration, and are slowly built back up to their new and improved state. This is not good if other processes attempt to access the view -- they can see it in an inconsistent state.

This PR fixes makes environment view updates atomic. This requires a level of indirection (via symlink, similar to nix or guix) from the view root to the underlying implementation on the filesystem. 

Now, an environment view at `/path/to/foo` is a symlink to `/path/to/._foo/<hash>`, where `<hash>` is a hash of the contents of the view.  We construct the view in its content-keyed hash directory, create a new symlink to this directory, and atomically replace the symlink with one to the new view.

This PR has a couple of other benefits:
* It future-proofs environment views so that we can implement rollback.
* It ensures that we don't leave users in an inconsistent state if building a new view fails for some reason.

For background:
* there is no atomic operation in posix that allows for a non-empty directory to be replaced.
* There is an atomic `renameat2` in the linux kernel starting in version 3.15, but many filesystems don't support the system call, including NFS3 and NFS4, which makes it a poor implementation choice for an HPC tool, so we use the symlink approach that others tools like nix and guix have used successfully.
2021-05-13 06:56:20 +00:00
Massimiliano Culpo
fc2ac099cd
ASP-based solver: account for deprecated versions (#23491)
fixes #22351

The ASP-based solver now accounts for the presence
in the DAG of deprecated versions and tries to minimize
their number at highest priority.
2021-05-12 07:17:38 -07:00
Peter Scheibel
5230730941
Environments: add run deps to shell modifications (#23485)
When adding an Environment to a user's shell, Spack was only adding
root specs. This now includes run dependencies of root specs.
2021-05-11 14:30:57 -07:00
Massimiliano Culpo
2a509ea0bf
ASP-based solver: variants set from cli are considered as defaults (#23542)
Variants explicitly set in an abstract root spec are considered
as defaults for the package they refer to, and they override
what is in packages.yaml and in package.py. This is relevant
only for multi-valued variants, where a constraint may extend
an already default value.
2021-05-11 12:38:17 -07:00
Howard Pritchard
f055a48445
cray: fix parsing of module list (#23566)
The code for guessing cpu archtype based on craype modules names got confused,
at least on LLNL RZ prototype systems.  In particular a (L) or (D) at the end of a craype-x86-xxx or other
cpu architecture module was geting the logic confused.

With this patch, any white space + remaining characters in the moduel name are removed.

Signed-off-by: Howard Pritchard <howardp@lanl.gov>
2021-05-11 18:16:09 +00:00
Tamara Dahlgren
0368f8ae51
Updates and format tweaks to the release documentation (#22053) 2021-05-11 10:39:25 -07:00
Tamara Dahlgren
066d33b4b3
Documentation: Refinement of "Checking an installation" (#22210)
There have been a lot of questions and some confusion recently surrounding Spack installation test capabilities so this PR is intended to clean up and refine the documentation for "Checking an installation".

It aims to better distinguish between checks that are performed during an installation (i.e., build-time tests) and those that can be done days and weeks after the software has been installed (i.e., install (or smoke) tests).
2021-05-11 10:37:48 -07:00
Tamara Dahlgren
2450ee0fb0
bugfix: correct force_autoreconf method syntax (#23546) 2021-05-10 19:31:11 +00:00
eugeneswalker
4903eabc7a
compare full old_prefix and new_prefix instead of layout_root (#23506) 2021-05-10 10:36:53 -07:00
Massimiliano Culpo
00a1418d10 clingo: don't skip tests that deal with file permissions
When we first merged the ASP-based solver, unit-tests
were run in a Docker container with root permissions
and that was preventing a few tests to succeed.

Since some time though, clingo is tested as a regular
user within Github Actions VMs, so we should start to
run checks again.
2021-05-08 06:14:44 -07:00
Scott Wittenburg
91de23ce65 install cmd: --no-add in an env installs w/out concretize and add
In an active concretize environment, support installing one or more
cli specs only if they are already present in the environment.  The
`--no-add` option is the default for root specs, but optional for
dependency specs.  I.e. if you `spack install <depspec>` in an
environment, the dependency-only spec `depspec` will be added as a
root of the environment before being installed.  In addition,
`spack install --no-add <spec>` fails if it does not find an
unambiguous match for `spec`.
2021-05-07 10:07:53 -07:00
Peter Josef Scheibel
a3d58129ec return concrete spec (as is advertised in the docstring) 2021-05-07 10:07:53 -07:00
Peter Josef Scheibel
320eb4872d fix check when retrieving matching spec from environment when there is a match with a root spec as well as with a dependency of a root spec 2021-05-07 10:07:53 -07:00
Tiziano Müller
ccf9a11ff9
compilers: aocc is now also available as a Cray PrgEnv (#23289) 2021-05-07 14:55:32 +02:00
Harmen Stoppels
129de9083a
Show useful error in build-env (#23458)
Instead of an out of bounds error tell the user to provide a spec
2021-05-07 14:53:08 +02:00
Massimiliano Culpo
4402f89e39
ASP-based solver: minimize mismatch of targets (#23462)
Like compilers targets now try to minimize
mismatches, instead of maximizing matches.

Deduction of mismatches is reworked to be
the opposite of a match, since computing
that is faster.
2021-05-06 12:39:30 -07:00
Massimiliano Culpo
f83ec4d46f
ASP-based solver: no intermediate package for concretizing together (#23307)
The ASP-based solver can natively manage cases where more than one root spec is given, and is able to concretize all the roots together (ensuring one spec per package at most).

Modifications:
- [x] When concretising together an environment the ASP-based solver calls directly its `solve` method rather than constructing a temporary fake root package.
2021-05-06 10:19:10 -07:00
Harmen Stoppels
e5d87b711d
Reduce visual noise during distributed build (#23338) 2021-05-06 07:30:02 -07:00
Massimiliano Culpo
219eb09e59
Put a module object in sys.modules before executing module code (#23269)
The loading protocol mandates that the the module we are going
to import needs to be already in sys.modules before its code is
executed, so to prevent unbounded recursions and multiple loading.

Loading a module from file exits early if the module is already
in sys.modules
2021-05-06 11:53:40 +02:00
Robert Cohn
ab018c2081
intel-oneapi packages: support root installs (#23401)
When installing OneAPI packages as root (e.g. in a container), the
installer places cache files in /var/intel/installercache that
interfere with future Spack installs. This ensures that when
running an installation as a root user that this is removed.
2021-05-05 14:00:34 -07:00
Massimiliano Culpo
8a65bcb7c9
archspec: updated external dependency (#23311)
Added support for Apple M1, extended support
for zen3 with more compiler flags.
2021-05-03 22:27:37 -07:00
Massimiliano Culpo
10389b2b51
Use Python's built-in machinery to import compilers (#23290) 2021-05-03 22:26:48 -07:00
Michael Kuhn
21ad8d4372
cmd: improve shell support help message (#23410)
Users sometimes set up Spack's shell support but still call `bin/spack`,
which results in the help message showing up again.
2021-05-03 18:28:28 -04:00
Harmen Stoppels
9c1c7ab6ca
Use an environment variable to set the default stacktrace behavior (#23357) 2021-05-03 16:22:30 +02:00
Massimiliano Culpo
5b12568c4f
Make Spack able to apply gz compressed remote patches (#22823)
Modified ncbi-rmblastn to retrieve patches from remote
2021-04-28 17:00:58 +02:00
BenWeber42
5cb5aac57e
Fix intersection if a version is a prefix of another (#22941)
* Added test for version intersections when one is prefix of another

* Fix version intersection for prefixes
2021-04-28 08:28:09 -06:00
Harmen Stoppels
3f4c9aeca7
Read colorization from environment variable, if command line is not set (#23130) 2021-04-28 13:03:25 +00:00
Massimiliano Culpo
985e101507
Import hooks using Python's built-in machinery (#23288)
The function we coded in Spack to load Python modules with arbitrary
names from a file seem to have issues with local imports. For
loading hooks though it is unnecessary to use such functions, since
we don't care to bind a custom name to a module nor we have to load
it from an unknown location.

This PR thus modifies spack.hook in the following ways:

- Use __import__ instead of spack.util.imp.load_source (this
  addresses #20005)
- Sync module docstring with all the hooks we have
- Avoid using memoization in a module function
- Marked with a leading underscore all the names that are supposed
  to stay local
2021-04-27 16:55:07 -07:00
Zack Galbreath
295377b2b4
Don't report configure errors to CDash for successful packages (#23286)
Convert configure errors detected by our log scraper into warnings when
the package being installed reports that it was successful.
2021-04-27 12:20:32 -06:00
Tim Haines
c23ffd89ff
Dyninst: Add dependencies for v11.0.0 (#23121)
Also update the mpileaks unit test to avoid a conflict on CentOS 6
where Dyninst >=11.0.0 no longer builds due to a compiler version
conflict.
2021-04-26 13:53:53 -07:00
George Hartzell
6d789a5835
docs: be more precise on what spack add ... does (#23204)
This is as much a question as it is a minor fine-tuning of the docs.  I've been known to add things to an environment by editing the `spack.yaml` file directly.  When I read the previous version of this sentence, I was afraid that `spack add` was actually doing *two* things, modifying the `spack.yaml` and updating something else that defined the roots of the Environment.  A bit of experimentation suggests that editing the `spack.yaml` file is sufficient to change the roots.

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-04-23 13:29:19 +00:00
Tamara Dahlgren
6f25e5242e
Docs: Updated copyrights in files still using 2020 as ending year (#23215) 2021-04-22 22:23:09 -07:00
Massimiliano Culpo
3325eff486
ASP-based solve: minimize compiler mismatches (#23016)
fixes #22718

Instead of trying to maximize the number of
matches (preferred behavior), try to minimize
the number of mismatches (unwanted behavior).
2021-04-21 01:02:43 -07:00
Massimiliano Culpo
9a473d6ab3
ASP-based solver: suppress warnings when constructing facts (#23090)
fixes #22786

Trying to get optimization flags for a specific target from
a compiler may trigger warnings. In the context of constructing
facts for the ASP-based solver we don't want to show these
warnings to the user, so here we simply ignore them.
2021-04-21 01:02:10 -07:00
Chris White
58a897be0e
check for package in spec not variant (#23157) 2021-04-20 18:13:15 -06:00
Glenn Johnson
09e80604f5
Catch rstudio based URL for cran attribute in create.py (#23072) 2021-04-20 19:03:42 -05:00
Vanessasaurus
b9a2b1c096
Fixing typo tty.fail -> tty.die and monitor docstrings (#23152)
This isn't a significant issue, but I noticed that the docstring incorrectly references "tty.fail" and I wanted to quickly fix it to reflect the correct command, tty.die. I also wanted to fix the docstrings to not be large clumps, to what @tgamblin suggested after I wrote this - having one line at the top that is a quick summary, and more verbose after that.
2021-04-20 14:53:30 -07:00
Vanessasaurus
e6de04d149
docs: spack does not have a variant debug for libelf (#23021)
Signed-off-by: vsoch <vsoch@users.noreply.github.com>

Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-04-16 09:29:42 +02:00
Zack Galbreath
080d9b094f
Return non-zero from CDash reporter when errors are detected (#22962) 2021-04-15 15:11:08 -06:00
Vanessasaurus
7f91c1a510
Merge pull request #21930 from vsoch/add/spack-monitor
This provides initial support for [spack monitor](https://github.com/spack/spack-monitor), a web application that stores information and analysis about Spack installations.  Spack can now contact a monitor server and upload analysis -- even after a build is already done.

Specifically, this adds:
- [x] monitor options for `spack install`
- [x] `spack analyze` command
- [x] hook architecture for analyzers
- [x] separate build logs (in addition to the existing combined log)
- [x] docs for spack analyze
- [x] reworked developer docs, with hook docs
- [x] analyzers for:
  - [x] config args
  - [x] environment variables
  - [x] installed files
  - [x] libabigail

There is a lot more information in the docs contained in this PR, so consult those for full details on this feature.

Additional tests will be added in a future PR.
2021-04-15 00:38:36 -07:00
vsoch
613348ec90 Use gethostname() instead of getfqdn() for lock debug mode
In debug mode, processes taking an exclusive lock write out their node name to
the lock file. We were using `getfqdn()` for this, but it seems to produce
inconsistent results when used from within some github actions containers.

We get this error because getfqdn() seems to return a short name in one place
and a fully qualified name in another:

```
  File "/home/runner/work/spack/spack/lib/spack/spack/test/llnl/util/lock.py", line 1211, in p1
    assert lock.host == self.host
AssertionError: assert 'fv-az290-764....cloudapp.net' == 'fv-az290-764'
  - fv-az290-764.internal.cloudapp.net
  + fv-az290-764
!!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
== 1 failed, 2547 passed, 7 skipped, 22 xfailed, 2 xpassed in 1238.67 seconds ==
```

This seems to stem from https://bugs.python.org/issue5004.

We don't really need to get a fully qualified hostname for debugging, so use
`gethostname()` because its results are more consistent. This seems to fix the
issue.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-04-15 00:01:41 -07:00
Gregory Becker
393542064d updates for new tutorial
update s3 bucket
update tutorial branch
2021-04-14 23:53:07 -07:00
Tiziano Müller
dee030618f
Documentation: update intel-parallel-studio instructions (#22248)
* Clarify stub compiler definition in compilers.yaml
* Update explanation of why stub compiler definition is needed
* Add note about required module definition when using Spack-installed
  intel-parallel-studio as intel-compiler
* Add suggestion about updating package config preferences based on
  choice of variants when installing intel-parallel-studio to avoid
  reinstallation
2021-04-13 13:31:14 -07:00
Tiziano Müller
a580788d86
intel-parallel-studio: fix vtune installation for 2020+ (#22255)
vtune_amplifier got renamed to vtune_profiler for the 2020+ suite
2021-04-13 13:01:58 +02:00
Peter Scheibel
51df9b0c9c
Externals with merged prefixes (#22653)
We remove system paths from search variables like PATH and 
from -L options because they may contain many packages and
could interfere with Spack-built packages. External packages 
may be installed to prefixes that are not actually system paths 
but are still "merged" in the sense that many other packages are
installed there. To avoid conflicts, this PR places all external
packages at the end of search paths.
2021-04-12 11:19:29 +02:00
Massimiliano Culpo
215d194482
ASP-based solver: assign OS correctly with inheritance from parent (#22896)
fixes #22871

When in presence of multiple choices for the operating system
we were lacking a rule to derive the node OS if it was
inherited.
2021-04-11 01:01:09 -06:00
Peter Scheibel
f624ce0834
Build process output: handle UTF-8 for python 3.x to 3.7 (#22888)
We set LC_ALL=C to encourage a build process to generate ASCII
output (so our logger daemon can decode it). Most packages
respect this but it appears that intel-oneapi-compilers does
not in some cases (see #22813). This reads the output of the build
process as UTF-8, which still works if the build process respects
LC_ALL=C but also works if the process generates UTF-8 output.

For Python >= 3.7 all files are opened with UTF-8 encoding by
default. Python 2 does not support the encoding argument on
'open', so to support Python 2 the files would have to be
opened in byte mode and explicitly decoded (as a side note,
this would be the only way to handle other encodings without
being informed of them in advance).
2021-04-09 18:10:01 -07:00
Todd Gamblin
19b6d3589a
bugfix: spack config blame should print all lines of config (#22598)
* bugfix: fix representation of null in spack_yaml output

Nulls were previously printed differently by `spack config blame config`
and `spack config get config`.  Fix this in the `spack_yaml` dumpers.

* bugfix: `spack config blame` should print all lines of config

`spack config blame` was not printing all lines of configuration because
there were no annotations for empty lines in the YAML dump output. Fix
this by removing empty lines.
2021-04-08 16:37:16 +02:00
Toyohisa Kameyama
d805be02ec
autotools: ensure config.guess and config.sub are writeable before patching them (#19837) 2021-04-08 14:07:43 +02:00
Robert Cohn
c8b4414230
[oneapi] fix mkl deps, externally installed, and docs (#22607) 2021-04-07 10:31:08 -06:00
Harmen Stoppels
bbc666a1d2
meson: added variants, changed defaults for the build system (#22715)
- Use debugoptimized as default build type, just like RelWithDebInfo for cmake
- Do not strip by default, and add a default_library variant which conveniently support both shared and static
2021-04-06 17:57:31 +02:00
Harmen Stoppels
0fcda35a71
spack location: fix usage without args (#22755) 2021-04-06 08:17:58 +00:00
Adam J. Stewart
3336fff229
Remove erroneous warnings about quotes for from_source_file (#22767) 2021-04-06 07:13:54 +02:00
Zack Galbreath
7cc2db1b4e
Check against a list of known-broken specs in ci generate (#22690)
* Strip leading slash from S3 key in url_exists()

* Check against a list of known-broken specs in `ci generate`
2021-04-02 17:40:47 -06:00
Harmen Stoppels
69d123a1a0
Document unzip (#22723) 2021-04-02 20:56:24 +00:00
Todd Gamblin
0d387678b7
concretizer: improve display of optimization criteria (#22433)
By default, clingo doesn't show any optimization criteria (maximized or
minimized sums) if the set they aggregate is empty. Per the clingo
mailing list, we can get around that by adding, e.g.:

```
 #minimize{ 0@2 : #true }.
```

for the 2nd criterion. This forces clingo to print out the criterion but
does not affect the optimization.

This PR adds directives as above for all of our optimization criteria, as
well as facts with descriptions of each criterion,like this:

```
opt_criterion(2, "number of non-default variants")
```

We use facts in `concretize.lp` rather than hard-coding these in `asp.py`
so that the names can be maintained in the same place as the other
optimization criteria.

The now-displayed weights and the names are used to display optimization
output like this:

```console
(spackle):solver> spack solve --show opt zlib
==> Best of 0 answers.
==> Optimization Criteria:
  Priority  Criterion                                            Value
  1         version weight                                           0
  2         number of non-default variants (roots)                   0
  3         multi-valued variants + preferred providers for roots    0
  4         number of non-default variants (non-roots)               0
  5         number of non-default providers (non-roots)              0
  6         count of non-root multi-valued variants                  0
  7         compiler matches + number of nodes                       1
  8         version badness                                          0
  9         non-preferred compilers                                  0
  10        target matches                                           0
  11        non-preferred targets                                    0

zlib@1.2.11%apple-clang@12.0.0+optimize+pic+shared arch=darwin-catalina-skylake
```

Note that this is all hidden behind a `--show opt` option to `spack
solve`. Optimization weights are no longer shown by default, but you can
at least inspect them and more easily understand what is going on.

- [x] always show optimization criteria in `clingo` output
- [x] add `opt_criterion()` facts for all optimizationc criteria
- [x] make display of opt criteria optional in `spack solve`
- [x] rework how optimization criteria are displayed, and add a `--show opt`
      optiong to `spack solve`
2021-04-02 08:54:49 +00:00
Greg Becker
fb062428f9 add CachedCMakePackage for using CMake initial config files
CachedCMakePackage is a CMakePackage subclass for using CMake initial
cache. This feature of CMake allows packages to increase reproducibility,
especially between spack builds and manual builds. It also allows
packages to sidestep certain parsing bugs in extremely long cmake
commands, and to avoid system limits on the length of the command line.

Co-authored by: Chris White <white238@llnl.gov>
2021-04-01 20:06:39 -07:00
Todd Gamblin
fc48c63355 Revert "CachedCMakePackage for using *.cmake initial config files (#19316)""
This reverts commit 7daf582357.
2021-04-01 20:06:39 -07:00
Elizabeth Fischer
82e97124c8
bugfix: compiler wrappers should handle extra spaces between arguments (#22725)
In the face of two consecutive spaces in the command line, the compiler wrapper would skip all remaining arguments, causing problems building py-scipy with Intel compiler. This PR solves the problem.

* Fixed compiler wrapper in the face of extra spaces between arguments

Co-authored-by: Elizabeth Fischer <elizabeth.fischer@alaska.edu>
2021-04-01 18:39:06 +00:00
Greg Becker
7daf582357 CachedCMakePackage for using *.cmake initial config files (#19316)"
Original commit message:
This feature of CMake allows packages to increase reproducibility, especially between
Spack- and manual builds. It also allows packages to sidestep certain parsing bugs in
extremely long ``cmake`` commands, and to avoid system limits on the length of the
command line.

Adding:
Co-authored by: Chris White <white238@llnl.gov>

This reverts commit c4f0a3cf6c.
2021-03-31 18:38:22 -07:00
Chris White
c4f0a3cf6c Revert "CachedCMakePackage for using *.cmake initial config files (#19316)"
This reverts commit 764c170530.
2021-03-31 18:34:45 -07:00
Greg Becker
764c170530
CachedCMakePackage for using *.cmake initial config files (#19316)
CachedCMakePackage is a specialized class for packages built using CMake initial cache.

This feature of CMake allows packages to increase reproducibility, especially between
Spack- and manual builds. It also allows packages to sidestep certain parsing bugs in
extremely long ``cmake`` commands, and to avoid system limits on the length of the
command line.
2021-03-31 23:55:19 +00:00
Todd Gamblin
cf9adfd748
hotfix: make ifx work with autoconf <= 2.69 in Spack (#22683)
Autoconf before 2.70 will erroneously pass ifx's -loopopt argument to the
linker, requiring all packages to use autoconf 2.70 or newer to use ifx.

This is a hotfix enabling ifx to be used in Spack. Instead of bothering
to upgrade autoconf for every package, we'll just strip out the
problematic flag if we're in `ld` mode.

- [x] Add a conditional to the `cc` wrapper to skip `-loopopt` in `ld`
      mode. This can probably be generalized in the future to strip more
      things (e.g., via an environment variable we can constrol from
      Spack) but it's good enough for now.

- [x] Add a test ensuring that `-loopopt` arguments are stripped in link
      mode, but not in compile mode.
2021-03-31 21:47:38 +00:00
Todd Gamblin
a1d9a56a43 specs: remove "or ''" from Spec comparisons
Since `lazy_lexicographic_ordering` handles `None` comparison for us, we
don't need to adjust the spec comparators to return empty strings or
other type-specific empty types. We can just leverage the None-awareness
of `lazy_lexicographic_ordering`.

- [x] remove "or ''" from `_cmp_iter` in `Spec`
- [x] remove setting of `self.namespace` to `''` in `MockPackage`
2021-03-31 14:39:23 -07:00
Todd Gamblin
01a6adb5f7 specs: use lazy lexicographic comparison instead of key_ordering
We have been using the `@llnl.util.lang.key_ordering` decorator for specs
and most of their components. This leverages the fact that in Python,
tuple comparison is lexicographic. It allows you to implement a
`_cmp_key` method on your class, and have `__eq__`, `__lt__`, etc.
implemented automatically using that key. For example, you might use
tuple keys to implement comparison, e.g.:

```python
class Widget:
    # author implements this
    def _cmp_key(self):
        return (
            self.a,
            self.b,
            (self.c, self.d),
            self.e
        )

    # operators are generated by @key_ordering
    def __eq__(self, other):
        return self._cmp_key() == other._cmp_key()

    def __lt__(self):
        return self._cmp_key() < other._cmp_key()

    # etc.
```

The issue there for simple comparators is that we have to bulid the
tuples *and* we have to generate all the values in them up front. When
implementing comparisons for large data structures, this can be costly.

This PR replaces `@key_ordering` with a new decorator,
`@lazy_lexicographic_ordering`. Lazy lexicographic comparison maps the
tuple comparison shown above to generator functions. Instead of comparing
based on pre-constructed tuple keys, users of this decorator can compare
using elements from a generator. So, you'd write:

```python
@lazy_lexicographic_ordering
class Widget:
    def _cmp_iter(self):
        yield a
        yield b
        def cd_fun():
            yield c
            yield d
        yield cd_fun
        yield e

    # operators are added by decorator (but are a bit more complex)

There are no tuples that have to be pre-constructed, and the generator
does not have to complete. Instead of tuples, we simply make functions
that lazily yield what would've been in the tuple. If a yielded value is
a `callable`, the comparison functions will call it and recursively
compar it. The comparator just walks the data structure like you'd expect
it to.

The ``@lazy_lexicographic_ordering`` decorator handles the details of
implementing comparison operators, and the ``Widget`` implementor only
has to worry about writing ``_cmp_iter``, and making sure the elements in
it are also comparable.

Using this PR shaves another 1.5 sec off the runtime of `spack buildcache
list`, and it also speeds up Spec comparison by about 30%. The runtime
improvement comes mostly from *not* calling `hash()` `_cmp_iter()`.
2021-03-31 14:39:23 -07:00
Todd Gamblin
fd12cba18b specs: speed up traversal by avoiding redundant canonicalization 2021-03-31 14:39:23 -07:00
Harmen Stoppels
1db6cd5d16
Make -j flag less exceptional (#22360)
* Make -j flag less exceptional

The -j flag in spack behaves differently from make, ctest, ninja, etc,
because it caps the number of jobs to an arbitrary number 16.
Spack will behave like other tools if `spack install` uses a reasonable
default, and `spack install -j <num>` *overrides* that default.

This will be particularly useful for Spack usage outside of a traditional
HPC context and for HPC centers that encourage users to compile on
login nodes with many cores instead of on compute nodes, which has
become increasingly common as individual nodes have more cores.

This maintains the existing default value of min(num_cpus, 16). However, 
as it is right now, Spack does a poor job at determining the number of 
cpus on linux, since it doesn't take cgroups into account. This is
particularly problematic when using distributed builds with slurm. This PR
also introduces `spack.util.cpus.cpus_available()` to consolidate
knowledge on determining the number of available cores, and improves
core detection for linux. This should also improve core detection for Docker/
Kubernetes, which also use cgroups.
2021-03-30 12:03:50 -07:00
Harmen Stoppels
b848fab3ec
SpackCommand objects can set global args (#22318)
This commit extends the API of the __call__ method of the
SpackCommand class to permit passing global arguments 
like those interposed between the main "spack" command 
and the subsequent subcommand.

The functionality is used to fix an issue where running

```spack -e . location -b some_package```

ends up printing the name of the environment instead of 
the build directory of the package, because the location arg 
parser also stores this value as `arg.env`.
2021-03-30 18:47:36 +02:00
Massimiliano Culpo
c3bab11ee1
Bootstrapping: swap store before configuration (#22631)
fixes #22294

A combination of the swapping order for global variables and
the fact that most of them are lazily evaluated resulted in
custom install tree not being taken into account if clingo
had to be bootstrapped.

This commit fixes that particular issue, but a broader refactor
may be needed to ensure that similar situations won't affect us
in the future.
2021-03-30 17:23:32 +02:00
Harmen Stoppels
a37c916dff
Bootstrap: add _builtin config scope (#22610) 2021-03-30 13:41:34 +02:00
Harmen Stoppels
2a4c06b1e6
Fix clearing cache of InternalConfigScope (#22609)
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2021-03-30 11:23:39 +00:00
Danny McClanahan
f67d4774ea
move binary indices are stored into the misc_cache (#22500)
Remote buildcache indices need to be stored in a place that does not
require writing to the Spack prefix. Move them from the install_tree to
the misc_cache.
2021-03-29 17:20:04 -07:00
Cyrus Harrison
79193dc37c
bugfix for active when pkg is already active error (#22587)
* bugfix for active when pkg is already active error

Co-authored-by: Greg Becker <becker33@llnl.gov>
2021-03-29 17:09:34 -07:00
Massimiliano Culpo
4079bbce97 Externals are preferred even when they have non-default variant values
fixes #22596

Variants which are specified in an external spec are not
scored negatively if they encode a non-default value.
2021-03-29 16:06:11 -07:00
Massimiliano Culpo
4ed5c366fa Enforce uniqueness of the version_weight atom per node
fixes #22565

This change enforces the uniqueness of the version_weight
atom per node(Package) in the DAG. It does so by applying
FTSE and adding an extra layer of indirection with the
possible_version_weight/2 atom.

Before this change it may have happened that for the same
node two different version_weight/2 were in the answer set,
each of which referred to a different spec with the same
version, and their weights would sum up.

This lead to unexpected result like preferring to build a
new version of an external if the external version was
older.
2021-03-29 16:06:11 -07:00
Harmen Stoppels
e89c9ec082
Make stage use concrete specs from environment (#22320)
* Make stage use concrete specs from environment

Same as in https://github.com/spack/spack/pull/21642, the idea is that
we want to easily stage a package that fails to build in a complex
environment. Instead of making the user create a spec by hand (basically
transforming all the rules in the environment manifest into a spec,
defying the purpose of the environment...), use the provided spec as a
filter for the already concretized specs. This also speeds up things,
cause we don't have to reconcretize.
2021-03-29 11:10:44 -07:00
Harmen Stoppels
8b16728fd9
Add "spack [cd|location] --source-dir" (#22321) 2021-03-29 17:31:24 +02:00
Massimiliano Culpo
d5fa509b07
clingo: modify recipe for bootstrapping (#22354)
* clingo: modify recipe for bootstrapping

Modifications:
- clingo builds with shared Python only if ^python+shared
- avoid building the clingo app for bootstrapping
- don't link to libpython when bootstrapping

* Remove option that breaks on linux

* Give more hints for the current Python

* Disable CLINGO_BUILD_PY_SHARED for bootstrapping

* bootstrapping: try to detect the current python from std library

This is much faster than calling external executables

* Fix compatibility with Python 2.6

* Give hints on which compiler and OS to use when bootstrapping

This change hints which compiler to use for bootstrapping clingo
(either GCC or Apple Clang on MacOS). On Cray platforms it also
hints to build for the frontend system, where software is meant
to be installed.

* Use spec_for_current_python to constrain module requirement
2021-03-26 12:43:41 -05:00
Massimiliano Culpo
35c3a25ca6
ASP-based solver: model disjoint sets for multivalued variants (#22534)
* ASP-based solver: avoid adding values to variants when they're set

fixes #22533
fixes #21911

Added a rule that prevents any value to slip in a variant when the
variant is set explicitly. This is relevant for multi-valued variants,
in particular for those that have disjoint sets of values.

* Ensure disjoint sets have a clear semantics for external packages
2021-03-26 09:22:38 -05:00
Massimiliano Culpo
0bed64503d
Make SingleFileScope able to repopulate the cache after clearing it (#22559)
fixes #22547

SingleFileScope was not able to repopulate its cache before this
change. This was affecting the configuration seen by environments
using clingo bootstrapped from sources, since the bootstrapping
operation involved a few cache invalidation for config files.
2021-03-26 01:16:11 -06:00
Frédéric Simonis
38841ad746
Add doc for mirror of env (#22525) 2021-03-24 20:55:15 +00:00
Sergey Kosukhin
a1aec1450b
Add stdcxx_libs for PGI and Cray compilers (#22491) 2021-03-23 14:19:03 -06:00
Massimiliano Culpo
413c422e53
bootstrap: account for platform specific configuration scopes (#22489)
This change accounts for platform specific configuration scopes,
like ~/.spack/linux, during bootstrapping. These scopes were
previously not accounted for and that was causing issues e.g.
when searching for compilers.
2021-03-23 14:29:13 -05:00
Robert Cohn
f57626a7c4
Oneapi packages: update URLs, environment management, and dependencies (#22202)
* Replace URL computation in base IntelOneApiPackage class with
  defining URLs in component packages (this is expected to be
  simpler for now)
* Add component_dir property that all oneAPI component packages must
  define. This property names a directory that should exist after
  installation completes (useful for making sure the install was
  successful) and also defines the search location for the
  component's environment update script.
* Add needed dependencies for components (e.g. intel-oneapi-dnn
  requires intel-oneapi-tbb). The compilers provided by
  intel-oneapi-compilers need some components under certain
  circumstances (e.g. when enabling SYCL support) but these were
  omitted since the libraries should only be linked when a
  dependent package requests that feature
* Remove individual setup_run_environment implementations and use
  IntelOneApiPackage superclass method which sources vars.sh 
  (located in a subdirectory of component_dir)
* Add documentation for IntelOneApiPackge build system

Co-authored-by: Vasily Danilin <vasily.danilin@yandex.ru>
2021-03-22 17:35:45 -07:00
Greg Becker
95880d0dac
use link/run deps only to compare extensions (#22396) 2021-03-22 10:28:14 -05:00
Greg Becker
f4b56620e5
Document cli syntax for environment scopes (#20344)
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-03-21 10:14:13 +00:00
Harmen Stoppels
196db55855
Fix broken spack -c flag (#22361) 2021-03-18 15:26:30 +01:00
Massimiliano Culpo
8cf6ad9917
archspec: update to latest version (#22357) 2021-03-18 00:23:09 -07:00
Harmen Stoppels
15645147ed
Tab to spaces (#22362) 2021-03-18 06:20:06 +00:00
Harmen Stoppels
e57053bd32
Fix indentation compiler wrapper issue (#22352) 2021-03-17 18:45:10 +00:00
AMD Toolchain Support
e6c8fa1311
aocc: add support for v3.0 compilers (#22219)
A mitigation of a known issue that affects v3.0 is added, see
https://developer.amd.com/wp-content/resources/AOCC-3.0-Install-Guide.pdf
2021-03-17 15:06:25 +00:00
Harmen Stoppels
43dd7b84c0
spack location: bugfix for out of source build dirs (#22348) 2021-03-17 14:38:14 +00:00
Danny McClanahan
18fbd58fe6
fix weird failure in variant values (#22328) 2021-03-16 16:04:51 -07:00
Wouter Deconinck
c9ba95cc5c
containerize: fix typo in documentation (#22331)
Before this fix, `spack containerize` complains that `centos/7` is invalid
(should have been `centos:7`)
2021-03-16 21:02:26 +00:00
Massimiliano Culpo
b304b4bdb0
Speed-up CI by reorganizing tests (#22247)
* unit tests: mark slow tests as "maybeslow"

This commit also removes the "network" marker and
marks every "network" test as "maybeslow". Tests
marked as db are maintained, but they're not slow
anymore.

* GA: require style tests to pass before running unit-tests

* GA: make MacOS unit tests fail fast

* GA: move all unit tests into the same workflow, run style tests as a prerequisite

All the unit tests have been moved into the same workflow so that a single
run of the dorny/paths-filter action can be used to ask for coverage based
on the files that have been changed in a PR. The basic idea is that for PRs
that introduce only changes to packages coverage is not necessary, this
resulting in a faster execution of the tests.

Also, for package only PRs slow unit tests are skipped.

Finally, MacOS and linux unit tests are now conditional on style tests passing
meaning that e.g. we won't waste a MacOS worker if we know that the PR has
flake8 issues.

* Addressed review comments

* Skipping slow tests on MacOS for package only recipes

* QA: make tests on changes correct before merging
2021-03-16 08:16:31 -07:00
Todd Gamblin
3e570ce694 bugfix: allow imposed constraints to be overridden in special cases
In most cases, we want condition_holds(ID) to imply any imposed
constraints associated with the ID. However, the dependency relationship
in Spack is special because it's "extra" conditional -- a dependency
*condition* may hold, but we have decided that externals will not have
dependencies, so we need a way to avoid having imposed constraints appear
for nodes that don't exist.

This introduces a new rule that says that constraints are imposed
*unless* we define `do_not_impose(ID)`. This allows rules like
dependencies, which rely on more than just spec conditions, to cancel
imposed constraints.

We add one special case for this: dependencies of externals.
2021-03-16 12:50:14 +01:00
Todd Gamblin
e7cba04b95 bugfix: do not generate dep conditions when no dependency
We only consider test dependencies some of the time. Some packages are
*only* test dependencies. Spack's algorithm was previously generating
dependency conditions that could hold, *even* if there was no potential
dependency type.

- [x] change asp.py so that this can't happen -- we now only generate
      dependency types for possible dependencies.
2021-03-16 12:50:14 +01:00
Todd Gamblin
ada6ecc797 concretizer: unify logic for spec conditionals
This builds on #20638 by unifying all the places in the concretizer where
things are conditional on specs. Previously, we duplicated a common spec
conditional pattern for dependencies, virtual providers, conflicts, and
externals. That was introduced in #20423 and refined in #20507, and
roughly looked as follows.

Given some directives in a package like:

```python
depends_on("foo@1.0+bar", when="@2.0+variant")
provides("mpi@2:", when="@1.9:")
```

We handled the `@2.0+variant` and `@1.9:` parts by generating generated
`dependency_condition()`, `required_dependency_condition()`, and
`imposed_dependency_condition()` facts to trigger rules like this:

```prolog
dependency_conditions_hold(ID, Parent, Dependency) :-
  attr(Name, Arg1)             : required_dependency_condition(ID, Name, Arg1);
  attr(Name, Arg1, Arg2)       : required_dependency_condition(ID, Name, Arg1, Arg2);
  attr(Name, Arg1, Arg2, Arg3) : required_dependency_condition(ID, Name, Arg1, Arg2, Arg3);
  dependency_condition(ID, Parent, Dependency);
  node(Parent).
```

And we handled `foo@1.0+bar` and `mpi@2:` parts ("imposed constraints")
like this:

```prolog
attr(Name, Arg1, Arg2) :-
  dependency_conditions_hold(ID, Package, Dependency),
  imposed_dependency_condition(ID, Name, Arg1, Arg2).

attr(Name, Arg1, Arg2, Arg3) :-
  dependency_conditions_hold(ID, Package, Dependency),
  imposed_dependency_condition(ID, Name, Arg1, Arg2, Arg3).
```

These rules were repeated with different input predicates for
requirements (e.g., `required_dependency_condition`) and imposed
constraints (e.g., `imposed_dependency_condition`) throughout
`concretize.lp`. In #20638 it got to be a bit confusing, because we used
the same `dependency_condition_holds` predicate to impose constraints on
conditional dependencies and virtual providers. So, even though the
pattern was repeated, some of the conditional rules were conjoined in a
weird way.

Instead of repeating this pattern everywhere, we now have *one* set of
consolidated rules for conditions:

```prolog
condition_holds(ID) :-
  condition(ID);
  attr(Name, A1)         : condition_requirement(ID, Name, A1);
  attr(Name, A1, A2)     : condition_requirement(ID, Name, A1, A2);
  attr(Name, A1, A2, A3) : condition_requirement(ID, Name, A1, A2, A3).

attr(Name, A1)         :- condition_holds(ID), imposed_constraint(ID, Name, A1).
attr(Name, A1, A2)     :- condition_holds(ID), imposed_constraint(ID, Name, A1, A2).
attr(Name, A1, A2, A3) :- condition_holds(ID), imposed_constraint(ID, Name, A1, A2, A3).
```

this allows us to use `condition(ID)` and `condition_holds(ID)` to
encapsulate the conditional logic on specs in all the scenarios where we
need it. Instead of defining predicates for the requirements and imposed
constraints, we generate the condition inputs with generic facts, and
define predicates to associate the condition ID with a particular
scenario. So, now, the generated facts for a condition look like this:

```prolog
condition(121).
condition_requirement(121,"node","cairo").
condition_requirement(121,"variant_value","cairo","fc","True").
imposed_constraint(121,"version_satisfies","fontconfig","2.10.91:").
dependency_condition(121,"cairo","fontconfig").
dependency_type(121,"build").
dependency_type(121,"link").
```

The requirements and imposed constraints are generic, and we associate
them with their meaning via the id. Here, `dependency_condition(121,
"cairo", "fontconfig")` tells us that condition 121 has to do with the
dependency of `cairo` on `fontconfig`, and the conditional dependency
rules just become:

```prolog
dependency_holds(Package, Dependency, Type) :-
  dependency_condition(ID, Package, Dependency),
  dependency_type(ID, Type),
  condition_holds(ID).
```

Dependencies, virtuals, conflicts, and externals all now use similar
patterns, and the logic for generating condition facts is common to all
of them on the python side, as well. The more specific routines like
`package_dependencies_rules` just call `self.condition(...)` to get an id
and generate requirements and imposed constraints, then they generate
their extra facts with the returned id, like this:

```python
    def package_dependencies_rules(self, pkg, tests):
        """Translate 'depends_on' directives into ASP logic."""
        for _, conditions in sorted(pkg.dependencies.items()):
            for cond, dep in sorted(conditions.items()):
                condition_id = self.condition(cond, dep.spec, pkg.name)  # create a condition and get its id
                self.gen.fact(fn.dependency_condition(  # associate specifics about the dependency w/the id
                    condition_id, pkg.name, dep.spec.name
                ))
        # etc.
```

- [x] unify generation and logic for conditions
- [x] use unified logic for dependencies
- [x] use unified logic for virtuals
- [x] use unified logic for conflicts
- [x] use unified logic for externals

LocalWords:  concretizer mpi attr Arg concretize lp cairo fc fontconfig
LocalWords:  virtuals def pkg cond dep fn refactor github py
2021-03-16 12:50:14 +01:00
Harmen Stoppels
195341113e
Expand relative dev paths in environment files (#22045)
* Rewrite relative dev_spec paths internally to absolute paths in case of relocation of the environment file

* Test relative paths for dev_path in environments

* Add a --keep-relative flag to spack env create

This ensures that relative paths of develop paths are not expanded to
absolute paths when initializing the environment in a different location
from the spack.yaml init file.
2021-03-15 15:38:35 -05:00
Harmen Stoppels
4f1d9d6095
Propagate --test= for environments (#22040)
* Propagate --test= for environments

* Improve help comment for spack concretize --test flag

* Add tests for --test with environments
2021-03-15 15:34:18 -05:00
Adam J. Stewart
70c505a0b8
Fix use of quotes in Python build system (#22279) 2021-03-15 11:11:27 -07:00
Vanessasaurus
6ff717f395
do not validate variants of concrete specs in solver setup (#22272)
Currently, regardless of a spec being concrete or not, we validate its variants in `spec_clauses` (part of `SpackSolverSetup`).  

This PR skips the check if the spec is concrete.

The reason we want to do this is so that the solver setup class (really, `spec_clauses`) can be used for cases when we just want the logic statements / facts (is that what they are called?) and we don't need to re-validate an already concrete spec.  We can't change existing concrete specs, and we have to be able to handle them *even if they violate constraints in the current spack*.  This happens in practice if we are doing the validation for a spec produced by a different spack install.

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2021-03-14 19:00:15 +00:00
Vanessasaurus
746081e933
adding spack -c to set one off config arguments (#22251)
This pull request will add the ability for a user to add a configuration argument on the fly, on the command line, e.g.,:

```bash
$ spack -c config:install_tree:root:/path/to/config.yaml -c packages:all:compiler:[gcc] list --help
```
The above command doesn't do anything (I'm just getting help for list) but you can imagine having another root of packages, and updating it on the fly for a command (something I'd like to do in the near future!)

I've moved the logic for config_add that used to be in spack/cmd/config.py into spack/config.py proper, and now both the main.py (where spack commands live) and spack/cmd/config.py use these functions. I only needed spack config add, so I didn't move the others. We can move the others if there are also needed in multiple places.
2021-03-13 05:31:26 +00:00
Tamara Dahlgren
61baa40160
bugfix: ensure spack test list still works (#22203)
Was getting the following error:

```
$ spack test list
==> Error: issubclass() arg 1 must be a class
```

This PR adds a check in `has_test_method` (in case it is re-used elsewhere such as #22097) and ensures a class is passed to the method from `spack test list`.
2021-03-12 09:56:17 -08:00
Scott Wittenburg
7b97fe206b
Pipelines: Fix issue that allowed failing jobs to pass (#22199)
This is a workaround for an issue with how "spack install" is invoked from within "spack ci rebuild".  The fact that we don't get an exception or even the actual returncode when using the object returned by spack.util.executable.which('spack') to install the target spec means we get no indication of failures about the install command itself.  Instead we rely on the subsequent buildcache creation failure to fail the job.
2021-03-10 11:11:30 -08:00
Harmen Stoppels
1659beb220
Fix spack graph when deptypes are filtered (#22121) 2021-03-08 16:47:00 -08:00
Glenn Johnson
ccc7ed0af9
Add --vanilla flag to r build system (#22166)
Unlike the other commands of the `R CMD` interface, the `INSTALL` command
will read `Renviron` files. This can potentially break builds of r-
packages, depending on what is set in the `Renviron` file. This PR adds
the `--vanilla` flag to ensure that neither `Rprofile` nor `Renviron` files
are read during Spack builds of r- packages.
2021-03-08 15:53:12 -07:00
Todd Gamblin
8d3272f82d
spack python: add --path option (#22006)
This adds a `--path` option to `spack python` that shows the `python`
interpreter that Spack is using.

e.g.:

```console
$ spack python --path
/Users/gamblin2/src/spack/var/spack/environments/default/.spack-env/view/bin/python
```

This is useful for debugging, and we can ask users to run it to
understand what python Spack is picking up via preferences in `bin/spack`
and via the `SPACK_PYTHON` environment variable introduced in #21222.
2021-03-07 13:37:26 -08:00
Todd Gamblin
7aa5cc241d
add spack test list --all (#22032)
`spack test list` will show you which *installed* packages can be tested
but it won't show you which packages have tests.

- [x] add `spack test list --all` to show which packages have test methods
- [x] update `has_test_method()` to handle package instances *and*
      package classes.
2021-03-07 11:44:17 -08:00
Glenn Johnson
b5916451fd
Improve R package creation (#21861)
* Improve R package creation

This PR adds the `list_url` attribute to CRAN R packages when using
`spack create`. It also adds the `git` attribute to R Bioconductor
packages upon creation.

* Switch over to using cran/bioc attributes

The cran/bioc entries are set to have the '=' line up with homepage
entry, but homepage does not need to exist in the package file. If it
does not, that could affect the alignment.

* Do not have to split bioc

* Edit R package documentation

Explain Bioconductor packages and add `cran` and `bioc` attributes.

* Update lib/spack/docs/build_systems/rpackage.rst

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

* Update lib/spack/docs/build_systems/rpackage.rst

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

* Simplify the cran attribute

The version can be faked so that the cran attribute is simply equal to
the CRAN package name.

* Edit the docs to reflect new `cran` attribute format

* Use the first element of self.versions() for url

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-03-05 21:19:15 +00:00
Greg Becker
92b7805e40
Allow relative paths in config files (relative to file dirname) (#21996)
This allows users to use relative paths for mirrors and repos and other things that may be part of a Spack environment.  There are two ways to do it.

1. Relative to the file

    ```yaml
    spack:
      repos:
      - local_dir/my_repository
    ```

    Which will refer to a repository like this in the directory where `spack.yaml` lives:

    ```
    env/
      spack.yaml  <-- the config file above
      local_dir/
        my_repository/  <-- this repository
          repo.yaml
          packages/
    ```

2. Relative to the environment

    ```yaml
    spack:
      repos:
      - $env/local_dir/my_repository
    ```

Both of these would refer to the same directory, but they differ for included files.  For example, if you had this layout:

```
env/
    spack.yaml
    repository/
    includes/
        repos.yaml
        repository/
```

And this `spack.yaml`:

```yaml
spack:
    include: includes/repos.yaml
```

Then, these two `repos.yaml` files are functionally different:

```yaml
repos:
    - $env/repository    # refers to env/repository/ above

repos:
    - repository    # refers to env/includes/repository/ above
```
    
The $env variable will not be evaluated if there is no active environment. This generally means that it should not be used outside of an environment's spack.yaml file. However, if other aspects of your workflow guarantee that there is always an active environment, it may be used in other config scopes.
2021-03-04 22:29:48 -08:00
Massimiliano Culpo
10e9e142b7
Bootstrap clingo from sources (#21446)
* Allow the bootstrapping of clingo from sources

Allow python builds with system python as external
for MacOS

* Ensure consistent configuration when bootstrapping clingo

This commit uses context managers to ensure we can
bootstrap clingo using a consistent configuration
regardless of the use case being managed.

* Github actions: test clingo with bootstrapping from sources

* Add command to inspect and clean the bootstrap store

 Prevent users to set the install tree root to the bootstrap store

* clingo: documented how to bootstrap from sources

Co-authored-by: Gregory Becker <becker33@llnl.gov>
2021-03-03 09:37:46 -08:00
Adam J. Stewart
50ffb4b868
Assert the use of the patch directive with a non-existing file will fail (#21524) 2021-03-02 09:58:47 +00:00
Tamara Dahlgren
e775cbb0c0
Raise InstallError if any explicit specs is skipped (#21980) 2021-02-27 09:21:56 +01:00
Gregory Lee
b56d65fce5
Compilers: make oneapi ifx version_regex tolerant to wrappers (#21742)
If a user creates a wrapper for the ifx binary called ifx_orig,
this causes the ifx --version command to produce:

$ ifx --version
ifx_orig (IFORT) 2021.1 Beta 20201113
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.

The regex for ifx currently expects the output to begin with
"ifx (IFORT)..." so the wrapper would not be detected as ifx. This
PR removes the need for the static "ifx" string which allows wrappers
to be detected as ifx.

In general, the Intel compiler regexes do not include the invoked
executable name (i.e., ifort, icc, icx, etc.), so this is not
expected to cause any issues.
2021-02-26 14:57:40 -08:00
Andreas Baumbach
bbed6dc9a1
make spack fetch work with environments (#19166)
* make `spack fetch` work with environments
* previously: `spack fetch` required the explicit statement of
              the specs to be fetched, even when in an environment
* now: if there is no spec(s) provided to `spack fetch` we check
       if an environment is active and if yes we fetch all
       uninstalled specs.
2021-02-26 08:02:17 +00:00
Greg Becker
cedbded9d7
typo fix (#21967) 2021-02-25 19:10:55 -08:00
Michael Kuron
4453058862
Old concretizer: prevent unexpected propagation of external config (#20976)
When using an external package with the old concretizer, all
dependencies of that external package were severed. This was not
performed bidirectionally though, so for an external package W with
a dependency on Z, if some other package Y depended on Z, Z could
still pull properties (e.g. compiler) from W since it was not
severed as a parent dependency.

This performs the severing bidirectionally, and adds tests to
confirm expected behavior when using config from DAG-adjacent
packages during concretization.
2021-02-25 15:42:40 -08:00
Paul Ferrell
e85a8cde37
Config prefer upstream (#21487)
This allows for quickly configuring a spack install/env to use upstream packages by default. This is particularly important when upstreaming from a set of officially supported spack installs on a production cluster. By configuring such that package preferences match the upstream, you ensure maximal reuse of existing package installations.
2021-02-24 10:57:50 -08:00
Scott Wittenburg
ee5992783c
Gitlab fix pr workflow (#21786)
Fixes for gitlab pipelines

* Remove accidentally retained testing branch name
* Generate pipeline w/out debug mode
* Make jobs interruptible for auto-cancel pending
* Work around concretization conflicts
2021-02-23 19:19:06 -07:00
Josh Essman
93ed1a410c
Updates to support clingo-cffi (#20657)
* Support clingo when used with cffi

Clingo recently merged in a new Python module option based on cffi.

Compatibility with this module requires a few changes to spack - it does not automatically convert strings/ints/etc to Symbol and clingo.Symbol.string throws on failure.

manually convert str/int to clingo.Symbol types
catch stringify exceptions
add job for clingo-cffi to Spack CI
switch to potassco-vendored wheel for clingo-cffi CI
on_unsat argument when cffi
2021-02-23 23:46:37 +00:00
Nathan Hanford
8ef67e2b15
New splice method in class Spec. (#20262)
* Spec.splice feature

Construct a new spec with a dependency swapped out. Currently can only swap dependencies of the same name, and can only apply to concrete specs.

This feature is not yet attached to any install functionality, but will eventually allow us to "rewire" a package to depend on a different set of dependencies.

Docstring is reformatted for git below

Splices dependency "other" into this ("target") Spec, and return the result as a concrete Spec.

If transitive, then other and its dependencies will be extrapolated to a list of Specs and spliced in accordingly.

For example, let there exist a dependency graph as follows:

        T
        | \
        Z<-H

In this example, Spec T depends on H and Z, and H also depends on Z.

Suppose, however, that we wish to use a differently-built H, known as H'. This function will splice in the new H' in one of two ways:

1. transitively, where H' depends on the Z' it was built with, and the new T* also directly depends on this new Z', or
2. intransitively, where the new T* and H' both depend on the original Z.

Since the Spec returned by this splicing function is no longer deployed the same way it was built, any such changes are tracked by setting the build_spec to point to the corresponding dependency from the original Spec.

Co-authored-by: Nathan Hanford <hanford1@llnl.gov>
2021-02-23 13:56:00 -08:00
Peter Scheibel
76b1d97ca5
"spack build-env" searches env for relevant spec (#21642)
If you install packages using spack install in an environment with
complex spec constraints, and the install fails, you may want to
test out the build using spack build-env; one issue (particularly
if you use concretize: together) is that it may be hard to pass
the appropriate spec that matches what the environment is
attempting to install.

This updates the build-env command to default to pulling a matching
spec from the environment rather than concretizing what the user
provides on the command line independently.

This makes a similar change to spack cd.

If the user-provided spec matches multiple specs in the environment,
then these commands will now report an error and display all
matching specs (to help the user specify).

Co-authored-by: Gregory Becker <becker33@llnl.gov>
2021-02-23 11:45:50 -08:00
Peter Scheibel
e72ad6223a
reduce strictness of directory layout spec-equality check (#21869) 2021-02-23 09:53:07 -08:00
Massimiliano Culpo
7226bd64dc
Improve error message for inconsistencies in package.py (#21811)
* Improve error message for inconsistencies in package.py

Sometimes directives refer to variants that do not exist.
Make it such that:

1. The name of the variant
2. The name of the package which is supposed to have
   such variant
3. The name of the package making this assumption

are all printed in the error message for easier debugging.

* Add unit tests
2021-02-22 19:09:43 -08:00
Todd Gamblin
56e57769bd Merge tag 'v0.16.1' into develop 2021-02-22 17:41:46 -08:00
Greg Becker
482a1a86be
respect -k/verify-ssl-false in _existing_url method (#21864) 2021-02-22 22:00:59 +00:00
Tamara Dahlgren
8dd2d740b1 Update CHANGELOG and release version 2021-02-19 11:06:33 -08:00
Tamara Dahlgren
d0798160cf Resolve (post-cherry-picking) flake8 errors 2021-02-19 11:05:53 -08:00
Tom Payerle
f5e65e94e6
documentation: correct precedence of included configs in environment spack.yaml (#18663)
fixes #17993
2021-02-19 13:31:47 +00:00
Greg Becker
de5a396ecb
bugfix: add build deps to 'full hash' (#21735)
The "full hash" was only including the link/run deps, but it should include build deps as well.
2021-02-19 00:51:00 -08:00
Scott Wittenburg
6b509a95da
Pipelines: Move PR testing stacks (currently only E4S) into spack (#21714) 2021-02-18 18:50:57 -07:00
Tom Payerle
362a4bb8b9
Fix template for Rpackage in spack create command (#21776)
The signature for configure_args in the template for new
RPackage packages was incorrect (different than what is
defined and used in lib/spack/spack/build_systems/r.py)

See issue #21774
2021-02-18 22:40:21 +00:00
Massimiliano Culpo
f2e3edf6db
Testing: use spack.store.use_store everywhere (#21656)
Keep spack.store.store and spack.store.db consistent in unit tests

* Remove calls to monkeypatch for spack.store.store and spack.store.db:
  tests that used these called one or the other, which lead to
  inconsistencies (the tests passed regardless but were fragile as a
  result)
* Fixtures making use of monkeypatch with mock_store now use the
  updated use_store function, which sets store.store and store.db
  consistently
* subprocess_context.TestState now transfers the serializes and
  restores spack.store.store (without the monkeypatch changes this
  would have created inconsistencies)
2021-02-18 13:22:49 -08:00
Tom Payerle
b448b639e6
Documentation fix: build_system configure_args for #21760 (#21761)
Corrects the signature for configure_args (and therefore configure_vars)
in documentation on RPackage build system to match the code
See issue #21760
2021-02-18 18:08:48 +00:00
Todd Gamblin
7d586234ee
bugfix: relax racy test in fg/bg output (#21755)
Since signals are fundamentally racy, We can't bound the amount of time
that the `test_foreground_background_output` test will take to get to
'on', we can only observe that it transitions to 'on'. So instead of
using an arbitrary limit, just adjust the test to allow either 'on' or
'off' followed by 'on'.

This should eliminate the spurious errors we see in CI.
2021-02-18 08:33:08 +00:00
Massimiliano Culpo
8aaf31b166
Avoid spurious warning from clingo (#21731)
There's a spurious warning that occurs whenever a spec being concretized 
does not depend on a virtual provider under any possible configuration.
2021-02-18 08:13:50 +01:00
Adam J. Stewart
3256f018eb apple-clang: add correct path to compiler wrappers (#21662)
Follow-up to #17110

### Before
```bash
CC=/Users/Adam/spack/lib/spack/env/clang/clang; export CC
SPACK_CC=/usr/bin/clang; export SPACK_CC
PATH=...:/Users/Adam/spack/lib/spack/env/apple-clang:/Users/Adam/spack/lib/spack/env/case-insensitive:/Users/Adam/spack/lib/spack/env:...; export PATH
```

### After
```bash
CC=/Users/Adam/spack/lib/spack/env/clang/clang; export CC
SPACK_CC=/usr/bin/clang; export SPACK_CC
PATH=...:/Users/Adam/spack/lib/spack/env/clang:/Users/Adam/spack/lib/spack/env/case-insensitive:/Users/Adam/spack/lib/spack/env:...; export PATH
```

`CC` and `SPACK_CC` were being set correctly, but `PATH` was using the name of the compiler `apple-clang` instead of `clang`. For most packages, since `CC` was set correctly, nothing broke. But for packages using `Makefiles` that set `CC` based on `which clang`, it was using the system compilers instead of the compiler wrappers. Discovered when working on `py-xgboost@0.90`.

An alternative fix would be to copy the symlinks in `env/clang` to `env/apple-clang`. Let me know if you think there's a better way to do this, or to test this.
2021-02-17 17:07:48 -08:00
Greg Becker
240726a2e1 add intel oneapi to compiler/pkg translations (#21448) 2021-02-17 17:07:46 -08:00
Yang Zongze
40d32890d0 Print groups properly for spack find -d (#20028) 2021-02-17 17:07:45 -08:00
eugeneswalker
18022050f2 store sbang_install_path in buildinfo, use for subsequent relocation (#20768) 2021-02-17 17:07:44 -08:00
Nathan Hanford
cdd86bddec [WIP] relocate.py: parallelize test replacement logic (#19690)
* sbang pushed back to callers;
star moved to util.lang

* updated unit test

* sbang test moved; local tests pass

Co-authored-by: Nathan Hanford <hanford1@llnl.gov>
2021-02-17 17:07:44 -08:00
Massimiliano Culpo
488a08b464 concretizer: require at least a dependency type to say the dependency holds
fixes #20784

Similarly to the previous bug, here we were deducing
conditions to be imposed on nodes that were not part
of the DAG.
2021-02-17 17:07:43 -08:00
Massimiliano Culpo
7162e15531 concretizer: dependency conditions cannot hold if package is external
fixes #20736

Before this one line fix we were erroneously deducing
that dependency conditions hold even if a package
was external.

This may result in answer sets that contain imposed
conditions on a node without the node being present
in the DAG, hence #20736.
2021-02-17 17:07:42 -08:00
Robert Underwood
c99850dd58 restore ability of dev-build to skip patches (#20351)
At some point in the past, the skip_patch argument was removed
from the call to package.do_install() this broke the --skip-patch
flag on the dev-build command.
2021-02-17 17:07:41 -08:00
Massimiliano Culpo
ddd9c86ce0 concretizer: make rules on virtual packages more linear
fixes #20679

In this refactor we have a single cardinality rule on the
provider, which triggers a rule transforming a dependency
on a virtual package into a dependency on the provider of
the virtual.
2021-02-17 17:07:39 -08:00
Todd Gamblin
8e442d6dc1 concretizer: use consistent naming for compiler predicates (#20677)
Every other predicate in the concretizer uses a `_set` suffix to
implement user- or package-supplied settings, but compiler settings use a
`_hard` suffix for this. There's no difference in how they're used, so
make the names the same.

- [x] change `node_compiler_hard` to `node_compiler_set`
- [x] change `node_compiler_version_hard` to `node_compiler_version_set`
2021-02-17 17:07:38 -08:00
Todd Gamblin
9393d97139 concretizer: simplify handling of virtual version constraints
Previously, the concretizer handled version constraints by comparing all
pairs of constraints and ensuring they satisfied each other. This led to
INCONSISTENT ressults from clingo, due to ambiguous semantics like:

    version_constraint_satisfies("mpi", ":1", ":3")
    version_constraint_satisfies("mpi", ":3", ":1")

To get around this, we introduce possible (fake) versions for virtuals,
based on their constraints. Essentially, we add any Versions,
VersionRange endpoints, and all such Versions and endpoints from
VersionLists to the constraint. Virtuals will have one of these synthetic
versions "picked" by the solver. This also allows us to remove a special
case from handling of `version_satisfies/3` -- virtuals now work just
like regular packages.
2021-02-17 17:07:38 -08:00
Todd Gamblin
8f85ab88c0 concretizer: remove rule generation code from concretizer
Our program only generates facts now, so remove all unused code related
to generating cardinality constraints and rules.
2021-02-17 17:07:37 -08:00
Todd Gamblin
247e73e85a concretizer: convert virtuals to facts; move all rules to concretize.lp
This converts the virtual handling in the new concretizer from
already-ground rules to facts. This is the last thing that needs to be
refactored, and it converts the entire concretizer to just use facts.

The previous way of handling virtuals hinged on rules involving
`single_provider_for` facts that were tied to the virtual and a version
range. The new method uses the condition pattern we've been using for
dependencies, externals, and conflicts.

To handle virtuals as conditions, we impose constraints on "fake" virtual
specs in the logic program. i.e., `version_satisfies("mpi", "2.0:",
"2.0")` is legal whereas before we wouldn't have seen something like
this. Currently, constriants are only handled on versions -- we don't
handle variants or anything else yet, but they key change here is that we
*could*. For a long time, virtual handling in Spack has only dealt with
versions, and we'd like to be able to handle variants as well. We could
easily add an integrity constraint to handle variants like the one we use
for versions.

One issue with the implementation here is that virtual packages don't
actually declare possible versions like regular packages do. To get
around that, we implement an integrity constraint like this:

    :- virtual_node(Virtual),
       version_satisfies(Virtual, V1), version_satisfies(Virtual, V2),
       not version_constraint_satisfies(Virtual, V1, V2).

This requires us to compare every version constraint to every other, both
in program generation and within the concretizer -- so there's a
potentially quadratic evaluation time on virtual constraints because we
don't have a real version to "anchor" things to. We just say that all the
constraints need to agree for the virtual constraint to hold.

We can investigate adding synthetic versions for virtuals in the future,
to speed this up.
2021-02-17 17:07:37 -08:00
Todd Gamblin
6056cb71d3 concretizer: consolidate handling of virtuals into spec_clauses 2021-02-17 17:07:36 -08:00
Todd Gamblin
66376ab971 concretizer: make _condtion_id_counter an iterator 2021-02-17 17:07:36 -08:00
Todd Gamblin
9bb0375443 concretizer: more detailed section headers in concretize.lp 2021-02-17 17:07:35 -08:00
Todd Gamblin
56acb5a0c7 bugfix: infinite loop when building a set from incomplete specs (#20649)
This code in `SpecBuilder.build_specs()` introduced in #20203, can loop
seemingly interminably for very large specs:

```python
set([spec.root for spec in self._specs.values()])
```

It's deceptive, because it seems like there must be an issue with
`spec.root`, but that works fine. It's building the set afterwards that
takes forever, at least on `r-rminer`. Currently if you try running
`spack solve r-rminer`, it loops infinitely and spins up your fan.

The issue (I think) is that the spec is not yet complete when this is
run, and something is going wrong when constructing and comparing so many
values produced by `_cmp_key()`. We can investigate the efficiency of
`_cmp_key()` separately, but for now, the fix is:

```python
roots = [spec.root for spec in self._specs.values()]
roots = dict((id(r), r) for r in roots)
```

We know the specs in `self._specs` are distinct (they just came out of
the solver), so we can just use their `id()` to unique them here. This
gets rid of the infinite loop.
2021-02-17 17:07:35 -08:00
Massimiliano Culpo
ec42016241 concretizer: generate facts for externals
Generate only facts for external specs. Substitute the
use of already grounded rules with non-grounded rules
in concretize.lp
2021-02-17 17:07:35 -08:00
Greg Becker
f7195123d4 bugfix: do not write empty default dicts/lists in envs (#20526)
Environment yaml files should not have default values written to them.

To accomplish this, we change the validator to not add the default values to yaml. We rely on the code to set defaults for all values (and use defaulting getters like dict.get(key, default)).

Includes regression test.
2021-02-17 17:07:34 -08:00
Robert Cohn
290043b72a Add Intel oneAPI packages (#20411)
This creates a set of packages which all use the same script to install
components of Intel oneAPI. This includes:

* An inheritable IntelOneApiPackage which knows how to invoke the
  installation script based on which components are requested
* For components which include headers/libraries, an inheritable
  IntelOneApiLibraryPackage is provided to locate them
* Individual packages for DAL, DNN, TBB, etc.
* A package for the Intel oneAPI compilers (icx/ifx). This also includes
  icc/ifortran but these are not currently detected in this PR
2021-02-17 17:07:33 -08:00
Todd Gamblin
1a1babe185 concretizer: refactor conditional rules to be less repetitious (#20507)
We have to repeat all the spec attributes in a number of places in
`concretize.lp`, and Spack has a fair number of spec attributes. If we
instead add some rules up front that establish equivalencies like this:

```
    node(Package) :- attr("node", Package).
    attr("node", Package) :- node(Package).

    version(Package, Version) :- attr("version", Package, Version).
    attr("version", Package, Version) :- version(Package, Version).
```

We can rewrite most of the repetitive conditions with `attr` and repeat
only for each arity (there are only 3 arities for spec attributes so far)
as opposed to each spec attribute. This makes the logic easier to read
and the rules easier to follow.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2021-02-17 17:07:32 -08:00
Massimiliano Culpo
acd523c7f3 concretizer: optimize loop on compiler version
Similar to the optimization on platform
2021-02-17 17:07:32 -08:00
Massimiliano Culpo
4bbc6eec51 concretizer: optimized loop on node platforms
We can speed-up the computation by avoiding a
double loop in a cardinality constraint and
enforcing the rule instead as an integrity
constraint.
2021-02-17 17:07:31 -08:00
Massimiliano Culpo
cb76c5a90d concretizer: fix failing unit tests 2021-02-17 17:07:31 -08:00
Massimiliano Culpo
ab3f53d781 concretizer: emit facts for integrity constraints 2021-02-17 17:07:30 -08:00
Massimiliano Culpo
364c5b636c concretizer: emit facts for constraints on imposed dependencies 2021-02-17 17:07:30 -08:00
Massimiliano Culpo
02e0ea6105 concretizer: avoid redundant grounding on dependency types 2021-02-17 17:07:30 -08:00
Todd Gamblin
ff9ee9f243 concretizer: move conditional dependency logic into concretize.lp
Continuing to convert everything in `asp.py` into facts, make the
generation of ground rules for conditional dependencies use facts, and
move the semantics into `concretize.lp`.

This is probably the most complex logic in Spack, as dependencies can be
conditional on anything, and we need conditional ASP rules to accumulate
and map all the dependency conditions to spec attributes.

The logic looks complicated, but essentially it accumulates any
constraints associated with particular conditions into a fact associated
with the condition by id. Then, if *any* condition id's fact is True, we
trigger the dependency.

This simplifies the way `declared_dependency()` works -- the dependency
is now declared regardless of whether it is conditional, and the
conditions are handled by `dependency_condition()` facts.
2021-02-17 17:07:29 -08:00
Todd Gamblin
6c6631cfdc concretizer: spec_clauses should traverse dependencies
There are currently no places where we do not want to traverse
dependencies in `spec_clauses()`, so simplify the logic by consolidating
`spec_traverse_clauses()` with `spec_clauses()`.
2021-02-17 17:07:29 -08:00
Todd Gamblin
ea617f807f concretizer: pull _develop_specs_from_env out of main setup loop 2021-02-17 17:07:28 -08:00
Todd Gamblin
d0dfd3cb82 concretizer: add #defined statements to avoid warnings.
`version_satisfies/2` and `node_compiler_version_satisfies/3` are
generated but need `#defined` directives to avoid " info: atom does not
occur in any rule head:" warnings.
2021-02-17 17:07:28 -08:00
Massimiliano Culpo
a4066a52be asp: memoize the list of all target_specs to speed-up setup phase (#20473)
* asp: memoize the list of all target_specs to speed-up setup phase

* asp: memoize using a cache per solver object
2021-02-17 17:07:28 -08:00
Scott Wittenburg
18c5f10ae7 ci: fixes for compiler bootstrapping (#17563)
This PR addresses a number of issues related to compiler bootstrapping.

Specifically:
1. Collect compilers to be bootstrapped while queueing in installer
Compiler tasks currently have an incomplete list in their task.dependents,
making those packages fail to install as they think they have not all their
dependencies installed. This PR collects the dependents and sets them on
compiler tasks.

2. allow boostrapped compilers to back off target
Bootstrapped compilers may be built with a compiler that doesn't support
the target used by the rest of the spec.  Allow them to build with less
aggressive target optimization settings.

3. Support for target ranges
Backing off the target necessitates computing target ranges, so make Spack
handle those properly.  Notably, this adds an intersection method for target
ranges and fixes the way ranges are satisfied and constrained on Spec objects.

This PR also:
- adds testing
- improves concretizer handling of target ranges

Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Co-authored-by: Gregory Becker <becker33@llnl.gov>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2021-02-17 17:07:27 -08:00
Massimiliano Culpo
d82d2bb2db unit-tests: ensure that installed packages can be reused (#20307)
refers #20292

Added a unit test that ensures we can reuse installed
packages even if in the repository variants have been
removed or added.
2021-02-17 17:07:27 -08:00
Greg Becker
378af922a2 Fix comparisons for abstract specs (#20341)
bug only relevant for python3
2021-02-17 17:07:27 -08:00
Todd Gamblin
12d035b225 concretizer: don't use one_of_iff for range constraints (#20383)
Currently, version range constraints, compiler version range constraints,
and target range constraints are implemented by generating ground rules
from `asp.py`, via `one_of_iff()`.  The rules look like this:

```
version_satisfies("python", "2.6:") :- 1 { version("python", "2.4"); ... } 1.
1 { version("python", "2.4"); ... } 1. :- version_satisfies("python", "2.6:").
```

So, `version_satisfies(Package, Constraint)` is true if and only if the
package is assigned a version that satisfies the constraint. We
precompute the set of known versions that satisfy the constraint, and
generate the rule in `SpackSolverSetup`.

We shouldn't need to generate already-ground rules for this. Rather, we
should leave it to the grounder to do the grounding, and generate facts
so that the constraint semantics can be defined in `concretize.lp`.

We can replace rules like the ones above with facts like this:

```
version_satisfies("python", "2.6:", "2.4")
```

And ground them in `concretize.lp` with rules like this:

```
1 { version(Package, Version) : version_satisfies(Package, Constraint, Version) } 1
  :- version_satisfies(Package, Constraint).
version_satisfies(Package, Constraint)
  :- version(Package, Version), version_satisfies(Package, Constraint, Version).
```

The top rule is the same as before. It makes conditional dependencies and
other places where version constraints are used work properly. Note that
we do not need the cardinality constraint for the second rule -- we
already have rules saying there can be only one version assigned to a
package, so we can just infer from `version/2` `version_satisfies/3`.
This form is also safe for grounding -- If we used the original form we'd
have unsafe variables like `Constraint` and `Package` -- the original
form only really worked when specified as ground to begin with.

- [x] use facts instead of generating rules for package version constraints
- [x] use facts instead of generating rules for compiler version constraints
- [x] use facts instead of generating rules for target range constraints
- [x] remove `one_of_iff()` and `iff()` as they're no longer needed
2021-02-17 17:07:26 -08:00
Massimiliano Culpo
bf3a873a42 package sanity: ensure all variant defaults are allowed values (#20373) 2021-02-17 17:07:26 -08:00
Todd Gamblin
27f6b3df92 concretizer: remove clingo command-line driver (#20362)
I was keeping the old `clingo` driver code around in case we had to run
using the command line tool instad of through the Python interface.

So far, the command line is faster than running through Python, but I'm
working on fixing that.  I found that if I do this:

```python
control = clingo.Control()
control.load("concretize.lp")
control.load("hdf5.lp")       # code from spack solve --show asp hdf5
control.load("display.lp")

control.ground([("base", [])])
control.solve(...)
```

It's just as fast as the command line tool. So we can always generate the
code and load it manually if we need to -- we don't need two drivers for
clingo. Given that the python interface is also the only way to get unsat
cores, I think we pretty much have to use it.

So, I'm removing the old command line driver and other unused code. We
can dig it up again from the history if it is needed.
2021-02-17 17:07:25 -08:00
Tamara Dahlgren
802c5bdff7 Tests: enable re-use of post-install tests in smoke tests (#20298) 2021-02-17 17:07:25 -08:00
Andrew W Elble
ab3f1b10db concretizer: try hard to obtain all needed variant_possible_value()'s (#20102)
Track all the variant values mentioned when emitting constraints, validate them
and emit a fact that allows them as possible values.

This modification ensures that open-ended variants (variants accepting any string 
or any integer) are projected to the finite set of values that are relevant for this 
concretization.
2021-02-17 17:07:24 -08:00
Massimiliano Culpo
30a9e6462f bugfix: work around issue handling packages not in any repo 2021-02-17 17:07:24 -08:00
Todd Gamblin
0e725f0ab1 concretizer: refactor handling of special variants dev_build and patches
Other parts of the concretizer code build up lists of things we can't
know without traversing all specs and packages, and they output these
list at the very end.

The code for this for variant values from spec literals was intertwined
with the code for traversing the input specs. This only covers the input
specs and misses variant values that might come from directives in
packages.

- [x] move ad-hoc value handling code into spec_clauses so we do it in
  one place for CLI and packages

- [x] move handling of `variant_possible_value`, etc. into
  `concretize.lp`, where we can automatically infer variant existence
  more concisely.

- [x] simplify/clarify some of the code for variants in `spec_clauses()`
2021-02-17 17:07:23 -08:00
Massimiliano Culpo
ecfba13d89 concretizer: each external version is allowed by definition (#20247)
Registering external versions among the lists of allowed ones
generates the correct rules for `version_satisfies`
2021-02-17 17:07:22 -08:00
Massimiliano Culpo
a6d433b937 concretizer: restrict maximizing variant values to MV variants (#20194) 2021-02-17 17:07:22 -08:00
Matthias Wolf
b4f79f3cb7 environment installs: fix reporting. (#20004)
PR #15702 changed the invocation of the report context when installing
specs, do the same when building environments.
2021-02-17 17:07:22 -08:00
Greg Becker
30290acf67 avoid circular import (#20236) 2021-02-17 17:07:21 -08:00
Andrew W Elble
92de484228 concretizer: call inject_patches_variants() on the roots of the specs (#20203)
As was done in the old concretizer. Fixes an issue where conditionally
patched dependencies did not show up in spec (gdal+jasper)
2021-02-17 17:07:21 -08:00
Massimiliano Culpo
b78cc5b43d concretizer: try hard to infer the real version of compilers (#20099)
fixes #20055

Compiler with custom versions like gcc@foo are not currently
matched to the appropriate targets. This is because the
version of spec doesn't match the "real" version of the
compiler.

This PR replicates the strategy used in the original
concretizer to deal with that and tries to detect the real
version of compilers if the version in the spec returns no
results.
2021-02-17 17:07:21 -08:00
Harmen Stoppels
571e36787b Fix hipcc once more (#20095) 2021-02-17 17:07:20 -08:00
Andrew W Elble
598c25b434 concretizer: don't optimize emitting version_satisfies() (#20128)
When all versions were allowed a version_satisfies rule was not emitted,
and this caused conditional directives to fail.
2021-02-17 17:07:19 -08:00
Massimiliano Culpo
0b7a22dea2 spec: return early from concretization if a spec is already concrete (#20196) 2021-02-17 17:07:18 -08:00
Massimiliano Culpo
1e1a6f4e30 concretizer: remove ad-hoc rule for external packages (#20193)
fixes #20040

Matching compilers among nodes has been prioritized
in #20020. Selection of default variants has been
tuned in #20182. With this setup there is no need
to have an ad-hoc rule for external packages. On
the contrary it should be removed to prefer having
default variant values over more external nodes in
the DAG.
2021-02-17 17:07:18 -08:00
Massimiliano Culpo
22d7937c50 concretizer: swap priority of selecting provider and default variant (#20182)
refers #20040

Before this PR optimization rules would have selected default
providers at a higher priority than default variants. Here we
swap this priority and we consider variants that are forced by
any means (root spec or spec in depends_on clause) the same as
if they were with a default value.

This prevents the solver from avoiding expected configurations
just because they contain directives like:

depends_on('pkg+foo')

and `+foo` is not the default variant value for pkg.
2021-02-17 17:07:18 -08:00
George Hartzell
96283867d6 Typos: add missing closing parens (#20174) 2021-02-17 17:07:17 -08:00
Massimiliano Culpo
d7ffdd76f6 concretizer: treat target ranges in directives correctly (#19988)
fixes #19981

This commit adds support for target ranges in directives,
for instance:

conflicts('+foo', when='target=x86_64:,aarch64:')

If any target in a spec body is not a known target the
following clause will be emitted:

node_target_satisfies(Package, TargetConstraint)

when traversing the spec and a definition of
the clause will then be printed at the end similarly
to what is done for package and compiler versions.
2021-02-17 17:07:17 -08:00
Massimiliano Culpo
b326d59e10 concretizer: prioritize matching compilers over newer versions (#20020)
fixes #20019

Before this modification having a newer version of a node came
at higher priority in the optimization than having matching
compilers. This could result in unexpected configurations for
packages with conflict directives on compilers of the type:

conflicts('%gcc@X.Y:', when='@:A.B')

where changing the compiler for just that node is preferred to
lower the node version to less than 'A.B'. Now the priority has
been switched so the solver will try to lower the version of the
nodes in question before changing their compiler.
2021-02-17 17:07:16 -08:00
Massimiliano Culpo
0ae49821e2 concretizer: allow a bool to be passed as argument for tests dependencies (#20082)
refers #20079

Added docstrings to 'concretize' and 'concretized' to
document the format for tests.

Added tests for the activation of test dependencies.
2021-02-17 17:07:16 -08:00
Massimiliano Culpo
8e1b5f734f concretizer: treat conditional providers correctly (#20086)
refers #20040

This modification emits rules like:

provides_virtual("netlib-lapack","blas") :- variant_value("netlib-lapack","external-blas","False").

for packages that provide virtual dependencies conditionally instead
of a fact that doesn't account for the condition.
2021-02-17 17:07:16 -08:00
Adam J. Stewart
ad84351c43 Docs: remove duplication in Command Reference (#20021) 2021-02-17 17:07:15 -08:00
Martin Aumüller
508534aad9 recognize macOS 11.1 as big sur (#20038)
Big Sur versions go 11.0, 11.0.1, 11.1 (vs. prior versions that
only used the minor component)

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2021-02-17 17:07:15 -08:00
Greg Becker
38cf4f9fc2 fix error handling for spack test results command (#19987) 2021-02-17 17:07:14 -08:00
Danny Taller
c42ce439e4 hip support for umpire, chai, raja, camp (#19715)
* create HipPackage base class and do some refactoring

* comments and added conflict to raja for openmp with hip
2021-02-17 17:07:14 -08:00
Adam J. Stewart
d04f9a1ae3
apple-clang: add correct path to compiler wrappers (#21662)
Follow-up to #17110

### Before
```bash
CC=/Users/Adam/spack/lib/spack/env/clang/clang; export CC
SPACK_CC=/usr/bin/clang; export SPACK_CC
PATH=...:/Users/Adam/spack/lib/spack/env/apple-clang:/Users/Adam/spack/lib/spack/env/case-insensitive:/Users/Adam/spack/lib/spack/env:...; export PATH
```

### After
```bash
CC=/Users/Adam/spack/lib/spack/env/clang/clang; export CC
SPACK_CC=/usr/bin/clang; export SPACK_CC
PATH=...:/Users/Adam/spack/lib/spack/env/clang:/Users/Adam/spack/lib/spack/env/case-insensitive:/Users/Adam/spack/lib/spack/env:...; export PATH
```

`CC` and `SPACK_CC` were being set correctly, but `PATH` was using the name of the compiler `apple-clang` instead of `clang`. For most packages, since `CC` was set correctly, nothing broke. But for packages using `Makefiles` that set `CC` based on `which clang`, it was using the system compilers instead of the compiler wrappers. Discovered when working on `py-xgboost@0.90`.

An alternative fix would be to copy the symlinks in `env/clang` to `env/apple-clang`. Let me know if you think there's a better way to do this, or to test this.
2021-02-17 15:54:50 -08:00
Massimiliano Culpo
ee1b0b9fb9
Delete unused "mutable_mock_store" fixture (#21632)
The fixture was introduced in #19690 maybe accidentally.

It's not used in unit tests, and though it should be
mutable it seems an exact copy of it's immutable version.
2021-02-16 17:26:16 -08:00
Scott Wittenburg
5b0507cc65
Pipelines: Temporary buildcache storage (#21474)
Before this change, in pipeline environments where runners do not have access
to persistent shared file-system storage, the only way to pass buildcaches to
dependents in later stages was by using the "enable-artifacts-buildcache" flag
in the gitlab-ci section of the spack.yaml.  This change supports a second
mechanism, named "temporary-storage-url-prefix", which can be provided instead
of the "enable-artifacts-buildcache" feature, but the two cannot be used at the
same time.  If this prefix is provided (only "file://" and "s3://" urls are
supported), the gitlab "CI_PIPELINE_ID" will be appended to it to create a url
for a mirror where pipeline jobs will write buildcache entries for use by jobs
in subsequent stages.  If this prefix is provided, a cleanup job will be
generated to run after all the rebuild jobs have finished that will delete the
contents of the temporary mirror.  To support this behavior a new mirror
sub-command has been added: "spack mirror destroy" which can take either a
mirror name or url.

This change also fixes a bug in generation of "needs" list for each job.  Each
jobs "needs" list is supposed to only contain direct dependencies for scheduling
purposes, unless "enable-artifacts-buildcache" is specified.  Only in that case
are the needs lists supposed to contain all transitive dependencies.  This
changes fixes a bug that caused the needs lists to always contain all transitive
dependencies, regardless of whether or not "enable-artifacts-buildcache" was
specified.
2021-02-16 18:21:18 -07:00
Sergey Kosukhin
7538444a03
NAG compiler: disable forcing RPATH/RUNPATH (#21701) 2021-02-16 18:31:51 +01:00
Scott Wittenburg
428f831899
Pipelines: DAG Pruning (#20435)
Pipelines: DAG pruning

During the pipeline generation staging process we check each spec against all configured mirrors to determine whether it is up to date on any of the mirrors.  By default, and with the --prune-dag argument to "spack ci generate", any spec already up to date on at least one remote mirror is omitted from the generated pipeline.  To generate jobs for up to date specs instead of omitting them, use the --no-prune-dag argument.  To speed up the pipeline generation process, pass the --check-index-only argument.  This will cause spack to check only remote buildcache indices and avoid directly fetching any spec.yaml files from mirrors.  The drawback is that if the remote buildcache index is out of date, spec rebuild jobs may be scheduled unnecessarily.

This change removes the final-stage-rebuild-index block from gitlab-ci section of spack.yaml.  Now rebuilding the buildcache index of the mirror specified in the spack.yaml is the default, unless "rebuild-index: False" is set.  Spack assigns the generated rebuild-index job runner attributes from an optional new "service-job-attributes" block, which is also used as the source of runner attributes for another generated non-build job, a no-op job, which spack generates to avoid gitlab errors when DAG pruning results in empty pipelines.
2021-02-16 09:12:37 -07:00
Tamara Dahlgren
851490bd54
Correct the reference to the staged examples files (#21557) 2021-02-13 08:14:38 -08:00
Chuck Atkins
5a771bc8ad
Introduce a SPACK_PYTHON environment variable (#21222)
The SPACK_PYTHON environment variable can be set to a python interpreter to be
used by the spack command.  This allows the spack command itself to use a
consistent and separate interpreter from whatever python might be used for package
building.
2021-02-12 10:52:44 -08:00
Massimiliano Culpo
113073ceed
unit test: refactored bindist.py (#21497)
Modifications:
- Make use of SpackCommand objects wherever possible
- Deduplicated code when possible
- Moved cleaning of mirrors to fixtures
- Ensure mock configuration has a clear initialization order
2021-02-11 10:29:56 -08:00
Todd Gamblin
3b3314802e database: don't create a date object in query() unless it's necessary
`query()` calls `datetime.datetime.fromtimestamp` regardless of whether a
date query is being done. Guard this with an if statement to avoid the
unnecessary work.
2021-02-11 15:30:57 +01:00
Todd Gamblin
c81ca37dfc version: precompile regexes in Version constructor 2021-02-11 15:30:57 +01:00
Todd Gamblin
e3e913ef8f spack_json: _strify should be a no-op in Python 3
_strify traverses *all* of the read-in data and converts strings, but
only for Python 2.  Ignore it in Python 3.
2021-02-11 15:30:57 +01:00
Todd Gamblin
52508e6ee7 database: do not redundantly mark specs concrete
Speed up reads by not traversing each spec recursively when marking them
concrete.
2021-02-11 15:30:57 +01:00
Todd Gamblin
6fe931ccb1 spec performance: don't parse in from_node_dict
Constructing a spec from a name instead of setting name directly forces
from_node_dict to call Spec.parse(), which is slow. Avoid this by using a
zero-arg constructor and setting name directly.
2021-02-11 15:30:57 +01:00
Massimiliano Culpo
4558dc06e2 Added a context manager to swap architectures
This solves a few FIXMEs in conftest.py, where
we were manipulating globals and seeing side
effects prior to registering fixtures.

This commit solves the FIXMEs, but introduces
a performance regression on tests that may need
to be investigated
2021-02-10 16:50:09 -08:00
Massimiliano Culpo
553d37a6d6 Move context manager to swap the current configuration into spack.config
The context manager can be used to swap the current
configuration temporarily, for any use case that may need it.
2021-02-10 16:50:09 -08:00
Massimiliano Culpo
cb2c233a97 Move context manager to swap the current store into spack.store
The context manager can be used to swap the current
store temporarily, for any use case that may need it.
2021-02-10 16:50:09 -08:00
Massimiliano Culpo
1a8963b0f4 repo: generalize "swap" context manager to also accept paths
The method is now called "use_repositories" and
makes it clear in the docstring that it accepts
as arguments either Repo objects or paths.

Since there was some duplication between this
contextmanager and "use_repo" in the testing framework,
remove the latter and use spack.repo.use_repositories
across the entire code base.

Make a few adjustment to MockPackageMultiRepo, since it was
stating in the docstring that it was supposed to mock
spack.repo.Repo and was instead mocking spack.repo.RepoPath.
2021-02-10 16:50:09 -08:00
Scott McMillan
0007ed72c3
Fix: Add a space between -isystem and the directory (#21599)
Some compilers, such as the NV compilers, do not recognize -isystem
dir when specified without a space.

Works: -isystem ../include
Does not work: -isystem../include

This PR updates the compiler wrapper to include the space with -isystem.
2021-02-10 15:56:42 -08:00
Greg Becker
2b6f896ca7
Bugfix: environments/views on separate mounts (#20720)
Environment views fail when the tmpdir used for view generation is
on a separate mount from the install_tree because the files cannot
by symlinked between the two. The fix is to use an alternative
tmpdir located alongside the view.
2021-02-10 13:39:11 -08:00
Adam J. Stewart
7ccb9992a6
Procedure to deprecate old versions of software (#20767)
* Procedure to deprecate old versions of software

* Add documentation

* Fix bug in logic

* Update tab completion

* Deprecate legacy packages

* Deprecate old mxnet as well

* More explicit docs
2021-02-09 13:51:18 -05:00
BenWeber42
e5ab686d77
Changed stages permissions to 750 (#21425) 2021-02-09 10:12:43 -08:00
BenWeber42
e4d74825f3
Fixed uninstall rm parent folder race condition (#21424) 2021-02-09 10:05:06 -08:00
Mark Meredith
784b421eda
Fix typo (#21567) 2021-02-09 15:34:42 +00:00
Adam J. Stewart
48954a5a3e
Restore verbosity of patching (#21233) 2021-02-08 10:29:19 -08:00
albestro
02b64c8903
let intel consider cray-mpich as mpich (#21512) 2021-02-05 17:55:39 +00:00
Adam J. Stewart
ba70f90ee0
Fix usage of PythonPackage.test outside of PythonPackage (#20555) 2021-02-04 11:00:37 -06:00
Adam J. Stewart
df5992293a
Python: add maintainer(s) (#21125)
* Python: add maintainer(s)

* Fix unit tests
2021-02-04 10:00:21 -06:00
Massimiliano Culpo
694d633a2c
spack external find: allow to search by tags (#21407)
This commit adds an option to the `external find`
command that allows it to search by tags. In this
way group of executables with common purposes can
be grouped under a single name and a simple command
can be used to detect all of them.

As an example introduce the 'build-tools' tag to
search for common development tools on a system
2021-02-04 13:17:32 +01:00
Massimiliano Culpo
ba42c36f00
concretizer: simplify "fact" method (#21148)
The "fact" method before was dealing with multiple facts
registered per call, which was used when we were emitting
grounded rules from knowledge of the problem instance.

Now that the encoding is changed we can simplify the method
to deal only with a single fact per call.
2021-02-03 10:12:03 -08:00
Greg Becker
7dcf3f7aed
add intel oneapi to compiler/pkg translations (#21448) 2021-02-02 19:11:51 +00:00
Adam J. Stewart
b597cbe1c0
PythonPackage: fewer phases (#20738) 2021-02-01 12:48:45 -06:00
Adam J. Stewart
1d636bed6a
R: add maintainer(s) (#21119)
* R: add maintainer(s)

* Add maintainer to base class
2021-02-01 11:33:33 -06:00
Adam J. Stewart
40a40e0265
Python 3.10 support: collections.abc (#20441) 2021-02-01 11:30:25 -06:00
Yang Zongze
f8124369f9
Print groups properly for spack find -d (#20028) 2021-01-29 11:05:36 -08:00