Commit graph

4365 commits

Author SHA1 Message Date
Patrick Gartung
676eb56ab2
Buildcache cmd: add install -o/--otherarch option for installing macOS buildcaches on linux (#15192)
* Buildcache command: add install option -o/--otherarch
This will allow matching specs from other archs, for example
installing macOS buildcaches on linux hosts.

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

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

fixes #14798
fixes #13733

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Remove unused patchelf definition.

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

    python -m pyinstrument script.py

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

    spack python -m pyinstrument ./test.py

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

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

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

* Fix unit tests

* More consistent quotation, less duplication

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

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

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

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

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

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

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

The test found the two errors fixed here, specifically:

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

and

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

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

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

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

* Make _cached_specs a set to avoid duplicates

* Fix packaging test

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

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

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

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

    $ spack -V
    0.13.3-912-3519a1762

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

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

    $ spack -V
    0.13.3

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

creates recipes to build images for different container runtimes

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

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

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

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

fixes #13357

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

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

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

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

    spack commands --update-completion

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

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

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

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

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

Progress:

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

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

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

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

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

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

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

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

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

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

The test found the two errors fixed here, specifically:

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

and

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

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

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

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

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

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

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

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

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

* Fix unit tests

* More consistent quotation, less duplication

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

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

fixes #4382

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

* Moved the functionality to its own command

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

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

* Make autoremove work directly on Spack's store

* Added unit tests for the new command

* Display a terser output to the user

* Renamed the "autoremove" command "gc"

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

* Preserve root specs in env contexts

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

* Added docs

* Added a unit test for gc within an environment

* Updated copyright to 2020

* Updated documentation according to review

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

* Updated function naming and docstrings

* Simplified computation of unused specs

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

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

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

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

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

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

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

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

You can combine any list option with keywords:

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

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

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

Or just list specific files:

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

Hopefully this stuff will help with debugging test issues.

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

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

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

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

- [x] construct Args objects lazily

- [x] remove the module-scoped argparse fixture

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* add licenses to empty files

* Fix Sphinx warning message about comment within docstring

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

* use explicit kwargs in push_to_url()

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

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

* add some basic tests

* update s3_fetch tests

* update S3 list code to strip leading slashes from prefix

* correct minor warning regression introduced in #11117

* add more tests

* flake8 fixes

* add capsys fixture to mirror_crud test

* add get_header() tests

* use get_header() in more places

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

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

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

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

* Spec Header Dirs: Only first include/

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

regex: non-greedy first match of include

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

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

* Alphabetize "spack create" template options for readability

* Revert template choices format; alphabetize list

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

* Add link to new bundlepackage file

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

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

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

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

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

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

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

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

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

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

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

add CUDA 10.2 support

* CudaPackage: Add 10.2 Conflicts

* CUDA: Modernize Run Environment

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

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

* add microarchitectures for thunderx2 and a64fx

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

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

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

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

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

* Use fake GitHub usernames

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

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

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

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

* Added macOS shasum

* Update lib/spack/docs/packaging_guide.rst

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

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

* Add colon

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

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

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

    spack add hdf5+hl

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

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

    spack add hdf5+hl

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

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

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

* flake

* missing module name

* add regression test

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

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

There is a larger question here of which part of Spack should be responsible for setting defaults in config files, and how we can get rid of empty lists and data structures currently cluttering files like `compilers.yaml`.  But that probably requires a rework of the default-setting validator in `spack.config`, as well as the code that uses `spack.config`.  This will at least help for `spack.yaml`.
2019-11-03 15:46:41 -08:00
Adam J. Stewart
a8228e1aec
spack create: http -> https (#13547) 2019-11-01 17:40:49 -05:00
Peter Scheibel
2e029fc2e5
Bugfix: respect order of mirrors in mirrors.yaml (#13544)
Commands like "spack mirror list" were displaying mirrors in a
different order than what was listed in the corresponding mirrors.yaml
file.

This restores commands to iterate over mirrors in the order that
they appear in the config file.
2019-11-01 14:02:08 -07:00
Greg Becker
24ec9f0ce3
environments: make shell modifications partially unconditional (#13523)
* environments: make shell modifications partially unconditional

* flake

* missing module name

* add regression test

* flake
2019-11-01 12:00:16 -05:00
Marc Mengel
2cea0633fa allow bootstrap buildcache install of patchelf (#13430)
* allow bootstrap buildcache install of patchelf

* file not path_name on one

* style

* add test for relocating patchelf

* blank lines..
2019-11-01 10:54:55 -05:00
Todd Gamblin
d670765b97
version bump: 0.13.1 2019-11-01 03:52:04 -07:00
Omar Padron
01a0d554f5
bugfix: spack.util.url.join() now handles absolute paths correctly (#13488)
* fix issue where spack.util.url.join() failed to correctly handle absolute path components
* add url util tests
2019-11-01 03:50:47 -07:00
Gregory Lee
2a9d6b9fbf
sbang: use utf-8 for encoding when patching (#13490)
This fixes a UnicodeDecodeError in the sbang patching function.
2019-11-01 03:50:38 -07:00
Massimiliano Culpo
eb286bb80f
Specs with quoted flags containing spaces are parsed correctly (#13521) 2019-11-01 03:50:26 -07:00
Massimiliano Culpo
1cc69e1ce0
targets: print a warning message before downgrading (#13513)
* Make package preferences a soft failure for targets, instead of a hard failure.
* Added unit tests for preferences expressed via packages.yaml
2019-11-01 03:50:17 -07:00
Adam J. Stewart
338a532e07
Travis CI: Test Python 3.8 (#13347)
* Travis CI: Test Python 3.8

* Fix use of deprecated cgi.escape method

* Fix version comparison

* Fix flake8 F811 change in Python 3.8

* Make flake8 happy

* Use Python 3.8 for all test categories
2019-11-01 03:50:02 -07:00
Greg Becker
30c9609c4e
Documentation: Database.query methods share docstrings (#13515)
Currently, query arguments in the Spack core are documented on the
Database._query method, where the functionality is defined.

For users of the spack python command, this makes the python builtin
method help less than ideally useful, as help(spack.store.db.query)
and help(spack.store.db.query_local) do not show relevant information.

This PR updates the doc attributes for the Database.query and
Database.query_local arguments to mirror everything after the first
line of the Database._query docstring.
2019-11-01 03:49:47 -07:00
Massimiliano Culpo
944d7b3d62
cuda: fix conflict statements for x86-64 targets (#13472)
* cuda: fix conflict statements for x86-64 targets

fixes #13462

This build system mixin was not updated after the support for specific
targets has been merged.

* Updated the version range of cuda that conflicts with gcc@8:

* Updated the version range of cuda that conflicts with gcc@8: for ppc64le

* Relaxed conflicts for version > 10.1

* Updated versions in conflicts

Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja>
2019-11-01 03:49:35 -07:00
Greg Becker
b727f922a4
cpu: fix clang flags for generic x86_64 (#13491)
* cpu: differentiate flags used for pristine LLVM vs. Apple's version
2019-11-01 03:49:16 -07:00
Peter Scheibel
835df4b2e4
syaml_int type should use int.__repr__ rather than str.__repr__ (#13487) 2019-11-01 03:49:00 -07:00
Omar Padron
0f816561db bugfix: spack.util.url.join() now handles absolute paths correctly (#13488)
* fix issue where spack.util.url.join() failed to correctly handle absolute path components
* add url util tests
2019-11-01 03:42:43 -07:00
Gregory Lee
3bdab6f686 sbang: use utf-8 for encoding when patching (#13490)
This fixes a UnicodeDecodeError in the sbang patching function.
2019-11-01 03:39:45 -07:00
Massimiliano Culpo
390ffb80e7 Specs with quoted flags containing spaces are parsed correctly (#13521) 2019-11-01 03:38:11 -07:00
Massimiliano Culpo
42b8355269 targets: print a warning message before downgrading (#13513)
* Make package preferences a soft failure for targets, instead of a hard failure.
* Added unit tests for preferences expressed via packages.yaml
2019-11-01 03:36:28 -07:00
Peter Scheibel
6ec39b6c81
Bugfix: BundlePackage staging/installation (#13524)
4af4487 added a mirror_id function to most FetchStrategy
implementations that is used to calculate resource locations in
mirrors. It left out BundleFetchStrategy which broke all packages
making use of BundlePackage (e.g. xsdk). This adds a noop
implementation of mirror_id to BundleFetchStrategy so that the
download/installation of BundlePackages can proceed as normal.
2019-10-31 12:56:38 -07:00
Adam J. Stewart
4b56933643
Docs: unlock requirement versions (#13384) 2019-10-31 14:21:05 -05:00
Adam J. Stewart
536486f0e5
Travis CI: Test Python 3.8 (#13347)
* Travis CI: Test Python 3.8

* Fix use of deprecated cgi.escape method

* Fix version comparison

* Fix flake8 F811 change in Python 3.8

* Make flake8 happy

* Use Python 3.8 for all test categories
2019-10-31 14:20:46 -05:00
Greg Becker
a97faeb3c7 Documentation: Database.query methods share docstrings (#13515)
Currently, query arguments in the Spack core are documented on the
Database._query method, where the functionality is defined.

For users of the spack python command, this makes the python builtin
method help less than ideally useful, as help(spack.store.db.query)
and help(spack.store.db.query_local) do not show relevant information.

This PR updates the doc attributes for the Database.query and
Database.query_local arguments to mirror everything after the first
line of the Database._query docstring.
2019-10-30 16:47:48 -07:00
Greg Becker
230c6aa326
cpu: fix clang flags for generic x86_64 (#13491)
* cpu: differentiate flags used for pristine LLVM vs. Apple's version
2019-10-30 17:16:13 -05:00
Massimiliano Culpo
cf1c38162e cuda: fix conflict statements for x86-64 targets (#13472)
* cuda: fix conflict statements for x86-64 targets

fixes #13462

This build system mixin was not updated after the support for specific
targets has been merged.

* Updated the version range of cuda that conflicts with gcc@8:

* Updated the version range of cuda that conflicts with gcc@8: for ppc64le

* Relaxed conflicts for version > 10.1

* Updated versions in conflicts

Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja>
2019-10-30 09:25:46 -07:00
Peter Scheibel
c99d367a11 syaml_int type should use int.__repr__ rather than str.__repr__ (#13487) 2019-10-29 13:51:48 -07:00
Tamara Dahlgren
3cf21e6edc bugfix: make spack -d test test_changed_files work (#13229)
The `test_changed_files` in `test/cmd/flake8.py` was failing because it calls
`ArgumentParser.parse_args()` without arguments.  Normally that would just
parse `sys.argv` but it seems to fail because of something in either `spack test`
or `pytest`.  Call it with an empty array so that it doesn't try to touch`sys.argv`
at all.

- [x] allow `-d` spack option for `test_changed_files`
2019-10-29 00:25:59 -07:00
Adam J. Stewart
2264e30d99
Update URL parsing regexes and tests (#13411)
* Update URL parsing regexes and tests

* Get rid of no longer used README

* Merge py-udunits and py-cf-units

* netcdf -> netcdf-c

* setup_environment -> setup_*_environment

* Fix doc tests

* Few last minute fixes

* Simplify prefix removal copypasta
2019-10-28 20:27:54 -05:00
Adam J. Stewart
b4e027e918
Output directory Spack is looking in for MKL libs (#13465) 2019-10-28 11:46:59 -05:00
Todd Gamblin
8eeb64096c
version bump: 0.13.0 2019-10-25 21:53:52 -07:00
Todd Gamblin
847703c13d
tutorial: move tutorial to standalone site (#13450)
* docs: add a spack environment for building the docs

* docs: remove tutorial and link to spack-tutorial.readthedocs.io

The tutorial now has its own standalone website, versioned by instances
of the tutorial.  Link to that instead of versioning it directly with Spack.
2019-10-25 21:49:27 -07:00
Peter Scheibel
4af448724f mirror create --all can mirror everything (#12940)
Support mirroring all packages with `spack mirror create --all`.

In this mode there is no concretization:

* Spack pulls every version of every package into the created mirror.
* It also makes multiple attempts for each package/version combination
  (if there is a temporary connection failure).
* Continues if all attempts fail. i.e., this makes its best effort to
  fetch evrerything, even if all attempts to fetch one package fail.

This also changes mirroring logic to prefer storing sources by their hash
or by a unique name derived from the source.  For example:

* Archives with checksums are named by the sha256 sum, i.e.,
  `archive/f6/f6cf3bd233f9ea6147b21c7c02cac24e5363570ce4fd6be11dab9f499ed6a7d8.tar.gz`
  vs the previous `<package-name>-package-version>.tar.gz`
* VCS repositories are stored by a path derived from their URL,
  e.g. `git/google/leveldb.git/master.tar.gz`.

The new mirror layout allows different packages to refer to the same
resource or source without duplicating that download in the
mirror/cache. This change is not essential to mirroring everything but is
expected to save space when mirroring packages that all use the same
resource.

The new structure of the mirror is:

```
<base directory>/
  _source-cache/   <-- the _source-cache directory is new
    archive/       <-- archives/resources/patches stored by hash
      00/          <-- 2-letter sha256 prefix
        002748bdd0319d5ab82606cf92dc210fc1c05d0607a2e1d5538f60512b029056.tar.gz
      01/
        0154c25c45b5506b6d618ca8e18d0ef093dac47946ac0df464fb21e77b504118.tar.gz
        0173a74a515211997a3117a47e7b9ea43594a04b865b69da5a71c0886fa829ea.tar.gz
        ...
    git/
      OpenFAST/
        openfast.git/
          master.tar.gz     <-- repo by branch name
      PHASTA/
        phasta.git/
          11f431f2d1a53a529dab4b0f079ab8aab7ca1109.tar.gz  <-- repo by commit
      ...
    svn/      <-- each fetch strategy has its own subdirectory
      ...
  openmpi/   <-- the remaining package directories have the old format
    openmpi-1.10.1.tar.gz  <-- human-readable name is symlink to _source-cache
```

In addition to the archive names as described above, `mirror create` now
also creates symlinks with the old format to help users understand which
package each mirrored archive is associated with, and to allow mirrors to
work with old spack versions. The symlinks are relative so the mirror
directory can still itself be archived.

Other improvements:

* `spack mirror create` will not re-download resources that have already
  been placed in it.

* When creating a mirror, the resources downloaded to the mirror will not
  be cached (things are not stored twice).
2019-10-25 21:47:28 -07:00
Peter Scheibel
cfbac14cba bugfix: restore upstream lock safety; update tests
Restore upstream lock safety; avoid calling methods directly on upstream DB in test.
2019-10-25 16:01:45 -07:00
Andreas Baumbach
ab55890ba8 Make error msg of test_api_for_build_and_run_environment more informative (#13435) 2019-10-25 19:24:41 +02:00
Todd Gamblin
ebeb1ed62f
bugfix: reindexing is not necessary for DB v0.9.3 to v5 upgrade (#13434)
reindexing takes a significant amount of time, and there's no reason to
do it from DB version 0.9.3 to version 5. The only difference is that v5
can contain "deprecated_for" fields.

- [x] Add a `_skip_reindex` list at the start of `database.py`

- [x] Skip the reindex for upgrades in this list. The new version will
  just be written to the file the first time we actually have to write
  the DB out (e.g., after an install), and reads will still work fine.
2019-10-25 07:10:03 -07:00
Todd Gamblin
dbee91f7f1
bugfix: allow fetching no-code packages (#13429)
Previously, spack would error out if we tried to fetch something with no
code, but that would prevent fetching dependencies. In particular, this
would fail:

    spack fetch --dependencies xsdk

- [x] Instead of raising an error, just print a message that there is nothing
      to be fetched for packages like xsdk that do not have code.

- [x] Make BundleFetchStrategy a bit more quiet about doing nothing.
2019-10-24 16:02:28 -07:00
Todd Gamblin
757387dc2a
commands: Add --json argument to spack spec (#13431)
We've had `spack spec --yaml` for a while, and we've had methods for JSON
for a while as well.  We just haven't has a `--json` argument for `spack spec`.

- [x] Add a `--json` argument to `spack spec`, just like `--yaml`
2019-10-24 16:01:31 -07:00
Chris Green
77af4684aa Improvements to detection of AMD architectures. (#13407)
New entry for K10 microarchitecture.

Reorder Zen* microarchitectures to avoid triggering as k10.

Remove some desktop-specific flags that were preventing Opteron Bulldozer/Piledriver/Steamroller/Excavator CPUs from being recognized as such.

Remove one or two flags which weren't produced in /proc/cpuinfo on older OS (RHEL6 and friends).
2019-10-24 15:48:54 -07:00
Chris Green
0913328812 Correctly identify Skylake CPUs on Darwin. (#13377)
* Correctly identify Skylake CPUs on Darwin.

* Add a test for haswell on Mojave.
2019-10-24 12:44:58 -05:00
Greg Becker
f65f2450df database: update DB version and change to integer database versions (#13410)
Update on version format: change to an integer database format version for simplicity, instead of tracking the Spack version.
2019-10-24 10:43:49 -07:00
Nick Forrington
845df79ac6 Patch libtool when using the Arm compiler (#12004)
* Patch libtool when using the arm, clang, and fujitsu compilers

If libtool does not have values for linker/pic flags, patch them in
2019-10-24 09:51:00 -05:00
Greg Becker
8c7a3e55dd add spack dev-build command; deprecate spack diy (#13374)
Rename the `spack diy` command to `spack dev-build` to make the use case clearer.

The `spack diy` command has some useful functionality for developers using Spack to build their dependencies and configure/build/install the code they are developing.  Developers do not notice it, partly because of the obscure name.

The `spack dev-build` command has a `-u/--until PHASE` option to stop after a given phase of the build. This can be used to configure your project, run cmake on your project, or similarly stop after any stage of the build the user wants. These options are analogous to the existing `spack configure` and `spack build` commands, but for developer builds.

To unify the syntax, we have deprecated the `spack configure` and `spack build` commands, and added a `-u/--until PHASE` option to the `spack install` command as well.

The functionality in `spack dev-build` (specifically `spack dev-build -u cmake`) may be able to supersede the `spack setup` command, but this PR does not deprecate that command as that will require slightly more thought.
2019-10-23 17:08:15 -07:00
Peter Scheibel
f2ddffb840 bugfix: web.push_to_url should not format the local path that is passed to it (#13408)
fd58c98 formats the `Stage`'s `archive_path` in `Stage.archive` (as part of `web.push_to_url`). This is not needed and if the formatted differs from the original path (for example if the archive file name contains a URL query suffix), then the copy fails.

This removes the formatting that occurs in `web.push_to_url`.

We should figure out a way to handle bad cases like this *and* to have nicer filenames for downloaded files.  One option that would work in this particular case would be to also pass `-J` / `--remote-header-name` to `curl`.  We'll need to do follow-up work to determine if we can use `-J` everywhere.

See also: https://github.com/spack/spack/pull/11117#discussion_r338301058
2019-10-23 16:50:51 -07:00
Peter Scheibel
685946b1f1 syaml.dump now allows representing all syaml_ objects (originally this was only available for syaml.dump_config) (#13403) 2019-10-23 14:24:14 -07:00
Massimiliano Culpo
b29eb4212e Users can configure use of RPATH or RUNPATH (#9168)
Add a new entry in `config.yaml`:

    config:
        shared_linking: 'rpath'

If this variable is set to `rpath` (the default) Spack will set RPATH in ELF binaries. If set to `runpath` it will set RUNPATH.

Details:
* Spack cc wrapper explicitly adds `--disable-new-dtags` when linking
* cc wrapper also strips `--enable-new-dtags` from the compile line
    when disabling (and vice versa)
* We specifically do *not* add any dtags flags on macOS, which uses
    Mach-O binaries, not ELF, so there's no RUNPATH)
2019-10-23 13:22:24 -07:00
Greg Becker
cd185c3d28 commands: add spack deprecate command (#12933)
`spack deprecate` allows for the removal of insecure packages with minimal impact to their dependents. It allows one package to be symlinked into the prefix of another to provide seamless transition for rpath'd and hard-coded applications using the old version.

Example usage:

    spack deprecate /hash-of-old-openssl /hash-of-new-openssl

The spack deprecate command is designed for use only in extroardinary circumstances.  The spack deprecate command makes no promises about binary compatibility. It is up to the user to ensure the replacement is suitable for the deprecated package.
2019-10-23 13:11:35 -07:00
Todd Gamblin
26ec644fc8 url summary: show right and wrong parse counts for each regex
Previously this command only showed total counts for each regular
expression.  This doesn't give you a sense of which regexes are working
well and which ones are not.  We now display the number of right, wrong,
and total URL parses per regex.

It's easier to see where we might improve the URL parsing with this
change.
2019-10-23 09:10:32 -07:00
Todd Gamblin
af65146ef6 Preserve comments for Spack YAML objects (#11602)
This updates the configuration loading/dumping logic (now called
load_config/dump_config) in spack_yaml to preserve comments (by using
ruamel.yaml's RoundTripLoader). This has two effects:

* environment spack.yaml files expect to retain comments, which
  load_config now supports. By using load_config, users can now use the
  ':' override syntax that was previously unavailable for environment
  configs (but was available for other config files).

* config files now retain user comments by default (although in cases
  where Spack updates/overwrites config, the comments can still be
  removed).

Details:

* Subclasses `RoundTripLoader`/`RoundTripDumper` to parse yaml into
  ruamel's `CommentedMap` and analogous data structures

* Applies filename info directly to ruamel objects in cases where the
  updated loader returns those

* Copies management of sections in `SingleFileScope` from #10651 to allow
  overrides to occur

* Updates the loader/dumper to handle the processing of overrides by
  specifically checking for the `:` character
  * Possibly the most controversial aspect, but without that, the parsed
    objects have to be reconstructed (i.e. as was done in
    `mark_overrides`). It is possible that `mark_overrides` could remain
    and a deep copy will not cause problems, but IMO that's generally
    worth avoiding.
  * This is also possibly controversial because Spack YAML strings can
    include `:`. My reckoning is that this only occurs for version
    specifications, so it is safe to check for `endswith(':') and not
    ('@' in string)`
  * As a consequence, this PR ends up reserving spack yaml functions
    load_config/dump_config exclusively for the purpose of storing spack
    config
2019-10-23 06:29:49 -07:00
Todd Gamblin
b3f5084b96
tests: avoid extra output in env status test (#13344)
`test_envoronment_status()` was printing extra output during tests.

- [x] disable output only for `env('status')` calls instead of disabling
  it for the whole test.
2019-10-22 23:59:28 -07:00
Greg Becker
95a48b27ec env activation: use package defined env setup methods (#13249)
This PR ensures that environment activation sets all environment variables set by the equivalent `module load` operations, except that the spec prefixes are "rebased" to the view associated with the environment.

Currently, Spack blindly adds paths relative to the environment view root to the user environment on activation. Issue #12731 points out ways in which this behavior is insufficient.

This PR changes that behavior to use the `setup_run_environment` logic for each package to augment the prefix inspections (as in Spack's modulefile generation logic) to ensure that all necessary variables are set to make use of the packages in the environment.

See #12731 for details on the previous problems in behavior.

This PR also updates the `ViewDescriptor` object in `spack.environment` to have a `__contains__` method. This allows for checks like `if spec in self.default_view`. The `__contains__` operator for `ViewDescriptor` objects checks whether the spec satisfies the filters of the View descriptor, not whether the spec is already linked into the underlying `FilesystemView` object.
2019-10-22 23:27:40 -07:00
Massimiliano Culpo
b14f18acda microarchitectures: look in /sbin and /usr/sbin for sysctl (#13365)
This PR ensures that on Darwin we always append /sbin and /usr/sbin to PATH, if they are not already present, when looking for sysctl.

* Make sure we look into /sbin and /usr/sbin for sysctl
* Refactor sysctl for better readability
* Remove marker to make test pass
2019-10-22 21:42:38 -07:00
Massimiliano Culpo
8808207ddf Fixed optimization flags support for old GCC versions (#13362)
These changes update our gcc microarchitecture descriptions based on manuals found here https://gcc.gnu.org/onlinedocs/ and assuming that new architectures are not added during patch releases.
2019-10-22 21:40:45 -07:00
Massimiliano Culpo
cfbdd2179e microarchitectures: add optimization flags for Intel compilers (#13345)
* Added optimization flags for Intel compilers with Intel CPUs
* Added optimization flags for Intel compilers with AMD CPUs
2019-10-22 00:33:59 -07:00
Omar Padron
fd58c98b0e fetching: S3 upload and download (#11117)
This extends Spack functionality so that it can fetch sources and binaries from-, push sources and binaries to-, and index the contents of- mirrors hosted on an S3 bucket.

High level to-do list:

- [x] Extend mirrors configuration to add support for `file://`, and `s3://` URLs.
- [x] Ensure all fetching, pushing, and indexing operations work for `file://` URLs.
- [x] Implement S3 source fetching
- [x] Implement S3 binary mirror indexing
- [x] Implement S3 binary package fetching
- [x] Implement S3 source pushing
- [x] Implement S3 binary package pushing

Important details:

* refactor URL handling to handle S3 URLs and mirror URLs more gracefully.
  - updated parse() to accept already-parsed URL objects.  an equivalent object
    is returned with any extra s3-related attributes intact.  Objects created with
    urllib can also be passed, and the additional s3 handling logic will still be applied.

* update mirror schema/parsing (mirror can have separate fetch/push URLs)
* implement s3_fetch_strategy/several utility changes
* provide more feature-complete S3 fetching
* update buildcache create command to support S3

* Move the core logic for reading data from S3 out of the s3 fetch strategy and into
  the s3 URL handler.  The s3 fetch strategy now calls into `read_from_url()` Since
  read_from_url can now handle S3 URLs, the S3 fetch strategy is redundant.  It's
  not clear whether the ideal design is to have S3 fetching functionality in a fetch
  strategy, directly implemented in read_from_url, or both.

* expanded what can be passed to `spack buildcache` via the -d flag: In addition
  to a directory on the local filesystem, the name of a configured mirror can be
  passed, or a push URL can be passed directly.
2019-10-22 00:32:04 -07:00
Massimiliano Culpo
3d77ecd92e Bootstrap environment modules optimizing for generic architectures (#13105)
fixes #13073

Since #3206 was merged bootstrapping environment-modules was using the architecture of the current host or the best match supported by the default compiler. The former case is an issue since shell integration was looking for a spec targeted at the host microarchitecture.

1. Bootstrap an env modules targeted at generic architectures
2. Look for generic targets in shell integration scripts
3. Add a new entry in Travis to test shell integration
2019-10-21 11:20:05 -07:00
Massimiliano Culpo
498f448ef3 microarchitectures: fix custom compiler versions (#13222)
Custom string versions for compilers were raising a ValueError on
conversion to int. This commit fixes the behavior by trying to detect
the underlying compiler version when in presence of a custom string
version.

* Refactor code that deals with custom versions for better readability
* Partition version components with a regex
* Fix semantic of custom compiler versions with a suffix
* clang@x.y-apple has been special-cased
* Add unit tests
2019-10-21 10:24:57 -07:00
Adam J. Stewart
596f3f1d61
spack create: http -> https (#13269) 2019-10-20 11:05:54 -05:00
Todd Gamblin
20bb6fd733
shebangs: don't warn when patching long shebangs (#13266)
We've been doing this for quite a while now, and it does not seem to
cause issues.

- [x] Switch the noisy warning to a debug to make Spack a bit quieter
  while building.
2019-10-19 14:09:25 -07:00
Massimiliano Culpo
41fb0395a6 Microarchitecture specific optimizations for LLVM (#13250)
* Added architecture specific optimization flags for Clang / LLVM
* Disallow compiler optimizations for mixed toolchains
    * We emit a warning when building for a mixed toolchain
* Fixed issues with suffixed versions of compilers; Apple's Clang will, 
    for the time being, fall back on x86-64 for every compilation.
2019-10-19 13:19:29 -07:00
Peter Scheibel
fd88f8fefa satisfaction checks on dependencies should be strict when the parent check is strict (#13243) 2019-10-17 11:02:14 -07:00
Massimiliano Culpo
9ddc98e46a Separate setting build environment and run environment in packages (#11115)
* Methods setting the environment now do it separately for build and run

Before this commit the `*_environment` methods were setting
modifications to both the build-time and run-time environment
simultaneously. This might cause issues as the two environments
inherently rely on different preconditions:

1. The build-time environment is set before building a package, thus
the package prefix doesn't exist and can't be inspected

2. The run-time environment instead is set assuming the target package
has been already installed

Here we split each of these functions into two: one setting the
build-time environment, one the run-time.

We also adopt a fallback strategy that inspects for old methods and
executes them as before, but prints a deprecation warning to tty. This
permits to port packages to use the new methods in a distributed way,
rather than having to modify all the packages at once.

* Added a test that fails if any package uses the old API

Marked the test xfail for now as we have a lot of packages in that
state.

* Added a test to check that a package modified by a PR is up to date

This test can be used any time we deprecate a method call to ensure
that during the first modification of the package we update also
the deprecated calls.

* Updated documentation
2019-10-17 10:17:21 -07:00
Todd Gamblin
cf9de058aa
multimethods: avoid calling caller_locals() in Python 3 (#13238)
Python 3 metaclasses have a `__prepare__` method that lets us save the
class's dictionary before it is constructed.  In Python 2 we had to walk
up the stack using our `caller_locals()` method to get at this.  Using
`__prepare__` is much faster as it doesn't require us to use `inspect`.

This makes multimethods use the faster `__prepare__` method in Python3,
while still using `caller_locals()` in Python 2.  We try to reduce the
use of caller locals using caching to speed up Python 2 a little bit.
2019-10-17 06:40:23 -07:00
Todd Gamblin
e65b7f8ebf
importing: make importlib_importer recognize .pyc cache (#13239)
Our importer was always parsing from source (which is considerably
slower) because the source size recorded in the .pyc file differed from
the size of the input file.

Override path_stats in the prepending importer to fool it into thinking
that the source size is the size *with* the prepended code.
2019-10-16 17:07:18 -07:00
Michael Kuhn
ffe87ed49f filter_file: fix multiple invocations on the same file (#13234)
Since the backup file is only created on the first invocation, it will
contain the original file without any modifications. Further invocations
will then read the backup file, effectively reverting prior invocations.

This can be reproduced easily by trying to install likwid, which will
try to install into /usr/local. Work around this by creating a temporary
file to read from.
2019-10-16 15:15:24 -07:00
Tamara Dahlgren
1ef71376f2 Bugfix: stage directory permissions and cleaning (#12733)
* This updates stage names to use "spack-stage-" as a prefix.
  This avoids removing non-Spack directories in "spack clean" as
  c141e99 did (in this case so long as they don't contain the
  prefix "spack-stage-"), and also addresses a follow-up issue
  where Spack stage directories were not removed.
* Spack now does more-stringent checking of expected permissions for
  staging directories. For a given stage root that includes a user
  component, all directories before the user component that are
  created by Spack are expected to match the permissions of their
  parent; the user component and all deeper directories are expected
  to be accessible to the user (read/write/execute).
2019-10-16 14:55:37 -07:00
Greg Becker
94e80933f0 Feature: installed file verification (#12841)
This feature generates a verification manifest for each installed
package and provides a command, "spack verify", which can be used to
compare the current file checksums/permissions with those calculated
at installed time.

Verification includes

* Checksums of files
* File permissions
* Modification time
* File size

Packages installed before this PR will be skipped during verification.
To verify such a package you must reinstall it.

The spack verify command has three modes.

* With the -a,--all option it will check every installed package.
* With the -f,--files option, it will check some specific files,
  determine which package they belong to, and confirm that they have
  not been changed.
* With the -s,--specs option or by default, it will check some
  specific packages that no files havae changed.
2019-10-15 14:24:52 -07:00
Massimiliano Culpo
d33b0ffc50 lmod: module files are written in a root folder named by target family (#13121)
fixes #13005

This commit fixes an issue with the name of the root directory for
module file hierarchies. Since #3206 the root folder was named after
the microarchitecture used for the spec, which is too specific and
not backward compatible for lmod hierarchies. Here we compute the
root folder name using the target family instead of the target name
itself and we add target information in the 'whatis' portion of the
module file.
2019-10-15 11:20:49 -07:00
Massimiliano Culpo
5cd28847e8 filter_file uses "surrogateescape" error handling (#12765)
From Python docs:
--
'surrogateescape' will represent any incorrect bytes as code points in
the Unicode Private Use Area ranging from U+DC80 to U+DCFF. These
private code points will then be turned back into the same bytes when
the surrogateescape error handler is used when writing data. This is
useful for processing files in an unknown encoding.
--

This will allow us to process files with unknown encodings.

To accommodate the case of self-extracting bash scripts, filter_file
can now stop filtering text input if a certain marker is found. The
marker must be passed at call time via the "stop_at" function argument.
At that point the file will be reopened in binary mode and copied
verbatim.

* use "surrogateescape" error handling to ignore unknown chars
* permit to stop filtering if a marker is found
* add unit tests for non-ASCII and mixed text/binary files
2019-10-14 20:35:14 -07:00
Greg Becker
3f46f03c83
bugfix: install --only dependencies works in env (#13090)
* bugfix: install --only dependents works in env

includes regression testing
2019-10-14 17:50:38 -07:00
Todd Gamblin
385d2bf3fa
commands: add resource stats to spack url stats (#13205)
`spack url stats` now also looks at packages' resources when outputting
statistics.

Example:

```
$ spack url stats
==> URL stats for 3531 packages:
--------------------------------------------------------------
stat                    versions        %   resources        %
--------------------------------------------------------------
url                         8335    89.3%         339    89.0%
    schemes
        https               6489    69.5%          93    24.4%
        ftp                   32     0.3%           8     2.1%
        http                1763    18.9%         237    62.2%
        file                  51     0.5%           1     0.3%
    checksums
        md5                   26     0.3%           0     0.0%
        sha256              8306    89.0%         336    88.2%
        no checksum            3     0.0%           3     0.8%
--------------------------------------------------------------
go                             1     0.0%           0     0.0%
--------------------------------------------------------------
hg                             7     0.1%           0     0.0%
--------------------------------------------------------------
no code                        4     0.0%           0     0.0%
--------------------------------------------------------------
svn                            4     0.0%          16     4.2%
--------------------------------------------------------------
git                          981    10.5%          26     6.8%
    branch                   442     4.7%           4     1.0%
    commit                   362     3.9%          14     3.7%
    no ref                    36     0.4%           2     0.5%
    tag                      141     1.5%           6     1.6%
--------------------------------------------------------------
```
2019-10-14 08:58:01 -07:00
Adam J. Stewart
e1cf35a82b Fix svn tests, skip if svnadmin not found (#13137) 2019-10-14 10:40:20 +02:00
Greg Becker
1808ba3c68 install: add --cache-only option (#12729)
* add `--cache-only` option to install
* testing for `--cache-only`
* remove extraneous stage creation at stage destroy time
2019-10-12 11:43:37 -07:00
Todd Gamblin
64bdc3251f checksums: enforce that all mainline packages use sha256 checksums
- Add a test that verifies checksums on all packages

- Also add an attribute to packages that indicates whether they need a
  manual download or not, and add an exception in the tests for these
  packages until we can verify them.
2019-10-12 07:19:43 -07:00
Massimiliano Culpo
f8a4a3802c Autotools build system to patch config.guess based on a range check 2019-10-11 21:21:57 -07:00
Massimiliano Culpo
8dd95c1705 Fixed options to compile generic code on ppc64 and ppc64le 2019-10-11 21:20:28 -07:00
Patrick Gartung
d248b0e9d5
Fix python3 errors from string and byte concatenation (#13141) 2019-10-11 03:21:45 -05:00
Tamara Dahlgren
93a44c822c tests: cleanup config:build_stage handling (fixes #12651, #12798) 2019-10-10 16:50:05 -07:00
Tamara Dahlgren
87cdfa2c25 Add support for nested "overrides" scopes. 2019-10-10 16:50:05 -07:00
Massimiliano Culpo
b07460ab5f Added NEON to the list of features required for the aarch64 family
Both floating-point and NEON are required in all standard ARMv8
implementations. Theoretically though specialized markets can support
no NEON or floating-point at all. Source:

https://developer.arm.com/docs/den0024/latest/aarch64-floating-point-and-neon

On the other hand the base procedure call standard for Aarch64
"assumes the availability of the vector registers for passing
floating-point and SIMD arguments". Further "the Arm 64-bit
architecture defines two mandatory register banks: a general-purpose
register bank which can be used for scalar integer processing and
pointer arithmetic; and a SIMD and Floating-Point register bank".
Source:

https://developer.arm.com/docs/ihi0055/latest/procedure-call-standard-for-the-arm-64-bit-architecture

This makes customization of Aarch64 with no NEON instruction set
available so unlikely that we can consider them a feature of the
generic family.
2019-10-10 16:24:36 -07:00
Massimiliano Culpo
77444dff10 ArchSpec: fix constraint satisfaction for targets
fixes #13111

Due to a missing case we were treating a single target that was not
equal to the one we were comparing to as a range open on the right.
2019-10-10 16:22:38 -07:00
Patrick Gartung
5b879459c7
Buildcache: pass string.encode('utf-8') for old_dir and new_dir to replace_prefix_bin. (#13114)
This should fix a Python3 error from concatenating strings and bytes.
2019-10-09 20:36:47 -05:00
Massimiliano Culpo
acbb2af528 "No Spack mirror configured": demoted the warning to a debug message (#13082)
fixes #12010
2019-10-09 07:13:37 -05:00
Adam J. Stewart
72d8febc4e Add macOS Catalina support (#13070) 2019-10-07 23:59:33 -07:00
Massimiliano Culpo
9faee51e22 Spack environments can concretize specs together (#11372)
This PR adds a 'concretize' entry to an environment's spec.yaml file
which controls how user specs are concretized. By default it is
set to 'separately' which means that each spec added by the user is
concretized separately (the behavior of environments before this PR).
If set to 'together', the environment will concretize all of the
added user specs together; this means that all specs and their
dependencies will be consistent with each other (for example, a
user could develop code linked against the set of libraries in the
environment without conflicts).

If the environment was previously concretized, this will re-concretize
all specs, in which case previously-installed specs may no longer be
used by the environment (in this sense, adding a new spec to an
environment with 'concretize: together' can be significantly more
expensive).

The 'concretize: together' setting is not compatible with Spec
matrices; this PR adds a check to look for multiple instances of the
same package added to the environment and fails early when
'concretize: together' is set (to avoid confusing messages about
conflicts later on).
2019-10-07 09:53:23 -07:00
Pariksheet Nanda
19e6f55647 doc: fix #12245 non-functional libdwarf dependency (#12515)
Applying accepted fix from spack/spack.io#4
2019-10-05 21:07:18 -05:00
Michael Kuhn
bdb92f2d91 Consistently support pkg-config files in share subdirectory (#12838)
While the build environment already takes share/pkgconfig into account,
the generated module files etc. only consider lib/pkgconfig and
lib64/pkgconfig.
2019-10-05 21:03:35 -05:00
Massimiliano Culpo
6a1021b81c bugfix: issue with custom dotkit root in config.yaml (#13046)
When removing support for dotkit in #11986 the code trying to set the
paths of the various module files was not updated to skip it. This
results in a failure because of a key error after the deprecation
warning is displayed to user.

This commit fixes the issue and adds a unit test for regression.
Note that code for Spack chains has been updated accordingly but
no unit test has been added for that case.
2019-10-04 23:42:21 -07:00
Adam J. Stewart
24f8d1042b
Update compilers.yaml location in Getting Started docs (#13029) 2019-10-03 10:31:32 -05:00
Massimiliano Culpo
78577c0a90
Generic x86_64 code compiled with GCC uses non deprecated mtune flags (#13022)
fixes #12928
2019-10-03 10:31:03 +02:00
Massimiliano Culpo
76b9c56110 Remove support for generating dotkit files (#11986)
Dotkit is being used only at a few sites and has been deprecated on new
machines. This commit removes all the code that provide support for the
generation of dotkit module files.

A new validator named "deprecatedProperties" has been added to the
jsonschema validators. It permits to prompt a warning message or exit
with an error if a property that has been marked as deprecated is
encountered.

* Removed references to dotkit in the docs
* Removed references to dotkit in setup-env-test.sh
* Added a unit test for the 'deprecatedProperties' schema validator
2019-10-02 22:15:01 -07:00
t-karatsu
a3a0e1cd2e fujitsu compiler: Add 'required_libs'. (#13014) 2019-10-02 11:55:08 -05:00
Patrick Gartung
2a739ed03e
Replace expensive store.reindex() call with db.add() call. (#13021) 2019-10-02 11:30:28 -05:00
Patrick Gartung
9dfec4a57c
'spack buildcache list' should show all buildaches available. (#13002)
* binary cache: show all packages for compatible differing targets

* Don't restrict spack buildcache list to arch or os

* Fix from merge conflict
2019-10-01 22:54:22 -05:00
Massimiliano Culpo
1b18ec90ab Add all compatible system types directory to module paths
fixes #12915
closes #12916

Since Spack has support for specific targets it might happen that
software is built for targets that are not exactly the host because
it was either an explicit user request or the compiler being used is
too old to support the host.

Modules for different targets are written into different directories
and by default Spack was adding to MODULEPATH only the directory
corresponding to the current host. This PR modifies this behavior to
add all the directories that are **compatible** with the current host.
2019-10-01 19:18:27 -07:00
Greg Becker
b92977492d binary cache: show all packages for compatible differing targets (#12943) 2019-10-01 17:03:28 -05:00
Jeffrey Salmond
76178f31ca When removing a file from a view, don't fail if it doesn't exist (#12960)
Sometimes when remove_file is called on a link, that link is missing
(perhaps ctrl-C happened halfway through a previous action). As
removing a non-existent file is no problem, this patch changes the
behavior so Spack continues rather than stopping with an error.

Currently you would see

  ValueError: /path/to/dir is not a link tree!

and now it continues with a warning.
2019-10-01 10:29:10 -07:00
Todd Gamblin
a12c032509 make license check slightly more lenient
bin/spack now needs to have a "-*- python -*-" line after the shebang, so
that emacs will interpret it as a python file instead of as a shell
script.  Add one line to the license check limit to accommodate this.
2019-09-29 09:32:04 -07:00
Massimiliano Culpo
9117dfd118 Add all the 'generic' architectures that are mentioned in recipes (#12958)
LLVM, mesa and other packages check for these generic
microarchitectures. One solution is to let Spack know they exist.
2019-09-28 21:47:05 -07:00
Glenn P Johnson
08a6577861 Fix perl build when using Build.PL
This fixes #12852 where perl builds that use Build.PL will fail when the
shebang of the Build script produced from the configure step is too
long.
2019-09-26 13:38:13 -07:00
Patrick Gartung
7dae058f91
Relocate mach-o binaries using macholib on linux. (#12946)
Changes deps and rpaths for bins and libs, changes id for libs.
2019-09-26 13:04:58 -05:00
eugeneswalker
950338aa92 add --no-deps opt to buildcache-create (#12956) 2019-09-26 12:23:59 -05:00
Patrick Gartung
321e956fa9
External: add macholib and altgraph needed to relocate Mach-o binaries on Linux (#12909) 2019-09-26 11:48:22 -05:00
Adam J. Stewart
065cbe89fe Fix "specific target" detection in Python 3 (#12906)
The output of subprocess.check_output is a byte string in Python 3. This causes dictionary lookup to fail later on.

A try-except around this function prevented this error from being noticed. Removed this so that more errors can propagate out.
2019-09-24 09:47:54 -07:00
Patrick Gartung
6dd9dbc071
Change get_patchelf to immediately return patchelf path if found (#12925) 2019-09-24 08:38:19 -05:00
t-karatsu
9aca0a17f4 Fujitsu compilers: added 'verbose_flag' method (#12922) 2019-09-24 11:17:29 +02:00
Todd Gamblin
18d63a239f bugfix: use string keys to set preferred targets (#12921)
Preferred targets were failing because we were looking them up by
Microarchitecture object, not by string.

- [x] Add a call to `str()` to fix target lookup.
- [x] Add a test to exercise this part of concretization.
- [x] Add documentation for setting `target` in `packages.yaml`
2019-09-24 10:18:48 +02:00
Massimiliano Culpo
2468ccee58 AMD: fix architecture hierarchy (zen) (#12913)
* microarchitectures: zen starts from x86_64, not from excavator
* Unit tests: fixed a test that is wrong with the new modeling
* microarchitectures: fixed features and inheritance for 15h family

bulldozer doesn't inherit from barcelona (10h) + added xop, lwp and tbm
instruction sets to the 15h family (it distinguish the family from 17h)
2019-09-23 21:54:13 -07:00
Adam J. Stewart
d6555f64b0
Fix detection of Apple Clang 11.0.0 (#12912) 2019-09-23 17:25:33 -05:00
Tamara Dahlgren
08e77e1b41
tests: more template creation tests (#12882)
Addresses #12804 

This PR adds the creation of the remaining (16) templates to ensure we can create them with expected content. The goal is to facilitate catching during testing.
2019-09-23 10:18:50 -07:00
Todd Gamblin
b4e148b562 externals: add note to jsonschema about modifications (#12895) 2019-09-22 09:43:57 -05:00
Todd Gamblin
7a1dd517b8 externals: avoid importing requests in jsonschema
Spack doesn't need `requests`, and neither does `jsonschema`, but
`jsonschema` tries to import it, and it'll succeed if `requests` is on
your machine (which is likely, given how popular it is).  This commit
removes the import to improve Spack's startup time a bit.

On a mac with SSD, the import of requests is ~28% of Spack's startup time
when run as `spack --print-shell-vars sh,modules` (.069 / .25 seconds),
which is what `setup-env.sh` runs.

On a Linux cluster where Python is mounted from NFS, this reduces
`setup-env.sh` source time from ~1s to .75s.

Note: This issue will be eliminated if we upgrade to a newer `jsonschema`
(we'd need to drop Python 2.6 for that).  See
https://github.com/Julian/jsonschema/pull/388.
2019-09-21 17:57:36 -07:00
Scott Wittenburg
db4d52d923 Fix how 'gpg --list-secret-keys ...' output is parsed 2019-09-20 11:33:58 -06:00
Gregory Becker
c43f105359 targets: add mic_knl target to microarchitectures.json
- This is needed to support Cray machines -- we need an architecture
  mic_knl > x86_64

- We used Cray's naming scheme for this target to make it work seamlessly
  with the module-based detection sccheme on Cray.  mic_knl is pretty
  much dead, so this will be the last succh target.  We will need to work
  wtih Cray and other vendors in the future.
2019-09-20 00:51:37 -07:00
Massimiliano Culpo
7daf860991 targets: adjust packages to use new specific targets semantics
Seamless translation from 'target=<generic>' to either
- target.family == <generic> (in methods)
- 'target=<generic>:' (in directives)

Also updated docs to show ranges in directives.
2019-09-20 00:51:37 -07:00
Massimiliano Culpo
3c4322bf1a targets: Spack targets can now be fine-grained microarchitectures
Spack can now:

- label ppc64, ppc64le, x86_64, etc. builds with specific
  microarchitecture-specific names, like 'haswell', 'skylake' or
  'icelake'.

- detect the host architecture of a machine from /proc/cpuinfo or similar
  tools.

- Understand which microarchitectures are compatible with which (for
  binary reuse)

- Understand which compiler flags are needed (for GCC, so far) to build
  binaries for particular microarchitectures.

All of this is managed through a JSON file (microarchitectures.json) that
contains detailed auto-detection, compiler flag, and compatibility
information for specific microarchitecture targets.  The `llnl.util.cpu`
module implements a library that allows detection and comparison of
microarchitectures based on the data in this file.

The `target` part of Spack specs is now essentially a Microarchitecture
object, and Specs' targets can be compared for compatibility as well.
This allows us to label optimized binary packages at a granularity that
enables them to be reused on compatible machines.  Previously, we only
knew that a package was built for x86_64, NOT which x86_64 machines it
was usable on.

Currently this feature supports Intel, Power, and AMD chips. Support for
ARM is forthcoming.

Specifics:

- Add microarchitectures.json with descriptions of architectures

- Relaxed semantic of compiler's "target" attribute.  Before this change
  the semantic to check if a compiler could be viable for a given target
  was exact match. This made sense as the finest granularity of targets
  was architecture families.  As now we can target micro-architectures,
  this commit changes the semantic by interpreting as the architecture
  family what is stored in the compiler's "target" attribute. A compiler
  is then a viable choice if the target being concretized belongs to the
  same family. Similarly when a new compiler is detected the architecture
  family is stored in the "target" attribute.

- Make Spack's `cc` compiler wrapper inject target-specific flags on the
  command line

- Architecture concretization updated to use the same algorithm as
  compiler concretization

- Micro-architecture features, vendor, generation etc. are included in
  the package hash.  Generic architectures, such as x86_64 or ppc64, are
  still dumped using the name only.

- If the compiler for a target is not supported exit with an intelligible
  error message. If the compiler support is unknown don't try to use
  optimization flags.

- Support and define feature aliases (e.g., sse3 -> ssse3) in
  microarchitectures.json and on Microarchitecture objects. Feature
  aliases are defined in targets.json and map a name (the "alias") to a
  list of rules that must be met for the test to be successful. The rules
  that are available can be extended later using a decorator.

- Implement subset semantics for comparing microarchitectures (treat
  microarchitectures as a partial order, i.e. (a < b), (a == b) and (b <
  a) can all be false.

- Implement logic to automatically demote the default target if the
  compiler being used is too old to optimize for it. Updated docs to make
  this behavior explicit.  This avoids surprising the user if the default
  compiler is older than the host architecture.

This commit adds unit tests to verify the semantics of target ranges and
target lists in constraints. The implementation to allow target ranges
and lists is minimal and doesn't add any new type.  A more careful
refactor that takes into account the type system might be due later.

Co-authored-by: Gregory Becker <becker33.llnl.gov>
2019-09-20 00:51:37 -07:00
Gregory Becker
dfabf5d6b1 targets: first pass at target detection for linux
Add llnl.util.cpu_name, with initial support for detecting different
microarchitectures on Linux.  This also adds preliminary changes for
compiler support and variants to control the optimizatoin levels by
target.

This does not yet include translations of targets to particular
compilers; that is left to another PR.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2019-09-20 00:51:37 -07:00
Patrick Gartung
a940ff34d7
Put back the use of otool and install_name_tool when running on macOS. Only use machotools on linux. (#12867)
Move verbose messages to debug level

get_patchelf should return None for test platform as well because create_buildinfo invokes patchelf to get rpaths.
2019-09-19 17:16:26 -05:00
Patrick Gartung
7c0c31361a
Update buildcache creation and installation to allow mach-o binary relocation using py-machotools on linux or macos. (#12858)
Update py-machotools dependencies and versions.
2019-09-18 07:24:45 -05:00
Scott Wittenburg
56894b8805 Support yaml paths anywhere specs are handled on CLI (#12561)
Update command-line (CLI) parsing to understand references to yaml
files that store Spack specs. Where a file reference is encountered,
the full Spec in the file will be read in. A file reference may
appear anywhere that a spec could appear before. For example, if you
write "spack spec -y openmpi > openmpi.yaml" you may then install the
spec using the yaml file by running "spack install ./openmpi.yaml";
you can also refer to dependencies in this way (e.g.
"spack install foo^./openmpi.yaml").

There are two requirements for file references:

* A file path entered on the CLI must include a "/" even if the file
  exists in your current working directory. For example, if you
  create an openmpi.yaml file as above and run
  "spack install openmpi.yaml" from the same directory, it will
  report an error.
* A file path entered on the CLI must end with ".yaml"

This commit adds error messages to clearly inform the user of both
violations.
2019-09-17 19:45:37 -07:00
Peter Scheibel
141a1648e6 implicit rpaths filtering (#12789)
* implicit_rpaths are now removed from compilers.yaml config and are always instantiated dynamically, this occurs one time in the build_environment module

* per-compiler list required libraries (e.g. libstdc++, libgfortran) and whitelist directories from rpaths including those libraries. Remove non-whitelisted implicit rpaths. Some libraries default for all compilers.

* reintroduce 'implicit_rpaths' as a config variable that can be used to disable Spack insertion of compiler RPATHs generated at build time.
2019-09-17 17:45:21 -05:00
Adam J. Stewart
21e4b1752e Fix generic body during package creation (#12804)
Fixes incomplete change in #11981 

Use the proper variable (`body_def`) during package creation for package subclasses.
2019-09-17 09:37:46 -07:00
Adam J. Stewart
dce45aa299 Allow build to proceed with failed compiler lib detection (#12756)
Fixes #12732
Fixes #12767

c22a145 added automatic detection and RPATHing of compiler libraries
to Spack builds. However, in cases where the parsing/detection logic
fails this was terminating the build. This makes the compiler library
detection "best-effort" and reports an issue when the detection fails
rather than terminating the build.
2019-09-16 19:09:28 -07:00
Adam J. Stewart
5eac8130b3 Quote shell variable values (#12759)
This updates logic which sets shell variables to quote the values,
which is necessary when the value contains a space (e.g. PATH).
2019-09-16 11:10:36 -07:00
Scott Wittenburg
1050fa5546 Fixes identified in ecp facilities hackathon fixes:
- improve mirror git repo management
- minio s3 implementation needs endpoint_url
- Remove image key from rebuild-index job
- Remove image, rely on tags instead
2019-09-13 22:57:15 -07:00
Scott Wittenburg
6d745a56fd Implement an optional compiler bootstrapping phase 2019-09-13 22:57:15 -07:00
Scott Wittenburg
5323a5cff9 Remove CombinatorialSpecSet in favor of environments + stacks 2019-09-13 22:57:15 -07:00
Scott Wittenburg
fabbb3d58a Refactor release-jobs cmd based on use of environments (no docker either) 2019-09-13 22:57:15 -07:00
Scott Wittenburg
73c161b7de Add schema for new gitlab-ci and cdash additions to environment 2019-09-13 22:57:15 -07:00
Greg Becker
b1868f35ec
module parsing: make heuristic to get paths from modules more robust (#12693)
* module parsing: make heuristic to get paths from modules more robust

* refactor module parsing
2019-09-11 10:51:44 -07:00
Massimiliano Culpo
bd0fed7090 clang: add another regex for version detection (#12769)
This is similar to #10191. The Ubuntu package for clang 8.0.0 displays
a very unusual version string, and we need this new regex to detect it
as just 8.0.0

Unit test have been complemented by the output that was failing
detection.
2019-09-09 11:37:04 -05:00
Adam J. Stewart
bff667051b
Fix PyQt installation (#12479)
* Fix PyQt installation

* Switch dependency type

* Replace SIP dependency with resource

* Relax py-pyqt4 Qt dependency
2019-09-08 10:48:50 -05:00
Todd Gamblin
a2220f3150 flake8: make entire repository pass spack flake8 -a
- Fix trailing whitespace missed by the bug described in #12755.

- Fix other style issues that have crept in over time (this can happen
  when flake8 adds new checks with new versions)
2019-09-07 23:59:10 -07:00
Todd Gamblin
0ec80e8f16
flake8: only add E501 exemptions when absolutely necessary (#12755)
E501 (line too long) exemptions are probably our most common ones -- we
add them for directives, URLs, hashes, etc. in packages.  But we
currently add them even when a line *doesn't* need them, which can mask
trailing whitespace errors.

This changes `spack flake8` so that it will only add E501 exemptions if
the line is *actually* too long.

Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com>
2019-09-07 23:58:12 -07:00
Adam J. Stewart
a4aa1b5a05
Update docs on module loads command (#12702) 2019-09-07 18:32:02 -05:00
Greg Becker
3f1c78128e
make env view loading unconditional (#12719) 2019-09-05 18:15:36 -07:00
Chris Green
7f8fe11e4d Improve mock_archive versatility; Remove unwanted ALLOWED_ARCHIVE_TYPES. (#12513)
mock_archive can now take multiple extension / tar option pairs (default matches old behavior).

url_fetch.test_fetch tests more archive types.

compression.EXTS split into EXTS and NOTAR_EXTS to avoid unwanted, non-meaningful combinatoric extensions such as .tar.tbz2.
2019-09-04 13:49:00 -05:00
Todd Gamblin
6b619daef3 specs: better lookup by hash; allow references to missing dependency hashes
- previously spec parsing didn't allow you to look up missing (but still
  known) specs by hash

- This allows you to reference and potentially reinstall
  force-uninstalled dependencies

- add testing for force uninstall and for reference by spec

- cmd/install tests now use mutable_database
2019-09-04 00:25:36 -07:00
Tamara Dahlgren
c141e99e06 Use spack/user-specific stage root by default; stage cleaning (#12516)
* When cleaning the stage root, only remove directories that appear
  to be used for staging Spack packages. Previously Spack was clearing
  all directories in the stage root, which could remove content not
  related to Spack if the user chose a staging root which contains
  files/directories not managed by Spack.
* The documentation is updated with warnings about choosing a stage
  directory that is only managed by Spack (although generally the
  check added in this PR for "spack clean" should avoid removing
  content that was not created by Spack)
* The default stage directory (in config.yaml) is now
  $tempdir/$user/spack-stage and the logic is updated to omit the
  $user portion of this path if $tempdir already contains a $user
  directory.
* When creating stage root assign user read/write permissions to all
  directories in the path under $user. Previously Spack was assigning
  the permissions of the first existing parent directory
2019-09-03 16:31:27 -07:00
Todd Gamblin
d79f85d763 perf: spack find -p now does only one DB transaction
`spec.prefix` reads from Spack's database, and if you do this with
multiple consecutive read transactions, it can take a long time.  Or, at
least, you can see the paths get written out one by one.

This uses an outer read transaction to ensure that actual disk locks are
acquired only once for the whole `spack find` operation, and that each
transaction inside `spec.prefix` is an in-memory operation. This speeds
up `spack find -p` a lot.
2019-09-03 07:41:38 -07:00
Todd Gamblin
da7fed86a8 tests: add tests for spack extensions command
- add tests for `spack extensions`
- refactor `test_activations` test to use real extensions.
2019-09-02 19:24:48 -07:00
Todd Gamblin
1b877e8e0f tests and completions for spack find --json and spack find --format 2019-09-02 19:24:48 -07:00
Todd Gamblin
2dc7467760 tests: remove extraneous print statement 2019-09-02 19:24:48 -07:00
Todd Gamblin
d4bad06202 refactor: clean up spack find, make spack find -dp work properly
Refactor `spack.cmd.display_specs()` and `spack find` so that any options
can be used together with -d. This cleans up the display logic
considerably, as there are no longer multiple "modes".
2019-09-02 19:24:48 -07:00
Todd Gamblin
987d8cbaaa docs: add docs for spack find --format and spack find --json
- add docs for `spack find --format`
- add docs for `spack find --json`
- update references to Spec.format() docs and add links
2019-09-02 19:24:48 -07:00
Todd Gamblin
1a1f5674df command: add spack find --json
This is another machine-readable version of `spack find`.  Supplying the
`--json` argument causes specs to be written out as json records,
easily filered with tools like jq.

e.g.:

    $ spack find --json python | jq -C ".[] | { name, version } "
    [
      {
        "name": "python",
        "version": "2.7.16"
      },
      {
        "name": "bzip2",
        "version": "1.0.8"
      }
    ]
2019-09-02 19:24:48 -07:00
Todd Gamblin
64af0a9874 command: add spack find --format
- spack find --format allows you to supply a format string and have specs
  output in a more machine-readable way, without dedcoration

e.g.:

    spack find --format "{name}-{version}-{hash}"
    autoconf-2.69-icynozk7ti6h4ezzgonqe6jgw5f3ulx4
    automake-1.16.1-o5v3tc77kesgonxjbmeqlwfmb5qzj7zy
    bzip2-1.0.6-syohzw57v2jfag5du2x4bowziw3m5p67
    ...

or:

    spack find --format "{hash}"
    icynozk7ti6h4ezzgonqe6jgw5f3ulx4
    o5v3tc77kesgonxjbmeqlwfmb5qzj7zy
    syohzw57v2jfag5du2x4bowziw3m5p67
    ...

This is intended to make it much easier to script with `spack find`
2019-09-02 19:24:48 -07:00
Peter Scheibel
9432d4c7ee
Archive all patches in a package after install (#12653)
When Spack installs a package it writes the package.py file and
patches to a separate repository (which reflects the state of the
package at the time it was installed). Previously, Spack only wrote
patches that were used at installation time. This updates the
archiving step to include all patch files that are relevant to the
package (in case that repository is used in another context).
2019-08-30 10:33:18 -07:00
t-karatsu
0c421589e6 Fujitsu compiler: Add flags for c11/c99 (#12622)
* Fujitsu compiler: Add flags for c11/c99

* Add unit tests about supported flags
2019-08-30 11:25:34 -05:00
Greg Becker
c8b613d261 fix packaging_guide variant table (#12296) 2019-08-29 09:35:48 -06:00
Geoffrey M Oxberry
56fd9bc7b6 AutotoolsPackage: remove redundant libtoolize call
This commit removes redundant calls to `libtoolize` and `aclocal`.

Some configurations, such as a Spack user using macOS with a
Homebrew-installed `libtool` added to their `packages.yaml`, have
`autoreconf` and GNU libtoolize installed as `glibtoolize`, but not
`libtoolize`. While Spack installations of `libtool` built from source
would install `glibtoolize` and symlink `libtoolize` to `glibtoolize`,
an external installation of GNU libtoolize as `glibtoolize` will not
have such a symlink, and thus the call `m.libtoolize()` will throw an
error because `libtoolize` does not exist at the path referenced by
`m.libtoolize()` (i.e.,
`self.spec['libtool'].prefix.bin.join('libtoolize')).

However, on these same systems, `autoreconf` runs correctly, and calls
`glibtoolize` instead of `libtoolize`, when appropriate. Thus,
removing the call to `libtoolize` should resolve the error mentioned
above.

The redundant call to `aclocal` is also removed in this commit because
the maintainers of GNU Automake state that "`aclocal` is expected to
disappear" and suggest that downstream users never call `aclocal`
directly -- rather, they suggest calling `autoreconf` instead.
2019-08-27 18:03:56 -07:00
Massimiliano Culpo
2e8aa6cb24 Configuration schema are checked against jsonschema draft 4 meta-schema (#10247)
fixes #10246
2019-08-27 09:31:18 -06:00
Adam J. Stewart
f31e87935e
RPackage docs: use cloud.r-project.org (#12471) 2019-08-25 12:34:58 -05:00
Ben Boeckel
c22a145344 Add implicit rpaths to compiler detection (#7153)
Uses code from CMake to detect implicit link paths from compilers
System paths are filtered out of implicit link paths
Implicit link paths added to compiler config and object under `implicit_rpaths`
Implicit link paths added as rpaths to compile line through env/cc wrapper

Authored by: "Ben Boeckel <ben.boeckel@kitware.com>"
Co-authored by: "Peter Scheibel <scheibel1@llnl.gov>"
Co-authored by: "Gregory Becker <becker33@llnl.gov>"
2019-08-24 06:21:45 -07:00
Tamara Dahlgren
b42324c23b bugfix: template create constructor args (#12536)
c9e214f updated template creation by passing **kwargs to package
template classes but the template classes were not updated to accept
them; this adds **kwargs to package template initializers where they
are needed.
2019-08-23 10:45:17 -07:00
Seth R. Johnson
c86006e948 Skip invisible non-packages in package directory. (#12467)
Having a non-directory invisible file causes `spack find` to die. This
fixes the logic to ignore invalid module names but only warn if they're
visible.
```
NotADirectoryError: [Errno 20] Not a directory: '/spack/var/spack/repos/builtin/packages/.DS_Store/package.py'
```
2019-08-23 06:42:17 +02:00
Tamara Dahlgren
c9e214f6d3 Spack BundlePackage: a group of other packages (#11981)
This adds a special package type to Spack which is used to aggregate
a set of packages that a user might commonly install together; it
does not include any source code itself and does not require a
download URL like other Spack packages. It may include an 'install'
method to generate scripts, and Spack will run post-install hooks
(including module generation).

* Add new BundlePackage type
* Update the Xsdk package to be a BundlePackage and remove the
  'install' method (previously it had a noop install method)
* "spack create --template" now takes "bundle" as an option
* Rename cmd_create_repo fixture to "mock_test_repo" and relocate it
  to shared pytest fixtures
* Add unit tests for BundlePackage behavior
2019-08-22 11:08:23 -07:00
Greg Becker
5af2378ece compiler install: fix bug in construction of compiler spec (#12507) 2019-08-22 09:57:53 -07:00
Peter Scheibel
661b1da5d0
'spack spec --yaml' command now writes build deps to yaml (#12317)
This allows "spack spec --yaml" to generate a spec YAML file that can
be used with "spack install -f". Before, this would fail in cases
where the spec had build dependencies.
2019-08-21 18:32:31 -07:00
Chris Green
2499c047f0 Emacs directives for fill-column setting. 2019-08-21 18:21:05 -07:00
Chris Green
ad4309b782 Fetch strategies: new global option no_cache, new git option get_full_repo.
* All fetch strategies now accept the Boolean version keyword option `no_cache` in order to allow per-version control of cache-ability.
* New git-specific version keyword option `get_full_repo` (Boolean). When true, disables the default `--depth 1` and `--single-branch` optimizations that are applied if supported by the git version and (in the former case) transport protocol.
* The try / catch blog attempting `--depth 1` and retrying on failure has been removed in favor of more accurately ascertaining when the `--depth` option should work based on git version and protocol choice. Any failure is now treated as a real problem, and the clone is only attempted once.
* Test improvements:
  * `mock_git_repository.checks[type_of_test].args['git']` is now specified as the URL (with leading `file://`) in order to avoid complaints when using `--depth`.
  * New type_of_test `tag-branch`.
  * mock_git_repository now provides `git_exe`.
  * Improved the action of the `git_version` fixture, which was previously hard-wired.
  * New tests of `--single-branch` and `--depth 1` behavior.
* Add documentation of new options to the packaging guide.
2019-08-21 18:21:05 -07:00
Chris Green
ccb688f575 Fix to option text for help command. (#12444) 2019-08-21 17:11:24 -07:00
Peter Scheibel
5127d95b2e properly format message with all paths that could not be used. also report canonicalized paths vs. Spack config variables like 'tempdir' (#12492) 2019-08-21 15:46:12 -07:00
Chris Green
2441c0bad7 pkg command uses a working directory for git invocations rather than -C. (#12491) 2019-08-21 09:31:27 -07:00
Greg Becker
3b115fffb1 permissions: fix file permissions on intermediate install directories (#12399)
- mkdirp now takes arguments to allow it to properly set permissions on created directories.
- Two arguments (group and mode) set permissions for the leaf directory.
- Intermediate directories can inherit permissions from either the topmost existing directory (the parent) or the leaf.
2019-08-20 23:08:02 -07:00
Todd Gamblin
368bf2d69c
stage: avoid using group name in _first_accessible_path()
On machines where $TMP is owned by a gid with no name, this avoids the
following error when the default spack stage does not exist:

    (spackbook):spack$ spack clean
    ==> Removing all temporary build stages
    ==> Error: 'getgrgid(): gid not found: 57095'

Spack needs to deal with gids directly unless users pass them in.
2019-08-20 14:52:53 -07:00
Tamara Dahlgren
aed204e409
cleanup: remove extraneous prints (#12474)
Removes messages accidentally introduced in #12072 .
2019-08-19 14:49:09 -07:00
Peter Scheibel
31ff791180 features: Update compiler caching (#7675)
Compiler caching was using the `id()` function to refer to configuration dictionary objects. If these objects are garbage-collected, this can produce incorrect results (false positive cache hits). This change replaces `id()` with an object that keeps a reference to the config dictionary so that it is not garbage-collected.
2019-08-19 11:24:05 -07:00
Tamara Dahlgren
0ea6e0f817
features: Remove stage symlinks (#12072)
Fixes #11163

The goal of this work is to simplify stage directory structures by eliminating use of symbolic links. This means, among other things, that` $spack/var/spack/stage` will no longer be the core staging directory. Instead, the first accessible `config:build_stage` path will be used.

Spack will no longer automatically append `spack-stage` (or the like) to configured build stage directories so the onus of distinguishing the directory from other work -- so the other work is not automatically removed with a `spack clean` operation -- falls on the user.
2019-08-19 10:31:24 -07:00
Zack Galbreath
cef1e4e0b4 Do not report on packages installed from the cache (#12336)
Skip generating reports for any packages that were found in the binary cache.
2019-08-16 10:19:11 -07:00
Greg Becker
0307b5a3dc mirrors: make spack mirror environment aware (#12345)
Allow "spack mirror" with no spec arguments to create a mirror for the
active environment (download all concretized specs in the environment)
2019-08-15 18:45:17 -07:00
Peter Scheibel
1f6befabb1
Fix "spack loads" when retrieving upstream modules (#12203)
Fixes #12062

406c791 addressed "spack module load" for upstream modules but not
the "spack module loads" command. This applies the same fixes from
406c791 to "spack module loads".
2019-08-13 11:09:40 -07:00
Massimiliano Culpo
ab4b5deb97 bugfix: Python 2.6 parsing error (#11867)
Apparently shlex.split can't deal with unicode encoded characters in
Python2.6. The solution is to convert to str before calling the
function.
2019-08-11 13:00:36 -07:00
Greg Becker
be6ac6ce6d bugfix: nested matrices in spec lists (#12320)
* stack concretization: fix handling of variant names with dashes
* spec_list: bugfix for handling nested matrices
2019-08-08 20:53:31 -07:00
Adam J. Stewart
44f4ad7bbf Allow Spack to uninstall external extensions without permissions (#11991)
* Allow Spack to uninstall external extensions without permissions

Raise when self.projections is not empty
2019-08-08 17:46:14 -07:00
Pariksheet Nanda
72bb7646fe docs: fix compiler config (#12330)
It's no longer possible to set compiler flags under as an entry under
"paths" in compilers.yaml; instead the user must list these under the
"flags" section. This updates the docs accordingly.
2019-08-08 16:47:24 -07:00
Adam J. Stewart
b4862be875 Fix typo in yaml config docs (#12312) 2019-08-08 10:56:11 +02:00
Greg Becker
36fbd6cf4c bugfix: spack stacks mixed dependency and non-dep constraints (#12315)
Spack stacks drop invalid dependencies applied to packages by a
spec_list matrix operation

Without this fix, Spack would raise an error if orthogonal dependency
constraints and non-dependency constraints were applied to the same
package by a matrix and the dependency constraint was invalid for
that package. This is an error, fixed by this PR.

An example failing configuration:

spack:
  definitions:
  - packages: [libelf, hdf5+mpi]
  - compilers: ['%gcc']
  - mpis: [^openmpi]

  specs:
  - matrix:
    - $packages
    - $compilers
    - $mpis
2019-08-07 18:34:41 -07:00
Peter Scheibel
92ec732f9a compiler bootstrapping: enable both single-node and multi-node DAGS(#12310)
5f74f22 enabled installing compilers for dependencies but not for the root package (and in particular not for DAGs which consist of one package)

this enables bootstrapping compilers for both types of DAGs
2019-08-07 14:43:25 -07:00
Tamara Dahlgren
951d42596b tests: explain and test dependency flattening routines (#11993)
- Add comments to explain that `install_dependency_symlinks` and `flatten_dependencies` are actually used.
- Add a test that exercises the routines.
2019-08-06 17:11:23 -07:00
Greg Becker
15884a679b
mirrors: mirror config should use spack variable expansions (#9027)
- ensure that `$spack` and other variables are substituted into mirror
  paths
2019-08-06 13:54:50 -07:00
Greg Becker
3b4d6ddc03 stacks: fix reference handling in env.write() (#12096)
* stacks: Fix env.write to properly write references
* stacks: regression test for 12095
2019-08-06 12:53:41 -07:00
Pariksheet Nanda
f68cdd1ad0 Fix typo in config (#12267)
Using "compilers" with the "s" is an invalid config section and throws an error.

Traceback (most recent call last):
  File "spack/bin/spack", line 48, in <module>
    sys.exit(spack.main.main())
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/main.py", line 633, in main
    env = ev.find_environment(args)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 263, in find_environment
    return Environment(env)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 534, in __init__
    self._read_manifest(f)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 561, in _read_manifest
    self.yaml = _read_yaml(f)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 402, in _read_yaml
    validate(data, filename)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 395, in validate
    e, data, filename, e.instance.lc.line + 1)
spack.config.ConfigFormatError: /home/omsai/src/libkmap/spack.yaml:15: Additional properties are not allowed ('compilers' was unexpected)
2019-08-03 20:18:44 -05:00
Adam J. Stewart
98605bba0d Fix CNL version detection (#12207) 2019-08-03 12:00:30 -07:00
Massimiliano Culpo
90756d0428 Refactor UI logic out of Environment.concretize (#12213)
Environment.concretize returns newly-concretized specs rather than
printing them; as a result, the _display argument is removed from
Environment.concretize (originally only used to avoid printing specs
during unit testing). Command logic which invokes
Environment.concretize prints these explicitly.
2019-08-02 17:27:51 -07:00
Seth R. Johnson
46027bea13 Fix QT4 build for mac (#10944)
This updates the Spack QT package to enable building qt version 4 on
MacOS. 

This includes the following changes to the qt package:

* add version 4.8.7
* add option to build with or without shared libs
* add options to disable tools, ssl, sql, and freetype support
* add qt4-tools patch when building qt@4+tools
* add option to build as a framework (only available on MacOS)
* replace qt4-el-capitan patch with qt4-mac patch (which includes the
  edits from qt4-el-capitan)
* apply qt4-pcre-include-conflict.patch only for version 4.8.6
  (rather than all 4.x versions)
* apply qt4-gcc-and-webkit.patch for 4.x versions before 4.8.7 and
  create a separate qt4-gcc-and-webkit-487.patch for version 4.8.7
* update patch function for qt@4 on MacOS to update configure
  variables relevant to Spack (e.g. PREFIX)
* add option to build freetype with Spack, as a vendored dependency
  of QT, or not at all (default is to build with Spack)

This includes the following edits outside of the qt package:

* Update MacOS version utility function to return all parts of the
  Mac version (rather than just the first two)
* gettext package: implement "libs"
* python package: add gettext as a dependency
2019-08-01 10:22:35 -07:00
Patrick Gartung
4ff14bd0b2
Buildcache: skip binary string replacement with padding when the new install path is longer than the old install path. (#12227)
* Raise an exception and exit with a meaningful message when binary path substitution fails.

* Skip binary text replacement with padding and issue a warning when the new install path is longer than the old install path.
2019-08-01 12:07:04 -05:00
Levi Baber
8ec9ebc92f should not need bin prefix on spack command (#12215) 2019-07-31 12:58:01 -05:00
Todd Gamblin
33701cc355
docs: update tutorial slides for PEARC19 2019-07-31 12:55:59 -05:00
Adam J. Stewart
f7d1df4d3a
Update Package Creation Tutorial for PEARC19 (#12209)
* Update Package Creation Tutorial for PEARC19

* A few remaining fixes

* Fix section link
2019-07-31 12:54:09 -05:00
Christoph Junghans
4ea5e177cd
CMake: make ninja verbose as well (#12200) 2019-07-31 08:41:58 -06:00
Javier Cervantes
a948954886 Print environment name when removing active env (#12198) 2019-07-31 14:40:11 +02:00
Adam J. Stewart
d973fca00e Fix Sphinx deprecation warning when building docs (#12205)
* Fix Sphinx deprecation warning when building docs

* Set minimum required version of Sphinx
2019-07-31 10:23:56 +02:00
Adam J. Stewart
b34da4e108
Add SIPPackage base class (#12157) 2019-07-30 17:12:48 -05:00
Adam J. Stewart
23420a6524 Typo fixes in Environments Tutorial (#12107) 2019-07-29 17:13:56 -05:00
Greg Becker
f78fc30032 intel: Add mpicc wrapper bindir to dependent env (#12132) 2019-07-29 12:04:15 -07:00
Gregory Lee
e8a71089a6 use Excecutable instead of exec for editing licenses (#11968)
* fix defunct editor exit in #11691
2019-07-25 11:48:32 -07:00
Todd Gamblin
b0abbfecb8 new command: spack maintainers queries package maintainers
- We don't currently make enough use of the maintainers field on
  packages, though we could use it to assign reviews.

- add a command that allows maintainers to be queried
  - can ask who is maintaining a package or packages
  - can ask what packages users are maintaining
  - can list all maintained or unmaintained packages

- add tests for the command
2019-07-24 14:10:08 -07:00
Tamara Dahlgren
7411347a29 tests: Test install of unconcretized spec (#12099) 2019-07-24 13:30:27 -05:00
Massimiliano Culpo
6fac0ae687 Fixed a name clash in the 'from_environment_diff' function (#12116)
* Added a unit test reproducing the failure in 12085

* Fixed name clash in the 'from_environment_diff' function

The bug reported in #12085 stemmed from a name clash among variables,
introduced during the refactor in #10753 and not caught by unit tests
and reviews.
2019-07-24 10:25:24 -05:00
Adam J. Stewart
58427a7102
Typo fixes in Spack Environments docs (#12100) 2019-07-23 17:42:16 -05:00
Greg Becker
daac376862
error messages: include whole spec for "no externals found" message (#12070)
* Provide better error message when matching externals are found for package marked not buildable
2019-07-23 13:58:07 -05:00
Gregory Becker
a086dda82f hashing: fix caching of dependency hashes in to_node_dict 2019-07-23 08:58:49 -07:00
Todd Gamblin
3cb40e1c02 commands: add tests for all subcommands of spack pkg 2019-07-22 23:01:45 -07:00
Todd Gamblin
0b17bccdce commands: add spack pkg changed subcommand, better test support
- Add `spack pkg changed` to show changed and added packages for a
  commit.

- Make `spack pkg` support tests better.
2019-07-22 23:01:45 -07:00
Denis Davydov
8cef81363c gcc: support without command line tools (#11040) 2019-07-22 16:53:50 -05:00
Adam J. Stewart
2d144316a8 Fix version scraping for CRAN packages (#12021)
* Fix version scraping for CRAN packages
* Remove set literals
2019-07-22 13:05:55 -07:00
Todd Gamblin
cc4094bb9b bugfix: env.write() should stringify Spec lists.
- Setting specs from lockfiles was not correctly stringifying concretized
  user specs.

- Fix `_set_user_specs_from_lockfile`

- Add some validation code to `SpecList` constructor
2019-07-22 13:45:34 -05:00
Peter Josef Scheibel
7ec1d320a8 hashes: consolidate and make hashing logic more consistent
Spack has evolved to have three types of hash functions, and it's
becoming hard to tell when each one is called. Whlie we aren't yet ready
to get rid of them, we can refactor them so that the code is clearer and
easier to track.

- Add a `hash_types` module with concise descriptors for hashes.

- Consolidate hashing logic in a private `Spec._spec_hash()` function.

- `dag_hash()`, `build_hash()`, and `full_hash()` all call `_spec_hash()`

- `to_node_dict()`, `to_dict()`, `to_yaml()` and `to_json()` now take a
  `hash` parameter consistent with the one that `_spec_hash()` requires.

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2019-07-22 13:45:34 -05:00
Peter Josef Scheibel
0715b512a1 env: environments index specs by full DAG w/build deps
- ensure that Spec._build_hash attr is defined
- add logic to compute _build_hash when it is not already computed (e.g. for specs prior to this PR)
- add test to ensure that different instance of a build dep are preserved
- test conversion of old env lockfile format to new format
- tests: avoid view creation, DAG display in tests using MockPackage
- add regression test for more-general bug also fixed by this PR
- update lockfile version since the way we are maintaining hashes has changed
- write out backup for version-1 lockfiles and test that
2019-07-22 13:45:34 -05:00
Adam J. Stewart
7d954720ff Add OpenMP flag for Apple Clang (#12049) 2019-07-20 13:40:36 -07:00
Massimiliano Culpo
a2cb26f520 tests: speed up tests that rely on the database fixture (#12031)
The database and mutable_database fixtures were installing and uninstalling the same specs multiple times to ensure the database for tests has the correct state.

This commit optimizes the procedure by caching the state in an external directory, and copying it in instead of going through the installation or uninstallation again.

The database fixture is meant not to be modified by tests. This commit enforces this invariant by making the database read-only before starting the test.

* Added missing db markers to tests
* Added test for uninstall_by_spec
* `database` fixture now returns a read-only database
* Tests that modify the DB now use `mutable_database` fixture
2019-07-20 10:18:50 -07:00
Greg Becker
67cd524e93 environment views: refactor stripping build deps (#12069) 2019-07-20 09:45:20 -07:00
Greg Becker
8ec098716b compilers: don't raise errors for duplicate compiler definitions (#11910)
Summary:
- Allow multiple definitions of compiler in compilers.yaml (use first instance)
- Still print debug messages when there are duplicates, to assist users in finding this issue.

Merging configs from different scopes can result in multiple compiler being present in the same configuration list.  Instead of raising when there are duplicates, take the one with highest precedence.

Print a debug message instead of raising, so that we can still diagnose this.  We don't have a good way of warning the user about inconsistent configuration *in the same file* -- we'd need to dig into YAML file/line info for that.
2019-07-20 00:42:12 -07:00
Todd Gamblin
993ee7f199 environments: add activate/deactivate tests, work wtih set -u
- [x] Add shell tests to ensure that `spack env activate`, `spack env
  deactivate`, and `despacktivate` continue to work.

- [x] Also ensure that activate and deactivate both work with `set -u`
2019-07-20 00:36:56 -07:00
Greg Becker
4f9131fdc2 Package inheritance: Find patch files defined in parent classes using MRO (#12051)
Fixes #8908, 11844

Use Python MRO to find patch files from parent classes.
2019-07-19 18:08:05 -07:00
albestro
3a026f1412 Fix #11240 (#11995)
* extends mkdirs with permissions for intermediate folders

Does not use os.makedirs mode parameter because its behavior is changed
with Python 3.7 (it ignores it for intermediate dirs), and moreover it
was not possible to set different modes for newly-created folders
and leaf folder.

reference:
- https://bugs.python.org/issue19930
- https://docs.python.org/3.7/library/os.html#os.makedirs

* comment mkdirp step easing code understanding

* revert mkdir to default for package metapath

since metapath is nested in package folder, there is no need
to specify permissions for intermediate folders because the prefix
already exists.

* comment create_install_directory package modes
2019-07-19 10:13:29 -05:00
Gregory Becker
ba0cd4d912 concretization: fix transient hang in python 3.5
Bug relates to the interplay between:
1. random dict orders in python 3.5
2. bugfix in initial implementation of stacks for `_concretize_dependencies`
   when `self._dependencies` is empty
3. bug in coconcretization algorithm computation of split specs

Result was transient hang in coconcretization.
Fixed #3 (bug in coconcretization) to resolve.
2019-07-18 19:28:50 -07:00
Gregory Becker
ec6e5b0fd3 stacks: add option to link only roots or all specs, default to all 2019-07-18 19:28:50 -07:00
Gregory Becker
7ec89aa036 stacks: refactor view descriptors into a separate object 2019-07-18 19:28:50 -07:00
Gregory Becker
6661cb1926 refactor: clean up Environment class
- remove redundant code in Environment.__init__
- use socket.gethostname() instead of which('hostname')
- refactor updating SpecList references
- refactor 'specs' literals to a single variable for default list name
- use six.string_types for python 2/3 compatibility
2019-07-18 19:28:50 -07:00
Gregory Becker
88295d927e bugfix: spec lists can now include multiple references 2019-07-18 19:28:50 -07:00
Gregory Becker
9577ade3ce stacks: use new format string syntax in environments code
- Change old spec expressions to use Spack's new spec formatting sytnax.
2019-07-18 19:28:50 -07:00
Gregory Becker
2f6af64157 docs: Add documentation for views in environments 2019-07-18 19:28:50 -07:00
Gregory Becker
cebf1fd668 stacks: update view management for multiple/combinatorial views
This adds notion of a default view, other views in environments
2019-07-18 19:28:50 -07:00
Gregory Becker
d0bfe0d6a8 stacks: environment add/remove respect multiply-defined lists 2019-07-18 19:28:50 -07:00
Gregory Becker
f9e6de5474 stacks: allow force-removing from a speclist used in a matrix 2019-07-18 19:28:50 -07:00
Gregory Becker
533a8d7c82 stacks: update environment add/remove algorithms 2019-07-18 19:28:50 -07:00
Gregory Becker
6cfbfcc967 concretization: regression test for constrain() with deps
- ensure that `Spec('foo').constrain('foo ^bar')` works
- prior to stacks implementation, this constraint would have done nothing.
2019-07-18 19:28:50 -07:00
Gregory Becker
12c8996294 docs: initial documentation for environments 2019-07-18 19:28:50 -07:00
Gregory Becker
d450a2fce2 stacks: initial implementation of stacks on environments
- stack syntax in env schema
- switch environment specs over to SpecList object
- add stack functionality to environments
- handle definition extensions through stack.yaml and SpecList
- implement conditional definitions
- tests
2019-07-18 19:28:50 -07:00
Adam J. Stewart
7f3048c8af
Add support for .txz and .tbz2 file extensions (#12048) 2019-07-17 16:23:23 -05:00
Tamara Dahlgren
b856e24444 tests: uninstall_by_spec error and rpath_args tests (#11971)
* tests: Add uninstall_by_spec error tests.

These tests were originally included in PR #11797.
2019-07-17 15:08:08 -05:00
Greg Becker
5cf8878185 feature: Allow developers to use Spack for partial builds (#12006)
Added new diy option.
2019-07-17 11:46:56 -07:00
Massimiliano Culpo
2fe1ecbaa2 Ignore Modules v4 environment variables in from_sourcing_file (#10753)
* from_sourcing_file: fixed a bug + added a few ignored variables

closes #7536

Credits for this change goes to mgsternberg (original author of #7536)

The new variables being ignored are specific to Modules v4.

* Use Spack Executable in 'EnvironmentModifications.from_sourcing_file'

Using this class avoids duplicating lower level logic to decode
stdout and handle non-zero return codes

* Extracted a function that returns the environment after sourcing files

The logic in `EnvironmentModifications.from_sourcing_file` has been
simplified by extracting a function that returns a dictionary with the
environment one would have after sourcing the files passed as argument.

* Further refactoring of EnvironmentModifications.from_sourcing_file

Extracted a function that sanitizes a dictionary removing keys that are
blacklisted, but keeping those that are whitelisted. Blacklisting and
whitelisting can be done on literals or regex.

Extracted a new factory that creates an instance of
EnvironmentModifications from a diff of two environments.

* Added unit tests

* PS1 is blacklisted + more readable names for some variables
2019-07-16 10:54:33 -05:00
Michael Kuhn
a7e915d38b Fix build_jobs exceeding number of cores
All documentation mentions that `build_jobs` is limited by the number of
cores available in the system. This is also enforced when setting it via
`--jobs`. However, when setting it via `config.yaml`, it can exceed the
number of cores available, making builds run out of memory.
2019-07-15 11:40:49 -07:00
Glenn Johnson
3f83a2a7d8 Add auto-dispatch specification to Intel packages (#11697)
This PR adds the ability to specify the auto-dispatch targets that can
be used by the Intel compilers. The `-ax` flag will be written to the
respective compiler configuration files. This ability is very handy when
wanting to build optimized builds for various architectures. This PR
does not set any optimization flags, however.
2019-07-15 11:37:54 -07:00
Massimiliano Culpo
5acbe449e5 spack uninstall can uninstall specs with multiple roots (#11977)
Fixes #3690
Fixes #5637

Uninstalling dependents of a spec was relying on a traversal of the
parents done by inspecting spec._dependents. This is in turn a
DependencyMap that maps a package name to a single DependencySpec object
(an edge in the DAG) and cannot thus model the case where a spec has
multiple configurations of the same parent package installed (for
example if different versions of the same Python library depend on
the same Python installation).

This commit works around this issue by constructing the list of specs to
be uninstalled in an alternative way, and adds tests to verify the
behavior. The core issue with DependencyMap is not resolved here.
2019-07-15 10:30:01 -07:00
Tim Fuller
5bc15b2d9a find_libraries searches lib and lib64 before prefix (#11958)
The default library search for a package checks the lib/ and lib64/
directories for libraries before the root prefix, in order to save
time when searching for libraries provided by externals (which e.g.
may have '/usr/' as their root).

This moves that logic into the "find_libraries" utility method so
packages implementing their own custom library search logic can
benefit from it.

This also updates packages which appear to be replicating this logic
exactly, replacing it with a single call to "find_libraries".
2019-07-12 17:46:47 -07:00
Oliver Breitwieser
d1af7ae5ab Copy --{use,no}-cache from install to bootstrap (#11786) 2019-07-12 16:30:12 -07:00
Carson Woods
76f1ee5f32 'spack compiler add' resolves relative path to absolute path (#11792)
Fixes #11782

Spack was not properly resolving relative paths to absolute paths
when a relative path was passed to "spack compiler add [PATH]".
Now, if provided a relative path, the absolute path is written to
compilers.yaml rather than the relative path.
2019-07-12 16:06:26 -07:00
Tamara Dahlgren
d615d0a1ec Add template creation test, --skip-editor option (#11970)
* Add template creation test
* Added --skip-editor option to "spack create": normally
  "spack create" opens an editor for the user after generating a
  package file; when the --skip-editor option is used, "spack create"
  only generates the package file and does not open an editor
* Added --skip-editor option to bash completion
2019-07-12 11:22:09 -07:00
t-karatsu
adbb9e2d8e Fix pic_flag and test contents about Fujitsu compiler. (#11996) 2019-07-12 10:34:08 -05:00
Todd Gamblin
91e35541ee
bugfix: show dot after namespaces in spack find -N (#11945)
- Namepsaces were shown without dots after the new format strings were
  added.

- Add a test for `spack find` to ensure that find -N shows the right
  output.
2019-07-12 08:32:47 -07:00
Tamara Dahlgren
05b6a5e53d test: Extra possible-dependencies coverage check (#11988) 2019-07-11 17:15:21 -07:00
Tamara Dahlgren
e3299e6923 Rename build logs and make names consistent (#11806)
Fixes #11781

* Rename build log to spack-build-log.txt
* Rename environment variables file to spack-build-env.txt
* The name of the log and env files is now the same during the build
  and after the build completes
* Update packages which referred to the build log/env files
* For packages installed before this commit using older names for the
  build and env files, search for the older names
2019-07-11 13:32:06 -07:00
Todd Gamblin
c2de2558b6
tutorial: correct image link on tutorial page 2019-07-10 00:56:25 -07:00
Todd Gamblin
0cd64d7b6e
tutorial: updates slides for DOE/NSF workshop. 2019-07-10 00:50:59 -07:00
Todd Gamblin
51b58f1478
bugfix: conflicts should print out the spec that has the conflict (#11947)
- Fix a bug introdcued by removing parse_anonymous_spec()

- Conflicts' when specs are now *actually* anonymous, and the name of the
  package is implicit, so we need to remember to add it back to error
  messages.
2019-07-08 08:00:43 -07:00
Todd Gamblin
d2e5b8474a
bugfix: always generate a stack trace when spack is run with --debug (#11940)
- We weren't previously printing stack traces on SystemExit or
  KeyboardInterrupts.

- Either raise or print the stacktrace in these cases.
2019-07-05 19:57:00 -07:00
Todd Gamblin
515b4045e9 specs: remove parse_anonymous_spec(); use Spec() instead
- `parse_anonymous_spec()` is a vestige of the days when Spack didn't
  support nameless specs.  We don't need it anymore because now we can
  write Spec() for a spec that will match anything, and satisfies()
  semantics work properly for anonymous specs.

- Delete `parse_anonymous_spec()` and replace its uses with simple calls
  to the Spec() constructor.

- make then handling of when='...' specs in directives more consistent.

- clean up Spec.__contains__()

- refactor directives and tests slightly to accommodate the change.
2019-07-01 18:45:44 -07:00
Todd Gamblin
12b9fad7b6 cray: use the cle-release file to determine CNL version
- CNL OS previously used the *Cray PE* version to determine the OS
  version.  Cray does not synchronize PE and CLE releases; you can run
  CLE7 with PrgEnv 6 (and NERSC currently does).

- Fix Spack's OS detection by using the cle-release file to detect the OS
  version.  This file is updated with every CLE OS release.

- Add some tests for our parsing logic
2019-07-01 18:36:02 -07:00
Patrick Gartung
9bf9c0cec3
buildcache: add replace_prefix_bin function to deal with hard coded paths in libraries and executables. (#11882) 2019-07-01 10:16:23 -05:00
Todd Gamblin
4189640ee8 style: remove unnecessary NOQA exceptions 2019-06-30 16:01:23 -07:00
Peter Scheibel
9c16b4a7f6 Allow uninstalling missing packages (#11874)
Remove package access from directory_layout; add regression test to ensure
that specs can be uninstalled without a package being known
2019-06-29 16:04:15 -07:00
Mark W. Krentel
8aa8b50f91 docs: add example for an external module in packages.yaml
Add an example of a 'modules:' entry for an external package in
packages.yaml.  The 'External Packages' section of 'Build
Customization' mentions 'paths:' and 'modules:' and gives an
example of paths, but not modules.
2019-06-28 11:59:10 -07:00
Toyohisa Kameyama
b185f87c55 Add --frontend and --backend option to spack arch command (#11746) 2019-06-26 08:19:46 -07:00
Patrick Gartung
30ce818fc4
Fix for #10063 : install from source if buildcache with different DAG exist (#11834)
* Fix for #10063 : install from source if buildcache with different DAG exist

* Flake8
2019-06-24 21:09:24 -05:00
Peter Scheibel
1ae03b327c
Use Stage.archive_file to access non-expanded download (#11817)
Fixes #11816

Allow packages to refer to non-expanded downloads (e.g. a single
script) using Stage.archive_file. This addresses a regression from
#11688 and adds a unit test for it.
2019-06-21 16:56:38 -07:00
Adam J. Stewart
9b8215ce9d Ignore pgcc-llvm and friends, default to pgcc (#11703)
This change reverts to the previous behavior of only looking for pgcc
and friends, not pgcc-llvm and friends.

The llvm variant doesn't support all the same features as the
traditional variant of the pgi code generator; this change avoids
treating the llvm variant as a default pgi compiler.

This retains the changes in #10704 which accept the "LLVM" suffix of
the version string of the PGI compiler, which allows users to
explicitly add the llvm-pgi compiler if desired.
2019-06-20 19:07:29 -07:00
Peter Scheibel
284ae9d1cc
Resources: use expanded archive name by default (#11688)
For resources, it is desirable to use the expanded archive name of
the resource as the name of the directory when adding it to the root
staging area.

#11528 established 'spack-src' as the universal directory where
source files are placed, which also affected the behavior of
resources managed with Stages.

This adds a new property ('srcdir') to Stage to remember the name of
the expanded source directory, and uses this as the default name when
placing a resource directory in the root staging area.

This also:

* Ensures that downloaded sources are archived using the expanded
  archive name (otherwise Spack will not be able to determine the
  original directory name when using a cached archive).
* Updates working_dir context manager to guarantee restoration of
  original working directory when an exception occurs
* Adds a "temp_cwd" context manager which creates a temporary
  directory and sets it as the working directory
2019-06-20 11:09:31 -07:00
Gregory Lee
8706ac1479 fixed spec dependence attribute writing. Fixes #11686 (#11776) 2019-06-19 04:13:12 +02:00
Greg Becker
9a4917644a Remove test dependency on /usr/bin/gcc (#11769)
The regression test for #11678 fails on at least some Mac OS systems
because they have a /usr/bin/gcc that is secretly clang.

This PR replaces the dependency on a system gcc executable with a
test-generated script that generates the expected output for the
compiler logic.
2019-06-18 18:23:02 -07:00
Elizabeth Fischer
f886c7e59d Rename build.out to build.txt (#11749)
Rename build.out to build.txt; makes it easier when people post log files to the Spack mailing list.
2019-06-18 10:32:00 -07:00
Tamara Dahlgren
6e067a05c7 bugfix: use config fixture for stage tests (#11701)
Some tests introduced in #11528 temporarily set the user's `config:build_stage`, which affected (or created) a config.yaml file in the user's `$HOME/.spack` directory that could leave entries behind if the tests fail.

This change ensures only temporary configuration files are used/affected by these tests.
2019-06-17 11:38:34 +02:00
Tamara Dahlgren
a551e4329e docs: updates for stage.source_path (#11702) 2019-06-17 11:36:22 +02:00
Todd Gamblin
45c65a255a
docs: update tutorial page for ISC19 tutorial (#11742) 2019-06-16 12:35:12 +02:00
Michael Kuhn
f3671244e4 docs: fix config tutorial (#11715)
This fixes a few typos, adds a hint to `spack config blame` and brings
the variant specification in line with other docs sections.
2019-06-15 21:34:32 +02:00
Tamara Dahlgren
1b8f641016
Ensure mock configuration directory is cleaned up on session exit. (#11700) 2019-06-13 16:41:00 -07:00
Tamara Dahlgren
25b21c093a Add tests for "spack location" command (#11661)
The "spack location" command was previously untested. This also adds
a check to ensure that composite Stages can report whether they were
expanded (this property was previously only recorded in Stage but not
in CompositeStage).
2019-06-13 12:20:13 -07:00
Tamara Dahlgren
5cf62e69ce Always treat DIYStage as expanded (#11663)
DIYStage, used to treat a user-managed directory as a staging area,
should always be considered expanded (i.e. the source has been
decompressed if it was stored in an archive).

This also:

* Adds checks to ensure that the path used to instantiate a
  DIYStage refers to an existing directory.
* Adds tests to check the behavior of DIYStage (including behavior
  added here, but it was generally untested before).
2019-06-13 11:14:35 -07:00
Tamara Dahlgren
16530f84be Update remaining packages to use Stage.source_path (#11662)
#11528 updated Stage to always store a Package's source in a fixed
directory accessible via `Stage.source_path` This left behind a
number of packages which were expecting to access the source code
via `Stage.path`. This Updates those packages to use
`Stage.source_path` instead.

This also updates the name of the fixed directory: The original name
of the fixed directory was "src", so if an expanded archive created a
"src" directory, then users inspecting the directory structure could
see paths like "src/src" (which wasn't wrong but could be confusing).
Therefore this also updates the name of the fixed directory to
"spack-src".
2019-06-12 17:07:47 -07:00
Massimiliano Culpo
3ce90741a3 Make "spack compiler find" check PATH by default (#11683)
Fixes #11678

`spack compiler find` was not searching `PATH` when provided with no
arguments. ea7910a updated the API for the search function and the
command logic did not update how it called this function. This also
adds a test to ensure that `spack compiler find` will collect
compilers from `PATH`.
2019-06-12 15:28:16 -07:00
Adam J. Stewart
4e812090c0
Add additional common C++ and Fortran header file extensions (#11600)
* Add additional common C++ and Fortran header file extensions

* Add .hxx extension

* Add .txx and .tcc extensions

* Add .icc extension
2019-06-11 20:13:55 -04:00
Chuck Atkins
91205545f0 Add extra logic for C std flags on PGI, XL, and Cray (#11635) 2019-06-11 14:15:55 +02:00
Peter Scheibel
406c791b88
Fix recursive module find for upstream dependencies (#11304)
"spack module tcl find -r <spec>" (and equivalents for other module
systems) was failing when a dependency was installed in an upstream
Spack instance. This updates the module index to handle locating
module files for upstream Spack installations (encapsulating the
logic in a new class called UpstreamModuleIndex); the updated index
handles the case where a Spack installation has multiple upstream
instances.

Note that if a module is not available locally but we are using the
local package, then we shouldn't use a module (i.e. if the package is
also installed upstream, and there is a module file for it, Spack
should not use that module). Likewise, if we are instance X using
upstreams Y and Z like X->Y->Z, and if we are using a package from
instance Y, then we should only use a module from instance Y. This
commit includes tests to check that this is handled properly.
2019-06-10 16:56:11 -07:00
Peter Scheibel
f31711b84e concretization: don't apply build-dep constraints for installed packages (#11594)
Spack currently tries to unify everything in the DAG, but this is too strict for build dependencies, where it is fine to build a dependency with a tool that conflicts with a version fo that tool for a dependent's build.

To enable a workaround for conflicts among build dependencies, so that users can install in multiple steps to avoid these conflicts, make the following changes:

* Dont apply package dependency constraints for build deps of installed packages
* Avoid applying constraints for installed packages vs. concrete packages
* Mark all dependencies of installed packages as visited in normalization method
* don't remove dependency links for concrete specs in flat_dependencies

Also add tests:
* Update test to ensure that link dependencies of installed packages have constraints applied
* Add test to check for proper handling of transitive dependencies (which is currently not the case)
2019-06-08 11:43:26 -07:00
Axel Huebl
61333dc606 spack list: latest version (JSON) (#11652)
List the latest version of each package in JSON encoding.
Preparation for consumption for a "spack badge" service.
2019-06-07 14:14:08 -07:00
Massimiliano Culpo
6d56d45454 Compiler search uses a pool of workers (#10190)
- spack.compilers.find_compilers now uses a multiprocess.pool.ThreadPool to execute
  system commands for the detection of compiler versions.

- A few memoized functions have been introduced to avoid poking the filesystem multiple
  times for the same results.

- Performance is much improved, and Spack no longer fork-bombs the system when doing a `compiler find`
2019-06-07 09:57:26 -07:00
Todd Gamblin
06cc799fd3
commands: remove unused spack list --format=rst (#11651)
- We use `spack list --foramt=html` now, as it is much faster and doesn't
  make the docs build take forever.

- Remove `spack list --format=rst` as it is no longer used.
2019-06-06 18:26:43 -07:00
Todd Gamblin
0c13c3f91f
bugfix: StageComposite must include the expanded property` (#11647) 2019-06-06 14:09:19 -07:00
Jennifer Herting
541578a456 tests: package_sanity now checks packages in 3rd-party repos (#11637) 2019-06-06 09:18:43 -07:00
Tamara Dahlgren
b76fc827ec tests: add extra coverage for fetch strategy tests 2019-06-05 22:41:28 -07:00
Tamara Dahlgren
1842873f85 stage: make source_path available before stage is built
- `stage.source_path` was previously overloaded; it returned `None` if it
  didn't exist and this was used by client code
  - we want to be able to know the `source_path` before it's created

- make stage.source_path available before it exists.
  - use a well-known stage source path name, `$stage_path/src` that is
    available when `Stage` is instantiated but does not exist until it's
    "expanded"
  - client code can now use the variable before the stage is created.
  - client code can test whether the tarball is expanded by using the new
    `stage.expanded` property instead of testing whether `source_path` is
    `None`

- add tests for the new source_path semantics
2019-06-05 22:41:28 -07:00
Tamara Dahlgren
eb584d895b refactor: remove unused spack.stage._get_mirrors() function 2019-06-05 22:41:28 -07:00
Tamara Dahlgren
8e3fd3f7c2 tty: make tty.* print exception types
- make tty.msg, tty.info, etc. print the exception type and stringified
  message if the message argument is an exception.

- simplify parts of the code that call tty.debug(str(e))

- add extra tty.debug statements in places where exceptions were
  previously ignored
2019-06-05 22:41:28 -07:00
Justin S
f4e7786786 clang: fix error messages in c11_flag, cxx17_flag (#11632) 2019-06-05 23:51:38 +02:00
Todd Gamblin
dc8af3023e graph: refactor static graphs
- `spack graph --static` (and `spack.graph.dot_graph`) now do the "right
  thing" and print the possible dependency graph of provided packages.

- `spack graph --static` no longer concretizes specs, as it only relies
  on class level metadata

- Previously the behavior was not consistent -- `spack graph --static`
  would graph possible dependencies of concrete specs, but would only
  include some of them.  The new code properly pursues all possible
  dependencies, and allows traversing by different dependency types.
2019-06-05 06:11:18 -07:00
Todd Gamblin
2e22fc1090 spack dependencies: support --deptype argument
- `spack dependencies` can now take a --deptype argument to only traverse
  particular deptypes

- add a new "common" argument for deptype in spack.cmd.common.arguments

- Database.installed_relatives() can now also take a deptype argument
  - this is used by `spack dependencies --installed`
2019-06-05 06:11:18 -07:00
Todd Gamblin
3dac78fc19 package: make possible_dependencies consider deptypes
- `PackageBase.possible_dependencies` now:
  - accepts a deptype param that controls dependency types traversed
  - returns a dict mapping possible depnames to their immediate possible
    dependencies (this lets you build a graph easily)

- Add tests for PackageBaes
2019-06-05 06:11:18 -07:00
Todd Gamblin
087a511da7 refactor: remove vestigial ALLOWED_URL_SCHEMES from package.py 2019-06-05 06:11:18 -07:00
Todd Gamblin
87e6cb9f72 refactor: make Package.name consistent with other class attributes
- The 'name' attribute for packages was being set in DirectiveMeta, which
  wasn't consistent with other class properties (like fullname, etc.)

- Move it to be a class property of `PackageMeta`, and add the
  corresponding property method wrapper on `PackageBase`
2019-06-05 06:11:18 -07:00
Todd Gamblin
3f5141d629 refactor: make PackageBase.possible_dependencies() a class method. 2019-06-05 06:11:18 -07:00
Justin S
4ac64e6cd8 add C standard flags to compiler classes (#11618)
* add c99_flag, c11_flag to compiler class

* implement c99_flag, c11_flag for gcc

* implement c99_flag, c11_flag for arm

* implement c99_flag for cce

* implement c99_flag, c11_flag for clang

* implement c99_flag, c11_flag for intel

* implement c99_flag, c11_flag for xl
2019-06-05 11:43:11 +02:00
Greg Becker
0990f12dd9 modules: set permissions based on package configuration (#11337)
Previously, module files were not set with the same permissions as the package installation.  For world-readable packages, this would not cause a problem.  For group readable packages, it does:

```
packages:
  mypackage:
    permissions:
      group: mygroup
      read: group
      write: group
```

In this case, the modulefile is unreadable by members of the group other than the one who installed it.  Add logic to the modulefile writers to set the permissions based on the configuration in `packages.yaml`
2019-06-04 19:15:47 -04:00
Patrick Gartung
964a1d5997
Buildcache relocate.py error fix (#11616)
* Add a trailing / if file --mime does not return a mimetype with a / in it

* Flake8
2019-06-04 14:39:04 -05:00
Patrick Gartung
88473a8da3
Build cache: relocate path to spack/bin/sbang in text files. (#11592)
* Build cache: relocate path to spack/bin/sbang in text files.

* Found in testing.

* update packaging test

* Make sbang replacement including #!/bin/bash. Add an additional spack prefix replacement to fix stage directory references.

* flake8

* Use buildinfo.get() so old buildcaches without buildinfo['spackprefix'] can be read.
2019-05-31 11:33:29 -05:00
Massimiliano Culpo
01ece824e1 Cap the maximum number of build jobs (#11373)
* config:build_jobs now controls the number of parallel jobs to spawn during
builds, but cannot ever exceed the number of cores on the machine.

* The default is set to 16 or the number of available cores, whatever
is lowest.

* Updated docs to reflect the changes done to limit parallel builds
2019-05-28 06:42:04 -07:00
Todd Gamblin
3ae5262182
docs: set gettext_uuid to False to reduce churn (#11567)
- `gettext_uuid=True` makes every commit update every .pot file in spack/localized-docs,
  and speeds up the internationalized doc build slightly.

- Optimize for less repository churn, and use `python-levenshtein` to accelerate 
  the build instead.
2019-05-27 13:42:27 -07:00
Axel Huebl
6d54212b94 mirror create: non-zero return code (#8585)
`mirror create` should return a non-zero return code if errors
occured.
2019-05-27 13:01:01 +02:00
Todd Gamblin
d6f2ff1426 link_tree: add option to merge link trees with relative targets
- previous version of link trees would only do absolute symlinks

- this version can do relative links using merge(relative=True)
2019-05-26 18:23:44 -07:00
Todd Gamblin
f32843528e docs: make docs build relocatable for localized builds
- make all Spack paths relative to a `_spack_root` symlink, so that we
  can easily relocate the docs build *outside* lib/spack/docs

- set some useful defaults for gettext translation variables in conf.py

- update `relativeinclude` and other references to the spack root in the
  RST files to use _spack_root
2019-05-26 18:23:44 -07:00
Todd Gamblin
8bf1bd4637 docs: remove legacy import for Sphinx 1.7 2019-05-26 18:23:44 -07:00
Todd Gamblin
e1c5d1378b docs: match ReadTheDocs; use -W (warnings as errors) with Sphinx 2019-05-26 18:23:44 -07:00
Todd Gamblin
3340d586c4 commands: add --update option to spack list
- Add a `--update FILE` option to `spack list`
- Output is written to the file only if any package is newer than the file
- Simplify the code in docs/conf.py using this new option
2019-05-26 18:23:44 -07:00
Todd Gamblin
6380f1917a commands: Add --header and --update options to spack commands
The Spack documentation currently hard-codes some functionality in
`conf.py`, which makes the doc build less "pluggable" for things like
localized doc builds.

In particular, we unconditionally generate an index of commands and a
package list as part of the docs, but those should really only be done if
things are not up to date.

This commit does the following:

- Add `--header` option to `spack commands` so that it can do the work of
  prepending text to its output.

- Add `--update FILE` option to `spack commands` that makes it generate a
  new command index *only* if FILE is out of date w.r.t. commands in the
  Spack source.

- Simplify code in `conf.py` to use these options and only update the
  command index when needed.
2019-05-26 18:23:44 -07:00
Todd Gamblin
43aaf8c404 docs: Use HDF5 as the example package for spack graph 2019-05-26 18:23:44 -07:00
Massimiliano Culpo
c291866b9a build env: simplify handling of parallel jobs (#11524)
This PR implements several refactors requested in #11373, specifically:

- Config scopes are used to handle builtin defaults, command line overrides 
  and package overrides (`parallel=False`)
- `Package.make_jobs` attribute has been removed; `make_jobs` remains
  as a module-scope variable in the build environment.
- The use of the argument `-j` has been rationalized across commands
  - move '-j'/'--jobs' argument into `spack.cmd.common.arguments`
- Add unit tests to check that setting parallel jobs works as expected
  - add new test to ensure that build job setting is isolated to each build
- Fix packages that used `Package.make_jobs` (i.e. `bazel`)
2019-05-24 11:45:22 -07:00
Todd Gamblin
ab21b3d194 docs: truncate spack list output in basic usage
`spack list` output is very long and takes up a lot of space in the docs.
Truncate it to just 10 lines and link to the package list page.
2019-05-23 12:40:01 -07:00
t-karatsu
1e9bb8c512 Add Fujitsu compiler to Spack. (#11287)
* Add Fujitsu compiler to Spack.

* Fixes for flake8

* Chenges location of FCC to subdirectory called case-insensitive

* Add compiler tests for Fujitsu compiler

* Modify the logic of taking compiler version for new version of Fujitsu compiler
2019-05-21 20:31:14 -05:00
Adam J. Stewart
e2065fad72 Make flake8 check spack script as well as .py files (#11513)
* Make flake8 check bin/spack
2019-05-20 13:39:25 -07:00
Mario Melara
4d71117080 Get Cray OS version from PrgEnv-cray (#10774)
The regex used for finding the Cray OS version from the PrgEnv-cray
module was not exact and was at times pulling the version from other
PrgEnv modules. This updates the regular expression to be more exact.
2019-05-20 11:06:02 -07:00
George Hartzell
e592262da8 Typos: funciton, woudl, hm,... (#11511) 2019-05-18 11:39:23 -05:00
Mario Melara
9957093e53 Execute modulecmd in bash shell (#11510)
Adds executable=/bin/bash into Popen. We discovered this bug while
working in a csh/tsch environment. By executing with /bin/bash we ensure
that the module command works.
2019-05-18 01:49:19 +02:00
Massimiliano Culpo
c03be0d65a Command extensions can import code from modules in root or cmd folder (#11209)
#8612 added command extensions to Spack: a command implemented in a
separate directory. This improves the implementation by allowing
the command to import additional utility code stored within the
established directory structure for commands.

This also:

* Adds tests for command extensions
* Documents command extensions (including the expected directory
  layout)
2019-05-16 17:27:42 -07:00
Chris Green
b9370bf20b Allow command access to dump/pickle_environment from #8476 (#11434)
* Allow command access to dump/pickle_environment from #8476
2019-05-17 09:15:32 +09:00
Denis Davydov
9d34326992 fix suite-sparse built with tbb from intel-parallel-studio (#11134)
* fix suite-sparse built with tbb from intel-parallel-studio

* intel: add tbb_headers, strip newline from cxx_lib

* use property
2019-05-15 11:03:19 -07:00
Todd Gamblin
1dc8f952a5
Use svn info --xml instead of svn info to get svn revisions (#11466)
- `svn info` prints different results depending on the system locale
  - in particular, Japanese output doesn't contain "Revision:"

- Change Spack code to use XML output instead of using the human output
2019-05-15 13:37:02 +02:00
Greg Becker
b5316c31af Remove vestigial print statement in module logic (#11438)
Remove a vestigial print statement introduced in #8570
2019-05-14 09:03:34 +09:00
Greg Becker
f67a59fabc permissions: preserve suid and sgid bits (#10727)
* Don't overwrite suid/sgid bits when setting permissions
* add tests for permission setting
2019-05-10 00:38:13 -07:00
Glenn Johnson
c752af098d Intel packages: multiple installs and optional scalapack libs (#11384)
Add fixes to support multiple installs and dependents using a subset
of IntelPackage functionality.

* Update IntelPackage to only return scalapack libraries if the root
  spec depends on MPI: scalapack requires MPI to be mentioned as a
  dependency in the DAG. Package builds using intel-mkl for its
  blas/lapack implementations but not for scalapack were failing to
  build.

  Ideally it would be possible to ask if any of the packages in the
  DAG are actually requesting the scalapack functionality provided by
  the IntelPackage and only return scalapack libs in that case, but
  that is not easily done at this time.

  Fixes #11314
  Fixes #11289

* set HOME when the intel silent installer is run. This prevents the
  installer from using the ~/intel directory (which can cause
  conflicts for multiple installs of the same IntelPackage)

  Fixes #9713
2019-05-10 10:54:05 +09:00
Greg Becker
3d3cea1c87 modules: use new module function instead of get_module_cmd (#8570)
Use new `module` function instead of `get_module_cmd`

Previously, Spack relied on either examining the bash `module()` function or using the `which` command to find the underlying executable for modules. More complicated module systems do not allow for the sort of simple analysis we were doing (see #6451).

Spack now uses the `module` function directly and copies environment changes from the resulting subprocess back into Spack. This should provide a future-proof implementation for changes to the logic underlying the module system on various HPC systems.
2019-05-09 15:04:24 -07:00
Peter Josef Scheibel
53ec16c9e5 make license check more-strict
The license text is now expected to match almost exactly (not
accounting for formatting in different file types (e.g. rst vs.
bash script vs. python)
2019-05-10 04:37:56 +09:00
Seth R Johnson
6cdbc33c90 Hide some variables in spack-build.env file
Don't arbitrarily reset PWD and OLDPWD when sourcing, as well as other
session-specific IDs
2019-05-08 06:36:52 +09:00
Chris Green
01eaca607f Environment path sanitization and sourcing (#8476)
Add two functions to the EnvironmentModifications object to help
users sanitize environment variables in their package definitions:

* deprioritize_system_paths: this keeps system paths in the
  environment variable but moves them to the end.
* prune_duplicate_paths: remove any duplicate paths from the
  variable

This includes testing for the new functions as well as for
(previously-untested) old convenience functions for environment
variable manipulation.

This also adds special handling for bash functions so they
will be defined when the exported environment file is sourced.
2019-05-07 11:29:18 +09:00
Patrick Gartung
9a85a7a5aa Binary caches on MacOS - allow expanded RPATHs (#11345)
Fixes #11335

Update the Spack compiler wrappers to add the headerpad_max_install_names
linker flag on MacOS. This allows the install_name_tool to rewrite
the RPATH entry of the binary to be longer if needed. This is
primarily useful for creating and distributing binary caches of
packages (i.e. using the "spack buildcache" command); binary caches
created on MacOS before this commit may not successfully relocate
(if the target root path is larger).
2019-05-04 06:41:57 +09:00
Massimiliano Culpo
5ffb270714 Added a function that concretizes specs together (#11158)
* Added a function that concretizes specs together

* Specs concretized together are copied instead of being referenced

This makes the specs different objects and removes any reference to the
fake root package that is needed currently for concretization.

* Factored creating a repository for concretization into its own function

* Added a test on overlapping dependencies
2019-05-04 03:04:38 +09:00
Denis Davydov
5b82bf47af extend Version class so that 2.0 > 1.develop > 1.1 and develop > master > head > trunk > 9999 (#1983)
* extend Version class so that 2.0 > 1.develop > 1.1

* add concretization tests, with preferences and preferred version.

* add master, head, trunk as develop-like versions, develop > master > head > trunk

* update documentation on version comparison
2019-05-03 03:32:40 +09:00
Levi Baber
9e72fc48c8
fix error when adding package to env in container (#11321) 2019-05-02 11:04:21 -05:00
Patrick Gartung
309122c329
Don't use buildcache to install patchelf (#11343) 2019-05-02 10:02:25 -05:00
Todd Gamblin
8e5e36dc0b Fix spack flake8 to use Travis's target as base when needed 2019-05-01 04:44:02 +09:00
Daryl W. Grunau
edca0cde1c _valid_tokens list is missing intended comma (#11271)
* _valid_tokens list is missing a needed comma
2019-04-24 08:55:20 +09:00
Todd Gamblin
552c9c57fd
Update tutorial page with RIKEN tutorial slides. (#11254)
- Add link to container image, as well as a description of VMs
- Update slide link to point to latest RIKEN tutorial
2019-04-23 01:53:47 +09:00
Greg Becker
5aa4edb939 Fix transitions between tutorial sections (#11251) 2019-04-22 17:14:26 +09:00
Todd Gamblin
0aed3bcea6 spack edit: use execv instead of Executable (#11245)
- `spack edit` previously used `spack.util.executable` `Executable` objects,
  and didn't `exec` the editor like you'd expect it to

- This meant that Spack was still running while your editor was, and
 stdout/stdin were being set up in weird ways

- e.g. on macOS, if you call `spack edit` with `EDITOR` set to the
  builtin `emacs` command, then type `Ctrl-g`, the whole thing dies with
  a `==> Error: Keyboard interrupt`

- Fix all this by changing spack.util.editor to use `os.execv` instead of
  Spack's `Executable` object
2019-04-20 20:51:45 -07:00
Adam J. Stewart
7255d5ee3c
Fix detection of LLVM-enabled PGI compilers (#10704)
* Fix detection of LLVM-enabled PGI compilers

* Add unit tests for LLVM-enabled PGI compiler version detection
2019-04-20 17:52:55 -05:00
Denis Davydov
95fafb4e44 Move NoLibrariesError/NoHeadersError into error.py (#10997)
Also add constructor to NoLibrariesError which can either take an
error message (like other SpackErrors) or a name and prefix (in
which case the error message is constructed).
2019-04-20 14:08:05 -07:00
Justin S
6f1fe3904c Fix outdated R packages failing to fetch (#11039)
PR #10758 made a slight change to find_versions_of_archive() which included
archive_url in the search process. While this fixed `spack create` and
`spack checksum` missing command-line arguments, it caused `spack
install` to prefer those URLs over those it found in the scrape process.

As a result, the package url was treated as a list_url causing all R
packages to stop fetching once the package was updated on CRAN.

This patch is more selective about including the archive_url in the
remote versions, explicitly overriding it with matching versions found
by the scraper.
2019-04-19 17:39:13 -07:00
Greg Becker
141e8b8de3 Fix backwards compatibility for module naming (#11236)
f242f5f8 changed the format strings but maintained backwards
compatibility in all cases except one: The list of valid tokens for
the module naming schemes was not updated properly to contain both
the new and old styles for compilers and package names.

This PR re-adds the old tokens into the list of valid tokens.
2019-04-19 13:20:41 -07:00
Peter Scheibel
8a23154755
Spack chain docs: config should go in upstreams.yaml (#11225)
#11152 added documentation for #8772 but some details were based on
an earlier implementation that had changed by the time #8772 was
merged. In particular, #11152 mentioned that upstream Spack instances
were configured in config.yaml, when in fact they should be placed in
a separate upstreams.yaml config file; this PR updates the
documentation accordingly.
2019-04-18 18:57:10 -07:00
Massimiliano Culpo
9cf650d2ab Moved cleanup before raising (the code couldn't be reached before) 2019-04-18 18:41:22 -07:00
Massimiliano Culpo
400aa5fe51 Cleaned get methods of Repo and RepoPath 2019-04-18 18:41:22 -07:00
Massimiliano Culpo
76b5af6bf3 Used functools.wrap for the decorator + reordered imports 2019-04-18 18:41:22 -07:00
Massimiliano Culpo
bbb5d61662 Removed 'namespace' argument from Repo and RepoPath
fixes #11159

The 'namespace' argument to both Repo and RepoPath were used to set the
"super namespace". Currently it seems to be vestigial as the only
"super namespace" allowed for packages is 'spack.pkg' since 39c9bbf
2019-04-18 18:41:22 -07:00
Zack Galbreath
7febb88c2a improvements to our CDash reporter (#11168)
* Make a separate CDash report for each package installed

Previously, we generated a single CDash report ("build") for the complete results
of running a `spack install` command. Now we create a separate CDash build for
each package that was installed.

This commit also changes some of the tests related to CDash reporting.
Now only one of the tests exercises the code path of uploading to a
(nonexistent) CDash server. The rest of the related tests write their reports
to disk without trying to upload them.

* Don't report errors to CDash for successful packages

Convert errors detected by our log scraper into warnings when the package
being installed reports that it was successful.

* Report a maximum of 50 errors/warnings to CDash

This is in line with what CTest does. The idea is that if you have more than
50 errors/warnings you probably aren't going to read through them all anyway.
This change reduces the amount of data that we need to transfer and store.
2019-04-18 09:39:35 -07:00
Greg Becker
f242f5f8a9 Features: Improve Spec format strings (#10556)
* Update spec format to simpler syntax, maintain backwards compatibility
* Switch to new spec.format method throughout internals
* update package files for new format strings
* documentation and minor code cleanup. removed nonsensical variant sigils
2019-04-17 18:21:40 -07:00
Satish Balay
7280f21397 Add ftn to lib/spack/env (#11180)
Fixes #11070 #11010

Spack attempts to intercede on behalf of all compiler invocations for
a build. This involves adding its wrappers to PATH. Cray systems
include a "ftn" executable and Spack was only redirecting this call
when the Spec was built with cce. This updates the compiler wrappers
to add "ftn" in all cases.
2019-04-17 13:12:25 -07:00
Peter Scheibel
ef8b5c73ce
don't record 'view: True' in environment config (#11182)
The default (implied) behavior for all environments, as of ea1de6b,
is that an environment will maintain a view in a location of its
choosing. ea1de6b explicitly recorded all three possible states of
maintaining a view:

 1. Maintain a view, and let the environment decide where to put it
    (default)
 2. Maintain a view, and let the user decide
 3. Don't maintain a view

This commit updates the config writer so that for case [1], nothing
will be written to the config.yaml. This will not change any existing
behavior, it just serves to keep the config more compact.
2019-04-16 19:08:10 -07:00
Adam J. Stewart
dbfa928cdb Add unit tests for Cray compiler detection (#11191) 2019-04-16 10:01:42 +02:00
Greg Becker
5f74f22dc6 Bugfix: Install missing compilers for dependency packages (#11175)
Compilers are treated separately from other dependencies in Spack.
#10761 added the option to automatically install compilers when a
package specifies using a compiler that is not available in Spack.
However, this did not work correctly for dependency packages (it
would only build a compiler for the root of an install DAG). This
commit enables the building of compilers for dependency packages.
2019-04-15 17:41:15 -07:00
Massimiliano Culpo
263d8a818a Updated Sphinx configuration (#11165) 2019-04-11 14:38:52 -07:00
Denis Davydov
177b7f111a intel: optionally take gcc executable from cflags (#11136) 2019-04-11 12:33:59 -07:00
Peter Scheibel
ea1de6b941 Maintain a view for an environment (#10017)
Environments are nowm by default, created with views.  When activated, if an environment includes a view, this view will be added to `PATH`, `CPATH`, and other shell variables to expose the Spack environment in the user's shell.

Example:

```
spack env create e1 #by default this will maintain a view in the directory Spack maintains for the env
spack env create e1 --with-view=/abs/path/to/anywhere
spack env create e1 --without-view
```

The `spack.yaml` manifest file now looks like this:

```
spack:
  specs:
  - python
  view: true #or false, or a string
```

These commands can be used to control the view configuration for the active environment, without hand-editing the `spack.yaml` file:

```
spack env view enable
spack env view envable /abs/path/to/anywhere
spack env view disable
```

Views are automatically updated when specs are installed to an environment. A view only maintains one copy of any package. An environment may refer to a package multiple times, in particular if it appears as a dependency. This PR establishes a prioritization for which environment specs are added to views: a spec has higher priority if it was concretized first. This does not necessarily exactly match the order in which specs were added, for example, given `X->Z` and `Y->Z'`:

```
spack env activate e1
spack add X
spack install Y # immediately concretizes and installs Y and Z'
spack install # concretizes X and Z
```

In this case `Z'` will be favored over `Z`. 

Specs in the environment must be concrete and installed to be added to the view, so there is another minor ordering effect: by default the view maintained for the environment ignores file conflicts between packages. If packages are not installed in order, and there are file conflicts, then the version chosen depends on the order.

Both ordering issues are avoided if `spack install`/`spack add` and `spack install <spec>` are not mixed.
2019-04-10 16:00:12 -07:00
Mario Melara
a1db22ba1a Unload altd and darshan (#11162) 2019-04-10 13:19:41 -07:00
Peter Scheibel
c1f8fdd5df
Add documentation for chaining Spack instances (#11152)
Add documentation for the Spack chain feature added in #8772
2019-04-10 11:54:13 -07:00
George Hartzell
0256766ab9 Typo: Unkown -> Unknown (#11150) 2019-04-09 18:36:45 -05:00
Denis Davydov
1f1ea2c859 intel: consolidate libs() in the base class (#11143)
* intel: consolidate libs() in the base class

* white space

* flake8
2019-04-09 13:54:21 -07:00
Scott Wittenburg
3616617804 Allow spack install to take either cdash stamp or track (#11106)
When providing a track, the cdash reporter will format the stamp
itself, as it has always done, and register the build during the
package installation process.  When providing a stamp, it should
first be formatted as cdash expects, and then cdash will be sure
to report results to same build id which was registered manually
elsewhere.
2019-04-06 15:30:34 -07:00
Greg Becker
8a17282001 Fix reading externals from old databases (#11118)
* Update Spec.prefix to have special case for 'None' in database path; regression test
* Update in database reader rather than spec
* Change assertion to conditional + raise
* Added test for concrete check in Spec.prefix
2019-04-05 14:58:57 -07:00
Michael Kuhn
320e00276f Fix module_parsing test (#11087)
The module_parsing test checks whether the module function is available
by looking for the string 'not found'. If the user has set a different
locale, the test can assume that the module function is available when
it actually is not.
2019-04-05 11:26:40 -07:00
Tim Fuller
a9ae507152 Fix directory layout using namespace (#11076)
Directory layouts using ${NAMESPACE} were broken. This addresses that
and adds a test to prevent regression.
2019-04-02 17:47:57 -07:00
Tristan Carel
4793242158 spack repo add: fix error message when `packages' directory is missing (#11031) 2019-04-02 17:05:57 -07:00
Massimiliano Culpo
a1255b61c0 Added tests on compiler's version detection (#10931)
* Split get_compiler_version into two functions:
  get_compiler_version_output runs the compiler with the relevant
  option to print the version; extract_version_from_output determines
  the version by examining this output. This makes it easier to test
  the customized version detection for each compiler. Users can
  customize this by overriding the following:
  * version_argument: this is the argument that tells the compiler to
    print its version. It assumes that the compiler will report its
	version if invoked with a single option (like "--version")
  * version_regex: the regular expression used to extract the version
    from the compiler argument. This assumes that a regular
	expression is sufficient to extract the version, and that the
	version can be extracted from a single capture group (Spack uses
	the first capture group)
  * default_version: allows you to completely override all version
    detection logic
  * get_compiler_version_output: if getting the compiler to report
    its version is more complex than invoking it with a single arg
  * extract_version_from_output: if it is difficult to define a regex
    that can be used to extract the version from the output
* Added tests for version detection of most compilers
* Removed redundant code from xl_r compiler class (by inheriting
  from xl compiler definition)
2019-04-02 12:52:47 -07:00
Massimiliano Culpo
e3f00750e8 Update llnl.util.lang.memoized so that Sphinx can extract signature (#11055)
Replace the original implementation of the "memoized" decorator with
an implementation that exposes the docstring and arguments of the
wrapped function. This is achieved using functools.wraps.
2019-03-29 17:11:44 -07:00
Denis Davydov
def5b23763 add libs property to IntelMkl and IntelParallelStudio (#10993)
* add libs property to IntelMkl and IntelParallelStudio
* fix scalapack_libs when MPI is provided by intel-parallel-studio
2019-03-29 13:01:43 -07:00
Massimiliano Culpo
0a006351c8 Spack can be extended with external commands (#8612)
This provides a mechanism to implement a new Spack command in a
separate directory, and with a small configuration change point Spack
to the new command.

To register the command, the directory must be added to the
"extensions" section of config.yaml. The command directory name must
have the prefix "spack-", and have the following layout:

  spack-X/
    pytest.ini #optional, for testing
    X/
	  cmd/
	    name-of-command1.py
	    name-of-command2.py
	    ...
    tests/ #optional
      conftest.py
	  test_name-of-command1.py
    templates/ #optional jinja templates, if needed

And in config.yaml:

  config:
    extensions:
      - /path/to/spack-X

If the extension includes tests, you can run them via spack by adding
the --extension option, like "spack test --extension=X"
2019-03-28 16:56:36 -07:00
Peter Scheibel
a6511fbafc Consistent patch ordering (#10879)
* preserve the order in which patches are applied by packages (in spite of grouping them by 'when')

* add tests confirming patch order
2019-03-28 11:25:44 -07:00
Peter Scheibel
99f35c3338 spack chain (#8772)
* initial work to make use of an 'upstream' spack installation: this uses the DB of the upstream installation to check if a package is installed

* need to query upstream dbs when adding new record to local db

* prevent reindexing upstream DBs

* set prefix on specs read from DB based on path stored in install record

* check that Spack does not install packages that are recorded as installed in an upstream db

* externals do not add their path to install records - need to use 'external_path' to get path of upstream externals

* views need to check for upstream installations when linking metadata

* package and spec now calculate upstream installation properties on-demand themselves rather than depending on concretization to set these properties up-front. The added tests for upstream installations don't work with this new strategy so they need to be updated

* only refresh modules for local specs (not those in upstream packages); optionally generate local module files for packages installed upstream

* when a user tries to locate a module file for a package installed upstream, tell them to use the upstream spack instance to locate it

* support recursive upstream databases (allow upstream databases to use their own upstream databases)

* separate upstream config into separate file with its own schema; each entry now also includes a name

* metadata_dir is no longer customizable on a per-instance basis for YamlDirectoryLayout

* treat metadata_dir as an instance variable but dont set it from kwargs; this follows several other hardcoded variables which must be consistent between upstream and downstream DBs. Also update DirectoryLayout.metadata_path to work entirely with Spec.prefix, since Spec.prefix is set from the DB when available (so metadata_path was duplicating that logic)
2019-03-27 13:06:46 -07:00
Mario Melara
298a55b28f Replace previous bash command to new one (#7005)
Prevents infinite recursion caused by sourcing `setup-env.sh` in bashrc
2019-03-27 10:26:52 -07:00
Chris Green
e88c1d585c Move CMakePackage build directory to base stage directory (#8431)
Change the location of the CMake build area from the staged source
directory to the stage base directory.

This change allows CMake packages to refer to the build directory in
setup_environment (e.g. if tests need to have a directory in PATH):
Staging happens after the call to setup_environment(), and if the
stage area does not exist, then spec.stage.source_path returns None.

To accommodate this change, archived files (like config.log for
Autotools packages) are archived relative to the stage base directory
rather than the expanded source directory.

Other packages (those not using CMake) will still use the staged
source directory as the default working directory for builds (and
will still be unable to reference this directory in
setup_environment())
2019-03-26 17:40:49 -05:00
ajw1980
e5b86c5527 Retrieve environment-modules prefix based on architecture (#10975)
When multiple instances of environment-modules were installed with
different architectures, Spack was not retrieving the installation
appropriate for the current architecture when finding the module
prefix.
2019-03-26 15:23:17 -05:00
Seth R. Johnson
844ca31894 Use 'shlex' to split default Executable arguments (#10929)
This allows shell commands for `spack edit` to be executed correctly if
they have quoted arguments.
2019-03-26 14:02:32 -05:00
Massimiliano Culpo
89b9880719 Add regression marker to pytest.ini (#11011) 2019-03-26 12:04:36 -05:00
Nichols A. Romero
66172f80f3 Fixed some issues with CUDA-Intel compiler conflicts. (#10924)
* Fixed some issues with CUDA-Intel compiler conflicts.

* Comment about expressing CUDA-compiler conflicts.

* More precise conflicts and also add support for Intel 19.0
2019-03-26 15:31:56 +01:00
Shahzeb Siddiqui
724acb6421 typo in documentation (#10976) 2019-03-21 14:29:40 -05:00
George Hartzell
aa1e70aab1 Minor commentary correction, TCL -> lmod (#10951) 2019-03-21 11:17:41 +01:00
Stephen McDowell
70e436e932 prevent UnboundLocalError when sourcing files (#10950)
Patch extracted from #7536 courtesy of @mgsternberg
2019-03-21 11:08:29 +01:00
Chris Green
9ad02685d9 Fix help text for --no-checksum. (#10932) 2019-03-19 15:02:06 -05:00
Adam J. Stewart
4e6285a19b
Ensure that every package has a description (#10896) 2019-03-14 20:49:07 -05:00
Chris Green
9b51fb09f1 Support VISUAL environment variable for editing. (#10898)
If the user has set the environment variable VISUAL, it will be used
in preference to EDITOR for all Spack editing activities. If VISUAL
is not set or fails (perhaps due to a lack of graphical editing
capabilities),EDITOR will be used instead. We fall back to one of
several common editors if neither bears fruit.

This feature has been tailored to:

* Provide identical behavior to the previous implementation in the
  case that VISUAL is not set.
* Not require any change to code utilizing the editor feature.
* Follow usual UNIX behavior concerning VISUAL and EDITOR.
2019-03-14 16:16:26 -05:00
Tristan Carel
c3662492de Do not use string module to be compatible with python 3 (#248) (#10667)
`string.find` is not part of Python 3 anymore.
2019-03-12 20:34:47 -05:00
Justin Stanley
2bea940e43 find_versions_of_archive: expand link search (#10758) 2019-03-12 20:19:46 -05:00
Nick Forrington
6bda37f542 Fix clearing EnvironmentModifications with python2 (#10791)
* Fix clearing EnvironmentModifications with python2

* Add EnvironmentModifications::clear unit test

Use re-assignment rather than del to clear array

* Fix flake issues
2019-03-12 20:12:51 -05:00
Shahzeb Siddiqui
d20b5ce2ec format change and typo in doc (#10848) 2019-03-11 13:19:13 -05:00
Massimiliano Culpo
a42fd7f276 Improved detection of Clang versions (#10316)
Fixes #10191

* Add more regular expressions to detect clang versions that were
  not being picked up
* Add a test for parsing versions from the output of Clang (this
  does not run Clang, but rather uses example outputs from Clang)
* Separate Clang version parsing into its own method (to make it
  easier to test)
2019-03-11 13:15:34 -05:00
Michael Kuhn
a1c91f3c07 Fix find_headers to also look for C++ headers and Fortran modules (#10798)
Currently, only C headers are considered, causing build failures for
packages depending on, e.g., netcdf-fortran and xerces-c. Additionally,
the regex used to look for the include path component did not consider
word boundaries, causing false matches.
2019-03-08 21:06:22 -06:00
Greg Becker
f4d4322a41
Create option to build compilers as needed (#10761)
* Create option to build missing compilers and add them to config before installing packages that use them
* Clean up kwarg passing for do_install, put compiler bootstrapping in separate method
2019-03-07 17:30:48 -08:00
Adam J. Stewart
f7223e54ed Make is a required dependency of Spack (#10386)
Update documentation on getting started to mention that a "make"
executable is required to build packages with Spack.
2019-03-06 19:46:54 -06:00
Patrick Gartung
1d4289afdd
This fixes a problem where the placeholder path was not in the first rpath entry.
* Rework of buildcache creation and install prefix checking using the functions introduced in
https://github.com/spack/spack/pull/9199

Instead of replacing rpaths with placeholder and then checking strings, make use of the functions
relocate.is_recocatable and relocate.is_file_relocatable to decide if a package needs the allow-root option.

This fixes a problem where the placeholder path was not in the first rpath entry. This was seen in c++ libraries and binaries because the compiler was outside the spack install base path and always appears first in the rpath.

Instead of checking the first rpath entry, all rpaths have the placeholder path and the old install path (if it exists) replaced with the new install path.

* flake8
2019-03-01 07:47:26 -06:00
Massimiliano Culpo
e3af8ed454 Added a sub-command to show if packages are relocatable (#9199)
* Added the `spack buildcache preview` sub-command

This is similar to `spack spec -I` but highlights which nodes in a DAG
are relocatable and which are not.

spec.tree has been generalized a little to accept a status function,
instead of always showing the install status

The current implementation works only for ELF, and needs to be
generalized to other platforms.

* Added a test to check if an executable is relocatable or not

This test requires a few commands to be present in the environment.
Currently it will run only under python 3.7 (which uses Xenial instead
of Trusty).

* Added tests for the 'buildcache preview' command.

* Fixed codebase after rebase

* Fixed the list of apt addons for Python 3.7 in travis.yaml

* Only check ELF executables and shared libraries. Skip checking virtual or external packages. (#229)

* Fixed flake8 issues

* Add handling for macOS mach binaries (#231)
2019-02-28 15:36:47 -06:00
Michael Kuhn
617c1a3706 Fix shell integration with environment-modules@4 (#10736) 2019-02-28 13:22:44 +01:00
Adam J. Stewart
a25edb51a9 Fix 'make test' detection when LANG is not in English (#10499) 2019-02-27 14:01:50 -06:00
Massimiliano Culpo
7eec038690
Update environment-modules package (#10717)
The environment modules package has been updated to include 
versions up to 4.0.0. The url of the package and the homepage
have been updated accordingly.

The `spack bootstrap` command now builds version 3.2.10 of
the environment-modules package, and will do until #10708 
is fixed.
2019-02-27 14:00:46 +01:00
Massimiliano Culpo
42386dbe94 Use Package.headers for -I options (#10623)
This restores the use of Package.headers when computing -I options
for building a package that was added in #8136 and reverted in
#10604. #8136 used utility logic that located all header files in
an installation prefix, and calculated the -I options as the
immediate roots containing those header files.

In some cases, for a package containing a directory structure like

  prefix/
    include/
	  ex1.h
	  subdir/
	    ex2.h

dependents may expect to include ex2.h relative to 'include', and
adding 'prefix/include/subdir' as a -I was causing errors,
in particular if ex2.h has the same name as a system header.

This updates header utility logic to by default return the base
"include" directory when it exists, rather than subdirectories.
It also makes it possible for package implementers to override
Package.headers to return the subdirectory when it is required
(for example with libxml2).
2019-02-26 12:42:30 -06:00
Daniel Topa
c832479c65 Add libhio v1.4.1.3, 1.4.1.1 (#10699)
- Switch all libhio tarball listings to sha256 checksums
- Correct typo in alert message in /lib/spack/spack/util/module_cmd.py: fucntion -> function

https://github.com/hpc/libhio/releases
Released 2019-02-01

Verification builds on LANL Darwin:

**Intel Xeon**
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                40
On-line CPU(s) list:   0-39
Thread(s) per core:    2
Core(s) per socket:    10
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 63
Model name:            Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz
Stepping:              2
CPU MHz:               1198.779
CPU max MHz:           3300.0000
CPU min MHz:           1200.0000
BogoMIPS:              5193.70
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              25600K
NUMA node0 CPU(s):     0-9,20-29
NUMA node1 CPU(s):     10-19,30-39
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm abm cpuid_fault epb invpcid_single pti intel_ppin tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc dtherm ida arat pln pts
`
[+] /scratch/users/dantopa/new-spack/strawman.pr.libhio/opt/spack/linux-centos7-x86_64/gcc-4.8.5/libhio-1.4.1.3-s4fnmesfp65trhks5qi3it5p73ssfpsp
[+] /scratch/users/dantopa/new-spack/strawman.pr.libhio/opt/spack/linux-centos7-x86_64/gcc-4.8.5/libhio-1.4.1.2-fkgh5vqpijvwqywffmokgmsglqxwfrtl
`

**Arm**
Architecture:          aarch64
Byte Order:            Little Endian
CPU(s):                256
On-line CPU(s) list:   0-255
Thread(s) per core:    4
Core(s) per socket:    32
Socket(s):             2
NUMA node(s):          2
Model:                 0
BogoMIPS:              400.00
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              32768K
NUMA node0 CPU(s):     0-127
NUMA node1 CPU(s):     128-255
Flags:                 fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics cpuid asimdrdm
`
[+] /scratch/users/dantopa/new-spack/strawman.pr.libhio/opt/spack/linux-rhel7-aarch64/gcc-4.8.5/libhio-1.4.1.3-q6nnwiy6bi7ktnghdsngwamom23zpmgy
[+] /scratch/users/dantopa/new-spack/strawman.pr.libhio/opt/spack/linux-rhel7-aarch64/gcc-4.8.5/libhio-1.4.1.2-y6nwovff3qbdy242zc4x2toloz6xpcvm
`

2019-02-25

Signed-off-by: Daniel Topa <dantopa@lanl.gov>
2019-02-26 09:56:20 +01:00
Adam J. Stewart
a75a6ee1b7 Add /hash to spack help --spec (#10691)
* Add /hash to spack help --spec
* Make /hash gray, add ^/hash
2019-02-25 16:20:28 -08:00
Peter Scheibel
98f1c9a291
CPATH warning: downgrade to debug message (#10675)
Spack warns users when a dependency package updates CPATH. This
warning message is generating bug reports and alarm in cases where
there is no problem. For now this downgrades the warning message to
the debug level, so it only shows up if something goes wrong for the
user and they ask for more information from Spack.
2019-02-21 17:26:38 -06:00
Scott Wittenburg
5600c9f0d9 release workflow: Add build scripts for jobs and means to upload pkgs 2019-02-21 15:37:35 -06:00
Scott Wittenburg
a6e8e889b2 release workflow: Add spack command for generating the .gitlab-ci.yml
This spack command adds a new schema for a file which describes the
builder containers available, along with the compilers availabe on
each builder.  The release-jobs command then generates the .gitlab-ci.yml
file by first expanding the release spec set, concretizing each spec
(in an appropriate docker container if --this-machine-only argument is
not provided on command line), and then combining and staging all the
concrete specs as jobs to be run by gitlab.
2019-02-21 15:37:35 -06:00
Scott Wittenburg
fce1c4133f buildcache: Add sub-commands needed by release workflow
Adds four new sub-commands to the buildcache command:

1. save-yaml: Takes a root spec and a list of dependent spec names,
along with a directory in which to save yaml files, and writes out
the full spec.yaml for each of the dependent specs.  This only needs
to concretize the root spec once, then indexes it with the names of
the dependent specs.

2. check: Checks a spec (via either an abstract spec or via a full
spec.yaml) against remote mirror to see if it needs to be rebuilt.
Comparies full_hash stored on remote mirror with full_hash computed
locally to determine whether spec needs to be rebuilt.  Can also
generate list of specs to check against remote mirror by expanding
the set of release specs expressed in etc/spack/defaults/release.yaml.

3. get-buildcache-name: Makes it possible to attempt to read directly
the spec.yaml file on a remote or local mirror by providing the path
where the file should live based on concretizing the spec.

4. download: Downloads all buildcache files associated with a spec
on a remote mirror, including any .spack, .spec, and .cdashid files
that might exist.  Puts the files into the local path provided on
the command line, and organizes them in the same hierarchy found on
the remote mirror

This commit also refactors lib/spack/spack/util/web.py to expose
functionality allowing other modules to read data from a url.
2019-02-21 15:37:35 -06:00
Todd Gamblin
be4b95ee30 add CombinatorialSpecSet class for taking cross-products of Specs.
- add CombinatorialSpecSet in spack.util.spec_set module.
  - class is iterable and encaspulated YAML parsing and validation.

- Adjust YAML format to be more generic
  - YAML spec-set format now has a `matrix` section, which can contain
    multiple lists of specs, generated different ways. Including:
    - specs: a raw list of specs.
    - packages: a list of package names and versions
    - compilers: a list of compiler names and versions

  - All of the elements of `matrix` are dimensions for the build matrix;
    we take the cartesian product of these lists of specs to generate a
    build matrix.  This means we can add things like [^mpich, ^openmpi]
    to get builds with different MPI versions.  It also means we can
    multiply the build matrix out with lots of different parameters.

- Add a schema format for spec-sets
2019-02-21 15:37:35 -06:00
Peter Scheibel
32ba471816
Dependency libs: filter system paths and always add lib dir (#10622)
Fixes #10617
Fixes #10624
Closes: #10619

#8136 dependended entirely on spec.libs to retrieve library directories
from dependencies. By default this function only retrieves libraries if
their name is something like lib<package> (e.g. "libfoo.so" for a
package called "Foo"). This unconditionally adds lib/lib64 directories
for each dependency as link/rpath directories. 

This also filters system paths from link/rpaths/include directories and
removes duplicated paths that #8136 could add.
2019-02-15 17:21:35 -06:00
Javier Cervantes
9b1690641b Fix bug getting specs from build caches (#9600) 2019-02-15 13:33:49 -06:00
Scott Wittenburg
75487dca44 CDash: allow installing from spec.yaml (#10565)
If the -f <specyamlfile> argument to install is used (rather than
providing package specs on the command line), CDash throws an exception
due to missing the installation command (the packages targeted for
install).  This fixes that behavior so CDash reporting succeeds in
either case.
2019-02-14 17:43:53 -06:00
Massimiliano Culpo
1ec0d4feb3 Removed pkg.headers.directories from the include list (#10604)
fixes #10601

Due to a bug this attribute is wrong for packages that use directories
as namespaces. For instance it will add "<boost-prefix>/include/boost"
instead of "<boost-prefix>/include" to the include path.

As a minor addition a few loops in the compiler wrappers have been
simplified.
2019-02-14 08:35:41 -08:00
Peter Scheibel
8ca384875e
Dynamic library/include paths (#8136)
Fixes #7855
Closes #8070
Closes #2645

When searching for library directories (e.g. to add "-L" arguments to
the compiler wrapper) Spack was only trying the "lib/" and "lib64/"
directories for each dependency install prefix; this missed cases
where packages would install libraries to subdirectories and also was
not customizable. This PR makes use of the ".headers" and ".libs"
properties for more-advanced location of header/library directories.
Since packages can override the default behavior of ".headers" and
".libs", it also allows package writers to customize.

The following environment variables which used to be set by Spack
for a package build have been removed:

* Remove SPACK_PREFIX and SPACK_DEPENDENCIES environment variables as
  they are no-longer used
* Remove SPACK_INSTALL environment variable: it was not used before
  this PR
2019-02-13 17:38:14 -06:00
abernede
89727ba4e7 Bug Fix in permission setter (#10584)
* fix permission setter

Fix a typo in islink test when applied to files.

* os.walk explicitly set not to follow links

The algorithm strongly rely on not following links.
2019-02-13 11:18:36 -08:00
sknigh
a76c50d1ee Allow tty output to be timestamped (#10554)
* Spack debug output now includes microsecond-granularity timestamps.
* Timestamps can also be enabled with the `--timestamp` command line argument.
2019-02-13 10:14:35 -08:00
Matthias Wolf
861dd06bd1 enh: allow time like HH:MM in date strings. (#10034) 2019-02-13 11:05:00 +01:00
George Hartzell
f65a1155e1 Enhancement to module autoload documentation (#10310)
* Note that `none` is the default for lmod autoload

Save a bit of confusion by *explicitly* pointing out that `none` is
the default value for autoload in the lmod module file generator.

* Add a tip re building software externally

Add a tip about using `autoload: all` when building packages outside
of the tree that use artifacts (e.g. libraries, includes) within the
tree.
2019-02-12 22:02:13 +01:00
Chris Green
05f565356f Allow secondary generators when building with CMake. (#9324)
CMake supports the notion of secondary generators which provide extra
information to (e.g.) IDEs over and above that normally provided by
the primary generator. Spack only supports the 'Unix Makefiles' and
'Ninja' primary generators but was not parsing out the primary
generator when a secondary generator was also included (e.g. for
a generator attribute like 'Codeblocks - Ninja'). This adds a regex
for extracting the primary generator for validation.

Since the secondary generator is irrelevant to a Spack build, it is
passed on to CMake without further validation.
2019-02-12 12:39:19 -06:00
Denis Davydov
5623ac3d6b CudaPackage: fix wrong version range (#10551) 2019-02-08 16:32:43 +01:00
Massimiliano Culpo
58f1dc037a log-parse: fix error message when no error lines are found (#10543) 2019-02-07 12:19:19 -06:00
Mario Melara
5bc71f07dd Add x86_64 as target to cray platform (#10369)
Add x86_64 as a target for the Cray platform, and also designate it
as the default front_end target.
2019-02-06 17:49:00 -06:00
Nichols A. Romero
5394f0016a CUDA compiler conflicts for Linux (#10460)
* CUDA compiler conflicts for Linux.

* Add Volta and Turing GPUs.

* Add mandatory conflict for Volta and Turing GPUs.

* Revert "CUDA compiler conflicts for Linux."

This reverts commit 7d4ff654ac53aad272c59e9f7f8bb3fbb32bcec4.

* Compiler conflicts introduced from previous commit into CUDA packaged moved and integrated into CUDA build system.

* More conversative with compiler conflicts for cuda 10.0.130, since I don't know what will happen with future cuda 10.x releases.

* Correct off-by-one errors in clang conflicts for x86_64 Linux.

* No restrictions on Apple Clang compiler until we are able to distinguish Xcode clang from github clang more easily. Note to fix this in the future.

* Change comment to clarify that github clang refers to LLVM clang.

* Fix and simplify index range.

* Fix overlapping conflicts for CUDA 10.0.130

* Removed extra ^cuda from conflict.
2019-02-06 17:09:52 +01:00
Peter Scheibel
b2c2cbadcd
debug output includes modulecmd output (#9476)
Debug output now includes the output of modulecmd executions. Only
output module content when a failure occurs; always report when a
module is loaded/unloaded.
2019-01-29 17:41:15 -06:00
Peter Scheibel
5abf29c971
Environments: fix bug for install of external packages (#10437)
"spack install" will install all packages added to the current
environment. When this included external packages, the environment
update would fail because it would attempt to copy log files that
were only generated if Spack handled the install itself. This skips
that step for external packages.
2019-01-24 21:29:21 -06:00
Greg Becker
98e0b5b0db
Allow spack install --overwrite for nonexistent or multiple packages (#9201)
* Allow overwrite nonexistent and multiple packages

initial implementation
give one prompt to users instead of a prompt per spec
testing

* flake

* bugfix: install overwrite check each spec against installed

* python3 compliance for filter/map
2019-01-24 12:10:32 -08:00
Todd Gamblin
618741fce2 tutorial: update tutorial materials for ECP19 2019-01-14 01:03:38 -06:00
Gregory Becker
dc005f3ff1 version bump: v0.12.1 2019-01-13 14:26:39 -08:00
Adam J. Stewart
dc6dca3c36 cc: clean up cray compilers, fix issues with case-insensitive filesystems (#10323)
* Remove Cray CC compilers causing problems on case-insensitive filesystems
* cray -> cce
* Ensure that compiler-specific directory comes first in build-env
* Point to compiler-specific symlinks
2019-01-12 17:37:20 -08:00