Commit graph

4034 commits

Author SHA1 Message Date
Adam J. Stewart
284e450c91
Language-specific PIC flags (#15474)
* Language-specific PIC flags

* Add tests for every compiler flag

* Fix bad rebase

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

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

* SourceForge: unspectacular mirror replacement

add mirrors to all sourceforge packages with trivial
download logic.

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

* SourceForge: xz

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

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

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

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

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

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

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

Output is properly suppressed:

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

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

Significantly extend testing of process output logger:

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

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

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

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

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

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

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

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

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

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

Add all the variables listed here:

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

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

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

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

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

Significantly extend testing of process output logger:

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

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

* Fixed a few minor issues in extensions docs

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

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

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

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

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

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

* Ran flake8 locally and corrected errors

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

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

Add all the variables listed here:

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

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

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

* added test for "spack load --first"

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

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

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

* spelling fixes

* spelling fixes

* spelling fixes

* spelling fix

* spelling fix

* spelling fix

* spelling fixes

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

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

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

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

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

Improved existing docstrings

* relocate: simplified search function by un-nesting conditionals

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

Extended docstring.

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

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

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

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

Output is properly suppressed:

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

* Working on SL7 with python 3.6

* Flake8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* disable private sip installation in sippackage class

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

* fix typo

* fix typo

* also apply fix to PyQt4

* tidy up

* flake8 and tidy up

* tidy and undo hardcoding of python_include_dir

* replace hardcoded python inc dir

* fix minor issues

* rethink include dir variable name

* improve style

* add new versions

* implement new sip setup to qsci installation

* set sip-incdir correctly for the new setup

* setup extend_path thing before qsci python bindings

* take care of conflict

* flake8

* also extend for PyQt4

* improve style

* improve style

* SipPackage build sys should depend on py-sip

* consolidate extend_path fixes into SipPackage

* fix typo

* fix bugs

* flake8

* revert sip doc to pre-resource setup

* import os module

* flake8

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

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

can be replaced with:

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

The following conversions are handled automatically:

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

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

Store a dictionary mapping of original dependency prefixes to dependency hashes

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Add comma

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

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

* Flake8 fixes

* Fix cuda_arch when no arch is set

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

* CUDA 6.5+ supports SM_37

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

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

* Add mutually exclusive required options

* spack commands --update-completion

* Apply @opadron's patch

* Update share/spack/spack-completion.bash

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

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

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

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

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

fixes #14798
fixes #13733

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Remove unused patchelf definition.

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

    python -m pyinstrument script.py

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

    spack python -m pyinstrument ./test.py

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

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

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

* Fix unit tests

* More consistent quotation, less duplication

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

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

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

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

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

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

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

The test found the two errors fixed here, specifically:

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

and

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

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

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

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

* Make _cached_specs a set to avoid duplicates

* Fix packaging test

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

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

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

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

    $ spack -V
    0.13.3-912-3519a1762

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

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

    $ spack -V
    0.13.3

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

creates recipes to build images for different container runtimes

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

fixes #13357

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

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

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

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

    spack commands --update-completion

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

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

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

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

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

Progress:

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

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

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

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

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

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

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

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

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

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

The test found the two errors fixed here, specifically:

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

and

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

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

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

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

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

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

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

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

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

* Fix unit tests

* More consistent quotation, less duplication

* Fix import syntax
2020-01-16 15:46:18 -06:00
Adam J. Stewart
3cd6938d80
Fix typo in modules docstring (#14521) 2020-01-15 15:16:12 -06:00
Adam J. Stewart
240a9e6284
Fix parsing of rocketmq URL (#14490) 2020-01-14 11:59:10 -06:00