Commit graph

3220 commits

Author SHA1 Message Date
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