Commit graph

4252 commits

Author SHA1 Message Date
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
Greg Becker
c63c4a048c Binary caching bugfix: symlink relocation (#10073)
Binary caches of packages with absolute symlinks had broken symlinks.
As a stopgap measure, #9747 addressed this by replacing symlinks with
copies of files when creating binary cached packages.

This reverts #9747 and instead, either relative-izes the symlink or
rewrites the target. If the binary cache is created using '--rel' (as
in "spack buildcache create --rel...") then absolute symlinks will be
replaced with relative symlinks (in addition to making RPATHs relative
as before); otherwise they are rewritten (when the binary cache is
unpacked and installed).
2019-01-11 14:52:01 -08:00
Matthias Wolf
3c6d484150 enh: buildcache list should behave similar to find (#10052)
The current output of buildcache list is very verbose and I feel like
some details are getting lost. By making the output similar to find, I
think users will be able to get a better overview of what is stored in
the cache.
2019-01-11 13:57:10 -08:00
Denis Davydov
f4bda74b30 dealii: fix concretization of xsdk package (#10288)
* dealii: fix concretization of xsdk package

* tests: add concretization tests for deal.II and xSDK, which are often broken due to limitations in the concretizer

* use pytest.mark.parametrize
2019-01-11 10:07:28 -08:00
Adam J. Stewart
72a41a4918 spack versions: only list safe versions (#10004)
* spack versions: only list safe versions
* Add unit tests for spack versions -s
2019-01-10 00:32:47 -08:00
Greg Becker
450b0e3059 Allow combinatorial projections in views (#9679)
Allow customizing views with Spec-formatted directory structure

Allow views to specify projections that are more complicated than
merging every package into a single shared prefix. This will allow
sites to configure a view for the way they want to present packages
to their users; for example this can be used to create a prefix for
each package but omit the DAG hash from the path.

This includes a new YAML format file for specifying the simplified
prefix for a spec in a view. This configuration allows the use of
different prefix formats for different specs (i.e. specs depending
on MPI can include the MPI implementation in the prefix).
Documentation on usage of the view projection configuration is
included.

Depending on the projection configuration, paths are not guaranteed
to be unique and it may not be possible to add multiple installs of
a package to a view.
2019-01-09 17:39:35 -08:00
Greg Becker
f5bb93c75b tutorial basics section: fix gcc install version (#10298) 2019-01-09 17:37:37 -06:00
Owen Solberg
c48b0a13b9 bug fix: copy permissions when staging (#10285)
Fixes #10284

#10152 replaced shutil.move with llnl's copy and copy_tree for
resources. This did not copy permissions so led to later failures
if an executable was copied (e.g. a configure script). This uses
install/install_tree instead, which preserve permissions.
2019-01-08 17:56:16 -08:00
Srinath Vadlamani
4fdd3b6794 Armcompiler (#9840)
* Initial compiler support

* added arm.py

* Changed licence to Arm suggested header

* Changed licence to the same as clang.py
Main author of file is Nick Forrington <Nick.Forrington@arm.com>
Minor changes by Srinath Vadlamani <srinath.vadlamani@arm.com>

* compilers: add arm compiler detection to Spack

- added arm.py with support for detecting `armclang` and `armflang`

Co-authored-by: Srinath Vadlamani <srinath.vadlamani@arm.com>

* Changed to using get get_compiler_version

* linking to general cc for arm compiler

* For arm compiler add CFLAGS to use compiler-rt rtlib.

* Escape for special characters in rexep

* Cleaned up for Flake8 to pass.

* libcompiler-rt should be part of the LDFLAGS not CFLAGS

* fixed m4 when using clang to used LDFLAGS.  Fixed comments for arm.py to display compiler --version output with # NOAQ for flakes pass.

* added arm compilers

* proper linked names
2019-01-08 16:31:25 -08:00
Peter Josef Scheibel
9f79995718 For spec-file-based installs, store the initial spec read from the file as the abstract spec 2019-01-07 20:40:34 -08:00
Massimiliano Culpo
c4521535e7 Multi-valued variants: better support for combinations (#9481)
This enforces conventions that allow for correct handling of
multi-valued variants where specifying no value is an option,
and adds convenience functionality for specifying multi-valued
variants with conflicting sets of values. This also adds a notion
of "feature values" for variants, which are those that are understood
by the build system (e.g. those that would appear as configure
options). In more detail:

* Add documentation on variants to the packaging guide
* Forbid usage of '' or None as a possible variant value, in
  particular as a default. To indicate choosing no value, the user
  must explicitly define an option like 'none'. Without this,
  multi-valued variants with default set to None were not parsable
  from the command line (Fixes #6314)
* Add "disjoint_sets" function to support the declaration of
  multi-valued variants with conflicting sets of options. For example
  a variant "foo" with possible values "a", "b", and "c" where "c"
  is exclusive of the other values ("foo=a,b" and "foo=c" are
  valid but "foo=a,c" is not).
* Add "any_combination_of" function to support the declaration of
  multi-valued variants where it is valid to choose none of the
  values. This automatically defines "none" as an option (exclusive
  with all other choices); this value does not appear when iterating
  over the variant's values, for example in "with_or_without" (which
  constructs autotools option strings from variant values).
* The "disjoint_sets" and "any_combination_of" methods return an
  object which tracks the possible values. It is also possible to
  indicate that some of these values do not correspond to options
  understood by the package's build system, such that methods like
  "with_or_without" will not define options for those values (this
  occurs automatically for "none")
* Add documentation for usage of new functions for specifying
  multi-valued variants
2019-01-04 19:02:34 -08:00
Peter Josef Scheibel
64deda1b0c Add tests for expanding/non-expanding resources 2019-01-04 17:04:28 -08:00
Michael Kuhn
41ef02ee10 stage: fix resources being deleted from local cache (#10152)
Non-expanded resources were being deleted from the cache on account
of two behaviors:

* ResourceStage was moving files rather than copying them, and uses
  "os.path.realpath" to resolve symlinks
* CacheFetchStrategy creates a symlink to a cached resource rather
  than copying it

This alters the first behavior: ResourceStage now copies the file
rather than moving it.
2019-01-04 17:04:28 -08:00
Ben Zwick
7d9dbc5fd2 Add missing code block (#10243)
Otherwise the `--` in `--dot` is rendered as a single en-dash.
2019-01-03 09:41:14 -06:00
Michael Kuhn
802dc4a03a patch: split up fetch and clean into separate methods (#10150)
"mirror create" was invoking a package's do_patch method in order to
retrieve and archive URL patches. If a package implements a "patch"
method, this is also called as part of do_patch; this failed when the
package-specific implementation referred to environment variables
that are only available at the time the package is built
(e.g. "spack_cc").

This change introduces fetch and clean methods for patches. They are
no-ops for FilePatch but perform the appropriate actions for
UrlPatch. This allows "mirror create" to invoke do_fetch, which does
not call the package's patch method.
2019-01-02 11:44:50 -08:00
Massimiliano Culpo
8540d5390e
Removed an extra comma after a dict literal (#10236)
The extra comma was turning a dict into a tuple, and caused errors
during validation of the schema.
2019-01-02 01:15:15 +01:00
Todd Gamblin
5425a3dad4 flake8: fix flake8 issues with invalid escapes
- in many files, regular strings were used in places where raw strings
  should've been used.

- convert these to raw strings and get rid of new flake8 errors
2019-01-01 00:44:28 -08:00
Todd Gamblin
6f50cd52ed copyright: update license headers for 2013-2019 copyright. 2019-01-01 00:44:28 -08:00
Todd Gamblin
e82992ae32 license: license command prints sorted, non-redundant results
- spack license command now ignores symlinks

- spack license list-files now prints sorted output, and checks for files
  we've already seen.
2019-01-01 00:44:28 -08:00
Massimiliano Culpo
3b8b13809e Improve validation of modules.yaml (#9878)
This PR improves the validation of `modules.yaml` by introducing a custom validator that checks if an attribute listed in `properties` or `patternProperties` is a valid spec. This new check applied to the test case in #9857 gives:

```console
$ spack install szip
==> Error: /home/mculpo/.spack/linux/modules.yaml:5: "^python@2.7@" is an invalid spec [Invalid version specifier]
```

Details: 
* Moved the set-up of a custom validator class to spack.schema
  * In Spack we use `jsonschema` to validate configuration files 
    against a schema. We also need custom validators to enforce
    writing default values within "properties" or "patternProperties"
    attributes.

  * Currently, validators were customized at the place of use and with the
    recent introduction of environments that meant we were setting-up and
    using 2 different validator classes in two different modules.

  * This commit moves the set-up of a custom validator class in the
    `spack.schema` module and refactors the code in `spack.config` and
    `spack.environments` to use it.

* Added a custom validator to check if an attribute is a valid spec
  * Added a custom validator that can be used on objects, which yields an
    error if the attribute is not a valid spec.

* Updated the schema for modules.yaml

* Updated modules.yaml to fix a few inconsistencies:
  - a few attributes were not tested properly using 'anyOf'
  - suffixes has been updated to also check that the attribute is a spec
  - hierarchical_scheme has been updated to hierarchy

* Removed $ref from every schema
  * $ref is not composable or particularly legible
  * Use python dicts and regular old variables instead.
2019-01-01 00:11:49 -08:00
Todd Gamblin
2e3303abd0 bugfix: nested directives were broken in python 3
- The nested directive implementation was broken for python 3

- directive results were not properly removed from the directive list
  when it was processed in the DirectiveMeta metaclass.

- the issue was that remove_directives only descended into a list or
  tuple, but in Python3, the initial value passed to the function is a
  view of dictionary values.

- make it a list to fix things, and add a regression test.
2018-12-30 00:19:08 -08:00
Todd Gamblin
d763e92141 commands: add spack resource command to inspect downloadable files
- currently just looks at patches
  - allows you to find out which package applied a patch to a spec

- intended to work with tarballs and resources in the future.

- add tab completion for `spack resource` and subcommands
2018-12-30 00:19:08 -08:00
Todd Gamblin
d2db978c7f tests: add a test to make sure that patched specs can be round-tripped
- previously, if a concrete sub-DAG with patched specs was written out
  and read back in, its patches would not be found because the dependent
  that patched it was no longer in the DAG.

- Add a test to ensure that the PatchCache handles this case.

- Also add tests to ensure that patch objects are properly created from
  Specs -- previously we only checked that the patches were on the Spec.
2018-12-30 00:19:08 -08:00
Todd Gamblin
d3ee6c977b patches: add a per-repository patch index
- this fixes a bug where if we save a concretized sug-DAG where a package
  had been patched by a dependent, and the dependent was not in the DAG,
  we would not read in all patches correctly.

- Rather than looking up patches in the DAG, we look them up globally
  from an index created from the entire repository.

- The patch cache is a bit tricky for several reasons:

  - we have to cache information from packages, specifically, the patch
    level and working directory.

  - FilePatches need to know which package owns them, so that they can
    figure out where the patch lives.  The repo can change locations from
    run to run, so we have to store relative paths and restore them when
    the cache is reloaded.

  - Patch files can change underneath the cache, because repo indexes
    only update on package changes.  We currently punt on this -- there
    are stub methods for needs_update() that will need to check patch
    files when packages are loaded.  There isn't an easy way to do this
    at global indexing time without making the FastPackageChecker a lot
    slower.  This is TBD for a future commit.

  - Currently, the same patch can only be used one way in a package. That
    is, if it appears twice with different level/working_dir settings,
    bad things will happen.  There's no package that current uses the
    same patch two different ways, so we've punted on this as well, but
    we may need to fix this in the future by moving a lot of the metdata
    (level, working dir) to the spec, and *only* caching sha256sums in
    the PatchCache.  That would require some much more complicated tweaks
    to the Spec, so we're holding off on that til later.

- This required patches to be refactored somewhat -- the difference
  between a UrlPatch and a FilePatch is still not particularly clean.
2018-12-30 00:19:08 -08:00
Todd Gamblin
a9b69fa902 ProviderIndex uses json instead of YAML
- indexes should use json, not YAML, to optimize for speed
- only use YAML in human-editable files
- this makes ProviderIndex consistent with other indexes
2018-12-30 00:19:08 -08:00
Todd Gamblin
c1d7adaaac repo: refactor indexes to be more extensible
- virtual provider cache and tags were previously generated by nearly
  identical but separate methods.

- factor out an Indexer interface for updating repository caches, and
  provide implementations for each type of index (TagIndex,
  ProviderIndex) so that more can be added if needed.

- Among other things, this allows all indexes to be updated at once.
  This is an advantage because loading package files is the real
  overhead, and building the indexes once the packages are loaded is
  trivial. We avoid extra bulk read-ins by generating all package indexes
  at once.

- This can be extended for dependents (reverse dependencies) and patches
  later.
2018-12-30 00:19:08 -08:00
Todd Gamblin
527ff860f0 patches: clean up patch.py, directives, and package class properties
- cleanup patch.py:
  - make patch.py constructors more understandable
  - loosen coupling of patch.py with package

- in Package: make package_dir, module, and namespace class properties

  - These were previously instance properties and couldn't be called from
    directives, e.g. in patch.create()

  - make them class properties so that they can be used in class definition

  - also add some instance properties to delegate to class properties so
    that prior usage on Package objects still works
2018-12-30 00:19:08 -08:00
Massimiliano Culpo
28fd1baa86 tests: run 'test_compiler_add' serially in Python 2 (#10127)
* Don't spawn processes during python 2.6/2.7 'test_compiler_add' unit tests
* Travis seems to choke on the excessive parallelism in `compiler find`
2018-12-25 23:47:46 -08:00
Denis Davydov
39b23d277b environment: ignore invalid files names in var/spack/environments (#10198) 2018-12-25 22:22:21 -08:00
Todd Gamblin
35dd929651
bugfix: handle unicode properly in spack.util.executable (#10186)
- When returning string output, use text_type and decode utf-8 in Python
  2 instead of using `str`

- This properly handles unicode, whereas before we would pass bad strings
  to colify in `spack blame` when reading git output

- add a test that round-trips some unicode through an Executable object
2018-12-23 23:59:58 -08:00
Elsa Gonsiorowski, PhD
74a5d92f07 Remove /nfs/tmp2 from default build_stage locations (#10170)
* Remove /nfs/tmp2 from default configuration
* /nfs/tmp2 is going away from LC... and doesn’t exist for the rest of the world.
* update documentation to remove /nfs/tmp2 as well
2018-12-21 02:03:54 -08:00
Zack Galbreath
b90f619037 Performance improvements for CDash reporter
* Record build output as an array of lines rather than concatenating to a
  single large string.
* Use string.find to avoid running re.search on every line of output.
2018-12-20 09:23:08 -08:00
Zack Galbreath
6355ee208c Include accurate build time in CDash report 2018-12-20 09:23:08 -08:00
Zack Galbreath
8d0872083c Report current git commit of Spack to CDash
When using the CDash reporter, upload a Update.xml file that
indicates the hash of Spack's current git commit.
2018-12-20 09:23:08 -08:00
Scott Wittenburg
7217b4a4b9 Make sure to urlencode cdash submit parameters 2018-12-20 09:23:08 -08:00
Zack Galbreath
aed9a532c6 Get buildId from CDash at submit time
Pass extra data when submitting to CDash.  If CDash responds with a buildId,
construct and display helpful URL that links to the uploaded report.
2018-12-20 09:23:08 -08:00
Zack Galbreath
738d2bd77a Allow more customization for CDash reporter
Add new command line arguments to `spack install` that allow users
to set the build name, site name, and track in their CDash report.
2018-12-20 09:23:08 -08:00
Zack Galbreath
0bae6626a4 Avoid UnboundLocalError
Make sure cdash_phase is defined before referring to it.
2018-12-20 09:23:08 -08:00
Todd Gamblin
207c37759c env: all commands that disambiguate specs should be env-aware
- some commands were missed in the rollout of spack environments

- this makes all commands that need to disambiguate specs restrict the
  disambiguation to installed packages in the active environment, as
  users would expect
2018-12-19 17:49:51 -08:00
Michael Kuhn
67ab73d381 fetch_strategy: improve GitFetchStrategy (#10153)
Currently, only the Git repsository's URL shows up in the `spack info`
output, which makes it hard to distinguish different versions:
```
Safe versions:
    develop    [git] https://github.com/LLNL/H5Z-ZFP.git
    0.8.0      [git] https://github.com/LLNL/H5Z-ZFP.git
    0.7.0      [git] https://github.com/LLNL/H5Z-ZFP.git
```

This change adds additional information as shown when cloning a Git
repository:
```
Safe versions:
    develop    [git] https://github.com/LLNL/H5Z-ZFP.git on branch master
    0.8.0      [git] https://github.com/LLNL/H5Z-ZFP.git at commit af165c4
    0.7.0      [git] https://github.com/LLNL/H5Z-ZFP.git at commit 58ac811
```
2018-12-19 14:33:58 -08:00
Adam J. Stewart
c1a99bf8ec
Add additional info to MesonPackage docs (#10133)
* Add additional info to MesonPackage docs

* No Pygments lexer for Meson code, default to none
2018-12-18 21:51:42 -06:00
Adam J. Stewart
2d0ddd5d11
Add help messages to spack gpg subcommands (#10117) 2018-12-17 13:02:51 -06:00
Adam J. Stewart
d5d64bdf3b
spack buildcache: --allow_root -> --allow-root (#10115) 2018-12-17 13:02:28 -06:00
Peter Scheibel
0217a651c8 mirrors: patches are now properly added to mirrors (#8993)
* This fixes a number of bugs:

  * Patches were not properly downloaded and added to mirrors.

  * Mirror create didn't respect `list_url` in packages

  * Update the `spack mirror` command to add all packages in the
    concretized DAG (where originally it only added the package specified
    by the user). This is required in order to collect patches that are specified
    by dependents. Example:
      * if X->Y and X requires a patch on Y called Pxy, then Pxy will only
        be discovered if you create a mirror with X.

  * replace confusing --one-version-per-spec option for `spack mirror create`
    with --versions-per-spec; support retrieving multiple versions for 
    concrete specs

* Implementation details:

  * `spack mirror create` now uses regular staging logic to download files 
    into a mirror, instead of reimplementing it in `add_single_spec`.

  * use a separate resource caching object to keep track of new
    resources and already-existing resources; also accepts storing
    resources retrieved from a cache (unlike the local cache)

  * mirror cache object now stores resources that are considered
    non-cachable, like (e.g. the tip of a branch);

  * the 'create' function of the mirror module no longer traverses
    dependencies since this was already handled by the 'mirror' command; 

  * Change handling of `--no-checksum`:

    * now that 'mirror create' uses stages, the mirror tests disable
      checksums when creating the mirror

    * remove `no_checksum` argument from library functions - this is now
      handled at the Spack-command-level (like for 'spack install')
2018-12-16 10:15:22 -08:00
Adam J. Stewart
1424830378 spack pkg add: add help message (#10116) 2018-12-15 11:44:37 +01:00
Greg Becker
d2d0ab06b7 Fix spack package inheritance for module variables (#10097)
* we weren't properly setting module variables for the root package in a DAG -- just for transitive dependencies.
2018-12-14 08:37:22 -08:00
Adam J. Stewart
ad046402b6 Make downloads from list_url deterministic (#10047) 2018-12-10 14:36:55 +01:00
Gregory Becker
b072c9b457 multimethod: slight refactoring, documentation for code review 2018-12-06 15:48:23 -08:00
Gregory Becker
2621af41d1 fix MRO for multimethod.__call__ using iterative algorithm.
Add tests MRO for inherited multimethods with multiple inheritance
Add tests for inherited and overridden multimethods
2018-12-06 15:48:23 -08:00
Todd Gamblin
43d94d4a30 tests: fully parametrize multimethod test
- all multimethod tests are now run for both `multimethod` and
  `multimethod-inheritor`

- do this with a parameterized fixture (pkg_name) that runs the same
  tests on both
2018-12-06 15:48:23 -08:00
Todd Gamblin
61b859193d multimethod uses Spec() instead of parse_anonymous_spec()
- simplify logic in multimethod
- remove the requirement of multimethod invocations to walk up the stack.
2018-12-06 15:48:23 -08:00
Todd Gamblin
88cb11758b spec: refactor and clean up Spec initialization
- Since early Spack versions, the SpecParser has (weirdly) been
  responsible for initializing Spec fields.

- This refactors initialization to take place in Spec.__init__, as it
  probably should have originally.

- This makes the code easier to read, the parser easier to understand,
  and removes the use of __new__ in the parser to initialize the Spec.

- This also makes it possible to make a completely empty Spec with
  `Spec()` -- this is an abstract Spec that will match anything.
2018-12-06 15:48:23 -08:00
Gregory Becker
7bb7b94666 Added test for multimethod inheritance 2018-12-06 15:48:23 -08:00
Peter Scheibel
34f64f1f3f improved constraint conflict error message (#9975) 2018-12-04 14:19:57 +01:00
Massimiliano Culpo
e998a399da Injected flags have a consistent order (#9960)
Fixes #9908

Spack was assembling flags in a manner that could in different
orderings for repeated concretizations of the same spec and config
2018-11-28 10:23:38 -08:00
Scott Wittenburg
33b112a60d Expose option to save all dependencies when writing spec.yaml (#9965) 2018-11-27 17:13:39 -08:00
Denis Davydov
abd7b185f7 intel-mkl: fix usage of openmp_libs and tbb_libs (#9863)
* intel-mkl: fix usage of openmp_libs and tbb_libs
* intel-mkl: remove trailing whitespace from openmp lib
2018-11-16 10:25:15 -08:00
Adam J. Stewart
b771b4015a Fix bugs in Modules Tutorial (#9821)
Found a couple bugs while trying to copy and paste the exact
tutorial content.
2018-11-13 09:31:09 -06:00
Adam J. Stewart
7bca5b9c61 Fix typos in Build Systems Tutorial (#9822) 2018-11-12 18:32:13 -06:00
Todd Gamblin
2efaf1b6f7 docs: update tutorial slide link for SC18 2018-11-12 09:44:47 -06:00
Todd Gamblin
d079a5c73e version bump: v0.12.0 2018-11-12 06:04:17 -06:00
Todd Gamblin
f92349ff8c docs: add environments tutorial
- tutorial goes through three sections:
  - installing and uninstalling environments
  - dealing with many specs
  - spack.yaml and spack.lock and workflows
2018-11-12 05:57:08 -06:00
Adam J. Stewart
a1676ab012 Updates to Configuration Tutorial for SC18 (#9811)
* Updates to Configuration Tutorial for SC18

* Suggested rewording
2018-11-11 22:50:59 -08:00
Adam J. Stewart
71561f9d2b Consistent capitalization of Build Caches docs for SC18 (#9810) 2018-11-11 21:13:01 -08:00
Adam J. Stewart
49c66db2fa Minor changes to Build Settings docs (#9808) 2018-11-11 21:12:37 -08:00
Adam J. Stewart
c227e1f02e Minor changes to Basic Settings docs for SC18 (#9809)
Grammar/spelling issues
2018-11-11 23:10:05 -06:00
Greg Becker
dfd0e96508 Update basic usage and modules tutorial (#9807)
* "spack install" now uses cache by default, update examples accordingly
* Replace some example packages with others
* Packing tutorial reference to "spack env" replaced with "spack build-env"
* Command line prompts in examples are shortened
* Example output (including paths) are updated to be more relevant to training environment
2018-11-11 22:58:50 -06:00
Peter Scheibel
2a5d5fda26
Advanced packaging tutorial: reorganize for binary caches (#9804)
Update all examples that need an MPI provider to build with MPICH; reorganize so that fixing MPICH (as part of environment section) comes first in the tutorial (most examples in the tutorial use an MPI provider).
2018-11-11 21:31:51 -06:00
Todd Gamblin
a8e8d80750 env: uninstall just removes specs that are still needed by other envs
- previously, uninstall would complain if a spec was needed by an
  environment.

- Now, we analyze dependents and dependent environments and simply remove
  (not uninstall) specs that are needed by environments
2018-11-11 18:32:24 -06:00
Todd Gamblin
87aec4134d bugfix: preserve abstract specs when installing an environment
- `spack install` was setting the root to be the concrete spec
- abstract spec is now preserved
2018-11-11 18:32:24 -06:00
Todd Gamblin
0f2bfd7492 env: fix display of concretized specs in spack find
- fix highlighting of roots in concretized specs in `spack find`
- tighten up the `spack find` output in environments
2018-11-11 18:32:24 -06:00
Todd Gamblin
8d92fd6640 env: make spack config edit and spack config get environment-aware
- with no arguments, these commands will now edit or dump the
  environment's `spack.yaml` file.

- users may not know where named environments live

- this makes it convenient for users to get to the spack.yaml
  configuration file for their named environment.
2018-11-11 18:32:24 -06:00
Todd Gamblin
25f8abb963 bugfix: make defaults consistent --use-cache and --no-cache (#9803) 2018-11-11 17:18:21 -06:00
Mario Melara
7d98c73e40 Update buildsystem tut (#9795)
* Update Makefile to use property methods ("build_targets"/"install_targets")
  to demonstrate their usage
* Fix highlighting
* Change cbench example to ESMF:
  CBench package file was changed and no longer uses the example shown in
  the old docs
2018-11-11 14:21:54 -06:00
Adam J. Stewart
d366e642e4 Updates to Configuration Files docs for SC18 (#9801)
Scopes added with -C are now referred to as "custom scopes"
rather than "command line scopes". "command line scope" now refers
to specific config options that are set on the command line (like
"--insecure")
2018-11-11 10:57:46 -08:00
Todd Gamblin
6141ae49fd
install: add --use-cache back so that existing tooling does not break (#9797)
- default is still to use the cache, but we've added back the
  `--use-cache` argument so that scripts that used it are still correct.

- `--no-cache` is stil present and is mutually exclusive with `--use-cache`
2018-11-09 16:41:48 -08:00
Nichols A. Romero
236b34f3df Introduce fftw-api virtual package for Intel-MKL and FFTW (#9618)
* Introduce FFTW2 and FFT3 providers for Intel-MKL and FFTW Spack packages.

* make fftw default package for fftw-api virtual package

* virtual package test assertion now provides location of default virtual packages.

* Change name of virtual package to fftw-api and used versioned interface.
2018-11-09 08:16:11 -08:00
Greg Becker
988d37757f buildcache: update spack install to use build cache by default (#9772) 2018-11-09 00:59:28 -08:00
Todd Gamblin
423d3e75ab env: clean up command access to the active environment
- all commands (except `spack find`, through `ConstraintAction`) now go
  through get_env() to get the active environment

- ev.active was hard to read -- and the name wasn't descriptive.
  - rename it to _active_environment to be more descriptive and to strongly
    indicate that spack.environment manages it
2018-11-09 00:31:24 -08:00
Todd Gamblin
562482d9cc env: only add concrete attribute to abstract specs
- to aovid changing spec hashes drastically, only add this attribute to
  differentiated abstract specs.

- othherwise assume that read-in specs are concrete
2018-11-09 00:31:24 -08:00
Todd Gamblin
13164b114a env: make environment search more consistent; simplify code
- spack.yaml files in the current directory were picked up inconsistently
  -- make this a sure thing by moving that logic into find_environment()
  and moving find_environment() to main()

- simplify arguments to Spack command:
  - remove short args for infrequently used commands (--pdb/-D, -P, -s)
  - `spack -D` now forces an env with a directory
2018-11-09 00:31:24 -08:00
Todd Gamblin
3f68d8c53a externals: bugfix in ruamel for ordereddict in Python 2.6
- args weren't being delegated properly from CommentedMap to OrderedDict
2018-11-09 00:31:24 -08:00
Todd Gamblin
62f8ea1a75 env: rename EnvError to SpackEnvironmentError 2018-11-09 00:31:24 -08:00
Todd Gamblin
13aca774e3 bugfix: preserve patch ordering when specs are copied
- The `Spec` class maintains a special `_patches_in_order_of_appearance`
  attribute on patch variants, but it is was preserved when specs are
  copied.

- This caused issues for some builds

- Add special logic to `Spec` to preserve this variant on copy

- TODO: in the long term we should get rid of the special variant and
  make it the responsibility of one of the variant classes.
2018-11-09 00:31:24 -08:00
Todd Gamblin
a41bce2148 fix bad regular expressions and docstrings with '\' 2018-11-09 00:31:24 -08:00
Todd Gamblin
1137b183e3 commands: rework command categories and arguments
- split 'environment' section into 'environments' and 'modules'
- move location to 'query packages' section
- move cd to developer section

- --env-dir no longer has a short optino (was -E)
- -E now means "run without an environment" (no longer same as --env-dir)
- -D now means "run with this directory environment"
- remove short options for may infrequently used top-level commands
2018-11-09 00:31:24 -08:00
Todd Gamblin
efad7ac81b env: consolidate most of spack env status into spack find
- `spack env status` used to show install status; consolidate that into
  `spack find`.

- `spack env status` will still print out whether there is an active
  environment
2018-11-09 00:31:24 -08:00
Todd Gamblin
26a55ff749 env: move env uninstall into spack uninstall
- uninstall now:
  - restricts its spec search to the current environment
  - removes uninstalled specs from the current environment
  - reports envs that still need specs you're trying to uninstall

- removed spack env uninstall command
- updated tests
2018-11-09 00:31:24 -08:00
Todd Gamblin
7136274f4b env: move spack env stage into spack stage command 2018-11-09 00:31:24 -08:00
Todd Gamblin
e62506571f env: spack env destroy is now spack env remove 2018-11-09 00:31:24 -08:00
Todd Gamblin
8b549f664c env: move add, remove, and concretize to top-level commands 2018-11-09 00:31:24 -08:00
Todd Gamblin
e63b45b293 env: moved all spack env install functionality into spack install
- moved get_env from cmd/env.py to environment.py

- spack install will now install into the active environment when no
  arguments are provided.  It looks:
  1. at the command line
  2. for a local spack.yaml file
  3. for any currently activated environment
2018-11-09 00:31:24 -08:00
Todd Gamblin
08e4720ed9 env: remove all -e arguments on subcommands
- add and remove now require an active environment
- update tests to use with <ENV> instead of -e
2018-11-09 00:31:24 -08:00
Todd Gamblin
d483e6e17b env: currently activated environment cannot be destroyed 2018-11-09 00:31:24 -08:00
Todd Gamblin
40af955b94 env: prevent any active environments from interfering with tests
- ensure that `SPACK_ENV` is unset before tests
- ensure that `spack.environment.active` is deactivated if set
2018-11-09 00:31:24 -08:00
Todd Gamblin
c27b78ee36 env: remove upgrade() and relocate() for now
- these won't be in the first release of environments
- they'll be added back in later
2018-11-09 00:31:24 -08:00
Todd Gamblin
36623a27fd env: add test to ensure config precedence is high-to-low 2018-11-09 00:31:24 -08:00
Todd Gamblin
66aa3426ac env: make install_status output more concise 2018-11-09 00:31:24 -08:00
Todd Gamblin
a1818f971f env: environments can be named or created in directories
- `spack env create <name>` works as before

- `spack env create <path>` now works as well -- environments can be
  created in their own directories outside of Spack.

- `spack install` will look for a `spack.yaml` file in the current
  directory, and will install the entire project from the environment

- The Environment class has been refactored so that it does not depend on
  the internal Spack environment root; it just takes a path and operates
  on an environment in that path (so internal and external envs are
  handled the same)

- The named environment interface has been hoisted to the
  spack.environment module level.

- env.yaml is now spack.yaml in all places.  It was easier to go with one
  name for these files than to try to handle logic for both env.yaml and
  spack.yaml.
2018-11-09 00:31:24 -08:00
Todd Gamblin
9fb37dfd76 env: spack install SPEC installs into currently active environment.
- install will now add (if necessary), concretize, and install a single
  spec into the active environment.
2018-11-09 00:31:24 -08:00
Todd Gamblin
3fd9fc8994 env: spack env install automatically concretizes specs 2018-11-09 00:31:24 -08:00
Todd Gamblin
d14f7b82bb env: add spack env activate/deactivate and shell support
- `spack env activate foo`: sets SPACK_ENV to the current active env name

- `spack env deactivate`: unsets SPACK_ENV, deactivates the environment

- added support to setup_env.sh and setup_env.csh

- other env commands work properly with SPACK_ENV, as with an environment
  arguments.

- command-line --env arguments take precedence over the active
  environment, if given.
2018-11-09 00:31:24 -08:00
Todd Gamblin
15c5c36eaf env: bugfix: spack env list won't fail if var/spack/environments doesn't exist 2018-11-09 00:31:24 -08:00
Todd Gamblin
ce230fa3f4 env: rework environments
- env.yaml is now meaningful; it contains authoritative user specs

  - concretize diffs user specs in env.yaml and env.json to allow user to
    add/remove by simply updating env.yaml

  - comments are preserved when env.yaml is updated by add/unadd

  - env.yaml can contain configuration and include external configuration
    either from merged files or from config scopes

  - there is only one file format to remember (env.yaml, no separate init
    format)

- env.json is now env.lock, and it stores the *last* user specs to be
  concretized, along with full provenance.
  - internal structure was modified slightly for readability
  - env.lock contains a _meta section with metadata, in case needed

- added more tests for environments

- env commands follow Spack conventions; no more `spack env foo install`
2018-11-09 00:31:24 -08:00
Todd Gamblin
6af5dfbbc2 config: allow env.yaml to contain configuration in a single file
- add `SingleFileScope` to configuration, which allows us to pull config
  sections from a single file.

- update `env.yaml` and tests to ensure that the env.yaml schema works
  when pulling configurtion from the env file.
2018-11-09 00:31:24 -08:00
Todd Gamblin
9ee2623486 env: rename spack env list to spack env status 2018-11-09 00:31:24 -08:00
Todd Gamblin
c19000038b schemas: rework schemas so that they can be included from other files
- Each schema now has a top-level `properties` and `schema` attribute.

- The `properties` is a fragment that can be included in other
  jsonschemas, via Python, not via '$ref'

- Th `schema` is a complete `jsonschema` with `title` and `$schema`
  properties.
2018-11-09 00:31:24 -08:00
Todd Gamblin
83323f4e71 bugfix: Avoid KeyError in compilers.yaml version check 2018-11-09 00:31:24 -08:00
Todd Gamblin
84140c6cd3 env: add -e as global spack argument, make spack -e <env> spec work
- add -E/--exact-env instead of --use-env-repo
- simplify env handling in `spack find`
2018-11-09 00:31:24 -08:00
Todd Gamblin
180d804615 env: add --env argument to spack location 2018-11-09 00:31:24 -08:00
Todd Gamblin
47e60d5ef8 env: add --env argument to spack find
- add a common argument for `-e/--env`
- modify the database to support queries on subsets of hashes
- allow `spack find` to be filtered by hashes in an environment
2018-11-09 00:31:24 -08:00
Todd Gamblin
ea7648ff84 bugfix: identical specs with different DAG hashes don't shadow each other
- logic used in `spack find` was hiding duplicate installations if their
  hashes were different

- short hash doesn't work in this scenario, since specs are structurally
  identical

- ConstraintAction always works on a DB query, so use the DAG hash to
  ensure uniqueness
2018-11-09 00:31:24 -08:00
Todd Gamblin
3e94c4d573 env: move main Environment class and logic to spack.environment
- `spack.environment` is now the home for most of the infrastructure
   around Spack environments

- refactor `cmd/env.py` to use everything from spack.environment

- refactor the cmd/env test to use pytest and fixtures
2018-11-09 00:31:24 -08:00
Todd Gamblin
0e60fcccfb utils: merge spack.environment into spack.util.environment
- `spack.util.environment` is the new home for routines that modify
  environment variables.

- This is to make room for `spack.environment` to contain new routines
  for dealing with spack environments
2018-11-09 00:31:24 -08:00
Todd Gamblin
cd075b04d2 env: refactor imports in cmd/env.py and tests 2018-11-09 00:31:24 -08:00
Todd Gamblin
b738b7b05b env: refactor subparsers in env.py
- Instead of one method with all parsers, each subcommand gets two
  functions: `setup_<cmd>_parser()` and `environment_<cmd>()`

- the `setup_parser()` and `env()` functions now generate the parser
  based on these and a list of subcommands.

- it is now easier to associate the arguments with the subcommand.
2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
31cb2041c3 env: add spack env command, along with env.yaml schema and tests
Co-authored-by: Elizabeth Fischer <rpf2116@columbia.edu>
2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
4b2f51d063 env: preserve command_line as the scope of highest precedence
Co-authored-by: Elizabeth Fischer <rpf2116@columbia.edu>
2018-11-09 00:31:24 -08:00
Elizabeth Fischer
d1cce990cd env: refactor common arguments 2018-11-09 00:31:24 -08:00
Elizabeth Fischer
037457adc9 specs: save/restore concrete & patches when exporting/importing Specs 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
7f224b616d specs: _concrete should never be cleared when copying Specs 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
acdb391931 specs: add convenience function for reading spec dependencies from node dict 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
4daa164fbf specs: allow writing full spec (including build deps) to dict 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
e6c6ab64b8 env: rename 'spack env' command to 'spack build-env' 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
bb8da72f0c env: renamed 'environment' test 2018-11-09 00:31:24 -08:00
Peter Scheibel
7d97e8b067 New repo for advanced packaging tutorial (#9711)
* modified tutorial packages

* update hint in hdf5 tutorial file (typo for suggested argument)

* add repo.yaml to tutorial repository

* update tutorial docs to refer user to tutorial package repository

* flake edits

* recommend site scope vs. defaults

* you don't specify the repo's name when adding a repo, just the path
2018-11-06 19:57:32 -08:00
Peter Scheibel
058cf81312 Binary caching: remove symlinks, copy files instead (#9747)
* omit symlinks and create file copies when making a binary cache of a package

* unrelated flake edits involving regexes that recent flake is now angry about
2018-11-06 19:56:03 -08:00
Zack Galbreath
30eda8b837 cdash: report clean results to CDash server (#9564)
* Record stdout for packages without errors

  Previously our reporter only stored stdout if something went wrong
  while installing a package.  This prevented us from properly reporting
  on steps where everything went as expected.

* More robustly report all phases to CDash

  Previously if a phase generated no output it would not be reported to CDash.
  For example, consider the following output:

    ==> Executing phase: 'configure'
    ==> Executing phase: 'build'

  This would not generate a report for the configure phase. Now it does.

* Add test case for CDash reporting clean builds

* Fix default directory for CDash reports

  The default 'cdash_report' directory name was getting overwritten
  by 'junit-report'.

* Upload the build phase first to CDash

  Older versions of CDash expect Build.xml to be the first file uploaded
  for any given build.

* Define cdash_phase before referring to it
2018-11-06 16:09:47 -08:00
Massimiliano Culpo
05779d911f Adapted the code of the non-daemonic pool to recent python versions
fixes #9739

The non-daemonic pool relies heavily on implementation details of the
multiprocessing package. In this commit we provide an implementation
that fits recent python versions.
2018-11-06 16:02:37 -08:00
Nick Forrington
9f5865a68d compilers: add arm compiler detection to Spack
- added arm.py with support for detecting `armclang` and `armflang`

Co-authored-by: Srinath Vadlamani <srinath.vadlamani@arm.com>
2018-11-02 12:53:50 -07:00
Tim Fuller
fc25ba1b22 Parse the ${NAMESPACE} format string in a spec's format method. (#9686)
This allows installing software on a namespace basis by including ${NAMESPACE} in `install_path_scheme`. e.g.,

```
cat ~/.spack/config.yaml
config:
  install_path_scheme:
      "${ARCHITECTURE}/${NAMESPACE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}"
```
2018-10-31 20:07:07 -07:00
Satish Balay
fb849a4b7f static_to_shared_library: separate options from option values (#9690)
The 'static_to_shared_library' function takes a compiler Executable,
which is intended to be invoked with a list of arguments; the
arguments must be separated from their values in the list, given
the way that 'Executable.__call__' invokes the underlying executable.
'static_to_shared_library' was not doing this, which this commit fixes.
2018-10-31 12:49:04 -07:00
Todd Gamblin
2912cf3e17
compilers: update clang fortran compiler wrapper selection (#9678)
Clang has support for using different fortran compilers with the Clang executable.

Spack includes logic to select a compiler wrapper symlink which refers to the fortran executable (since some build systems depend on the name of the compiler, e.g. 'gfortran' or 'flang').

This selection was previously based on the architecture, and chose incorrectly in some situations (e.g. for clang/gfortran on Linux). This replaces architecture-based wrapper selection with a selection that is based on the name of the Fortran compiler executable.
2018-10-30 23:00:43 -07:00
Levi Baber
72fa122101 tests: add test for FIXME boilerplate to package_sanity (#9285)
* package_sanity: add test_no_fixme
* cleanup & better assert message
2018-10-30 13:44:25 -07:00
Todd Gamblin
b27fbfb379
config: spack config blame now colors filenames in config output (#9656)
- it was hard to distinguish all-gray filenames
- added rotating colors to `spack config blame`
2018-10-26 22:19:11 -07:00
Omar Padron
aa1c814c75 docker: unite Dockerfiles; auto-deploy images to DockerHub (#9329)
* Unite Dockerfiles - add build/run/push scripts
* update docker documentation
* update .travis.yml
* switch to using a preprocessor on Dockerfiles
* skip building docker images on pull requests
* update files with copyright info
* tweak when travis builds for docker files are done
2018-10-26 10:15:05 -07:00
Massimiliano Culpo
da537d2211
Fix autoload of direct dependencies for python (#9630)
fixes #9624

merge_config_rules was using `strict=False` to check if a spec
satisfies a constraint, which loosely translates to "this spec has
no conflict with the constraint, so I can potentially add it to the
spec". We want instead `strict=True` which means "the spec satisfies
the constraint right now".
2018-10-25 23:56:03 +02:00
Todd Gamblin
a1f90d5b8c
bugfix: use OS default permissions for mkdirp when mode is not provided (#9604)
- #8773 made the default mode 0o777, which is what's documented but
   mkdirp actually takes the OS default or umask by default

- revert to the Python default by default, and only set the mode when
  asked explicitly.
2018-10-24 11:36:41 -07:00
Javier Cervantes
02f67b5c16 Fix typo in help message (#9599) 2018-10-24 12:40:35 +02:00
Satish Balay
79e25032e8 Bug fix: Module PATH check (#9574)
#9100 added a warning message when a path extracted from a module file
did not appear to be a valid filesystem path. This check was applied
to a variable which could be a list of paths, which would erroneously
trigger the warning. This commit updates the check to run at the
actual point where the path has been extracted.
2018-10-22 18:10:49 -07:00
Todd Gamblin
ccd5a5fb7b license: exclude ignored files from the license check (#9578)
Previously, if you built the docs, you'd get license errors for
generated .rst files. This removes them from the list of licensed
files.
2018-10-22 11:13:30 -07:00
Michael Kuhn
7070d9fcd4 Allow setting language of compiler messages (#9486)
* Add a build_language config.yaml option which controls the language
  of compiler messages
* build_language defaults to "C", in which case the compiler messages
  will be in English. This allows Spack log parsing to detect and
  highlight error messages (since the regular expressions to find
  error messages are in English)
* The user can use the default language in their environment by setting
  the build_language config variable to null or ''
2018-10-18 12:55:58 -07:00
Todd Gamblin
e2e0b5df1c relicense: add spack license command
- `spack license list-files`: list all files that should have license headers
- `spack license list-lgpl`:  list files still under LGPL-2.1
- `spack license verify`:     check that license headers are correct

- Added `spack license verify` to style tests
2018-10-17 14:42:06 -07:00
Todd Gamblin
7cb5638516 relicense: add Apache2/MIT header to spack create 2018-10-17 14:42:06 -07:00
Todd Gamblin
eea786f4e8 relicense: replace LGPL headers with Apache-2.0/MIT SPDX headers
- remove the old LGPL license headers from all files in Spack
- add SPDX headers to all files
  - core and most packages are (Apache-2.0 OR MIT)
  - a very small number of remaining packages are LGPL-2.1-only
2018-10-17 14:42:06 -07:00
Mark W. Krentel
e5e8d89ad9 docs: add note about compilers with modules (#9520)
compilers.yaml can track a module that is needed for a compiler, but
Spack does not fill this in automatically. This adds a note to the
documentation informing the user how to do this.
2018-10-16 15:34:22 -07:00
Michael Kuhn
cc6e765d28 meson: explicitly add --libdir (#9504)
If we do not specify libdir explicitly, Meson chooses something like
lib/x86_64-linux-gnu, which causes problems when trying to find libraries
and pkg-config files.
2018-10-15 11:14:59 -07:00
Peter Scheibel
6977d933c8
buildcache install: generate modules (#9509)
Spack packages installed using spack buildcache were not running
post-install hooks, which create module files and manage licenses
(if necessary).

This was already occurring for Spack packages installed with
spack install --use-cache
2018-10-12 10:43:06 -07:00
Greg Becker
d1a5113cfe permissions: add permission configuration to packages.yaml (#8773)
Spack can now be configured to assign permissions to the files installed by a package.

In the `packages.yaml` file under `permissions`, the attributes `read`, `write`, and `group` control the package permissions. These attributes can be set per-package, or for all packages under `all`. If permissions are set under `all` and for a specific package, the package-specific settings take precedence.  The `read` and `write` attributes take one of `user`, `group`, and `world`.

   packages:
    all:
      permissions:
        write: group
        group: spack
    my_app:
      permissions:
        read: group
        group: my_team
2018-10-11 14:29:07 -07:00
Zack Galbreath
bc8bb9dfaf Make CDash reporting easier to use (#9357)
* Better default CLI arguments for CDash reporting

--log-format=cdash is now implied if you specify the --cdash-upload-url
option to spack install.

We also now default to writing CTest XML files to cdash_report/ when using
the CDash reporter if no --log-file argument was specified.

* Improved documentation on how to use the CDash reporter
2018-10-10 22:29:14 -07:00
Greg Becker
ca0d9ae7f0
Make builtin flag handlers available in package scope (#8668)
* Push default flag handlers into module scope

* Preserve backwards compatibility of builtin flag handler names

Ensure Spack continues to work for packages using the `Package.env_flags` idiom and equivalent.

* update docs and tests to match

* Update packages to match new syntax
2018-10-09 15:18:31 -07:00
Greg Becker
97d0dd2390
Update Spack on Cray docs for singularity platform=linux workaround (#9398) 2018-10-02 14:58:40 -07:00
Peter Scheibel
28f6a4a095
Module path parsing: CRAY_LD_LIBRARY_PATH and PACKAGE_DIR (#9374)
Fix two bugs with module file parsing:

* Detection of the CRAY_LD_LIBRARY_PATH variable was broken by #9100.
  This fixes it and adds a test for it.
* For module names like "foo-bar/1.0", the associated PACKAGE_DIR
  environment variable name would be "FOO_BAR_DIR", but Spack was not
  parsing the components and not converting "-" to "_"
2018-09-27 19:40:22 -07:00
Peter Scheibel
28c0dd9148
Increase and customize lock timeouts (#9219)
Fixes #9166

This is intended to reduce errors related to lock timeouts by making
the following changes:

* Improves error reporting when acquiring a lock fails (addressing
  #9166) - there is no longer an attempt to release the lock if an
  acquire fails
* By default locks taken on individual packages no longer have a
  timeout. This allows multiple spack instances to install overlapping
  dependency DAGs. For debugging purposes, a timeout can be added by
  setting 'package_lock_timeout' in config.yaml
* Reduces the polling frequency when trying to acquire a lock, to
  reduce impact in the case where NFS is overtaxed. A simple
  adaptive strategy is implemented, which starts with a polling
  interval of .1 seconds and quickly increases to .5 seconds
  (originally it would poll up to 10^5 times per second).
  A test is added to check the polling interval generation logic.
* The timeout for Spack's whole-database lock (e.g. for managing
  information about installed packages) is increased from 60s to
  120s
* Users can configure the whole-database lock timeout using the
  'db_lock_timout' setting in config.yaml

Generally, Spack locks (those created using spack.llnl.util.lock.Lock)
now have no timeout by default

This does not address implementations of NFS that do not support file
locking, or detect cases where services that may be required
(nfslock/statd) aren't running.

Users may want to be able to more-aggressively release locks when
they know they are the only one using their Spack instance, and they
encounter lock errors after a crash (e.g. a remote terminal disconnect
mentioned in #8915).
2018-09-25 18:58:51 -07:00
Denis Davydov
d2bd5177da macos: add mojave (#9322) 2018-09-24 12:20:49 -07:00
scheibelp
95850a7a5e
report error if failed process captures stderr (#9293)
When a Spack Executable was configured to capture stderr and the
process failed, the error messages of the process were discarded.
This made it difficult to understand why the process failed. The
exception is now updated to include the stderr of the process when
the Executable captures stderr.
2018-09-19 17:29:15 -07:00
Adam J. Stewart
133dd7a4ac Fix version parsing for cistem package (#9260)
Adds 'code' to the list of suffixes that are excluded from version
parsing of URLs, such that if a URL contains the string
'cistem-1.0.0-beta-source-code', a version X will substitute in to
produce a URL with cistem-X-source-code ('source' was already excluded).
The 'cistem' package version is updated to make use of this (and fix
a fetching bug with the cistem package). A unit test is added to check
this parsing case.
2018-09-18 19:29:18 -07:00
scheibelp
22fbb3dba7
Bug fix: module file path parsing (#9100)
Improve Spack's parsing of module show to eliminate some false
positives (e.g. accepting MODULEPATH when it is in fact looking for
PATH). This makes the following changes:

* Updates the pattern searching for several paths to avoid the case
  where they are prefixes of unwanted paths
* Adds a warning message when an extracted path doesn't exist (which
  may help catch future module parsing bugs faster)
* Adds a test with the content mentioned in #9083
2018-09-12 18:15:31 -07:00
Michael Kuhn
add0c8fe11 test: Make flag_handlers tests use mock repo (#9132)
Without this change, openssl's new perl dependency makes the tests fail.
2018-09-06 18:41:26 +02:00
becker33
f6fff8f343 Spack environment updates take precedence (#9107)
Spack originally handled environment modifications in the following
order:

 1. clear environment variables
    (unless Spack was invoked with --dirty)
 2. apply spack-specific environment variable updates,
    including variables set by Spack core like CC/PKG_CONFIG_PATH
	and those set by installed dependencies (e.g. in
	setup_dependent_environment)
 3. load all external/compiler modules

1 and 2 were done together. This splits 1 into its own function and
imposes the following order for environment modifications:

 1. clear environment variables
 2. load all external/compiler modules
 3. apply spack-specific environment variable updates

As a result, prepend-path actions taken by Spack (or installed Spack
dependencies) take precedence over prepend-path actions from compiler
and external modules. Additionally, when Spack (or a package
dependency) sets/unsets an environment variable, that will override
the actions of external/compiler modules.
2018-09-05 17:28:39 -07:00
Sergey Kosukhin
f9617b2ad8 Extended set of environment modification commands. (#8996) 2018-09-05 10:56:45 -07:00
Chris Green
dd27662b40 Enable testing in parallel when using CMake. (#8484)
* Add 'extra_env' argument to Executable.__call__: this will be added
  to the environment but does not affect whether the current
  environment is reused. If 'env' is not set, then the current
  environment is copied and the variables from 'extra_env' are added
  to it.
* MakeExecutable can take a 'jobs_env' parameter that specifies the
  name of an environment variable used to set the level of parallelism.
  This is added to 'extra_env' (so does not affect whether the current
  environment is reused).
* CMake-based Spack packages set 'jobs_env' when executing the 'test'
  target for make and ninja (which does not use -j)
2018-09-04 11:37:19 -07:00
Adam J. Stewart
0ca69fef42 Better warning message when fetching non-existent URL 2018-09-03 20:42:01 -07:00
Michael Sternberg
d95fdc8441 Update instructions to initialize Spack-global license files (#8991)
* Suggest adding contents before the explanatory comment to avoid
  issue #6534
* Mention that the license file may not need to be edited
2018-08-29 22:04:14 -07:00
Michael Sternberg
a86f22d755 Intel prefixes (#7469)
Consolidate prefix calculation logic for intel packages into the
IntelPackage class.

Add documentation on installing Intel packages with Spack an
(alternatively) adding them as external packages in Spack.
2018-08-29 21:09:34 -07:00
Andreas Baumbach
5aded248a5 spack view suggests -I option for merge conflict (#9035) 2018-08-29 13:10:55 -04:00
Andreas Baumbach
7d61ef5078 import spack load error message (#9088)
It now additionally prints spec hash and options
2018-08-27 21:26:24 -04:00
Massimiliano Culpo
6f5a68a58d Moved functions returning default scopes to spack.config
The functions returning the default scope to be modified or listed
have been moved from spack.cmd to spack.config.

Lmod now writes the guessed core compiler in the default modify scope
instead of the 'site' scope.
2018-08-27 14:49:50 -07:00
Massimiliano Culpo
8ecf5ae2ee Spack can guess lmod core compilers, if none is already present
closes #8916

Currently Spack ends with an error if asked to write lmod modules files
and the 'core_compilers' entry is not found in `modules.yaml`. After
this PR an attempt will be made to guess that entry and the site
configuration file will be updated accordingly.

This is similar to what Spack already does to guess compilers on first
run.
2018-08-27 14:49:50 -07:00
Adam J. Stewart
cc01e89d6b
Update to latest version of pytest and dependencies (#9087)
* Update to latest version of pytest and dependencies

* Fix bug in installation tests
2018-08-25 14:12:46 -05:00
Todd Gamblin
3c292de6bd bugfix: 'submodules' attribute should imply git fetch
- 'submodules' wasn't properly declared as an optional attribute for git
  fetcher

- add it and add a test.
2018-08-25 10:20:39 -07:00
Todd Gamblin
3f0e6d04e0 commands: add spack url stats command
This command prints out stats about all package versions, like so:

$ spack url stats
==> 6070 total versions for 2827 packages:
------------------------------------
url                    5411    89.1%
  schemes
    https              3822    70.6%
    http               1527    28.2%
    ftp                  27     0.5%
    file                 35     0.6%
  checksums
    sha512                6     0.1%
    sha256              163     3.0%
    sha1                 81     1.5%
    md5                5161    95.4%
------------------------------------
svn                       3     0.0%
------------------------------------
hg                        5     0.1%
------------------------------------
go                        1     0.0%
------------------------------------
git                     650    10.7%
  security
    no commit           384    59.1%
    commit              266    40.9%
------------------------------------
2018-08-25 10:20:39 -07:00
Todd Gamblin
82820efe37 Remove Python 3.3 from testing.
- Support for Python 3.3 isn't really needed, as nothing uses it as the
  default system Python, and nearly everyone will have a newer Python 3
  version installed.
2018-08-24 16:22:37 -07:00
Adam J. Stewart
5e8a9ddaed More consistent colored messages from activate/deactivate (#9036)
* More consistent colored messages from activate/deactivate

* Make 'activating' the default, make 'activated' the debug
2018-08-22 22:09:51 -07:00
Massimiliano Culpo
85f84aabed Added a new target message to comply with newer versions of GNU Make (#9068)
#fixes 9067

Unit tests were failing on a system with GNU Make v 4.1
2018-08-22 09:32:25 -05:00
Todd Gamblin
c0855d9bd5 tests: add tests for warnings in build output
- add tests for build warnings and error messages
- simplify some code in build environment with plural() function
2018-08-21 21:21:53 -07:00
Adam J. Stewart
0b0887f48f Display warnings if no errors are found in build log 2018-08-21 21:21:53 -07:00
Adam J. Stewart
f97550e149 Fix error caused by missing spack-build.out build log 2018-08-21 14:16:50 -07:00
Todd Gamblin
63004e3de1 yaml: use ruamel.yaml instead of pyyaml
- ruamel.yaml allows round-tripping comments from/to files
- ruamel.yaml is single-source, python2/python3 compatible
2018-08-20 16:36:04 -07:00
Adam J. Stewart
2e8a820afd Even better Makefile target parsing (#8819)
#8223 replaced regex-based makefile target parsing with an invocation of
"make -q". #8818 discovered that "make -q" can result in an error for some
packages.

Also, the "make -q" strategy relied on interpreting the error code, which only
worked for GNU Make and not BSD Make (which was deemed acceptable at
the time). As an added bonus, this implementation ignores the exit code and
instead parses STDERR for any indications that the target does not exist; this
works for both GNU Make and BSD Make.

#8223 also updated ninja target detection to use "ninja -t targets". This does
not change that behavior but makes it more-explicit with "ninja -t targets all"

This also adds tests for detection of "make" and "ninja" targets.
2018-08-20 17:42:28 -04:00
scheibelp
638cc64571
install_tree: symlink handling and add 'ignore' option (#9019)
Fixes #9001

#8289 added support for install_tree and copy_tree to merge into an existing
directory structure. However, it did not properly handle relative symlinks and
also removed support for the 'ignore' keyword. Additionally, some of the tests
were overly-strict when checking the permissions on the copied files.

This updates the install_tree/copy_tree methods and their tests:

* copy_tree/install_tree now preserve relative link targets (if the symlink in the
  source directory structure is relative, the symlink created in the destination
  will be relative)
* Added support for 'ignore' argument back to copy_tree/install_tree (removed
  in #8289). It is no longer the object output by shutil.ignore_patterns: you pass a
  function that accepts a path relative to the source and returns whether that
  path should be copied.
* The openfoam packages (currently the only ones making use of the 'ignore'
  argument) are updated for the new API
* When a symlink target is absolute, copy_tree and install_tree now rewrite the
  source prefix to be the destination prefix
* copy_tree tests no longer check permissions: copy_tree doesn't enforce
  anything about permissions so its tests don't check for that
* install_tree tests no longer check for exact permission matching since it can add
  file permissions
2018-08-17 22:08:38 -04:00
Todd Gamblin
39c9bbfbbb imports: spack uses importlib instead of imp when available
- `imp` is deprecated and seems to have started having some weird
  issues on certain Linux versions.
  - In particular, the file argument to `load_source` is ignored on
    arch linux with Python 3.7.

- `imp` is the only way to do imports in 2.6, so we'll keep it around for
  now and use it if importlib won't work.

- `importlib` is the new import system, and it allows us to get
  lower-level access to the import implementation.

- This consolidates all import logic into `spack.util.imp`, and make it
  use `importlib` if it's avialable.
2018-08-16 16:00:44 -07:00
Adam J. Stewart
ac6d929897 Fix spack versions behavior when no URL (#8967)
* Fix spack versions behavior when no URL
* Unit test packages without URLs or safe versions
2018-08-16 08:42:23 -07:00
Adam J. Stewart
73c978ddd9 install_tree, copy_tree can install into existing directory structures (#8289)
Replace use of `shutil.copytree` with `copy_tree` and `install_tree` functions in `llnl.util.filesystem`.

- `copy_tree` copies without setting permissions.  It should be used to copy files around in the build directory.
- `install_tree` copies files and sets permissions.  It should be used to copy files into the installation directory.
- `install` and `copy` are analogous single-file functions.
- add more extensive tests for these functions
- update packages to use these functions.
2018-08-15 09:30:09 -07:00
Todd Gamblin
62026ce302 tests: make the dependency patching test more complete
- dependency patching test didn't attempt to apply patches; just to see
  whether they were on the spec.

- it applies the patch now and verifies that that patch was applied.
2018-08-14 14:33:50 -07:00
Tom Merrick
b1182741d4 Branch with the meson build-system (#8467)
* Branch with the meson build-system

* Fix build_environment for dual loads and add create code

* Add documentation

* Fixed option list

* Update build_system_guess for meson

* Fixed documentation errors

* Added meson to build and configure and updated documentation

* fix typos
2018-08-10 12:52:09 -05:00
Scott Wittenburg
2278c65d0a spec: make full_hash look like dag_hash (#8911) 2018-08-09 09:00:49 -07:00
Todd Gamblin
ed79d6a11b bugfix: cc handles spaces in flag variables properly
- cc cleanup caused a parsing regression in flag handling

- We added proper quoting to array expansions, but flag variables were
  never actually converted to arrays. Old code relied on this.

This commit:
- Adds reads to convert flags to arrays.
- Makes the cc test check for improper space handling to prevent future
  regressions.
2018-08-09 08:00:22 -07:00
Todd Gamblin
bb5d83890d cc: refactor flag adding so that it's not in reverse order
- flags were prepended in reverse order to args, but this makes it hard
  to see what order they'll be in on the final command line.

- add them in the order they'll appear to make cc easier to maintain.

- simplify code for assembling the command line

- fix separator used in SPACK_SYSTEM_DIRS test
2018-08-08 01:51:51 -07:00
Todd Gamblin
4210f839e2 cc: restore ccache support in the wrapper, add a regression test
- Add back ccache support to the wrapper.
- Add a regression test to make sure ccache is working properly.
2018-08-08 01:51:51 -07:00
Todd Gamblin
62089d43ef cc: run shellcheck linter on the cc compiler script, minor cleanup
- This corrects most of the issues found by shellcheck

- This also uses ':' as the delimiter for SPACK_SYSTEM_DIRS, for
  consistency with other variables.
2018-08-08 01:51:51 -07:00
Todd Gamblin
b84067f6db cc: don't use sed to filter system directories
- filtering using sed causes most builds to slow down quite a bit, as the
  compiler wrapper has to run sed many times, and *it* runs many times

- do the system directory parsing directly in bash
2018-08-08 01:51:51 -07:00
Todd Gamblin
0e81f6cba5 refactor: clean up and fix the cc test
- Add tests to ensure that RPATHs are not added in cc mode, which can
  cause some builds to fail.

- Change cc.py to use pytest style

- Instead of writing out all the flags, break the flags down into
  variables so that it's easy to read what each test is supposed to
  check. This should make cc.py more maintainable in the future.
2018-08-08 01:51:51 -07:00
Todd Gamblin
c8fb9b5479 bugfix: cc should not add -L or -Wl,-rpath in compile-only mode
- Adding -L and -Wl,-rpath to compile-only command lines ("cc mode" or
  "-c") causes clang (if not also other compilers) to emit warnings that
  confuse configure systems.

- Clang will print warnings about unused command-line arguments.

- This fix ensures that -L and -Wl,-rpath are not added if the compile
  line is just building an object file with -c

- This also cleans up the cc script in several places.
2018-08-08 01:51:51 -07:00
Gregory Becker
683c7fbf3b Restore cc: package search paths come before dependency paths (#4692)
Spack currently prepends include paths, library paths, and rpaths to the
compile line.  This causes problems when a header or library in the package
has the same name as one exported by one of its dependencies.  The
*dependency's* header will be preferred over the package's, which is not
what most builds expect.  This also breaks some of our production codes.

This restores the original cc behavior (from *very* early Spack) of parsing
compiler arguments out by type (`-L`, `-I`, `-Wl,-rpath`) and reconstituting
the full command at the end.

`<includes> <other_args> <library dirs> <rpaths>`

This differs from the original behavior in one significant way, though: it
*appends* the library arguments so that dependency libraries do not shadow
those in the build.

This is safe because semantics aren't affected by *interleaving* `-I`, `-L`,
and `-Wl,-rpath` arguments with others, only with each other (so the order of
two `-L` args affects the search path, but we search for all libraries on the
command line using the same search path).

We preserve the following:
1. Any system directory in the paths will be listed last.
2. The root package's include/library/RPATH flags come before flags of the
   same type for any dependency.
3. Order will be preserved within flags passed by the build (except system
   paths, which are moved to be last)
4. Flags for dependencies will appear between the root flags and the system
   flags, and the flags for any dependency will come before those for *its*
   dependencies (this is for completeness -- we already guarantee this in
   `build_environment.py`)
2018-08-08 01:51:51 -07:00
cedricchevalier19
3301e21f06 Fix performance issue when compiling. (#8828)
* Fix performance issue when compiling.

Spack was doing active wait when compiling, spoiling one core.
My fix consists in not setting any timeout for select, instead of
the previous 0 second.

* Fix comments about select.select timeout
2018-08-07 09:13:07 -07:00
Paul Chelarescu
6ef2eb8f7e libstdc++ detection uses os.path.realpath instead of os.readlink (#8865) 2018-08-06 22:30:29 -07:00
Adam J. Stewart
5f10d9239b Remove default variant bug from list of known issues (#8900) 2018-08-06 16:56:45 -04:00
George Hartzell
4e985051c0 Docstring typo: builing -> building (#8896) 2018-08-06 13:36:57 -04:00
Todd Gamblin
5cc2309330 revert cd9691de5 (#4692) while we work on a fix. 2018-08-04 20:31:55 -07:00
Todd Gamblin
b5071312c4 spack spec: no extra newline with --yaml; error with no specs
- `spack spec` now returns an error if given no specs

- removed superfluous trailing newline from `spack spec --yaml` output
  (only one newline now)
2018-08-03 15:18:34 -05:00
Adam J. Stewart
4f76e80925 Add spack arch --operating-system and --target flags 2018-08-03 11:32:08 -05:00
Todd Gamblin
43c77ac3cb libdwarf: remove use of hide_files()
- This was a nasty workaround due to the way our compiler wrappers used
  to work.  We don't want to have to modify our elfutils installation to
  install libdwarf.

- Since cd9691de5, we no longer need this because the package will always
  come before dependencies in our include order.
2018-08-02 19:00:52 -07:00
becker33
cd9691de53 cc: package search paths come before dependency paths (#4692)
Spack currently prepends include paths, library paths, and rpaths to the compile line.  This causes problems when a header or library in the package has the same name as one exported by one of its dependencies.  The *dependency's* header will be preferred over the package's, which is not what most builds expect.  This also breaks some of our production codes.

This restores the original cc behavior (from *very* early Spack) of parsing compiler arguments out by type (`-L`, `-I`, `-Wl,-rpath`) and reconstituting the full command at the end.

`<includes> <other_args> <library dirs> <rpaths>`

This differs from the original behavior in one significant way, though: it *appends* the library arguments so that dependency libraries do not shadow those in the build. 

This is safe because semantics aren't affected by *interleaving* `-I`, `-L`, and `-Wl,-rpath` arguments with others, only with each other (so the order fo two `-L` args affects the search path, but we search for all libraries on the command line using the same search path).

We preserve the following:
1. Any system directory in the paths will be listed last.
2. The root package's include/library/RPATH flags come before flags of the same type for any dependency.
3. Order will be preserved within flags passed by the build (except system paths, which are moved to be last)
4. Flags for dependencies will appear between the root flags and the system flags, and the flags for any dependency will come before those for *its* dependencies (this is for completeness -- we already guarantee this in `build_environment.py`)
2018-08-01 15:48:00 -07:00
Holly
38062a8abc docs: minor text changes (#8858) 2018-08-01 13:59:51 -07:00
Stephen Herbein
de60e9d582 lmod: fix use of custom separator in prepend_path etc. (#8737)
fixes #8736
2018-08-01 12:58:54 +02:00
Stephen Herbein
cdbc545793 docs: update spack view argument synatx (#8839)
The `--dependencies` and `--exclude` flags are now arguments to the `spack view`
comand rather than the `spack view symlink` command.
2018-07-31 10:41:41 -07:00
Todd Gamblin
2c45c3c5b3
spec: Spec.tree() merges deptypes when only covering nodes (#8821)
- previously, output could be confusing when deptypes were only shown for
  one dependent when a node had *multiple* dependents

- also fix default coverage of `Spec.tree()`: it previously defaulted to
  cover only build and link dependencies, but this is a holdover from
  when those were the only types.
2018-07-29 11:54:20 -07:00
Massimiliano Culpo
1fd9574353 Fixed a typo in the docs (the docker image to pull was wrong) (#8814) 2018-07-27 09:56:01 -05:00
Adam J. Stewart
7902f3eb49 Add docs on new top-level VCS attributes 2018-07-25 23:10:10 -07:00
Todd Gamblin
5f00056490 tests: convert mirror test to pytest with free functions. 2018-07-25 23:10:10 -07:00
Todd Gamblin
020c34e136 tests: add checks and tests for consistent version() arguments
- Previously, Spack didn't check the arguments you put in version()
  directives.

- So, you could do something like this, where there are arguments for a
  URL fetcher AND for a git fetcher:

  version('1.0', md5='abc123', git='https://foo.bar', commit='feda2343')

- Now, we check the arguments before constructing a fetcher, to ensure
  that each package has *only* arguments for a single type of fetcher.

- Also added `test_package_version_consistency()` to the `package_sanity`
  test, so that all builtin packages are required to have valid
  `version()` directives.
2018-07-25 23:10:10 -07:00
Todd Gamblin
6f7eaecfa0 tests: correct name of check_db to check_repo
- this test is checking the package *repository*, not the database.
2018-07-25 23:10:10 -07:00
Todd Gamblin
773cfe088f core: differentiate package-level fetch URLs by args to version()
- packagers can specify two top-level fetch URLs if one is `url`
  - e.g., `url` and `git` or `url` and `svn`

- allow only one VCS fetcher so we can differentiate between URL and VCS.

- also clean up fetcher logic and class structure
2018-07-25 23:10:10 -07:00
Todd Gamblin
04aec9d6f8 core: add check for conflicting top-level fetch attributes in packages
- ensure that packages can't have more than one of git, hg, svn, or url
2018-07-25 23:10:10 -07:00
Todd Gamblin
6837da2ad7 style: clean up exception definitions in package.py 2018-07-25 23:10:10 -07:00
Todd Gamblin
498d8cf04b core: fixes and tests for handling of fetcher attributes in packages
- Packages can remove the top-level `url` attribute and still work

- These are now legal:
  - Packages with *only* version-specific URLs (even with gaps)

  - Packages with a top-level git/hg/svn attribute and `version`
    directives for that.

- If a package has both a top-level hg/git/svn attribute AND a top-level
  url attribute, the url attribute takes precedence.
2018-07-25 23:10:10 -07:00
Adam J. Stewart
5792a805fc core: quick fix for packages without URLs
Some packages do not have a `url` and are instead downloaded via `git`,
`hg`, or `svn`. Some packages like `spectrum-mpi` cannot be downloaded at
all, and are placeholder packages for system installations. Previously,
`__init__()` in `PackageBase` crashed if a package did not have a `url`
attribute defined.

I hacked this section of code out, but I have no idea what the
repercussions of that are.
2018-07-25 23:10:10 -07:00
Adam J. Stewart
13c52066a5 Fix order of regexes reported by spack url summary 2018-07-24 21:02:28 -07:00
Todd Gamblin
656e935e50 core: make spack.util.crypto initialization less expensive.
- This hard-codes the hash lengths rather than computing them on import.

- Also cleans up the code in `spack.util.crypto` to make it easier to
  understand.
2018-07-24 18:35:02 -07:00
Todd Gamblin
674eb00e53
bugfix: spack module -m error message (#8794)
Fix this output error:

```
$ spack -m module loads mpileaks
==> Error: `spack module loads -m t -m c -m l ...` has been moved. Try this instead:

    $ spack module t loads mpileaks
    $ spack module c loads mpileaks
    $ spack module l loads mpileaks
```
2018-07-24 16:12:47 -07:00
Massimiliano Culpo
6bb2256043 Die with a meaningful error if a deprecated command is used
In case a deprecated form of the module command is used, the program
will exit non-zero and print an informative error message suggesting
which command should be used instead.
2018-07-24 11:27:17 -07:00
Massimiliano Culpo
35cef16974 Grouped all the module commands under spack module
As requested in the review all the commands meant to manage module
files have been grouped under the `spack module` command.

Unit tests have been refactored to match the new command structure.
2018-07-24 11:27:17 -07:00
Massimiliano Culpo
7cbe1aedb7 module file tutorial: rebuilt docker image and updated the script 2018-07-24 11:27:17 -07:00
Massimiliano Culpo
576f0c98d2 Added --dependencies to the help text of spack load
fixes #6321
2018-07-24 11:27:17 -07:00
Massimiliano Culpo
443d702971 spack load exits with 1 if module does not exist or is not installed
fixes #2215
fixes #2570
fixes #6676
fixes #7281
closes #3827

This PR reverts the use of `spack module loads` in favor of
`spack module find` when loading module files via Spack. After this PR
`spack load` will accept a single spec at a time, and will be able
to interpret correctly the `--dependencies` option.
2018-07-24 11:27:17 -07:00
Massimiliano Culpo
7a49ba56b6 Added blacklisting of implicit modules in docs + regression tests
fixes #4400

The feature requested in #4400 was already part of the module file
configuration, but it was neither tested nor documented. This
commit takes care of adding a few lines in the documentation and a
regression test.
2018-07-24 11:27:17 -07:00
Massimiliano Culpo
ff83003eaf Renamed 'patch_configuration' fixture to 'module_configuration'
This just because the fixture has been moved one level above the one
it was originally defined. In this more general context there's more
than one configuration file that could be patched for tests.
2018-07-24 11:27:17 -07:00
Massimiliano Culpo
008f171a7e Added a unit test for 'spack lmod setdefault' 2018-07-24 11:27:17 -07:00
Massimiliano Culpo
e81c0c3e2c Updated references to spack module in the documentation. 2018-07-24 11:27:17 -07:00
Massimiliano Culpo
6ab57571c2 Added 'setdefault' subcommand to 'spack lmod'
Added a subcommand that sets the default module to be loaded, if
multiple installations of the same package are present.
2018-07-24 11:27:17 -07:00
Massimiliano Culpo
0457c1fbee Split 'spack module' into multiple commands
'spack module' has been split into multiple commands, each one tied to a
specific module type. This permits the specialization of the new
commands with features that are module type specific (e.g. set the
default module file in lmod when multiple versions of the same package
are installed at the same time).
2018-07-24 11:27:17 -07:00
Todd Gamblin
fdcaf5c4c8 bugfix: fix spack spec --yaml
- repo membership test was broken by the refactor of spack/__init__.py

- refactor singleton so that 'spec in repo' works again for `spack.repo.path`

- fix spec command and add basic tests for `spack spec` and `spack spec --yaml`
2018-07-24 11:25:34 -07:00
Todd Gamblin
d4c4effb5e docs: update old docs for spack.package.PackageBase
- There was a lot of documentation in `PackageBase` dating back to the
  very first versions of Spack.

- It was repetitive and out of date, and the docs at spack.readthedocs.io
  are better.

- Remove the outdated specifics, and leave the minimal useful set of
  developer docs in `package.py`.
2018-07-23 11:57:52 -07:00
Todd Gamblin
bd3ffc7b76 core: use sha256 instead of md5 for spack checksum and spack create
- This changes `get_checksums_for_versions` to generate code that uses an
  explicit `sha256` argument instead if the bare `md5` hash we used to
  generate.

- also use a generic digest parameter for the `version` directive, rather
  than a specific `md5` parameter.
2018-07-23 11:57:52 -07:00
Todd Gamblin
a1d6909864 bugfix: stage test no longer modifies ~/.spack/config.yaml
- two stage tests weren't properly using the mutable_config fixture.
- this caused running `spack test` to modify the user's config.yaml
2018-07-21 17:12:36 -07:00
Todd Gamblin
b2f3b07ec0 docs: doucment spack config blame 2018-07-21 14:04:18 -07:00
Todd Gamblin
331da779f8 docs: updates to spack config get docs for command-line scopes 2018-07-21 14:04:18 -07:00
Elizabeth Fischer
46f87cb9f2 docs: command-line scopes
Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2018-07-21 14:04:18 -07:00
Elizabeth Fischer
52fbbdf5a1 config: allow user to add configuration scopes on the command line.
- Add command-line scope option to Spack

- Rework structure of main to allow configuration system to raise
  errors more naturally

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2018-07-21 14:04:18 -07:00
Todd Gamblin
2b0d944341 locks: fix bug when creating lockfiles in the current directory.
- Fixes a bug in `llnl.util.lock`

- Locks in the current directory would fail because the parent directory
  was the empty string.

- Fix this and return '.' for the parent of locks in the current
  directory.
2018-07-21 10:39:47 -07:00
Todd Gamblin
20e4038a72 style: make core comply with pep8-naming 2018-07-19 00:41:36 -07:00
Todd Gamblin
264761ccb8 add py-pep8-naming package 2018-07-19 00:41:36 -07:00
Adam J. Stewart
a67139f6c5 Better Makefile target detection (#8223)
Replace regex-based target detection for Makefiles with a preliminary "make -q"
to check if a target exists. This does not work for NetBSD make; additional work
is required to detect if NetBSD make is present and to use a regex in that case.
The affected makefile target checks are only performed when the "--test" flag is
added to a "spack install" invocation.
2018-07-18 11:11:10 -07:00
Massimiliano Culpo
33aa06e1cf shell: fixed a typo in spack --print-shell-vars (#8732) 2018-07-17 17:03:45 -07:00
Massimiliano Culpo
373b3d2444 Packages must be added to DB to be considered installed (#8038)
Fixes #8036

Before this PR Package.installed was returning True if the spec prefix
existed, without checking the DB. This is wrong for external packages,
whose prefix exists before being registered into the DB. Now the property
checks for both the prefix and a DB entry.
2018-07-17 11:43:30 -07:00
Adam J. Stewart
8ce62ba513 Add documentation on build systems (#5015)
Spack provides a number of classes based on commonly-used build systems
that users can extend when writing packages; the classes provide functionality
to perform the actions relevant to the build system (e.g. running "configure" for
an Autotools-based package). This adds documentation for classes supporting the
following build systems:

* Makefile
* Autotools
* CMake
* QMake
* SCons
* Waf

This includes build systems for managing extensions of the following packages:

* Perl
* Python
* R
* Octave

This also adds documentation on implementing packages that use a custom build
system (e.g. Perl/CMake).

Spack also provides extendable classes which aggregate functionality for related
sets of packages, e.g. those using CUDA. Documentation is added for
CudaPackage.
2018-07-17 11:28:38 -07:00
Todd Gamblin
06418a3dcd
add spack --print-shell-vars to speed up setup-env.[c]sh (#8101)
- The setup-env.sh script currently makes two calls to spack, but it
  should only need to make one.

- Add a fast-path shell setup routine in `main.py` to allow the shell
  setup to happen in a single, fast call that doesn't load more than it
  needs to.

- This simplifies setup code, as it has to eval what Spack prints

- TODO: consider eventually making the whole setup script the output of a
  spack command
2018-07-16 15:43:44 -07:00
Andreas Baumbach
79b407f59e clean up of spack clean (#8610)
* update help of `clean --all` to include `-p`
* remove old orphaned `.pyc` removal
* restrict removal or orphaned pyc files to `lib/spack` and `var/spack`
2018-07-14 17:20:49 -07:00
Todd Gamblin
650786c812 locks: improve errors and permission checking
- Clean up error messages for when a lock can't be created, or when an
  exclusive (write) lock can't be taken on a file.

- Add a number of subclasses of LockError to distinguish timeouts from
  permission issues.

- Add an explicit check to prevent the user from taking a write lock on a
  read-only file.
  - We had a check for this for when we try to *upgrade* a lock on an RO
    file, but not for an initial write lock attempt.

- Add more tests for different lock permission scenarios.
2018-07-12 19:59:53 +02:00
Todd Gamblin
ab794fa741 locks: llnl.util.lock now only writes host info when in debug mode
- write locks previously wrote information about the lock holder (host
  and pid), and read locks woudl read this in.

- This is really only for debugging, so only enable it then

- add some tests that target debug info, and improve multiproc lock test
  output
2018-07-12 19:59:53 +02:00
Todd Gamblin
b9af52a888 tests: Separate tests for llnl.util.lock and spack.util.lock
- llnl.util.lock tests are now independent of Spack
2018-07-12 19:59:53 +02:00
Todd Gamblin
7626ec4579 refactor: move spack.util.multiproc to llnl.util.multiproc
- multiproc doesn't depend on Spack
- llnl.util.lock test uses it, but shouldn't use parts of Spack.
2018-07-12 19:59:53 +02:00
Massimiliano Culpo
e3a556cd2a Don't propagate version-specific URL overrides to newer versions (#8565)
When a user specifies a URL for a specific version of a package, Spack originally
would use that URL for all newer versions of the package. This behavior has
proven to be generally more harmful than useful, so this PR removes the feature
such that a version-specific URL override affects only that version.
2018-07-11 13:12:19 -07:00
Matthias Diener
90042749e8 fetch: remove 'trying' when cloning repos (#8651)
* fetch: remove 'trying' when cloning repos

This makes it similar to what the URL strategy prints.

* change svn/hg names
2018-07-10 10:22:51 -05:00
Christoph Junghans
8bc3f7d726 Add ccache support (#3761)
If the user sets "ccache: true" in spack's config.yaml, Spack will use an available
ccache executable when compiling c/c++ code. This feature is disabled by default
(i.e. "ccache: false") and the documentation is updated with how to enable
ccache support
2018-07-09 14:06:10 -07:00
Andreas Baumbach
21a46fb2ce fix typo in help of spack clone prefix is singular (#8658)
Change-Id: I3bfe5b4ba497fae57d5382502ea9a1b054688fdb
2018-07-08 20:28:46 +02:00
George Hartzell
7f814971a5 Clear up a bit of modules/dotkit confusion (#8650)
`use` is an overloaded word between dotkit, modules and spack.  Add additional words to make the distinction clear in the docs.
2018-07-06 12:06:53 -05:00
Paul Chelarescu
719f324423 Removed duplicate word (#8609) 2018-06-29 07:44:23 -05:00
scheibelp
3560f6dbe9 views: packages can customize how they're added to views (#7152)
Functional updates:

- `python` now creates a copy of the `python` binaries when it is added
  to a view

- Python extensions (packages which subclass `PythonPackage`) rewrite
  their shebang lines to refer to python in the view

- Python packages in the same namespace will not generate conflicts if
  both have `...lib/site-packages/namespace-example/__init__.py`

  - These `__init__` files will also remain when removing any package in
    the namespace until the last package in the namespace is removed


Generally (Updated 2/16):

- Any package can define `add_files_to_view` to customize how it is added
  to a view (and at the moment custom definitions are included for
  `python` and `PythonPackage`)

  - Likewise any package can define `remove_files_from_view` to customize
    which files are removed (e.g. you don't always want to remove the
    namespace `__init__`)

- Any package can define `view_file_conflicts` to customize what it
  considers a merge conflict

- Global activations are handled like views (where the view root is the
  spec prefix of the extendee)

  - Benefit: filesystem-management aspects of activating extensions are
    now placed in views (e.g. now one can hardlink a global activation)

  - Benefit: overriding `Package.activate` is more straightforward (see
    `Python.activate`)

  - Complication: extension packages which have special-purpose logic
    *only* when activated outside of the extendee prefix must check for
    this in their `add_files_to_view` method (see `PythonPackage`)

- `LinkTree` is refactored to have separate methods for copying a
  directory structure and for copying files (since it was found that
  generally packages may want to alter how files are copied but still
  wanted to copy directories in the same way)


TODOs (updated 2/20):

- [x] additional testing (there is some unit testing added at this point
  but more would be useful)

- [x] refactor or reorganize `LinkTree` methods: currently there is a
  separate set of methods for replicating just the directory structure
  without the files, and a set for replicating everything

- [x] Right now external views (i.e. those not used for global
  activations) call `view.add_extension`, but global activations do not
  to avoid some extra work that goes into maintaining external views. I'm
  not sure if addressing that needs to be done here but I'd like to
  clarify it in the comments (UPDATE: for now I have added a TODO and in
  my opinion this can be merged now and the refactor handled later)

- [x] Several method descriptions (e.g. for `Package.activate`) are out
  of date and reference a distinction between global activations and
  views, they need to be updated

- [x] Update aspell package activations
2018-06-26 16:14:05 -07:00
Todd Gamblin
a48bdfaf1d bugfix: fix macos incompatibility in lock test (#8573)
- Spack was assuming that a group with gid == current uid would always exist.
- This was breaking the travis build for macos.

- also fix issue with the DB tarball test finding coverage filesx
2018-06-26 14:51:02 +02:00
Todd Gamblin
e5a6832760 refactor: move pytest.ini and top-level conftest.py to lib/spack/spack/test
- removes two files from root of repository
- `spack test` still works fine to run tests
2018-06-25 23:02:06 -07:00
Todd Gamblin
c4c1d37fcd refactor: move templates from root to share/spack
- This complies with the unix directory hierarchy standard (which Spack
  attempts to follow)
- Also unclutters the repo root directory.
2018-06-24 16:38:36 -07:00
Todd Gamblin
15910debb2 tests: test file/line attribution in config errors 2018-06-24 14:21:52 -07:00
Todd Gamblin
970b558f7f tests: add a test for spack debug command 2018-06-24 14:21:52 -07:00
Todd Gamblin
175de19f2d tests: test html output for spack list
- make list test use SpackCommand
- convert to pytest
- add a test for HTML output
2018-06-24 14:21:52 -07:00
Todd Gamblin
f476e60c01 Add spack -H shortcut for spack help --all
- I keep typing this based on `spack test -h` and `spack test -H`
- This finally makes my fingers happy
2018-06-24 10:19:07 -07:00
Michael Kuhn
c2d56b0b10 Fix version detection for gcc@8 (#8511) 2018-06-22 18:03:43 -05:00
Todd Gamblin
398afa460a pytest: add _pytest/_version.py and LICENSE
- pytest was not reporing the correct version from pytest.__version__.
  It reported 'unknown'

- this fixes issues on some systems where system-installed pytest plugins
  would try to use the version and convert it to an int
2018-06-20 14:35:10 -05:00
Todd Gamblin
137456fbf3 externals: move spack.util.ordereddict to external/ordereddict_backport 2018-06-20 14:35:10 -05:00
Adam J. Stewart
55d0d1814c Allow docs to be built with Sphinx 1.7.1+ (#8500)
* Allow docs to be built with Sphinx 1.7.1+

* Allow docs to be built with Sphinx 2.0+
2018-06-18 17:17:21 -07:00
George Hartzell
cb11e1b8ee There's only one 'u' in "configuration" (#8498) 2018-06-17 19:11:16 -05:00
Todd Gamblin
afe7964670
docs: remove vendored sphinx_rtd_theme (#8496) 2018-06-17 01:13:56 -07:00
Dan FitzGerald
d182d85dd1 Update the clang compiler definition to use IBM XL Fortran compiler (#8389)
on CORAL systems (linux-rhel7-ppc64le).
2018-06-14 20:51:45 -07:00
Adam J. Stewart
0f1a1ae94e Add trailing slash when spidering URLs for versions (#8429)
By default, if a package does not specify a list_url and does not download from
a common repository, Spack runs dirname on the package URL. Given a URL
like https://root.cern.ch/download/root_v6.09.02.source.tar.gz, this returns
https://root.cern.ch/download. However, https://root.cern.ch/download
gives a 404, while https://root.cern.ch/download/ works just fine.

Note that some servers *don't* work with a trailing slash, so this tries with and
without the slash. This will double the number of URLs searched but the
slowdown should only affect the "spack versions" command.
2018-06-12 10:33:47 -07:00
Chris Green
15c98fa57c compiler flags: add cxx98 standard support (#7601)
The following improvements are made to cxx standard support
(e.g. compiler.cxxNN_flag functions) in compilers:

* Add cxx98_flag property
* Add support for throwing an exception when a flag is not supported (previously
  if a flag was not supported the application was terminated with tty.die)
* The name of the flag associated with e.g. c++14 standard support changes for
  different compiler versions (e.g. c++1y vs c++14). This makes a few corrections
  on what flag to return for which version.
* Added tests to confirm that versions report expected flags for various c++
  standards (or raise an exception for versions that don't provide a given cxx
  standard)

Note that if a given cxx standard is the default, the associated flag property will
return ""; cxx98 is assumed to be the default standard so this is the behavior for
the associated property in the base compiler class.

Package changes:

* Improvements to the boost spec to take advantage of the improved standard
  flag facility.
* Update the clingo spec to catch the new exception rather than look for an
  empty flag to indicate non-support (which is not part of the compiler flag API)
2018-06-08 13:49:31 -07:00
healther
980817575a add python cache removal to spack clean (#8419)
Remove .pyc and .pyo files along with __pycache__directory if the user provides
the -p/--python-cache option to "spack clean"
2018-06-07 10:33:38 -07:00
scheibelp
c97d058ce3
Fix bug where patches specified by dependents were not applied (#8272)
Fixes #7885

#7193 added the patches_to_apply function to collect patches which are then
applied in Package.do_patch. However this only collects patches that are
associated with the Package object and does not include Spec-related patches
(which are applied by dependents, added in #5476).

Spec.patches already collects patches from the package as well as those applied
by dependents, so the Package.patches_to_apply function isn't necessary. All
uses of Package.patches_to_apply are replaced with Package.spec.patches.

This also updates Package.content_hash to require the associated spec to be
concrete: Spec.patches is only set after concretization. Before this PR, it was
possible for Package.content_hash to be valid before concretizing the associated
Spec if all patches were associated with the Package (vs. being applied by
dependents). This behavior was unreliable though so the change is unlikely to
be disruptive.
2018-06-06 18:28:25 -07:00
Massimiliano Culpo
df1e23335c Preserve Spack CC/FC/F77/CXX settings when loading modules (#8346)
Fixes #8345

Spack environment modifications are applied before modules are loaded; this
includes settings to CC, FC, F77, and CXX, which point to the Spack compiler
wrappers. If the loaded modules set CC, this overrides the Spack compiler
wrappers. This PR adds a context manager to preserve the values of CC etc. that
are set by Spack: any effects on the CC, FC, F77, and CXX variables from modules
are undone and their original values are restored.
2018-06-05 11:26:30 -07:00
Axel Huebl
add7f2b09a pybind11: test functionality (#8304)
* pybind11: test support

Add a test functionality to pybind11.

* CMake: test also on "make check"

Some projects use non-CTest manual targets for tests.
2018-06-04 09:50:02 -05:00
Adam J. Stewart
f42afc6168 Less sensitive error detection in build logs (#8278)
* Less sensitive error detection in build logs
* Fix test_log_parser unit test
2018-06-02 21:07:02 -07:00
Adam J. Stewart
d6458a6ba7 Don't duplicate Python error messages (#8270) 2018-06-02 21:04:36 -07:00
Adam J. Stewart
fec11757d5 Fix coloring of error messages containing '}' symbol (#8277) 2018-06-02 21:02:28 -07:00
Adam J. Stewart
9862c97d38 Fix package error message line numbers (#8271)
Line numbers were reported as zero-indexed, but we need to adjust.
2018-06-02 20:53:18 -07:00
Massimiliano Culpo
8d3a153331 Skip external specs when creating mirrors (#8084)
fixes #8083

External specs are supposed to be installed already, so there's no need
to try to download a tarball for them.
2018-06-01 12:27:11 -07:00
George Hartzell
5de2f1ab75 Typo: an -> and (#8350) 2018-06-01 10:56:16 -07:00
Denis Davydov
8285a1778f extend Prefix class with join() member to support dynamic directories (#8329)
* extend Prefix class with join() member to support dynamic directories

* add more tests for Prefix.join()

* more tests for Prefix.join()

* add docstring

* add example to docstring of Prefix class

* cleanup Prefix.join() tests

* use Prefix.join() in Packaging Guide
2018-06-01 07:16:09 -05:00
George Hartzell
a6867d5cd5 binary caching: skip check if old and new paths are identical (#8281)
Fixes #8217

Trying to relocate a distribution when the new and old paths are
equal leads to failure, because the test that ensures that no
unrelocated bits are left over always fails. As an example, this
occurs if a user installs a package, generates a binary with it
using 'spack buildcache', uninstalls it, and then attempts to
reinstall into the same spack installation using the generated
binary package.

This updates the relocation check to accept the presence of the
old prefix in binaries if the package is being reinstalled into
its original location.
2018-05-31 16:01:32 -07:00
Denis Davydov
939eedcb37 improve Advanced Compiler Configuration part of tutorial (#8325) 2018-05-31 10:28:38 -07:00
scheibelp
43114c2e06 more-flexible user-specified dependency constraints (#8162)
* allow user to constrain dependencies that are added conditionally

* remove check for not-visited deps from normalize, move it to concretize. The check now runs after the concretization loop completes (so an error is only reported if the user-mentioned spec doesnt appear anywhere in the dag)

* remove separate full_spec_deps variable; rename spec_deps to all_spec_deps to clarify that it merges user-specified dependencies with derived dependencies

* add unit test to confirm new functionality
2018-05-30 11:07:13 -07:00
Todd Gamblin
1a677e30f3
config: add spack config blame command (#8081)
- `spack config blame` is similar to `spack config get`, but it prints
  out the config file and line number that each line of the merged
  configuration came from.

- This is a debugging tool for understanding where Spack config settings
  come from.

- add tests for config blame
2018-05-30 10:25:22 -07:00
Adam J. Stewart
87223a531b
Document specs with multiple version ranges (#8284) 2018-05-30 10:36:56 -05:00
Michael Kuhn
c77bc613eb Fix missing spack.compiler import (#8240)
Fixes: #8258

#8090 altered import behavior so that import spack no longer
provides access to many other Spack modules. This addresses
a case which depended on the prior behavior and was not
updated as part of #8090. This particular import error only
came up when users were setting compiler flags on specs.

See also: #8194
2018-05-24 10:59:20 -07:00
Axel Huebl
cd72312940 CUDA 9.2 (#8238)
Add the latest CUDA release, v9.2 and updated CUDA Compatibility Matrix
2018-05-22 12:45:47 +02:00
George Hartzell
e954686e5a Add info about haveged to gpg/randomness note (#8227) 2018-05-21 15:57:03 -05:00
Adam J. Stewart
0ccbc3a479
URL parsing: strip x86-64 from filename (#8200) 2018-05-20 15:01:58 -05:00
Todd Gamblin
22b551f84f fix leftover references to spack.<symbol>
- there were some leftover spack.* names being used after we removed
  globals and moved everything in the top-level namespace to spack.pkgkit

- point those references to their new homes
2018-05-19 07:37:24 -07:00
Todd Gamblin
8d7873e8b2 imports: remove unnecessary import spack statements
- remove most `import spack` statements, except for files that need
  `spack_version`

- import spack is no longer sufficient to use submodules
  (e.g. spack.directives).

  - these submodules must be imported directly. Update references
    accordingly.
2018-05-18 16:06:21 -07:00
Todd Gamblin
6b2c49648a init: move symbols in spack to spack.pkgkit
- Spack packages were originally expected to call `from spack import *`
  themselves, but it has become difficult to manage imports in the
  Spack core.

- the top-level namespace polluted by package symbols, and it's not
  possible to avoid circular dependencies and unnecessary module loads in
  the core, given all the stuff the packages need.

- This makes the top-level `spack` package essentially empty, save for a
  version tuple and a version string, and `from spack import *` is now
  essentially a no-op.

- The common routines and directives that packages need are now in
  `spack.pkgkit`, and the import system forces packages to automatically
  include this so that old packages that call `from spack import *`
  will continue to work without modification.

- Since `from spack import *` is no longer required, we could consider
  removing ``from spack import *`` from packages in the future and
  shifting to ``from spack.pkgkit import *``, but we can wait a while to
  do this.
2018-05-18 16:06:21 -07:00
Todd Gamblin
54201e3c02
locks: add configuration and command-line options to enable/disable locks (#7692)
- spack.util.lock behaves the same as llnl.util.lock, but Lock._lock and
  Lock._unlock do nothing.

- can be disabled with a control variable.

- configuration options can enable/disable locking:
  - `locks` option in spack configuration controls whether Spack will use filesystem locks or not.
  - `-l` and `-L` command-line options can force-disable or force-enable locking.

- Spack will check for group- and world-writability before disabling
  locks, and it will not allow a group- or world-writable instance to
  have locks disabled.

- update documentation
2018-05-18 14:41:03 -07:00
Todd Gamblin
5ef30e0a51 make check_for_compiler_existence an instance variable 2018-05-17 14:10:30 -07:00
Todd Gamblin
e9a3e3bfbb use os.path.join instead of join_path in core
- Spack core has long used llnl.util.filesystem.join_path, but
  os.path.join is pretty much the same thing, and is more efficient.

- Use os.path.join in the core Spack code from now on.
2018-05-17 14:10:30 -07:00
Todd Gamblin
f202198777 Convert lazy singleton functions to Singleton object
- simplify the singleton pattern across the codebase
- reduce lines of code needed for crufty initialization
- reduce functions that need to mess with a global

- Singletons whose semantics changed:
  - spack.store.store() -> spack.store
  - spack.repo.path() -> spack.repo.path
  - spack.config.config() -> spack.config.config
  - spack.caches.fetch_cache() -> spack.caches.fetch_cache
  - spack.caches.misc_cache() -> spack.caches.misc_cache
2018-05-17 14:10:30 -07:00
Todd Gamblin
3493f7e793 init: make spack.cmd.all_commands lazy
- `spack.cmd.all_commands` does a directory listing on
  `lib/spack/spack/cmd`, regardless of whether it is needed

- make this lazy so that the directory listing won't happen unless it's
  necessary.
2018-05-17 14:10:30 -07:00
Todd Gamblin
1fe5dbf338 init: only imoprt jsonschema if needed
- It turns out that jsonschema is one of the more expensive imports.

- move imports of jsonschema into functions to avoid the performance hits
  for calls that don't need config.
2018-05-17 14:10:30 -07:00
Todd Gamblin
6f2cac9565 init: initialize spack.store lazily
- spack.store was previously initialized at the spack.store module level,
  but this means the store has to be initialized on every spack call.

- this moves the state in spack.store to a singleton so that the store is
  only initialized when needed.
2018-05-17 14:10:30 -07:00
Todd Gamblin
c615d2be06 init: move spack.repo global variable into its own module
- spack.repository module is now spack.repo

- `spack.repo` is now `spack.repo.path()` and loaded lazily

- Added `spack.repo.get()` and `spack.repo.all_package_names()` as
  convenience functions to simplify the new lazy interface.

- updated tests and code
2018-05-17 14:10:30 -07:00
Todd Gamblin
2a09b627c9 tests: rename builtin_mock to "mock_packages" for clarity.
- rename `builtin_mock` and `refresh_builtin_mock` to the more clear
  `mock_packages` and `mutable_mock_packages`
2018-05-17 14:10:30 -07:00
Todd Gamblin
d1903f3bf3 init: convert spack.debug global variable to config option 2018-05-17 14:10:30 -07:00
Todd Gamblin
47dc96224d init: remove package_testing global
- refactor the way test dependencies are passed to the concretizer
- remove global state
- update tests
2018-05-17 14:10:30 -07:00
Todd Gamblin
bc9f5f084f init: remove dependency on spack.version
- no longer require `spack_version` to be a Version (it isn't used that
  way anyway)

- use a simple tuple `spack_version_info` with major, minor, patch
  versions

- generate `spack_version` from the tuple
2018-05-17 14:10:30 -07:00
Todd Gamblin
678639749c init: remove binary_cache_retrieved_specs global variable
- remove variable from spack/__init__.py
- clean up imports and some code structure in binary_distribution.py
2018-05-17 14:10:30 -07:00
Todd Gamblin
3e6d85c404 init: remove spack.concretizer global variable 2018-05-17 14:10:30 -07:00
Todd Gamblin
d4709673b5 init: remove build_jobs global variable 2018-05-17 14:10:30 -07:00
Todd Gamblin
2ab7b7a5a0 init: convert spack.dirty global to config option 2018-05-17 14:10:30 -07:00
Todd Gamblin
278933e824 init: remove template_dirs global
- remove template_dirs global variable from __init__.py

- also remove update_template_dirs fixture, which had no effect on test
  correctness
2018-05-17 14:10:30 -07:00
Todd Gamblin
77bd2dd706 init: replace global spack.do_checksum with config option 2018-05-17 14:10:30 -07:00
Todd Gamblin
73ab0e5dd7 init: replace spack.insecure global with spack.config.get 2018-05-17 14:10:30 -07:00
Todd Gamblin
863ccd5e94 config: simplify configuration API to just get and set
- replace `spack.config.get_configuration()` with `spack.config.config()`

- replace `get_config`/`update_config` with `get`, `set`

- add a path syntax that can be used to refer to specific config options
  without firt getting the entire configuration dict

- update usages of `get_config` and `update_config` to use `get` and `set`
2018-05-17 14:10:30 -07:00
Todd Gamblin
c9ea957563 config: create internal config scope for commands to use. 2018-05-17 14:10:30 -07:00
Todd Gamblin
eee502cc3b init: Move file cache initialization out of __init__.py 2018-05-17 14:10:30 -07:00
Todd Gamblin
d3a1ccd2fa config: rework config system into a class instead of globals
- Current configuration code forces the config system to be initialized
  at module scope, so configs are parsed on every Spack run, essentially
  before anything else.

- We need more control over configuration init order, so move the config
  scopes into a class and reduce global state in config.py
2018-05-17 14:10:30 -07:00
Todd Gamblin
6e398c7f08 init: move editor from spack/__init__.py to spack.util.editor 2018-05-17 14:10:30 -07:00
Todd Gamblin
a4d276fbe4 init: factor paths out of spack/__init__.py and into spack.paths module 2018-05-17 14:10:30 -07:00
Todd Gamblin
74aee60f7d init: simplify import ordering in __init__.py 2018-05-17 14:10:30 -07:00
Zack Galbreath
f7d080b7fb Move report writers to separate classes 2018-05-15 05:43:07 -07:00
Zack Galbreath
49e37a5ecf Add test case for CDash reporting 2018-05-15 05:43:07 -07:00
Zack Galbreath
218331552c upload reports to CDash 2018-05-15 05:43:07 -07:00
Zack Galbreath
847c1216d0 Generate CDash reports for build/install step 2018-05-15 05:43:07 -07:00
Zack Galbreath
ae0ba373b8 CDash report for concretization errors
Capture any concretization errors and record them in a CTest Update.xml file.
2018-05-15 05:43:07 -07:00
Zack Galbreath
d7581697a5 CDash report for configure step
Generate CTest XML file containing configure output
2018-05-15 05:43:07 -07:00
Zack Galbreath
f35d5bbf2b Capture source line number in CTest log parser 2018-05-15 05:43:07 -07:00
Zack Galbreath
d174d6618f Fix typo in comment 2018-05-15 05:43:07 -07:00
Zack Galbreath
072f907831 Add CDash as a valid reporting format 2018-05-15 05:43:07 -07:00
Zack Galbreath
e4e8c72fa1 Initialize report generator before parsing specs
This will allow us to generate reports for concretization errors
2018-05-15 05:43:07 -07:00
Zack Galbreath
de01d70ae4 Allow --overwrite and --log-format to be used together
Restructure the logic of the spack install command to allow these two
command-line arguments to be used at the same time.
2018-05-15 05:43:07 -07:00
Zack Galbreath
6c5dbdd9cd Format-agnostic data structure for reports
Replace the JUnit-specific terms 'testsuite' and 'testcase' with
'spec' and 'package', respectively.
2018-05-15 05:43:07 -07:00
Massimiliano Culpo
b4859e10e2 Packages can tune the list of files to be archived at the end of install (#7760)
Fixes #2781

This PR introduces a new attribute for packages called
`archive_files`, which designates files that should be saved from
a package build (e.g. the config.log generated during autotools
builds).

The attribute contains a list of glob expressions; Any file that
matches will be archived in the `<prefix>/.spack/archived-files`
directory. Errors that occur when archiving files are collected and
reported in a file named `<prefix>/.spack/archived-files/errors.txt`.

`AutotoolsPackage` and `CMakePackage` provide a sensible default
override for this attribute.
2018-05-08 17:40:53 -07:00
Massimiliano Culpo
ff3205d21e
Specs add a space before dependencies (#7942)
fixes #7941

Modified string representation of Specs to add a space before deps
Unit-tests have been modified accordingly
Added a test for regression on #7941
2018-05-07 09:05:50 +02:00
健美猫
c451644f12 Support *.TAR.gz extension. (#7973) 2018-05-06 09:34:16 -05:00
Adam J. Stewart
3a29cc3f5c
Fix coloring of URLs containing @ symbol (#7799)
* Fix coloring of URLs containing @ symbol

* Fix coloring of descriptions containing @ symbol
2018-05-05 17:27:40 -05:00
Adam J. Stewart
5af4d4f0ac
Set default provider for every virtual package (#7784)
* Set default provider for every virtual package

* Add unit test to ensure that every virtual package has a default provider explicitly set
2018-05-05 17:26:47 -05:00
scheibelp
d17372290d
Fix initialization of defaults in yaml schema validation (#7959)
Fixes #7924

Spack's yaml schema validator was initializing all instances of
unspecified properties with the same object, so that updating the
property for one entry was updating it for others (e.g. updating
versions for one package would update it for other packages).

This updates the schema validator to instantiate defaults with
separate object instances and adds a test to confirm this behavior
(and also confirms #7924 without this change).
2018-05-01 17:23:27 -07:00
Adam J. Stewart
c1febf8d9c Document how to run unit tests with print statements (#7860) 2018-04-28 17:59:33 +02:00
Chris Green
6cc79f8142 Allow len(Version) to return number of split components. (#7918) 2018-04-26 15:38:43 -07:00
serbanmaerean
963c103a67 XL Fortran compiler >= 16.0 is synced with C compiler version (#7887)
* Use reported version of IBM XL Fortran compiler for compiler versions >= 16.0.

Starting with the April 2018 release, the IBM XL C and Fortran compilers report the same version, 16.0.  Consequently, there is no need to downgrade the Fortran compiler version to match that of the C compiler.
2018-04-26 14:50:14 -07:00
Sergey Kosukhin
0f35f00b6e Use GitLab's API endpoint for fetching a git snapshot. (#7881)
* Use GitLab's API endpoint for fetching a git snapshot.

* More GitLab packages use the API.

* find_list_url for GitLab's API URLs.

* Flake8

* Url for 'hacckernels'.

* Check GitLab API regexps before the non-API ones.
2018-04-26 16:40:11 -05:00
健美猫
9dad069e89 config_args does NOT apply to CMakePackage. (#7917) 2018-04-26 13:03:45 -05:00
Matthew Scott Krafczyk
1b38631781 Add -d option to diy to specify source path move -j to common args (#5963) 2018-04-18 17:26:14 -05:00
Elizabeth Fischer
d3c1463b0a Fix bug/oversight in formatting error message. (#7810) 2018-04-18 15:05:37 -05:00
George Hartzell
669b85e6bc Activation of activated package just msg's (#7752)
Activating a package that is already activated now sends a `tty.msg`
and returns.

```
-bash-4.2$ ~/spack/bin/spack activate aspell6-en
==> Package aspell6-en/lc4v24f is already activated.
```
2018-04-17 07:44:08 -05:00
Massimiliano Culpo
4bf7ce7d99 Better error message for spack providers (#7748)
* Better error message for spack providers

fixes #1355

`spack providers` now outputs a sensible error message if non-virtual
specs are provided as arguments:
```
$ spack providers mpi zlib petsc
==> Error: non-virtual specs cannot be part of the query [zlib, petsc]
```

Formatting of the output changed slightly.

* Calling 'spack providers' without arguments print the virtual pkg list

Also, the error message in case of a wrong parameter has been improved
to show the list of valid packages.

* Avoid printing headers if stdout is not a tty

* The provider list is formatted with colify if not in a tty

* Added a test to check the list of providers returned from the command
2018-04-17 07:30:32 -05:00
Cameron Smith
e6d3ab8405 cray: add comment about module use in packages.yaml (#7751)
This advises users to prefer `modules:` entries in `packages.yaml` on Cray.
2018-04-13 11:53:26 -07:00
becker33
b9c8cdcbe3
Fix when_spec inheritance for extensions (#7746)
Popping the when spec from kwargs in the extends directive breaks
class inheritance. Inheriting classes do not find their when spec.

We now get the when spec from kwargs instead, leaving it to be found
by any downstream package classes.
2018-04-13 11:38:34 -07:00
Massimiliano Culpo
1307ad3979
Package.provides account for v deps that are provided conditionally (#7716)
fixes #7705

Package.provides now checks constraints to ensure that a spec provides
a given virtual package. Note that 'strict=True' is not passed to
satisfies as this function is also used during concretization.
2018-04-11 21:50:03 +02:00
healther
6a0f9ccf82 make view understand hashes (#7573)
Fixes #7548

This updates the "spack view" command to use the same parsing logic
as "spack install" on the user-provided specs. For example you can
provide a DAG hash to refer to an exact installed spec instead of
specifying name, compiler, etc.
2018-04-04 10:40:56 -07:00
Adam J. Stewart
c50628ebdf Fix bug in test_find_with_globbing unit test (#7652) 2018-04-03 22:27:17 -07:00
Zack Galbreath
f613437a44 Do not call sys.exit() in except block (#7659)
When an invalid spec is encountered by `parse_specs()` we now raise a
`SpackError` instead of calling `sys.exit()`
2018-04-03 22:22:28 -07:00
Adam J. Stewart
cdefbd7475 Avoid double 'lib' for packages whose name already starts with lib (#7651) 2018-03-31 17:33:41 +02:00
Axel Huebl
4c6199923e mirrors.yaml: does not expand ~ (#7631)
Use `$HOME` for cli commands in `mirrors.yaml` and add
"username" example strings in the file itself.
2018-03-28 14:30:18 -05:00
Patrick Gartung
52d55ea317 Fix buildcache relocate: only skip if rpaths are relative (#7605)
This fixes a check that decides when to skip buildcache relocation.
Originally the check was flawed in two ways: it would skip if the
source prefix matched the destination prefix, which no longer
matters since the source prefix is replaced with a placeholder
(so it always needs to be updated); it also would skip relocation
if the rpaths were not relative, when in fact it should be the
opposite (binaries without relative rpaths *should* be relocated,
and those without don't need it).
2018-03-27 10:54:26 -07:00
Todd Gamblin
54f97d1dec
Update copyright on LLNL files for 2018. (#7592) 2018-03-24 12:13:52 -07:00
Todd Gamblin
af0f94a1af
Avoid stat-ing all packages at startup. (#7587)
- FastPackageChecker was being called at startup every time Spack runs,
  which takes a long time on networked filesystems.  Startup was taking
  5-7 seconds due to this call.

- The checker was intended to avaoid importing all packages (which is
  really expensive) when all it needs is to stat them.  So it's only
  "fast" for parts of the code that *need* it.

- This commit makes repositories instantiate the checker lazily, so it's
  only constructed when needed.
2018-03-24 07:39:10 -07:00
Todd Gamblin
998b5a6482
Remove case consistency check at startup. (#7585)
- This was needed when we transitioned to all lowercase packages because
  git didn't handle case changes well on case-insensitive filesystems.

- Now it just adds extra stat calls to startup, and we check for
  all-lowercase package names in tests, so we'll remove it.

- people using really old versions of Spack can re-clone.
2018-03-23 22:38:31 -07:00
Mario Melara
385622953d Cray clean environment (#7582)
* Create unload_module method

Extract code from load_module into unload_module.

* Unload modules to create a clean env on Cray

removes cray-libsci, cray-mpich and darshan to prevent any silent
linking with those packages.
2018-03-23 14:53:52 -07:00
Adam J. Stewart
666e8e3a9b Increment Spack version (#7565) 2018-03-23 14:43:22 -07:00
becker33
1c169ead8b
Grab crayos version from PrgEnv module versions (#7583) 2018-03-23 14:41:43 -07:00
Mario Melara
2970a50ef6 Add the ability to separate architecture in path scheme (#4329)
* Add format to separate target and os for path

spec format can now handle separations of target and os for setting
up the path.

* Added ${PLATFORM} et al to spec.format()

${PLATFORM}, ${OS}, ${TARGET}

* Update tests

Updated tests and got rid of unnecessary code.

* Also update documentation to reflect this new ability.

* Add default path scheme to config.yaml

Added default path scheme to config.yaml. Users can overwrite this
section if they want.
2018-03-23 12:05:07 -07:00
Veselin Dobrev
4ddbc96c7b Speedup the default 'libs' property search ... (#7553)
* Speedup the default 'libs' property search - important for external
packages.

* As advised by @alalazo, use tuples instead of lists inside
_libs_default_handler.
2018-03-22 20:04:28 -05:00
Adam J. Stewart
f721fb3e4c
Fix error raising during install with Python 3 (#6894)
* Fix error raising during install with Python 3

* Fix env_path too
2018-03-22 19:37:49 -05:00
Massimiliano Culpo
5655895865 Record installation date and time in DB (#7334)
* Added installation date and time to the database

Information on the date and time of installation of a spec is recorded
into the database. The information is retained on reindexing.

* Expose the possibility to query for installation date

The DB can now be queried for specs that have been installed in a given
time window. This query possibility is exposed to command line via two
new options of the `find` command.

* Extended docstring for Database._add

* Use timestamps since the epoch instead of formatted date in the DB

* Allow 'pretty date' formats from command line

* Substituted kwargs with explicit arguments

* Simplified regex for pretty date strings. Added unit tests.
2018-03-22 11:07:27 -07:00
Massimiliano Culpo
6699ba8769 Recover the old patching order for packages. (#7558)
fixes #7543

This is very likely an hot-fix, while a more permanent solution is
needed. See this comment for more insight:

 https://github.com/spack/spack/pull/7193#discussion_r176448831

on the problem.
2018-03-22 10:09:43 -07:00
becker33
f8657e3fd9 Propagate architecture information during concretization (#7412)
This updates architecture concretization to

* Search for the nearest parent in the DAG for architecture information
  rather than defaulting to the root of the DAG
* Propagate architecture settings transitively, such that if for
  example the target is set at the root of the dag it will set the
  same target on indirect dependencies (assuming no intermediate
  dependency specifies a separate target). Previously this occurred
  in general but under some conditions did not, for example if an
  intermediate dependency specified some subset of architecture
  properties.
2018-03-21 18:14:01 -07:00
scheibelp
6548f2db5c Enable creation of mirrors for systems with different compilers (#5153)
* Create mirror for system with different compilers

Spack concretizes the spec provided by the user in
"spack mirror create" to ensure downloading the right
dependencies. Under normal circumstances concretization
requires that the chosen compiler exists on the system,
but this is not required when creating download mirrors
for other systems, so this requirement is removed in that
case.

* Add test for disabling compiler existence check

* Update compiler existence checking logic

* improve test for disabling compiler existence check
2018-03-21 14:55:26 -07:00
健美猫
71055a8ef4 Generate spack docset for Dash. (#6981) 2018-03-21 16:37:26 -05:00
Gregory Lee
7504e9997d make py-setuptools a run-time-only dep for py-basemap and patch pytho… (#6989)
* make py-setuptools a run-time-only dep for py-basemap and patch python package to only apply setuptools flag for build deps

* py-qtconsole does not require setuptools
2018-03-21 16:34:27 -05:00
scheibelp
e8a0637606 Support MD5 with a warning when OpenSSL is compiled in FIPS mode (#7531)
* This allows Spack to work with MD5 hashes on machines with openssl in FIPS mode.
* We are still using MD5 for validation in many places, and a later PR will replace all uses of MD5 with SHA256.
* This is a quick fix until that happens.
2018-03-21 14:11:54 -07:00
Gregory Lee
500ac793bc patch config.guess for ARM (aarch64) (#7427) 2018-03-21 13:13:38 -05:00
Peter Scheibel
6458b15bb1 spec: support "full" hashes
This hash includes the content of the package itself as well as the DAG
for the package.
2018-03-20 00:29:54 -07:00
Peter Scheibel
3501f2f4b5 package: add a content_hash method for packages
This calculates a hash which depends on the complete content of the
package including sources and the associated `package.py` file.
2018-03-20 00:29:54 -07:00
Peter Scheibel
e97c28e5b3 package: ensure patches are applied in-order
This helps to ensure that patches are applied consistently and will also
be used as the source for the patch part of full package hashes.
2018-03-20 00:29:54 -07:00
Peter Scheibel
2379ed54b9 package_hash: add code to generate a hash for a package file
This will be included in the full hash of packages.
2018-03-20 00:29:54 -07:00
Peter Scheibel
db81d19ddd PackageBase: add a list of metadata attributes
These attributes are ignored when doing a content hash of a package.
2018-03-20 00:29:54 -07:00
Peter Scheibel
39cb9d0397 fetch_strategy: add a source_id to fetches
This will be included in the full hash of packages.
2018-03-20 00:29:54 -07:00
Todd Gamblin
b4a9e37a98
Fix bugs in spack dependencies command (#7435)
- transitive dependencies were not being handled correctly

- restructure code to do recursion and mark visited packages properly

- add `-V` option to *not* expand virtuals in spack dependencies
2018-03-12 17:26:58 +09:00
Massimiliano Culpo
a1c8ce82f2 Constructing a SpecBuildInterface from another gives no inconsistent MRO (#7457)
fixes #7239
2018-03-12 17:07:08 +09:00
Patrick Gartung
a4e75c7f0e spack buildcache: allow unsigned tarballs (#7440)
This re-adds the option to create and install unsigned tarballs, now
with the -u option (--unsigned) rather than the -y option.

This also changes the "keys" command, replacing the -y/--yes-to-all
option with the -t/--trust option (which has the same effect but is
more-clearly named).
2018-03-09 15:29:10 -08:00
Levi Baber
38bb0e3e7d resource: convert symlink to real path (#7417)
Fixes #7130

shutil.move expects a source path like "/x/y/" to be a directory and
fails if "/x/y" is a symlink. This invokes realpath on the source
path to avoid the issue.
2018-03-09 12:40:57 -08:00
scheibelp
f27f20e5b3
replace dash with underscore in os name/version (#7381)
Fixes #7356

In some cases OperatingSystem (e.g. LinuxDistro) was getting
instantiated with a version that contains dashes. This breaks because
the concretizer later converts this value to a string and re-parses
it, and the '-' character is used to separate architecture components.
This adds a guard in the initializer to convert '-' to '_'.
2018-03-09 10:03:58 -08:00
Massimiliano Culpo
d77dd298eb
Changed CudaPackage base class to PackageBase (#7416)
CudaPackage is always used as a mixin. As such it should inherit from
PackageBase, and not Package.
2018-03-07 13:45:11 +01:00
Patrick Gartung
f5467957bc Improved binary relocation: error checking and reporting (#7314)
Fixes #7237
Fixes #6404
Fixes #6418
Fixes #6369

Identify when binary relocation fails to remove all instances of the
source prefix (and report an error to the user unless they specify
-a to allow the old root to appear). This check occurs at two stages:
during "bincache create" all instances of the root are replaced with
a special placeholder string ("@@@@..."), and a failure occurs if the
root is detected at this point; when the binary package is extracted
there is a second check. This addresses #7237 and #6418.

This is intended to be compatible with previously-created binary
packages.

This also adds:

* Better error messages for "spack install --use-cache" (#6404)
* Faster relocation on Mac OS (using a single call to
  install_name_tool for all files rather than a call for each file)
* Clean up when "buildcache create" fails (addresses #6369)
* Explicit error message when the spack instance extracting the binary
  package uses a different install layout than the spack instance that
  created the binary package (since this is currently not supported)
* Remove the option to create unsigned binary packages with -y
2018-03-06 18:02:53 -08:00
Mario Melara
ccb24b1438 Fix pkgconf on Crays (#7171)
This updates Cray.setup_platform_environment to use cray-specific
pkgconfig paths so that all providers of 'pkgconfig' have access
to them (previously the 'pkg-config' provider had this but the
'pkgconf' provider did not).
2018-03-05 12:08:11 -08:00
scheibelp
8b0552bc23 only filter compiler paths for binaries provided by the compiler (#7369) 2018-03-05 14:43:43 +01:00
Veselin Dobrev
d3ed46e958 [spack/spec.py] raise a query failure error if a property query returns None (#7277)
* [SPACK/spec.py] When a query through ForwardQueryToPackage returns
'None', treat that as query failure and raise RuntimeError with
suitable message. This overrides the current behavior to raise an
AttributeError which is now triggered only when no suitable query
property is found and there is no default handler.

* [spack/spec.py] Fix style.

* [SPACK/spec.py] In case of query failure, i.e. property returning
'None', raise AttributeError instead of RuntimeError in order to
pass the unit test. Also, small update in the logic distinguishing
query failure and lack of relevant property/attribute handling.
2018-02-28 15:25:29 -07:00
Mario Melara
14e3eb78a7 Fix class name in build system tutorials (#7346)
AutoTools -> Autotools
2018-02-27 20:15:35 -08:00
Omar Padron
3a9cd2614e Docker-Based Developer Resource (#5871)
* add docker-based development resources

* incorporate feedback from @ax3l

* fix docs/improve ssh handling

* experiment with custom prompt

* add arch/fix missing core_compilers key

* add centos/minor tweaks

* make prompt experiment optional

* workaround problem with latest fedora docker image

* add docker documentation page to index toc

* try another documentation fix

* switch arch linux base to base/archlinux

* update the git urls in the Dockerfiles

* add opensuse

* switch CUSTOM_PROMPT variable to simply "PROMPT"
2018-02-27 00:36:14 -08:00
Massimiliano Culpo
9c7d4e34f7 Pin Sphinx version to v1.7.0 (#7337)
Later versions of Sphinx fail due to possible clashes with our custom
argparse.
2018-02-23 12:09:01 -08:00
scheibelp
4a807fca08
Make fix_darwin_install_name python3-compatible (#7329)
This updates the fix_darwin_install_name function to use the Spack
Executable object to run install_name_tool, which ensures that
process output is formatted as a 'str' for python2 and python3.
Originally fix_darwin_install_name was invoking subprocess.Popen
directly.
2018-02-23 10:24:59 -08:00
Pramod S Kumbhar
8ae50ae8bb Use abspath to avoid permission errors(#7241)
Fixes #5189

When working with non-normalized paths containing ".." on some
file systems, Spack was found to encounter a permission error when
writing to the path. This normalizes a path written by the
intel-parallel-studio package and also normalizes all paths
written by the license install hook (for all packages) to avoid
this issue for intel-parallel-studio.
2018-02-15 17:26:37 -08:00
alalazo
efd2a95781 find has been changed to accept glob expressions
Following the discussion with Todd and Adam, find has been modified to
accept glob expressions. This should not affect performance as every
glob implementation I inspected has 3 cases (no wildcard, wildcard but
no directories involved, wildcard and directories involved) and uses
fnmatch underneath.

Mixins have been changed to do by default a non-recursive search (but
a recursive search can still be triggered using the recursive keyword).
2018-02-13 02:18:28 -08:00
alalazo
c62b3eef55 filter_compiler_path: added the possibility to narrow search path
Following a comment from Todd, the search path for the files listed in
`filter_compiler_wrappers` can now be narrowed. Anyhow, the function
implementation still makes use of `find`, the rationale being that we
have already seen packages that install artifacts in e.g. architecture
dependent folders. The possibility to have a relative search path might
be a good compromise between the previous approach and the one suggested
in the review.

Also: 'ignore_absent' and 'backup' keyword arguments can be optionally
forwarded to `filter_file`.
2018-02-13 02:18:28 -08:00
alalazo
4e48bae096 mixins: moved debug logs to 'filter_file'. Renamed shadowed variable name.
Following comments from Todd:

- the call to tty.debug has been moved deeper, to log the filtering of each file
- the shadowing on the name "kwargs" is avoided
2018-02-13 02:18:28 -08:00
alalazo
eae7263838 mixins: flush method dictionaries after registration. 2018-02-13 02:18:28 -08:00
alalazo
22def01adf mixins: implemented declarative syntax
Implemented a declarative syntax for the additional behavior that can
get attached to classes. Implemented a function to filter compiler
wrappers that uses the mechanism above.
2018-02-13 02:18:28 -08:00
alalazo
8e0f9038ab Improved naming of properties and classes (per Denis comments). 2018-02-13 02:18:28 -08:00
alalazo
28e129b087 Added mixins to modularize common behaviors across build-systems.
Modifications:
  * added a mixin to filter compiler wrappers from files
  * modified hdf5, openmpi, mpich, mvapich2 to use it
2018-02-13 02:18:28 -08:00
Todd Gamblin
b98cdf098a Rework command reference in docs, add spack commands command
- command reference now includes usage for all Spack commands as output
  by `spack help`.  Each command usage links to any related section in
  the docs.

- added `spack commands` command which can list command names,
  subcommands, and generate RST docs for commands.

- added `llnl.util.argparsewriter`, which analyzes an argparse parser and
  calls hooks for description, usage, options, and subcommands
2018-02-12 20:25:17 -08:00
Todd Gamblin
1b998cbeee Fix issues with spack [cmd] -h help output
- Shorten Spack command usage for short options. Short options are now
  shown as [-abc] instead of as [-a] [-b] [-c]

- fix bug that mixed long and short options for top-level `spack help`
2018-02-12 20:25:17 -08:00
Todd Gamblin
fff3cc695d Fix section labels for some commands in the docs 2018-02-12 20:25:17 -08:00
Todd Gamblin
39e6d54956 make defaults in command help look like standard argparse 2018-02-12 20:25:17 -08:00
Todd Gamblin
8f52de32b6 Add help for buildcache, reorganize command help categories
- Add proper help for `spack buildcache` subcommands

- Reorganize the help categories of Spack commands so that buildcache is
  in packaging and diy and setup are now in build.
2018-02-12 20:25:17 -08:00
Todd Gamblin
2b7dfcd19f Clean up help metavar for --scope configuration options
- previously commands with this argument showed a long list of choices
  that were platform specific.

- use a better metavar: {defaults,system,site,user}[/PLATFORM]
2018-02-12 20:25:17 -08:00
becker33
8913c3465c
Change location of public key in basic tutorial (#7192)
* Change location of public key in basic tutorial

* Change tuturial version number to 11.2
2018-02-07 08:45:29 -08:00
healther
e3951c2a21 Fix ignore-conflicts for extensions in views (#7167)
Fixes #7159

When activating extensions in external views, the --ignore-conflicts
option was being ignored. In this particular issue the conflict was
for the duplicate __init__ file for multiple python packages in the
same namespace, but in general any conflict for extensions would
cause an error whether or not --ignore-conflicts was set.

This also renames the 'force' option of do_activate to
'with_dependencies' and updates views to call do_activate with this
set to False (since it traverses the dependency dag anyway). This
isn't strictly required, it just avoids redundant calls.
2018-02-02 14:45:21 -08:00
scheibelp
71483d9390
Update tutorial on advanced packaging (#7144)
This reorganizes most sections and rewords a significant portion of
the content (including all introductions) but keeps all the examples.

* Remove section 'What happens at subscript time' from tutorial:
  it is too detailed for a tutorial
* Move the 'Extra query parameters' and 'Attach attributes to other
  packages' sections into a separate grouping 'Other packaging topics'
* move the 'Set variables at build time yourself' section after
  'Set environment variables in dependents' section since the latter
  is more motivating
* start the 'set environment variables at build-time for yourself'
  section with qt as an example
* renamed section 'specs build interface' to 'retrieving library
  information' and updated section introduction
* renamed section 'a motivating example' to 'accessing library
  dependencies'; split out the material which deals with implementing
  .libs for netlib-lapack into a separate section called 'providing
  libraries to dependents'. consolidated in material from the section
  'single package providing multiple virtual specs' since
  netlib-lapack is an example of this (this removes the material
  about intel-parallel studio)
2018-02-01 12:10:25 -08:00
Todd Gamblin
df758e1cfc Improve log parsing performance (#7093)
* Allow dashes in command names and fix command name handling

- Command should allow dashes in their names like the reest of spack,
  e.g. `spack log-parse`
  - It might be too late for `spack build-cache` (since it is already
    called `spack buildcache`), but we should try a bit to avoid
    inconsistencies in naming conventions

- The code was inconsistent about where commands should be called by
  their python module name (e.g. `log_parse`) and where the actual
  command name should be used (e.g. `log-parse`).

- This made it hard to make a command with a dash in the name, and it
  made `SpackCommand` fail to recognize commands with dashes.

- The code now uses the user-facing name with dashes for function
  parameters, then converts that the module name when needed.

* Improve performance of log parsing

- A number of regular expressions from ctest_log_parser have really poor
  performance, most due to untethered expressions with * or + (i.e., they
  don't start with ^, so the repetition has to be checked for every
  position in the string with Python's backtracking regex implementation)

- I can't verify that CTest's regexes work with an added ^, so I don't
  really want to touch them.  I tried adding this and found that it
  caused some tests to break.

- Instead of using only "efficient" regular expressions, Added a
  prefilter() class that allows the parser to quickly check a
  precondition before evaluating any of the expensive regexes.

- Preconditions do things like check whether the string contains "error"
  or "warning" (linear time things) before evaluating regexes that would
  require them.  It's sad that Python doesn't use Thompson string
  matching (see https://swtch.com/~rsc/regexp/regexp1.html)

- Even with Python's slow implementation, this makes the parser ~200x
  faster on the input we tried it on.

* Add `spack log-parse` command and improve the display of parsed logs

- Add better coloring and line wrapping to the log parse output.  This
  makes nasty build output look better with the line numbers.

- `spack log-parse` allows the log parsing logic used at the end of
  builds to be executed on arbitrary files, which is handy even outside
  of spack.

- Also provides a profile option -- we can profile arbitrary files and
  show which regular expressions in the magic CTest parser take the most
  time.

* Parallelize log parsing

- Log parsing now uses multiple threads for long logs
- Lines from logs are divided into chnks and farmed out to <ncpus>
- Add -j option to `spack log-parse`
2018-01-31 21:57:56 -08:00
Massimiliano Culpo
7368586f0d Mark slow unit tests (#6994)
* Marking database tests as slow

* Marking url command tests as slow

* Marking every test that uses database as slow

* Marking tests that import files as slow

* Marking gpg tests as slow

* Marking all versions and one list tests as slow

* Added more markers to unit tests + cli option to skip slow tests

Following a discussion with Axel, the generic 'slowtest' marker has been
split into 'db', 'network' and 'maybeslow'. A brief description of the
meaning of each marker has been added to pytest.ini.

A command line option to run only fast tests has been added to
'spack test'

* Don't use classes to group tests together

Reverted grouping tests under a class, as required in the review

* Minor style changes
2018-01-29 06:19:50 -08:00
scheibelp
f27c5e74ed Remove Package instance caching in Repo (#6367)
This attempts to address one of the complaints at #5996 (comment):

> Repo currently caches package instances by Spec, and those Package instances have a Spec. 
> This is unnecessary and causes confusion. I think I thought that we'd need to cache instances 
> after loading package classes, but really just caching the classes is fine.

With this update, Repo's package cache is removed and Specs cache the package reference themselves. One consequence is that Specs which compare as equal will store separate instances of a Package class (not doing this creates issues for #4595 (comment)).

There were several references to Spec.package that could be replaced with Spec.package_class without any additional modifications. There are still a couple remaining references to Spec.package in Spec that would require adding functionality before replacing (e.g. calling Package.provides and Package.installed).

Note this makes it difficult to mock fetchers for tests which invokes code that reconstructs specs. test_packaging was one example of this where the updates caused a failure (in that case the error was avoided by not making an unnecessary call).

Details:
* Replace instances of spec.package with spec.package_class where a class method is being called
* Remove instances of Repo.get where Spec.package_class can be used in its place
* remove Repo.get caching instances of Package class for specs
* remove redundant check (which is also incorrect now that each spec stores its own copy of its package)
* avoid creating mirror with specs because it copies specs and those copies dont refer to the mocked fetcher (and it is also not required for the test)
* remove checks that are no longer necessary since repo doesn't cache specs
2018-01-28 16:58:08 -08:00
Adam J. Stewart
f7f4bae154 Fix gfortran 7 detection (#7017) 2018-01-28 16:29:48 -08:00
Massimiliano Culpo
5af9256d4f Cleaned up JUnit report generation on install (#6977)
* Cleaned up JUnit report generation on install

The generation of a JUnit report was previously part of the install
command. This commit factors the logic into its own module, and uses
a template for the generation of the report.

It also improves report generation, that now can deal with multiple
specs installed at once. Finally, extending the list of supported
formats is much easier than before, as it entails just writing a
new template.

* Polished report generation + added tests for failures and errors

The generation of a JUnit report has been polished, so that the
stacktrace is correctly displayed with Jenkins JUnit plugin. Standard
error is still not used.

Added unit tests to cover for installation failures and installation
errors.
2018-01-28 12:07:59 -08:00
Federico Ficarelli
1f39afe475 Enable install of multiple specs from yaml files (#6984) 2018-01-26 08:33:53 +01:00
Axel Huebl
85c887a939 Python Installs: No User Site Dir (#7065)
Avoid adding an "outside" (local home's) python user site directory
during python package installs.

Implements #6611

Fixes packages with auto-find side effects such as `py-setuptools`
that cause `py-matplotlib` to fail to build #6558
2018-01-25 17:50:50 +01:00
Alastair Harrison
eb0f5c6efe Fix error message typo in 'spack create' cmd (#7042)
- Previously would print the spec's namespace twice, rather
  than printing the spec's namespace, followed by the repo's namespace.
2018-01-23 14:00:18 -06:00
Levi Baber
8d2e340e16 Add --full-path option to module find (#6838) 2018-01-19 20:08:36 +01:00
Massimiliano Culpo
a389bff949
Added a setter to the Spec.prefix property (#6814)
This commit removes logic from Spec that was there only to be used in
tests, and allows to set a new prefix cleanly in user's code.
2018-01-19 09:31:19 +01:00
becker33
3686c250ed Fix type issues with setting flag handlers (#6960)
The flag_handlers method was being set as a bound method, but when
reset in the package.py file it was being set as an unbound method
(all python2 issues). This gets the underlying function information,
which is the same in either case.

The bug was uncovered for parmetis in #6858. This is a partial fix.
Included are changes to the parmetis package.py file to make use of
flag_handlers.
2018-01-18 17:55:44 -08:00
Todd Gamblin
84b2cc0823
Final changes for v0.11.0 (#6318) 2018-01-16 22:25:08 -08:00
Massimiliano Culpo
4d7e7f25c4 Fix installing specs from yaml file (#6906)
The feature added in #4611 is currently broken. This commit fixes the
behavior of the command and adds unit tests to ensure the basic semantic
is maintained.

It also changes slightly the behavior of Spec.concretized to avoid
copying caches before the concretization (as this may result in a
wrong hash computation for the DAG).
2018-01-16 08:03:10 -06:00
Todd Gamblin
50ca4979e1
Speed up doc builds with spack list --format=html (#6945)
- Generating the HTML from for >2300 packages from RST in Sphinx seems to
  take forever.

- Add an option to `spack list` to generate straight HTML instead.

- This reduces the doc build time to about a minute (from 5 minutes on a mac laptop).
2018-01-16 00:12:11 -08:00
Massimiliano Culpo
1fb38c9e04
Vendor ordereddict for python2.6 only (#6931)
* Vendor ordereddict for python2.6 only

This commit substitutes the custom module 'ordereddict_backport' with
the more known 'ordereddict' and vendors it only for python 2.6. Other
supported versions of python will use 'collections.OrderedDict'.

* Use absolute imports also for python 2.6

See PEP-328 for more information on the subject

* Added provenance of vendored ordereddict
2018-01-16 07:00:39 +01:00
scheibelp
278901c02c
Handle test dependencies that are python extensions (#6904)
See #6794

This fixes cases where test-only dependencies were omitted from
consideration when modifying the environment at build time. This
includes an update to the python package definition to add
testing-related python extensions to its specialized environment
setup.
2018-01-12 19:02:54 -08:00
scheibelp
f4101550d1
Relax conflict checks for externals (#6907)
This updates the conflict-checking logic to require that the conflict
spec matches exactly and that all fields mentioned in the conflict
spec are present in the concretized spec in order to report a
conflict. This will automatically skip all conflict checks for
dependencies of externals (since externals strip dependencies). This
will not affect non-external packages since all fields and
dependencies are fully specified for such packages.
2018-01-12 10:53:11 -08:00
Adam J. Stewart
d7920ab4f3
Keep track of source and versions for external libraries (#6803)
* Keep track of source and versions for external libraries

* Note source of more obscure libraries

* We aren't upgrading jsonschema after all

* Add note on modifications made to pytest
2018-01-10 19:14:19 -06:00
Adam J. Stewart
57c71aea89
Update to pytest 3.2.5 (#6801)
* Update to pytest 3.2.5

* Get pytest to pass Python 2.6 compatibility checks
2018-01-10 17:41:50 -06:00
Adam J. Stewart
10ee7d6d81
Add suggestion to Contribution Guide to activate flake8 (#6886) 2018-01-10 13:02:33 -06:00
Adam J. Stewart
d17a10c6ac
Update to the latest version of jinja2 (#6790) 2018-01-10 10:06:04 -06:00
Adam J. Stewart
4fdf08e51c
Update to py 1.4.34 (#6789)
* Update to the latest version of py

* Revert back to py 1.4.34
2018-01-10 10:05:39 -06:00
Adam J. Stewart
e4c0ed8540
Add unit tests for spack versions command (#6774)
* Add unit tests for spack versions command

* Fix bug in web spidering for Python 2.6
2018-01-10 10:04:47 -06:00
Adam J. Stewart
2f0dd02c10
Update to the latest version of six (#6787) 2018-01-10 10:04:07 -06:00
Adam J. Stewart
cab34d7d3b
Fix bug in placeholder spack cd command and add unit tests (#6776) 2018-01-10 10:03:45 -06:00
Adam J. Stewart
ba84630caf Add unit tests for spack arch command (#6775) 2018-01-10 13:53:55 +01:00
Adam J. Stewart
f7bf73a458 Add unit tests for spack graph command (#6778) 2018-01-10 13:52:34 +01:00
Adam J. Stewart
824e078140 Fix a typo in fetch_strategy error message formatting (#6878) 2018-01-10 13:49:16 +01:00
Adam J. Stewart
ffd435bad7 Add documentation on Codecov (#6842) 2018-01-07 08:28:56 -08:00
Massimiliano Culpo
d978cfbb1a Fixes the bug in spack configure spotted in #6833 (#6837) 2018-01-05 15:07:51 -06:00
Adam J. Stewart
d1aee2c2f2
Fix spack configure output (#6835) 2018-01-05 14:26:43 -06:00
Michael Kuhn
01bec7976b Fix HTML detection (#6394)
Some servers report a content-type header instead of Content-Type.
2018-01-02 21:21:36 -06:00
Denis Davydov
4b5fe75bc3 add OctavePackage (#6746)
* add OctavePackage

1. remove import CudaPackage which is not needed anymore
2. mention CudaPackage and OctavePackage in packaging guide
3. adjust OctavePackageTemplate
4. add clue file for Octave build
5. sanity check on self.prefix

* use setup_environment
2018-01-02 20:03:27 -06:00
Adam J. Stewart
464ca87879 Add more unit tests for spack clean command (#6777) 2018-01-02 11:31:38 -08:00
Adam J. Stewart
05ce8407af Add unit tests for spack help command (#6779)
* Add unit tests for spack help command
* Work around issue with using `spack help` twice in tests
2017-12-30 22:55:49 -08:00
Adam J. Stewart
088c193a78 Update to the latest version of argparse (#6786)
* Update to the latest version of argparse

* Re-add colified logic
2017-12-30 16:08:35 -08:00
Adam J. Stewart
010334bf22 Update to distro 1.0.4 (#6788)
* Update to the latest version of distro

* Update distro to 1.0.4
2017-12-30 15:44:19 -08:00
Adam J. Stewart
0c1f4a7997 Add more unit tests for spack list command (#6750) 2017-12-22 10:29:20 -08:00
Massimiliano Culpo
d3913709bb spack mirror remove: fix no-update error (#6559)
Fixes #4573 

"spack mirror remove" was not actually removing mirrors from the
configuration.
2017-12-22 10:28:23 -08:00
Adam J. Stewart
1ce0c1b556 Fix python3 compatibility bug in spack edit command (#6748)
In Python 2, filter() returns a list, but in Python 3, filter()
returns an iterator, and iterators have no length.
2017-12-21 17:45:15 -08:00
becker33
feb4f1b387
separate stdout and stderr for module loading (#6713) 2017-12-21 16:27:52 -08:00
Patrick Gartung
e5d6f28b4e binary caching: handle files misidentified as needing relocation (#6679)
* Only specify a file as needing relocation if it contains the spack
  root as a text string (this constraint also applies to binaries)
* Don't fail if there is an error retrieving RPATH information from a
  binary (even if it is specified as requiring relocation)
2017-12-20 18:21:41 -08:00
becker33
28d8784ab9 Compiler flag handlers (#6415)
This adds the ability for packages to apply compiler flags in one of
three ways: by injecting them into the compiler wrapper calls (the
default in this PR and previously the only automated choice);
exporting environment variable definitions for variables with
corresponding names (e.g. CPPFLAGS=...); providing them as arguments
to the build system (e.g. configure).

When applying compiler flags using build system arguments, a package
must implement the 'flags_to_build_system_args" function. This is
provided for CMake and autotools packages, so for packages which
subclass those build systems, they need only update their flag
handler method specify which compiler flags should be specified as
arguments to the build system.

Convenience methods are provided to specify that all flags be applied
in one of the 3 available ways, so a custom implementation is only
required if more than one method of applying compiler flags is
needed.

This also removes redundant build system definitions from tutorial
examples
2017-12-20 15:40:38 -08:00
Denis Davydov
548c225d45 dealii: add GMSH, add CMAKE_FIND_APPBUNDLE to CMakePackage (#6723)
* dealii: add GMSH dependency

* CMakePackage: add CMAKE_FIND_APPBUNDLE to prevent picking up binaries from /Applications
2017-12-19 08:28:55 +01:00
Massimiliano Culpo
0192455885 spack install: make restaging the default (#6465)
Fixes #5940

This PR changes the option '--restage' of 'spack install' to
'--dont-restage', inverting its meaning and the default behavior
of the command.
2017-12-18 18:50:02 -08:00
scheibelp
020ce7735d
Skip collection of compilers which report an empty version (#6684)
Fixes #6200

For compilers that successfully run a version detection script but
don't actually return a version, Spack was keeping track of the
empty version and then failing when attempting to construct a
compiler spec. This skips any attempt to add a compiler entry when
no version is reported (but logs when a compiler fails to report
a version).
2017-12-14 17:54:57 -08:00
Mark Olesen
5727054c4a misc fixes, changed to EnvironmentModifications (issue #6501) (#6541)
* Support pruning of vars with Env from_sourcing_file (issue #6501)

- Blacklist string literals or regular expressions of environment
  variables that are to be removed from consideration as being affect
  by the sourcing of the file. Conversely, whitelist modifications
  that should not ignored.  Whitelisted variables have priority over
  blacklisting.
  Eg,

      EnvironmentModifications.from_sourcing_file
      (
          bashrc
          blacklist=['JUNK_ENV', 'OPTIONAL_.*'],
          whitelist=['OPTIONAL_REQUIRED.*']
      )

This modification can be used to eliminate environment variables that
are not generalized for modules (eg, user-specific variables).

* BUG: module prepend-path in wrong order (fixes #6501)

* STYLE: module variables in sorted order (issue #6501)

- looks nicer and also helps when comparing the contents of different
  module files.

* ENH: remove duplicates from env paths when creating modules (issue #6501)

- this makes for a cleaner module environment and helps avoid some
  unnecessary changes to the environment that are only provoked by
  redundancies in the PATH.

  eg,
      before PATH=/usr/bin
      after  PATH=/usr/bin:/usr/bin:/my/application/bin

  should only result in /my/application/bin being added to the PATH
  and not /usr/bin:/my/application/bin

Activate via the 'clean' flag (default: False):

    EnvironmentModifications.from_sourcing_file(bashrc, clean=True,..
2017-12-14 21:24:06 +01:00
becker33
9d8ea00966
add -d option for edit command (#6416)
* add -d option for edit command and improve suffix extrapolation from '.py' to use glob
2017-12-11 16:17:53 -08:00
Massimiliano Culpo
bd5d6b2bfa Simplified "Environment-Modules" section in getting started guide. (#6410)
Fixes #2440

The "Getting started" guide should be short and sweet. This commit
simplifies the "Environment-Modules" section pruning:

 - outdated / wrong suggestions as noted in #2440
 - uncommon setups that are better treated in a reference guide
2017-12-11 11:34:39 -08:00
Massimiliano Culpo
05b10ce967
config.py: fixed comments that refer to variables following them (#6585)
According to the documentation here:

  http://www.sphinx-doc.org/en/stable/ext/autodoc.html

"For module data members and class attributes, documentation can either
be put into a comment with special formatting (using a #: to start the
comment instead of just #), or in a docstring after the definition."
2017-12-07 08:09:53 +01:00
Sergey Kosukhin
bcb1630e39 CMAKE_INSTALL_RPATH is semicolon-separated. (#6577) 2017-12-06 08:07:11 +01:00
Patrick Gartung
f6c99d7beb Buildcache: relocate fixes (#6512)
* Updated function which checks if a binary file needs relocation.
  Previously this was incorrectly identifying ELF binaries as symbolic
  links (so they were being excluded from relocation). Added test to
  check that ELF binaries are not considered symlinks.

* relocate_text was not replacing paths in text files. Added test to
  check that text files are relocated properly (i.e. paths in the file
  are converted to the new prefix).

* Exclude backup files created by filter_file when installing from
  binary cache.

* Update write_buildinfo_file method signature to distinguish between
  the spec prefix and the working directory for the binary cache
  package.
2017-12-01 11:15:16 -08:00
Adam J. Stewart
0ffd7f8918 Remove reference to deprecated spack md5 command (#6537) 2017-12-01 14:31:40 +01:00
Massimiliano Culpo
23b1108451 gpg creation: added suggestion on how to set-up rngd (#6483) 2017-11-30 10:51:55 -08:00
Massimiliano Culpo
f7c0e24f0a 'spack install': make conflict messages as verbose as 'spack spec' (#6436)
"spack spec" was providing helpful error information about conflicts
that was missing from "spack install", this updates "spack install"
to provide the same information.
2017-11-30 10:41:24 -08:00
David Lukes
27b929bfe2 Improve docstring of spack.directives.extend (#6485)
The original docstring had confusing wording re: what is going to
symlinked and where when using the `extend` directive, and how exactly
the symlinking is performed (not automatically on install, but using
`spack activate`). See #5559.
2017-11-29 14:30:42 -08:00
Adam J. Stewart
e01a16b992 Remove spack md5 and sha256 commands (#6428) 2017-11-28 13:41:46 -08:00
healther
dc8f587b61 add path to package.py in case of a syntax error (#6458) 2017-11-28 13:32:21 -08:00
Massimiliano Culpo
f6ead27b5b spack spec: don't show normalize + no hash for non concrete specs (#6417)
Showing "Normalize" on output doesn't give users additional information,
as this step is essentially an implementation detail of concretization.
This PR skips it and shows just the input spec and the concretized one.

Printing partial hashes for input spec has been disabled.
2017-11-28 09:03:32 -08:00
Adam J. Stewart
257d968259 Use long flag in spack help message (#6429) 2017-11-26 06:14:47 -07:00
Michael Kuhn
5bbbfe9446 Introduce virtual dependency pkgconfig (#5198)
There are two providers, pkgconf and pkg-config, with the former being
the default provider.
2017-11-23 08:05:38 -07:00
Adam J. Stewart
1b3b262776 Remove spack extensions from list of known issues (#6405) 2017-11-22 02:31:56 +01:00
Denis Davydov
34da07db9b dealii: add cuda_arch variant via CudaPackage (#6070) 2017-11-19 12:39:13 -07:00
Christoph Junghans
7da8a02cbf
git grep --files-with-matches github.com/llnl/spack | xargs sed -i '/github.com/s@llnl/spack@spack/spack@' (#6329) 2017-11-15 16:46:39 -07:00
scheibelp
b9be9519e8
Fix truncated error messages in directives (#6320)
Fixes #6299

Error messages in 'directives' were split across multiple lines and not
properly concatenated, which led to truncated messages.
2017-11-15 10:33:59 -08:00
Todd Gamblin
9c93c4a42b
Update tutorial slide links. (#6276) 2017-11-13 07:52:43 -07:00
becker33
9b80f2fd38 basics tutorial: output updated (#6267)
* basics tutorial: output updated through gcc

* finished update for basics tutorial

* missed two lines

* doc error fix
2017-11-13 00:12:23 -07:00
Todd Gamblin
24d636eb30
Updates to build systems tutorial (#6273)
* Get rid of period in command

* formatting

* fix header

* Change GNU Make to Make

* Add variants
2017-11-13 00:11:55 -07:00
Mario Melara
2f1cbb5caa Add build systems tutorial for SC17 (#6125)
* First draft for SC17 build systems portion

Added tutorial_buildsystems.rst file as well as example files under
the tutorial/ directory.

* Remove floating `

* Add requested changes, and examples of subclasses

Added in the requested changes to the documentation. Also added in
information about the subclasses and the defaults that they provide.
Also fixed some phrasing issues, formatting and punctuation.

* Flake8 fixes and new files for classes

Made flake8 fixes to pass tests and also added files to demonstrate code
in the classes.

* Minor edits

Edits in formatting and made some sentence changes

* Flake8 fixes

More flake8 fixes

* Flake8 fix

* Change section order on tutorial and minor edits

Placed the section at the appropriate section for the tutorial and then
added some minor edits that were requested.

* Add requested changes and more details

Added more details to Cmake, Makefile and Python Packages.

* Fixed formatting and minor edits

* Fix doc build error
2017-11-12 23:24:18 -07:00
Adam J. Stewart
9db7eaade8 Last minute edits to the Configuration Tutorial (#6271) 2017-11-12 23:14:44 -07:00
becker33
b77acd0896 Add configuration tutorial for SC17 (#6141) 2017-11-12 20:12:57 -07:00
Matthew LeGendre
265c30b943 Update packaging tutorial (#6270)
* Allow types and 'any' in variant definitions.

- Previously variant values had to be a tuple or a callable predicate.

- This allows 'any' as shorthand for `lambda x: True` and type objects
  as shorthand for "any value of this type".

- Makes variant definitions more readable, keeps lambdas out of
  packages for common cases.

* Update packaging tutorial

* Fix bad file reference in packaging tutorial
2017-11-12 20:09:12 -07:00
becker33
b09341d861 binary packages: do post install hooks (#6269) 2017-11-12 17:57:10 -07:00
Massimiliano Culpo
1ab703448d SC17: advanced packaging tutorial (#6148)
* First draft of the advanced packaging tutorial

* advanced packaging tutorial: improved phrasing

Thanks Denis and Hartzell!

* Fixed typos + reworded a couple of sentences
2017-11-12 00:27:57 -08:00
Massimiliano Culpo
fe889124eb SC17: reworked module file tutorial section (#5657)
* Reworked module file tutorial section

First draft for the SC17 update. This includes:

 - adding an introduction on module files + Spack's module
   generation blueprints
 - adding a set-up section and provide a docker image for easy set-up
 - updating all the relevant snippets
 - extending a bit some of the concepts that were already touched

* Added reference to #5582 + committed Dockerfiles

Also fixed a couple of typos spotted by Denis.

* module file tutorial: added section on template customization

* module file tutorial: fixed minor typos + rephrased a sentence

* module file tutorial: made explicit that Docker image comes with software

* module file tutorial: improved phrasing and layout.

Thanks Hartzell!

* module file tutorial: added vim and nano to editors

* module file tutorial: fixed typo

* Fixed typos

Thanks Adam!

* module file tutorial: updated Dockerfile + minor changes in introduction
2017-11-12 00:27:20 -08:00
becker33
1008975bc0 Don't include build-only dependencies in build cache hash (#6262) 2017-11-11 20:54:17 -08:00
scheibelp
8c458a856f
Group flags and values separated by space (#6169)
Fixes #6154

For compiler options which set values using the syntax "-flag value"
(with a space between the flag and the flag's value) the flag and
value were treated as separate and reordered. This updates Spack's
logic to treat the flag and value as a single unit, even if there is
a space between them. It assumes that all flags are prefixed with
"-" and that all flag values are not.
2017-11-10 16:33:50 -08:00
Patrick Gartung
124b5fc296 deal with case where symbolic links are copied (#6178)
* deal with case where symbolic links are copied

* Suggested changes
2017-11-09 14:38:12 -08:00
Patrick Gartung
1484a94b1e spack buildcache: symlink and relative RPATH fixes (#6140)
* Skip rewriting files that are links (this also avoids issues with parsing
  the output of the 'file' command for symlinks)
* Fail rather than warn for several gpg signing issues (e.g. if there is no
  key available to sign with)
* Installation with 'buildcache install' only retrieves link and run
  dependencies (this matches 'buildcache create' which only creates tarballs
  of link/run dependencies)
* Don't rewrite RPATHs for a binary if the binary cached package was created
  with relative RPATHs
* Refactor relocate_binary to operate on multiple binaries (given as a
  collection of paths). This was likewise done for relocate_text and
  make_binary_relative
2017-11-09 10:53:34 -08:00
Todd Gamblin
3a0324fe1a
add artisanal handcrafted SVG Spack logo. (#6165)
- This isn't one of those autogenerated SVGs from a drawing program!

- This is a completely re-traced, minimalist SVG file with clearly
  delineated pieces so that your favorite renderer can draw a Spack logo
  at whatever resolution you want.

- Included versions with text, as well.
2017-11-06 22:42:16 -08:00
Johann Klähn
ac3a807f58 Fix spack view hardlink (#6130)
Fix a typo in "spack view hardlink" introduced in #5415
("os.hardlink" does not exist).
2017-11-06 19:19:27 -08:00
Michael Kuhn
ca73103dac Introduce static_to_shared_library function (#6092)
The static_to_shared_library function takes an existing static library
and produces a shared library based on it.
2017-11-06 17:21:46 -07:00
Axel Huebl
54bb28ccb0 Docs: MPI as Root (#6156)
New versions of OpenMPI need `--allow-run-as-root` for
running as root:
  http://www.open-mpi.de/doc/v2.0/man1/mpirun.1.php#toc22
2017-11-06 13:03:46 -08:00
scheibelp
31c5467f56
Add back help placeholder for "spack load" (#6127)
Fixes #6126

#3183 removed the print_help function from the "modules" module.
This adds it back so that if a user invokes 'spack load foo' without
having sourced an environment setup script, they will be prompted
to do so. This also improves the placeholder message to tell the 
user to invoke 'spack' as shell function rather than as an executable.
2017-11-06 11:03:36 -08:00
Todd Gamblin
05fa302655
Replace github.com/llnl/spack with github.com/spack/spack (#6142)
We moved to a new GitHub org! Now make the code and docs reflect that.
2017-11-04 17:08:04 -07:00
Johann Klähn
3fc8a71afb Fix restaging of resources (#5681)
Part of the resource staging process is to place downloaded/expanded
files in the root stage. This was not happening when a resource stage
was restaged.
2017-11-03 11:29:43 -07:00
Todd Gamblin
12f0725e9f spack fetch: don't fetch externals. (#6124)
Fixes #6123

spack fetch shouldn't attempt to fetch external deps when invoked
with --dependencies.
2017-11-03 10:15:15 -07:00
Michael Kuhn
bd7d61325f Configure user for mock Git repository (#6128)
If user.useConfigOnly is set globally and no name or e-mail is
configured, the git_fetch tests fail.
2017-11-02 21:43:28 -07:00
Ben Boeckel
0f896e921f test_activations: also test perl activations 2017-11-02 18:45:40 -07:00
Peter Scheibel
3a2a0c9ad4 test_activations: test Python's extension logic 2017-11-02 18:45:40 -07:00
Peter Scheibel
dde93c01cf spec: support a test prefix
This is used in tests to test real packages without actually building
and installing them.
2017-11-02 18:45:40 -07:00
Ben Boeckel
d5a3d9d20e view: test conflicting packages in views 2017-11-02 18:45:40 -07:00
Ben Boeckel
13b669de8e view: test that extension paths exist 2017-11-02 18:45:40 -07:00
Ben Boeckel
a06c6b0366 filesystem_view: reject packages with activations
If there are extensions that are globally activated, reject adding them
to a view. Those extensions should not be implicitly activated.
2017-11-02 18:45:40 -07:00
Ben Boeckel
26724688b1 view: test viewing external packages 2017-11-02 18:45:40 -07:00
Ben Boeckel
ea62347c46 view: add a test for extension activation 2017-11-02 18:45:40 -07:00
Ben Boeckel
4511d9d924 extensions: support only showing a subset of information 2017-11-02 18:45:40 -07:00
Ben Boeckel
b7ec870c3b extensions: support acting on a view
This allows extensions to be (de)activated and queried within a view
rather than only acting on the global installation.
2017-11-02 18:45:40 -07:00
Oliver Breitwieser
db529f5b61 view: use the FilesystemView abstraction for creating views 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
af42c24ef5 view: fix some docstrings for arguments 2017-11-02 18:45:40 -07:00
Ben Boeckel
9a39efd966 filesystem_view: do not link external packages 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
538d855e1b filesystem_view: add a class to handle a view via a Yaml description 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
21dc31a4a1 package: support removing dependencies when deactivating 2017-11-02 18:45:40 -07:00
Ben Boeckel
f50ddeed9f conftest: mock out spack.store.extensions as well 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
078f85a125 views: support querying view layouts as well
This abstracts out the layout in use between the global installations
and a specific view.
2017-11-02 18:45:40 -07:00
Oliver Breitwieser
00a893aa79 link_tree: support choosing the link function
This can be used to make hardlinks rather than symlinks.
2017-11-02 18:45:40 -07:00
Oliver Breitwieser
9024ddcf05 link_tree: support ignoring conflicts 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
20cd82dc56 directory_layout: add a YamlExtensionsLayout class
This uses a view to query extensions.
2017-11-02 18:45:40 -07:00
Oliver Breitwieser
94c0740a88 link_tree: only remove matching files when unmerging 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
b9e8402104 directory_layout: factor out an ExtensionsLayout class 2017-11-02 18:45:40 -07:00
Ben Boeckel
650ca7db9e extensions: add an installed_extensions_for method 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
56bafdc282 database: rename installed_extensions_for
Views support activating packages, so rename the method because it will
soon query what is activated versus what is installed.
2017-11-02 18:45:40 -07:00
Oliver Breitwieser
70d3558596 package: support verbosity when activating 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
af0cf2d3c6 package: rename activated to is_activated
This allows the activation code to be later given parameters.
2017-11-02 18:45:40 -07:00
Ben Boeckel
f31b47c353 cmd/test: fix a typo in a comment 2017-11-02 18:45:40 -07:00
Ben Boeckel
6f9bf197a5 spec_yaml: fix a typo 2017-11-02 18:45:40 -07:00
Oliver Breitwieser
28cc077ef6 view: fix a typo 2017-11-02 18:45:40 -07:00
Ben Boeckel
76305038ef determine full compiler version for gcc-7
Fixes #5778.

Spack uses 'gcc -dumpversion' to determine the full version of gcc.
'gcc -dumpversion' no longer gives the full version on gcc 7.2.0.
'gcc -dumpfullversion' is required instead. This PR detects when
'gcc -dumpversion' gives a truncated version of '7' and in that
case retrieves the full version with 'gcc -dumpfullversion'
2017-11-02 18:44:10 -07:00
Todd Gamblin
c96f2e50a6
Only use XCode clang wrappers for packages that set use_xcode=True (#6077) 2017-11-02 09:19:23 -07:00
scheibelp
3eb59f6932
update filename used for cc wrapper invocation debug log (#5837)
The name of the debug log written by the cc compiler wrapper was given
by Spec.short_spec, which includes the architecture. Somewhere along
the line Spec.format started adding spaces around the architecture
property so the filename started including spaces; the cc wrapper
script appears to ignore this, so files like spack-cc-bzip2-....in.log
(which record the wrapped compiler invocations) were not being
generated. This uses a different format string from the spec to
generate the wrapper log file names (which does not include spaces).
2017-11-01 20:11:00 -07:00
scheibelp
60a485591c Fix user specs which include already-installed packages (#5939)
* when a user-provided spec refers to an already-installed package, packages with patches applied were causing validation errors based on the recorded variants in the package's class

* avoid checks on all reserved variants (not just 'patches')
2017-11-01 18:44:31 -07:00
scheibelp
e5b8312de3 Auto install available pre-built packages from binary cache (#5242)
* basic functionality to install spec from a binary cache when it's available; this spiders each cache for each package and could likely be more efficient by caching the results of the first check

* add spec to db after installing from binary cache

* cache (in memory) spec listings retrieved from binary caches

* print a warning vs. failing when no mirrors are configured to retrieve pre-built Spack packages

* make automatic retrieval of pre-built spack packages from mirrors optional

* no code was using the links stored in the dictionary returned by get_specs, so this simplifies the logic to return only a set of specs

* print package prefix after installing from binary cache

* provide more information to user on install progress
2017-10-30 14:16:46 -07:00
Sergey Kosukhin
5ebddcd5e3 Bugfix: from_list_url(). (#5780)
This fixes a bug in from_list_url where it was referring to a method
which no longer exists. This also adds a test for the from_list_url
function.
2017-10-27 17:41:41 -07:00
Ben Boeckel
bd6378a6d2 Package.extends: update semantics when package isn't concrete (#5600)
This updates the logic for Package.extends so that if the spec
associated with the package is not concrete, it will report true if
the package *could extend* the given spec; generally speaking a
package could extend a spec as long as none of the details associated
with its extendee spec conflict with the given spec. When the spec
associated with the package is concrete, this function will only
report whether the package *does extend* the given spec. When both
the specs are concrete, the semantics are the same as before.
2017-10-26 13:12:32 -07:00
Patrick Gartung
8e47b17a4d Buildcache: symlinks, externals, & install-checking (#5894)
* When creating a tar of a package for a build cache, symlinks are
  preserved (the corresponding path in the newly-created tarfile will
  be a symlink rather than a copy of the file)
* Dont add external packages to a build cache
* When installing from binary cache, don't create install prefix until
  verification is complete
2017-10-26 11:06:59 -07:00
Ondřej Čertík
aa750f12de Colorize "Installing pkg_name" (#5950)
Now one can quickly visually see in the terminal which packages are installed
and where each package begins and ends in the log.
2017-10-26 00:06:56 +02:00
scheibelp
dcdd16b35e Check for namespace-qualified packages in repo_for_pkg (#5787)
* Fixes #5754

Previously when RepoPath.repo_for_pkg was invoked with a string,
it did not check if the string included a namespace. Any
namespace-qualified package provided as a string would not be found
(at which point the behavior was to return the highest-precedence
repository).

* handle nested namespaces for packages specified as strings in repo_for_pkg
* add preliminary repository tests
* add test which replicates #5754
* refactor repo tests with fixtures
* define repo_path equivalent at test-level scope for repo tests
* add tests for unknown namespace/package
* rename fixture function (no longer prefixed with 'test_')
2017-10-25 21:08:03 +02:00
George Hartzell
b43064190c Specify base branch for flake8 comparison (#5796)
Internally we work against a branch named 'llnl/develop', which
mirrors the public repository's `develop` branch.

It's useful to be able to run flake8 on our changes, using
`llnl/develop` as the base branch instead of `develop`.

Internally the flake8 subcommand generates the list of changes files
using a hardcoded range of `develop...`.

This makes the base of that range a command line option, with a
default of `develop`.

That lets us do this:

```
spack flake8 --base llnl/develop
```

which uses a range of `llnl/develop...`.
2017-10-25 14:30:22 +02:00
Massimiliano Culpo
8b7d2d0f24 'spack install' can overwrite an existing installation (#5384)
'spack install' can now reinstall a spec even if it has dependents, via
the --overwrite option. This option moves the current installation in a
temporary directory. If the reinstallation is successful the temporary
is removed, otherwise a rollback is performed.
2017-10-24 12:32:30 -07:00
Todd Gamblin
3f68cc2ba7 Fix bug in spack flake8 when no files differ from develop (#5898) 2017-10-24 11:29:18 +02:00
Todd Gamblin
6b5ca38723 do not use 'l' as a variable name, to appease new flake8 version
- new E741 flake8 checks disallow 'l', 'O', and 'I' as variable names

- rework parts of the code that use this, to be compliant

- we could add exceptions for this, but we're trying to mostly keep up
  with PEP8 and we already have more than a few exceptions.
2017-10-24 10:05:36 +02:00
Todd Gamblin
5449884b2e Fix bare 'except:' to placate errors in new flake8 version.
- fixes E722 errors from latest version of flake8
- requires us to not use 'bare except:' and catch BaseException instead
2017-10-24 10:05:36 +02:00
Todd Gamblin
b98fc48273 log tests use tmpdir properly 2017-10-24 10:05:36 +02:00
Todd Gamblin
0bb1eb32f2 fix bugs found with stricter flake8 rules
- When you don't use wildcards, flake8 will find places where you used an
  undefined name.

- This commit has all the bugfixes resulting from this static check.
2017-10-24 10:05:36 +02:00
Todd Gamblin
7dd79094b0 remove wildcards from make spack core and packages
- This removes all wildcard imports EXCEPT `from spack import *` in packages
2017-10-24 10:05:36 +02:00
Todd Gamblin
7757ebc0bc flake8: no wildcards in core; only import * from spack in packages
There are now separate flake8 configs for core vs. packages:
- core has a smaller set of flake8 exceptions
- packages allow `from spack import *` and module globals
- Allows core to take advantage of static checking for undefined names
- Allows packages to keep using Spack tricks like `from spack import *`
  and dependencies setting globals for dependents.
2017-10-24 10:05:36 +02:00
Todd Gamblin
78e22940c2 add --all option to spack flake8
- `-a`/`--all` causes flake8 to run on all files rather than just
  different ones.
2017-10-24 10:05:36 +02:00
scheibelp
e660611a87 package: remove bare except statements (#5896) 2017-10-23 19:28:53 -07:00
Massimiliano Culpo
3e7680e24a getting_started.rst: removed tip suggesting the use of 2 Spack instances (#4061) 2017-10-20 21:09:08 -07:00
Massimiliano Culpo
3afc6770f0 module-type argument defaults to 'tcl' instead of every known type (#5751)
fixes #5721

This is to solve the fact that lmod needs to be configured
by the user (to specify a core compiler).
2017-10-20 20:41:25 -07:00
Patrick Gartung
a8ee2a912b buildcache command updates (#5860)
* Add better spec matching to spack buildcache

* skip download of spec.yaml and keys if they exist

* autopep8
2017-10-20 20:33:01 -07:00
Adam J. Stewart
2570dfb4d9 Update Getting Started docs to clarify that full Xcode suite is required for qt (#4958)
* Update Getting Started docs to clarify that full Xcode suite is required for qt

* Better error message when only the command-line tools are installed
2017-10-20 17:31:12 -07:00
Todd Gamblin
4dac4736e7 spack blame can take a path to a file in the Spack repo (#5793)
- Previously `spack blame` only worked for package names; now it works
  for paths as well, so developers can use it on core spack files.
2017-10-19 14:27:15 -07:00
Adam J. Stewart
a1c19f8389 Allow documentation to build in Python 3 (#5736) 2017-10-19 00:26:04 -07:00
George Hartzell
464e558aea filter_file, don't remove absent backup file (#5733)
I'm tracking down a problem with the perl package that's been
generating this error:

```
OSError: OSError: [Errno 2] No such file or directory: '/blah/blah/blah/lib/5.24.1/x86_64-linux/Config.pm~'
```

The real problem is upstream, but it's being masked by an exception
raised in `filter_file`s finally block.

In my case, `backup` is `False`.

The backup is created around line 127, the `re.sub()` calls
fails (working on that), the `except` block fires and moves the backup
file back, then the finally block tries to remove the non-existent
backup file.

This change just avoids trying to remove the non-existent file.
2017-10-17 11:26:05 -07:00
Michael F. Herbst
1952a92820 Minor typos and corections (#5789)
- The shell script uses arrays and hence only works on sophisticated shells and not the default `sh`. For clarity the shebang `#!/bin/bash` has been used instead.
2017-10-17 01:36:03 -07:00
Todd Gamblin
100fb1e6ee Exercise more code paths in the git fetcher.
- This fakes out GitFetchStrategy to try code paths for different git
  versions.

- This allows us to test code paths for old versions using a newer git
  version.
2017-10-17 01:26:31 -07:00
Todd Gamblin
d14816cbaf Spack tests no longer clutter var/spack/stage
- Tests use a session-scoped mock stage directory so as not to interfere
  with the real install.

- Every test is forced to clean up after itself with an additional check.
  We now automatically assert that no new files have been added to
  `spack.stage_path` during each test.

  - This means that tests that fail installs now need to clean up their
    stages, but in all other cases the check is useful.
2017-10-17 01:26:31 -07:00
Todd Gamblin
44bebd7a8f `Package.stage` no longer implicitly makes stage directory
- Be explicit about stage creation during the install process.

- This avoids accidental creation of stages
  - e.g., during `spack install --fake`, stages were erroneously recreated
    after being destroyed
2017-10-17 01:26:31 -07:00
Todd Gamblin
894a1a73a4 Spack tests no longer use the var/spack/stage directory.
- This prevents the main spack install from being clusttered by
  invocations of `spack test`.

- This uses a session-scoped stage fixture to ensure tests don't
  interfere.
2017-10-17 01:26:31 -07:00
Todd Gamblin
c14f2dc7b4 Spack core and tests no longer use os.chdir()
- Spack's core package interface was previously overly stateful, in that
  calling methods like `do_stage()` could change your working directory.

- This removes Stage's `chdir` and `chdir_to_source` methods and replaces
  their usages with `with working_dir(stage.path)` and `with
  working_dir(stage.source_path)`, respectively.  These ensure the
  original working directory is preserved.

- This not only makes the API more usable, it makes the tests more
  deterministic, as previously a test could leave the current working
  directory in a bad state and cause subsequent tests to fail
  mysteriously.
2017-10-17 01:26:31 -07:00
Adam J. Stewart
6f9036c858 Ensure that FileList makes it into the documentation (#5739) 2017-10-14 06:20:39 +02:00
Todd Gamblin
1ba4c1af63 Clean up logic in Sepc.satisfies_dependencies()
- This puts in a fast path when there are no dependencies to satisfy.

- Reduces time spent to concretize r-rminer by 2x, down to 5s from 10s
2017-10-13 19:46:57 -07:00
Todd Gamblin
afc99ca516 Remove single-root assertion from Spec.root
- Assertion would search for root through all possible paths.
  - It's also really slow.

- This isn't needed anymore. We're pretty good at ensuring single-rooted
  DAGs, and this assertion has never been thrown.

- This shaves another 6 seconds off r-rminer concretization
2017-10-13 19:46:57 -07:00
Todd Gamblin
3f091fb6db Use list instead of OrderedDict to find virtual/external candidates
- This reduces concretization time for r-rminer from over 1 minute to
  only 16 seconds.
  - OrderedDict ends up taking a *lot* of time to compare larger specs.

- An OrderedDict isn't actually needed here.  It's actually not possible
  to find duplicates, and we end up sorting the contents of the
  OrderedDict anyway.
2017-10-13 19:46:57 -07:00
Todd Gamblin
f58c503091 avoid creating lots of dictionaries in traverse_edges()
- This is an optimization to the way traverse_edges iterates over
  successors.

- Previous version called dependencies_dict(), which involved a lot of
  redundant work (creating dicts and calling caonical_deptype)
2017-10-13 19:46:57 -07:00
Todd Gamblin
9ccaf6474d Don't redundantly check for providers of non-virtuals. 2017-10-13 19:46:57 -07:00
Todd Gamblin
55f85f2307 Cache compilers parsed from config files
- Spack ends up constructing compilers frequently from YAML data.

- This caches the result of parsing the compiler config

- The logic in compilers/__init__.py could use a bigger cleanup, but this
  makes concretization much faster for now.

- on macOS, this also ensures that xcrun is called only twice, as opposed
  to every time a new compiler object is constructed.
2017-10-13 19:46:57 -07:00
Patrick Gartung
2e1aa0a5e9 This fixes a bug in creating rpaths relative to $ORIGIN on linux. (#5726)
* This fixes a bug in creating rpaths relative to  on linux.

* fix for macOS as well

* found in testing

* flake8

* fix testing on macOS

* flake8
2017-10-13 19:13:07 -07:00
Axel Huebl
e17765db39 Docker Workflow (#5582)
This adds a workflow section on how to use spack on Docker.

It provides an example on the best-practices I collected over the
last months and circumvents the common pitfalls I tapped in.

Works with MPI, CUDA, Modules, execution as root, etc.

Background: Developed initially for PIConGPU.
2017-10-13 12:17:20 -07:00
Denis Davydov
1b53e82348 various fixes for macOS high sierra (#5647)
* various fixes for macOS high sierra

* add macOS_version() helper function

* flake8 fixes

* update oce and trilinos

* fix bison
2017-10-12 11:41:57 -07:00
David Hows
0dad5b3ee5 Make --trusted default when running spack gpg list (#5678)
* Make --trusted default when running spack gpg list

Currently running `spack gpg list` with no arguments returns nothing. You must supply either the `--trusted` or the `--signing` options. The idea here is to return some initial data to the user when the command is run. The alternative is to return an error, telling the user to select one of the two options.

* Add an extra test case for the empty list command

Fixes the issue with code coverage
2017-10-12 11:14:48 -07:00
Todd Gamblin
65b38764ae Speed up concretization (#5716)
This isn't a rework of the concretizer but it speeds things up a LOT.

The main culprits were:
  1. Variant code, `provider_index`, and `concretize.py` were calling
     `spec.package` when they could use `spec.package_class`
    - `spec.package` looks up a package instance by `Spec`, which requires a
      (fast-ish but not that fast) DAG compare.
    - `spec.package_class` just looks up the package's class by name, and you
        should use this when all you need is metadata (most of the time).
    - not really clear that the current way packages are looked up is
      necessary -- we can consider refactoring that in the future.

  2. `Repository.repo_for_pkg` parses a `str` argument into a `Spec` when
     called with one, via `@_autospec`, but this is not needed.
     - Add some faster code to handle strings directly and avoid parsing

This speeds up concretization 3-9x in my limited tests.  Still not super
fast but much more bearable:

Before:
  - `spack spec xsdk` took 33.6s
  - `spack spec dealii` took 1m39s

After:
  - `spack spec xsdk` takes 6.8s
  - `spack spec dealii` takes 10.8s
2017-10-12 09:52:38 -07:00
Todd Gamblin
b5e136b729 Better install output (#5714)
* Do not call setup_package for fake installs

- setup package could fail if ``setup_dependent_environment`` or other
  routines expected to use executables from dependencies

- xpetsc and boost try to get python config variables in
  `setup_dependent_package`; this would cause them not to be
  fake-installable

* Remove vestigial deptype_query argument to Spec.traverse()

- The `deptype_query` argument isn't used anymore -- it's only passed
  around and causes confusion when calling traverse.

- Get rid of it and just keep the `deptypes` argument

* Don't print redundant messages when installing dependencies

- `do_install()` was originally depth-first recursive, and printed "<pkg>
  already installed in ..." multiple times for packages as recursive
  calls encountered them.

- For much cleaner output, use spec.traverse(order='post') to install
  dependencies instead
2017-10-12 00:49:59 -07:00
Christoph Junghans
cb7628c9a4 compilers/clang: add flang (#5503)
* compilers/clang: add flang

* Update clang.py
2017-10-10 13:52:10 -07:00
George Hartzell
0d1c36e559 Add package for aspell and ass't dictionaries (#3890)
* Add package for aspell and ass't dictionaries

Add a package definition for aspell.

Add a handful of dictionaries to convince myself that the support for
a bunch of dictionaries works.

* Flake8 cleanup

* Use six's version of urlparse

`urlparse` is not python3 friendly.  This works around it (stolen from
`.../cmd/md5.py`).

* Fix incorrect trimming regexp

* Clean up dictionary build

- more parsimonious use of `which` (`make()` has already been made)
- use `sh` instead of `bash`

* Use a helper method to generate info for variants

I figured out my issues with static methods.  I *think* that it this
is pythonic.

* Convert aspell to an extendable package

Convert aspell to be extendable and rework the dictionaries to be
extensions.

As it stands, there's a great deal of cut and paste in the
dictionaries, I'll abstract that out next.

The {de,}activate methods copy a great deal of code out of
package.py.  Perhaps there's a better way....

* Create AspellDictPackage and use it for the dictionaries

Reduce the repeated code, pull it into a base class.

I'm confused about why 'from spack import *' wasn't more useful in the
base class.

* Oops, -de & -es should be AspellDictPackages too

* Typo: pakcage -> package

* Address some commentary

* Update copyright dates, 2016->2017
2017-10-09 14:14:19 -07:00
becker33
5d13f236b4 Fix setup for changes to dirty flag (#5592)
* Pass dirty arg through setup to setup_package
2017-10-09 10:01:55 -07:00
scheibelp
b08d457dfd Don't check package.installed in _mark_concrete if value=True (#5634)
* spec and spec.package.spec can refer to different objects in the
database. When these two instances of spec differ in terms of
the value of the 'concrete' property, Spec._mark_concrete can
fail when checking Spec.package.installed (which requires
package.spec to be concrete). This skips the check for
spec.package.installed when _mark_concrete is called with
'True' (in other words, when the database is marking all specs
as being concrete).

* add test to confirm this fixes #5293
2017-10-06 14:23:28 -07:00
Jimmy Tang
c6e7fb25a4 Fix formatting typo (#5622) 2017-10-05 10:58:51 -07:00
scheibelp
6243a28da1 Don't change properties on already-installed packages (#5580)
* edits to address issues where spack concretization attempts to set properties on already-installed specs

* most added checks only need to check if the spec is concrete; they dont also need to check if the package is installed

* add test to ensure that patches are not applied to an installed spec

* add test to ensure that an error is detected when a dependent requests a dependency constraint which conflicts with a requested installed dependency
2017-10-05 10:33:04 -07:00
becker33
04a4ac68d5 Identify the flag handlers feature as beta (#5609)
The flag-handling logic added in #4421 may change semantics, so this
commit adds a warning to the documentation for this feature.
2017-10-04 18:32:13 -07:00
becker33
328ab328be Fix module loads (#5599)
Fixes #5455

All methods within setup_package use an EnvironmentModifications object
to control the environment. Those modifications are applied at the end
of setup_package. Module loads for the build environment need to be
done after the rest of the environment modifications are applied, as
otherwise Spack may unset variables set by those modules (for example
LD_LIBRARY_PATH).
2017-10-04 18:25:55 -07:00
Massimiliano Culpo
3556eaae7e module files: restricted token expansion + case sensitivity (#5474)
closes #2884
closes #4684

In #1848 we decided to use `Spec.format` to expand certain tokens in
the module file naming scheme or in the environment variable name.
Not all the tokens that are allowed in `Spec.format` make sense in
module file generation. This PR restricts the set of tokens that can
be used, and adds tests to check that the intended behavior is respected.

Additionally, the names of environment variables set/modified by module
files were, up to now, always uppercase. There are packages though that
require case sensitive variable names to honor certain behaviors (e.g.
OpenMPI). This PR restricts the uppercase transformation in variable
names to `Spec.format` tokens.
2017-10-04 18:14:06 -07:00
scheibelp
395000c385 spec.patches: fix dictionary reference (#5608)
This fixes a loop that was iterating through the keys of a dictionary
when it was intending to use the values.
2017-10-04 17:14:58 -07:00
Massimiliano Culpo
5fa1191d17 Hotfix: maintain patch order while fixing hash
fixes #5587

In trying to preserve patch ordering, #5476 made equality inconsistent
for the added 'patches' variant. This commit maintains the original
weak ordering of patch applications while preserving consistency of
comparisons. The ordering DOES NOT enter the hashing mechanism. It's
supposed to be a hotfix, while we think of a cleaner and more-permanent
solution.
2017-10-04 11:39:25 -07:00
scheibelp
f53be46186 wrap generator with collection to avoid exhausting it with single iteration (#5586) 2017-10-03 16:47:07 -07:00
Christoph Junghans
d22ee8f993 patch: add workdir option (#5501)
* patch: add working_dir option
* added documentation
2017-10-02 22:56:43 -07:00
Todd Gamblin
29ca18e348 Port CTest's log scraping logic to Spack (#5561)
- This steals the magic regular expressions that CTest uses to parse log
  files and addds them to Spack.  See here:

  https://github.com/Kitware/CMake/blob/master/Source/CTest/cmCTestBuildHandler.cxx

  These are BSD licensed, so the port is in `externa/ctest_log_parser.py`

- We currently use these to do better filtering of errors from build
  output.  Plan is to use them to generate good CDash output.
2017-09-30 22:39:21 -07:00
Todd Gamblin
8648e2cda5 Add testing for spack blame; refactor llnl.util tests 2017-09-30 16:31:56 -07:00
Todd Gamblin
41a2652ef2 Add 'spack blame' command: shows contributors to packages
`spack blame` prints out the contributors to a package.

By modification time:

```
$ spack blame --time llvm
LAST_COMMIT    LINES  %      AUTHOR               EMAIL
3 days ago     2      0.6    Andrey Prokopenko    <andrey.prok@gmail.com>
3 weeks ago    125    34.7   Massimiliano Culpo   <massimiliano.culpo@epfl.ch>
3 weeks ago    3      0.8    Peter Scheibel       <scheibel1@llnl.gov>
2 months ago   21     5.8    Adam J. Stewart      <ajstewart426@gmail.com>
2 months ago   1      0.3    Gregory Becker       <becker33@llnl.gov>
3 months ago   116    32.2   Todd Gamblin         <tgamblin@llnl.gov>
5 months ago   2      0.6    Jimmy Tang           <jcftang@gmail.com>
5 months ago   6      1.7    Jean-Paul Pelteret   <jppelteret@gmail.com>
7 months ago   65     18.1   Tom Scogland         <tscogland@llnl.gov>
11 months ago  13     3.6    Kelly (KT) Thompson  <kgt@lanl.gov>
a year ago     1      0.3    Scott Pakin          <pakin@lanl.gov>
a year ago     3      0.8    Erik Schnetter       <schnetter@gmail.com>
3 years ago    2      0.6    David Beckingsale    <davidbeckingsale@gmail.com>

3 days ago     360    100.0
```

Or by percent contribution:

```
$ spack blame --percent llvm
LAST_COMMIT    LINES  %      AUTHOR               EMAIL
3 weeks ago    125    34.7   Massimiliano Culpo   <massimiliano.culpo@epfl.ch>
3 months ago   116    32.2   Todd Gamblin         <tgamblin@llnl.gov>
7 months ago   65     18.1   Tom Scogland         <tscogland@llnl.gov>
2 months ago   21     5.8    Adam J. Stewart      <ajstewart426@gmail.com>
11 months ago  13     3.6    Kelly (KT) Thompson  <kgt@lanl.gov>
5 months ago   6      1.7    Jean-Paul Pelteret   <jppelteret@gmail.com>
3 weeks ago    3      0.8    Peter Scheibel       <scheibel1@llnl.gov>
a year ago     3      0.8    Erik Schnetter       <schnetter@gmail.com>
3 years ago    2      0.6    David Beckingsale    <davidbeckingsale@gmail.com>
3 days ago     2      0.6    Andrey Prokopenko    <andrey.prok@gmail.com>
5 months ago   2      0.6    Jimmy Tang           <jcftang@gmail.com>
2 months ago   1      0.3    Gregory Becker       <becker33@llnl.gov>
a year ago     1      0.3    Scott Pakin          <pakin@lanl.gov>

3 days ago     360    100.0
```
2017-09-30 16:31:56 -07:00
George Hartzell
46d5901770 Typo: file -> directory (#5560)
Mirrors are directories (that use `file://` URLS, not files.
2017-09-30 14:32:07 -07:00
Todd Gamblin
96d2488e0c Documentation for dependency patching. 2017-09-30 02:06:59 -07:00
Todd Gamblin
4f8c7d57eb Patches are hashed with specs, and can be associated with dependencies.
- A package can depend on a special patched version of its dependencies.

  - The `Spec` YAML (and therefore the hash) now includes the sha256 of
    the patch in the `Spec` YAML, which changes its hash.

  - The special patched version will be built separately from a "vanilla"
    version of the same package.

  - This allows packages to maintain patches on their dependencies
    without affecting either the dependency package or its dependents.
    This could previously be accomplished with special variants, but
    having to add variants means the hash of the dependency changes
    frequently when it really doesn't need to.  This commit allows the
    hash to change *just* for dependencies that need patches.

  - Patching dependencies shouldn't be the common case, but some packages
    (qmcpack, hpctoolkit, openspeedshop) do this kind of thing and it
    makes the code structure mirror maintenance responsibilities.

- Note that this commit means that adding or changing a patch on a
  package will change its hash.  This is probably what *should* happen,
  but we haven't done it so far.

  - Only applies to `patch()` directives; `package.py` files (and their
    `patch()` functions) are not hashed, but we'd like to do that in the
    future.

- The interface looks like this: `depends_on()` can optionally take a
  patch directive or a list of them:

     depends_on(<spec>,
                patches=patch(..., when=<cond>),
                when=<cond>)
     # or
     depends_on(<spec>,
                patches=[patch(..., when=<cond>),
                         patch(..., when=<cond>)],
                when=<cond>)

- Previously, the `patch()` directive only took an `md5` parameter.  Now
  it only takes a `sha256` parameter.  We restrict this because we want
  to be consistent about which hash is used in the `Spec`.

- A side effect of hashing patches is that *compressed* patches fetched
  from URLs now need *two* checksums: one for the downloaded archive and
  one for the content of the patch itself.  Patches fetched uncompressed
  only need a checksum for the patch.  Rationale:

  - we include the content of the *patch* in the spec hash, as that is
    the checksum we can do consistently for patches included in Spack's
    source and patches fetched remotely, both compressed and
    uncompressed.

  - we *still* need the patch of the downloaded archive, because we want
    to verify the download *before* handing it off to tar, unzip, or
    another decompressor.  Not doing so is a security risk and leaves
    users exposed to any arbitrary code execution vulnerabilities in
    compression tools.
2017-09-30 02:06:59 -07:00
Todd Gamblin
14c141a410 add spack flake8 exception for long checksums 2017-09-30 02:06:59 -07:00
Todd Gamblin
bf610a379f Clean up exceptions and function names in directives.
- Functions returned by directives were all called `_execute`, which made
  reading stack traces hard because you couldn't tell what directive a
  frame came from.
  - renamed them all to `_execute_<directive>`

- Exceptions in directives were only really used in one or two places --
  get rid of the boilerplate init functions and let the callsite specify
  the message.
2017-09-30 02:06:59 -07:00
Todd Gamblin
94d85d842c Consolidate some web-spidering commands in spack.util.web
- move `spack.cmd.checksum.get_checksums` to `spack.util.web.spider_checksums`

- move `spack.error.NoNetworkError` to `spack.util.web.NoNetworkError` since
  it is only used there.
2017-09-30 02:06:59 -07:00
Todd Gamblin
2198a0e229 Disable duplicate cross-reference warnings in Sphinx. 2017-09-30 02:06:59 -07:00
Todd Gamblin
0e8bb9ec5e Refactor Package dependency metadata
- Previously, dependencies and dependency_types were stored as separate
  dicts on Package.
  - This means a package can only depend on another in one specific way,
    which is usually but not always true.
  - Prior code unioned dependency types statically across dependencies on
    the same package.

- New code stores dependency relationships as their own object, with a
  spec constraint and a set of dependency types per relationship.
  - Dependency types are now more precise
  - There is now room to add more information to dependency relationships.

- New Dependency class lives in dependency.py, along with deptype
  definitions that used to live in spack.spec.

Move deptype definitions to spack.dependency
2017-09-30 02:06:59 -07:00
Todd Gamblin
a3cb6b61ea Patch.apply() shouldn't affect working directory of caller. 2017-09-30 02:06:59 -07:00
Todd Gamblin
29ce69f3ed Only print "no patches needed" if there were no patches. 2017-09-30 02:06:59 -07:00
scheibelp
9e7faff6c9 Add test deptype (#5132)
* Add '--test=all' and '--test=root' options to test either the root or the root and all dependencies.
* add a test dependency type that is only used when --test is enabled.
* test dependencies are not added to the spec, but they are provided in the test environment.
2017-09-29 22:08:15 -07:00
Massimiliano Culpo
554937780b modules: specialized configure_options for external packages (#5543)
closes #5473

Prior to this PR we were not exiting early for external packages, which
caused the `configure_options` property of the contexts to fail with
e.g. a key error because the DAG gets truncated for them. More
importantly Spack configure options don't make any sense for externals.

Now we exit early, and leave a message in the module file clarifying
that this package has been installed outside of Spack.
2017-09-29 09:23:13 -07:00
Massimiliano Culpo
8864d145e9 module files: system paths are excluded from path inspection (#5460)
closes #5201

Currently, if a user sets an external package to have a prefix that is
one of the system paths (like '/usr') the module files that are
generated will prepend '/usr/bin' to 'PATH', etc. This is particularly
nasty at the time when a module file is unloaded, and e.g. paths like
'/usr/bin' will be discarded from PATH.

This PR solves the issue skipping system paths when a prefix inspection
is made to generate module files.
2017-09-25 09:47:50 -07:00
scheibelp
45a8c03bdf Prefer later versions of compilers by default (#5234)
* Prefer later versions of compilers by default

* update test to make it less fragile
2017-09-21 17:16:19 -07:00
Denis Davydov
234e00e84c update Blas/Lapack section of packaging guide (#5383) 2017-09-20 15:40:20 -07:00
Massimiliano Culpo
b1d129e681 Modulefiles generated with a template engine (#3183)
* Module files now are generated using a template engine refers #2902 #3173

jinja2 has been hooked into Spack.

The python module `modules.py` has been splitted into several modules
under the python package `spack/modules`. Unit tests stressing module
file generation have been refactored accordingly.

The module file generator for Lmod has been extended to multi-providers
and deeper hierarchies.

* Improved the support for templates in module files.

Added an entry in `config.yaml` (`template_dirs`) to list all the
directories where Spack could find templates for `jinja2`.

Module file generators have a simple override mechanism to override
template selection ('modules.yaml' beats 'package.py' beats 'default').

* Added jinja2 and MarkupSafe to vendored packages.

* Spec.concretize() sets mutual spec-package references

The correct place to set the mutual references between spec and package
objects at the end of concretization. After a call to concretize we
should now be ensured that spec is the same object as spec.package.spec.

Code in `build_environment.py` that was performing the same operation
has been turned into an assertion to be defensive on the new behavior.

* Improved code and data layout for modules and related tests.

Common fixtures related to module file generation have been extracted
in `conftest.py`. All the mock configurations for module files have been
extracted from python code and have been put into their own yaml file.

Added a `context_property` decorator for the template engine, to make
it easy to define dictionaries out of properties.

The default for `verbose` in `modules.yaml` is now False instead of True.

* Extendable module file contexts + short description from docstring

The contexts that are used in conjunction with `jinja2` templates to
generate module files can now be extended from package.py and
modules.yaml.

Module files generators now infer the short description from package.py
docstring (and as you may expect it's the first paragraph)

* 'module refresh' regenerates all modules by default

`module refresh` without `--module-type` specified tries to
regenerate all known module types. The same holds true for `module rm`

Configure options used at build time are extracted and written into the
module files where possible.

* Fixed python3 compatibility, tests for Lmod and Tcl.

Added test for exceptional paths of execution when generating Lmod
module files.

Fixed a few compatibility issues with python3.

Fixed a bug in Tcl with naming_scheme and autoload + unit tests

* Updated module file tutorial docs. Fixed a few typos in docstrings.

The reference section for module files has been reorganized. The idea is
to have only three topics at the highest level:

  - shell support + spack load/unload use/unuse
  - module file generation (a.k.a. APIs + modules.yaml)
  - module file maintenance (spack module refresh/rm)

Module file generation will cover the entries in modules.yaml

Also:

  - Licenses have been updated to include NOTICE and extended to 2017
  - docstrings have been reformatted according to Google style

* Removed redundant arguments to RPackage and WafPackage.

All the callbacks in `RPackage` and `WafPackage` that are not build
phases have been modified not to accept a `spec` and a `prefix`
argument. This permits to leverage the common `configure_args` signature
to insert by default the configuration arguments into the generated
module files. I think it's preferable to handling those packages
differently than `AutotoolsPackage`. Besides only one package seems
to override one of these methods.

* Fixed broken indentation + improved resiliency of refresh

Fixed broken indentation in `spack module refresh` (probably a rebase
gone silently wrong?). Filter the writers for blacklisted specs before
searching for name clashes. An error with a single writer will not
stop regeneration, but instead will print a warning and continue
the command.
2017-09-19 12:34:20 -07:00
Todd Gamblin
c7a789e2d6 Add --show-log-on-error option to spack install
- converted `log_path` and `env_path` to properties of PackageBase.

- InstallErrors in build_environment are now annotated with the package
  that caused them, in the 'pkg' attribute.

- Add `--show-log-on-error` option to `spack install` that catches
  InstallErrors and prints the log to stderr if it exists.

Note that adding a reference to the Pakcage allows a lot of stuff
currently handled by do_install() and build_environment to be handled
externally.
2017-09-17 18:52:25 -07:00
Todd Gamblin
742cd7f127 Remove redundant dest arguments in install.py 2017-09-17 18:52:25 -07:00
Todd Gamblin
eb0ea7697a Fix log error parsing bug introduced in c830eda0e (#5387)
- '\b' in regular expression needs to be in a raw string (r'\b')
- Regression test that would've caught this was unintentionally disabled

- This fixes the string and the test
2017-09-17 15:31:32 -07:00