Commit graph

2603 commits

Author SHA1 Message Date
Todd Gamblin
eb0ea7697a Fix log error parsing bug introduced in c830eda0e (#5387)
- '\b' in regular expression needs to be in a raw string (r'\b')
- Regression test that would've caught this was unintentionally disabled

- This fixes the string and the test
2017-09-17 15:31:32 -07:00
Pramod S Kumbhar
9aafe21b63 Filter system paths from CMAKE_PREFIX_PATH (#5385) 2017-09-17 14:47:16 +02:00
Kelly (KT) Thompson
0558fd640e Improve external package location detection algorithm. (#5145)
Also inspect `PATH` to help locate an external package and provide a test for
getting path from module's PATH.

Fixes #5141
2017-09-16 13:26:29 -07:00
Denis Davydov
f710a520e5 set CMAKE_PREFIX_PATH for cmake packages (#5364)
* cmake: set CMAKE_PREFIX_PATH

* cmake: use build/link immediate dependencies to construct CMAKE_PREFIX_PATH
2017-09-16 13:14:03 -07:00
Massimiliano Culpo
90d50a0cee Force reference consistency between Spec & Package
The correct place to set the mutual references between spec and
package objects is at the end of concretization. After a call to
concretize we should now be ensured that spec is the same object
as spec.package.spec.

Code in `build_environment.py` that was performing the same
operation has been turned into an assertion to be defensive on
the new behavior.
2017-09-12 12:10:31 -07:00
Todd Gamblin
f8f1c308c9 clean up concreteness detection
- Fixes bugs where concretization would fail due to an erroneously cached
  _concrete attribute.

- Ripped out a bunch of code in spec.py that isn't needed/valid anymore:
  - The various concrete() methods on different types of Specs would
    attempt to statically compute whether the Spec was concrete.
  - This dates back to when DAGs were simpler and there were no optional
    dependencies.  It's actually NOT possible to compute statically
    whether a Spec is concrete now.  The ONLY way you know is if it goes
    through concretization and is marked concrete once that completes.
  - This commit removes all simple concreteness checks and relies only on
    the _concrete attribute.  This should make thinking about
    concreteness simpler.

- Fixed a couple places where Specs need to be marked concrete explicitly.
  - Specs read from files and Specs that are destructively copied from
    concrete Specs now need to be marked concrete explicitly.
  - These spots may previously have "worked", but they were brittle and
    should be explcitly marked anyway.
2017-09-11 17:13:21 -07:00
Todd Gamblin
8c42aed9d5 bugfix: concrete dependencies are now copied properly.
- Dependencies in concrete specs did not previously have their cache
  fields (_concrete, _normal, etc.) preserved.

- _dup and _dup_deps weren't passing each other enough information to
  preserve concreteness properly, so only the root was properly
  preserved.

- cached concreteness is now preserved properly for the entire DAG, not
  just the root.

- added method docs.
2017-09-11 17:13:21 -07:00
Todd Gamblin
14cd73ed3c Simplify logic in Spec.normalize() 2017-09-11 17:13:21 -07:00
Todd Gamblin
de7e99f866 Preserve original stack trace for UnsatisfiableSpecError 2017-09-11 17:13:21 -07:00
Massimiliano Culpo
32117c22de 'with_or_without' accepts bool variants
Fixes #4112

This commit extends the support of the AutotoolsPackage methods
`with_or_without` and `enable_or_disable` to bool-valued variants. It
also defines for those functions a convenience short-cut if the
activation parameter is the prefix of a spec (like in
`--with-{pkg}={prefix}`).

This commit also includes:

* Updates to viennarna and adios accordingly: they have been modified to
  use `enable_or_disable` and `with_or_without`
* Improved docstrings in `autotools.py`. Raise `KeyError` if name is
  not a variant.
2017-09-11 16:20:49 -07:00
Adam J. Stewart
2eb8db1dd2 Fix name detection in HeaderList and LibraryList (#5118)
* Fix name detection in HeaderList and LibraryList

* Add support for CUDA header files
2017-09-09 22:22:56 +02:00
Matthew Scott Krafczyk
51828dd982 Bootstrap environment-modules
Renames the existing bootstrap command to 'clone'. Repurposes
'spack bootstrap' to install packages that are useful to the
operation of Spack (for now this is just environment-modules).
For bash and ksh users running setup-env.sh, if a Spack-installed
instance of environment-modules is detected and environment modules
and dotkit are not externally available, Spack will define the 
'module' command in the user's shell to use the environment-modules
built by Spack.
2017-09-08 10:15:06 -07:00
Rob Latham
4f57c9651a dump environment in sourceable form (#5301)
First, quote the environment variable values.  Second, export the
variables. sorry, this is bourn-shell syntax.  Happy to consider a
shell-independent way to do this, but spack is already using sh-like
"env=value"
2017-09-07 17:07:03 -10:00
Michael Kuhn
84ae7872d3 Update copyright notices for 2017 (#5295) 2017-09-06 17:44:16 -10:00
Massimiliano Culpo
d1a5857a03 Added support for querying by tags (#4786)
* Added support to query packages by tags.
    - The querying commands `spack list`, `spack find` and `spack info` have
      been modified to support querying by tags. Tests have been added to
      check that the feature is working correctly under what should be the
      most frequent use cases.

* Refactored Repo class to make insertion of new file caches easier.
    - Added the class FastPackageChecker. This class is a Mapping from
      package names to stat info, that gets memoized for faster access.

    - Extracted the creation of a ProviderIndex to its own factory function.

* Added a cache file for tags.

    - Following what was done for providers, a TagIndex class has been added.
      This class can serialize and deserialize objects from json. Repo and
      RepoPath have a new method 'packages_with_tags', that uses the TagIndex
      to compute a list of package names that have all the tags passed as
      arguments.

      On Ubuntu 14.04 the effect if the cache reduces the time for spack list
      from ~3sec. to ~0.3sec. after the cache has been built.

* Fixed colorization of `spack info`
2017-09-05 15:44:42 -10:00
Massimiliano Culpo
41d8981ab5 Fixed bug in spack env due to missing argument. (#5280)
This command broke after #5109. It was using the default value for the
"dirty" argument in `setup_package`. Now it adopts the same logic as
in `spack install`. Changed help for '--clean' and '--dirty'. 
Improved coverage of spack env.
2017-09-05 17:15:25 +02:00
scheibelp
5342ecf364 Set default cmake build_type to Release for llvm
Override CMake "build_type" variant to default to "Release" for
llvm package.
2017-09-01 10:32:04 -07:00
Massimiliano Culpo
01eba56e64 Patch directive allows non-archives (#5197)
- Don't expand downloaded patch file if it is not gzipped/tar'd/zipped/etc.
2017-08-31 14:06:03 -10:00
Denis Davydov
b5a9f8ead1 add optional maintainers property to package (#5230)
* add optional package maintainers
2017-08-30 10:56:24 -07:00
Andrey Prokopenko
c830eda0e6 Slightly better error matching when parsing spack logs (#5236) 2017-08-30 00:56:17 -07:00
alalazo
462de9847c Added unit tests for Spec.__init__ exceptional paths 2017-08-29 00:44:43 -07:00
alalazo
bf7b861554 Fixed bug in Spec._dup, updated docstring
The private method `Spec._dup` was missing a line (when setting compiler
flags the parent spec was not set to `self`). This resulted in
an inconsistent state of the duplicated Spec. This problem has been
fixed here. The docstring of `Spec._dup` has been updated.
2017-08-29 00:44:43 -07:00
Todd Gamblin
ee93993b07 Make Spec construction simpler (#5227) 2017-08-29 00:02:25 -07:00
Matthew Scott Krafczyk
c94933343a Add --show-full-compiler option to 'spack find'
When 'spack find' is invoked with the '--show-full-compiler' option,
the compiler flags and version are shown for each spec that is found.
2017-08-28 10:35:46 -07:00
Massimiliano Culpo
005b22aa8b Removed default value for 'dirty' function argument. (#5109)
This change is done to avoid inconsistencies during refactoring. The rationale is that functions at different levels in the call stack all define a default for the 'dirty' argument. This PR removes the default value for all the functions except the top-level one (`PackageBase.do_install`).

In this way not defining 'dirty' will result in an error, instead of the default value being used. This will reduce the risk of having an inconsistent behavior after a refactoring.
2017-08-25 20:40:37 -07:00
Michael Kuhn
91143e9db4 Fix copyright years in spack create template (#5203) 2017-08-25 20:38:56 -07:00
Michael Kuhn
b94711a54f Improve Ubuntu arch detection (#2649)
Ubuntu uses a YY.{04,10} release scheme, where YY.04 is not necessarily
binary-compatible with YY.10.
2017-08-25 17:30:40 -07:00
scheibelp
499617897b Link extra_rpaths from compilers.yaml at build time (#5211) 2017-08-25 11:02:36 -07:00
Gregory Lee
9a1fd166aa patch config.guess for any ppc64le arch (#5215) 2017-08-25 10:55:41 -07:00
Todd Gamblin
313771c734 Improve grammar in build log error message. (#5214)
- "1 error found" instead of "1 errors found"

- don't print any build log context if no errors were found; just refer
  the user to the build log.
2017-08-25 04:07:42 -07:00
Mark C. Miller
a0f39397c1 Add contributors link to Sphinx docs (#5213) 2017-08-25 02:57:44 -07:00
Sergey Kosukhin
fda3249c8b Respect --insecure (-k) flag when fetching list_url. (#5178)
* Respect --insecure when fetching list_url.
* Ensure support for Python 2.6, and that urlopen works for python versions prior 2.7.9 and between 3.0 and 3.4.3.
2017-08-25 02:15:46 -07:00
Ben Boeckel
0e7071befe test/gpg: init from the testing key directory
The old testing pattern set an attribute on the parser directly. Now
that there is a parsed flag, use it instead.
2017-08-24 16:17:35 -07:00
Ben Boeckel
f564b2abf7 gpg: add an argument for the import directory
This is hidden because it is only meant for use by the tests.
2017-08-24 16:17:35 -07:00
Massimiliano Culpo
5d7901b312 Improve Spec literals, add Spec.from_dict() (#5151)
* Simplified Spec.__init__ signature by removing the *dep_like argument.

The `*dep_like` argument of `Spec.__init__` is used only for tests. This
PR removes it from the call signature and introduces an equivalent
fixture to be used in tests.

* Refactored ``spec_from_dict`` to be a static method of ``Spec``

The fixture ``spec_from_dict`` has been refactored to be a static method
of ``Spec``. Test code has been updated accordingly. Added tests for
exceptional paths.

* Renamed argument `unique` to `normal` + added LazySpecCache class

As requested in the review the argument `unique` of `Spec.from_literal`
has been renamed to `normal`. To avoid eager evaluations of
`Spec(spec_like)` expressions a subclass of `collections.defaultdict`
has been introduced.

* Spec object can be keys of the dictionary for a spec literal.

Added back the possibility use a spec directly as a key. This permits
to build DAGs that are partially normalized.
2017-08-23 14:20:40 -07:00
Christoph Junghans
fa1d0a8a4d Add --source option to spack install (#4102)
- -- source will copy source into prefix along with the package.
- added a test for --source, as well
2017-08-23 14:08:52 -07:00
healther
15186d4ae8 add test for lua and node patching in sbang (#5169)
* add test for lua and node handling in sbang patching (cf #5086)
2017-08-23 01:05:36 -07:00
Todd Gamblin
40e9171390 Add testing for new build output.
- Update handling of ChildError so that its output is capturable from a
  SpackCommand

- Update cmd/install test to make sure Python and build log output is
  being displayed properly.
2017-08-22 16:14:38 -07:00
Todd Gamblin
f51b541ef8 Make install command reusable within single Spack run
- install and probably other commands were designed to run once, but now
  we can to test them from within Spack with SpackCommand

- cmd/install.py assumed that it could modify do_install in PackageBase
  and leave it that way; this makes the decorator temporary

- package.py didn't properly initialize its stage if the same package had
  been built successfully before (and the stage removed).
  - manage stage lifecycle better and remember when Package needs to
    re-create the stage
2017-08-22 16:14:38 -07:00
Todd Gamblin
fa1faa61c4 SpackCommand uses log_output to capture command output. 2017-08-22 16:14:38 -07:00
Todd Gamblin
4f444c5f58 log_ouptut can take either a filename or a file object 2017-08-22 16:14:38 -07:00
Todd Gamblin
139d5bfa6b Display build output on ProcessError, instead of Python context.
- If a failure comes from an external command and NOT the Python code,
  display errors highlighted with some context.

- Add some rudimentary support for parsing errors out of the build log
  (not very sophisticated yet).

- Build errors in Python code will still display with Python context.
2017-08-22 16:14:38 -07:00
Todd Gamblin
d54110d208 Limit package context to 3 lines and colorize in error output. 2017-08-22 16:14:38 -07:00
Massimiliano Culpo
4600d106e2 Config scopes are now returning OrderedDicts instead of dicts. (#5183)
It seems 8f21332fec introduced a bug
in that normal dictionaries are returned from ConfigScope objects
instead of OrderedDicts. This is fixed here.
2017-08-22 14:20:19 -07:00
Matthew Scott Krafczyk
48bf1e276b Add environment variables to path substitution
Update documentation on config file variable substitutions and
add expansion of environment variables in config files.
2017-08-21 18:35:00 -07:00
Massimiliano Culpo
581f70ff6f Added custom messages for conflicts directive. fixes #4965 (#5083)
Users can now add an optional custom message to the conflicts directive.
Layout on screen has been changed to improve readability and the long
spec is shown in tree format. Two conflicts in `espresso` have been
modified to showcase the feature.
2017-08-21 09:20:07 -07:00
Todd Gamblin
10bb681b57 Unbuffer so that output from packages appears when redirecting
- Python I/O would not properly interleave (or appear) with output from
  subcommands.

- Add a flusing wrapper around sys.stdout and sys.stderr when
  redirecting, so that Python output is synchronous with that of
  subcommands.
2017-08-20 16:51:10 -07:00
Todd Gamblin
79045afada Add tests for output redirection. 2017-08-20 16:51:10 -07:00
Todd Gamblin
11196e7b69 Preserve verbosity across installs when 'v' is pressed.
- 'v' toggle was previously only good for the current install.
- subsequent installs needed user to press 'v' again.
- 'v' state is now preserved across dependency installs.
2017-08-20 16:51:10 -07:00
Todd Gamblin
48440766df Fix exit call in SpackError.die()
- Previously we would use `os._exit()` in to avoid Spack error handling
  in the parent process when build processes failed.  This isn't
  necessary anymore since build processes propagate their exceptions to
  the parent process.

- Use `sys.exit` instead of `os._exit`. This has the advantage of
  automatically flushing output streams on quit, so output from child
  processes is not lost when Spack exits.
2017-08-20 16:51:10 -07:00
Todd Gamblin
05cc6c966f Rework output redirection in Spack.
- Simplify interface to log_output. New interface requires only one
  context handler instead of two.  Before:

      with log_output('logfile.txt') as log_redirection:
           with log_redirection:
               # do things ... output will be logged

  After:

      with log_output('logfile.txt'):
          # do things ... output will be logged

  If you also want the output to be echoed to ``stdout``, use the
  `echo` parameter::

      with log_output('logfile.txt', echo=True):
          # do things ... output will be logged and printed out

  And, if you just want to echo *some* stuff from the parent, use
  ``force_echo``:

      with log_output('logfile.txt', echo=False) as logger:
          # do things ... output will be logged

          with logger.force_echo():
              # things here will be echoed *and* logged

  A key difference between this and the previous implementation is that
  *everything* in the context handler is logged.  Previously, things like
  `Executing phase 'configure'` would not be logged, only output to the
  screen, so understanding phases in the build log was difficult.

- The implementation of `log_output()` is different in two major ways:

  1. This implementation avoids race cases by using only one pipe (before
     we had a multiprocessing pipe and a unix pipe).  The logger daemon
     stops naturally when the input stream is closed, which avoids a race
     in the previous implementation where we'd miss some lines of output
     because the parent would shut the daemon down before it was done
     with all output.

  2. Instead of turning output redirection on and off, which prevented
     some things from being logged, this version uses control characters
     in the output stream to enable/disable forced echoing.  We're using
     the time-honored xon and xoff codes, which tell the daemon to echo
     anything between them AND write it to the log.  This is how
     `logger.force_echo()` works.

- Fix places where output could get stuck in buffers by flushing more
  aggressively.  This makes the output printed to the terminal the same
  as that which would be printed through a pipe to `cat` or to a file.
  Previously these could be weirdly different, and some output would be
  missing when redirecting Spack to a file or pipe.

- Simplify input and color handling in both `build_environment.fork()`
  and `llnl.util.tty.log.log_output()`.  Neither requires an input_stream
  parameter anymore; we assume stdin will be forwarded if possible.

- remove `llnl.util.lang.duplicate_stream()` and remove associated
  monkey-patching in tests, as these aren't needed if you just check
  whether stdin is a tty and has a fileno attribute.
2017-08-20 16:51:10 -07:00
Todd Gamblin
e0dd55e090 Make SpackCommand a bit more testable
- add fail_on_error argument
- record exception and return code when the command fails
2017-08-20 16:51:10 -07:00
Todd Gamblin
e77c1a20c5 Fix issue with color formatting regular expression. (#5171)
- Fix issue with color formatting regular expression.
  - _separators regex in spec.py could be constructed such that '^' came
    first in the character matcher, e.g. '[^@#/]'.  This inverts the match
    and causes transient KeyErrors.

  - Fixed to escape all characters in the constructed regex.

  - This bug comes up in Python3 due to its more randomized hash iteration
    order, but it could probably also happen in a Python 2 implementation.

- also clean up variable docstrings in spec.py
2017-08-20 15:34:35 -07:00
Todd Gamblin
bb10bc39ab Make test_inspect_path work on Mac OS X without XCode (#5168)
- Mac OS X Sierra has no /usr/include by default
- Instead of assuming there's an include directory in /usr, mock up a directory that looks like we expect.
2017-08-19 14:48:24 -07:00
healther
d6d2dff324 sbang support: add node-js and fix lua
This adds sbang hook support for node-js and fixes the sbang filter
for lua (the character class exclusion was swallowing newlines and
reporting a false positive if lua was mentioned anywhere in the 
file).
2017-08-18 11:57:52 -07:00
Axel Huebl
6472c39c2e Docs: Travis-CI Workflow (#5133)
* Docs: Travis-CI Workflow

Add a workflow how to use spack on Travis-CI.

Future Work:

depending if and how we can simplify 5101:
add a multi-compiler, multi-C++-standard, multi-software
build matrix example

* Fix Typos
2017-08-17 11:25:40 -05:00
Massimiliano Culpo
0f5582cefc Colorize spack info. Adds prominence to preferred version. (#4994)
* Colorize spack info. Adds prominence to preferred version. fixes #2708

This uses 'llnl.util.tty.color' to colorize the output of 'spack info'.
It also displays versions in the order the concretizer would choose
them and shows the preferred in a line on its own and in bold.

* Modified output according to Adam and Denis reviews.

Section titles are not bold + black, but bold + blue. Added a new
section named "Preferred version", which prints the preferred version
in bold characters.

* Further modifications according to Adam and Denis reviews.

After "Homepage:" we now have a single space. Removed newline after each
variant. Preferred version is not in bold fonts anymore. Added a simple
test that just runs the command.
2017-08-17 09:15:57 -07:00
Massimiliano Culpo
101693d823 Improved error message for unsatisfiable specs (#5113)
* Improved error message for unsatisfiable specs. fixes #5066

This PR improves the error message for unsatisfiable specs by showing in tree format both the spec that cannot satisfy the constraint and the spec that asked for that constraint. After that follows a readable error message.
2017-08-17 08:26:04 +02:00
Massimiliano Culpo
c16a68f517 Relaxed constraints on config.yaml structure (#5115)
This PR allows additional unused properties at the top-level of the config.yaml file. Having these properties permits to use two different versions of Spack, one of which adds a new property, without receiving error messages due to the presence of this new property in a configuration cache stored in the user's home.
2017-08-17 06:37:09 +02:00
Patrick Gartung
1c8bdd7e24 buildcache fixes: index.html & unsigned installs
This fixes a syntax error in the index.html file generated by the
"spack buildcache" command when creating build caches. This also
fixes support for installing unsigned binaries.
2017-08-16 19:03:14 -07:00
Adam J. Stewart
af02774b3e Add tab completion & update docs for buildcache
This adds tab completion and fixes some formatting issues in the
documentation for the "spack buildcache" command.
2017-08-16 13:58:09 -07:00
Adam J. Stewart
11b3ce27b7 Add better generator support to CMakePackage (#4988)
* Add better generator support to CMakePackage

* List valid CMake generators on error
2017-08-16 12:25:37 -05:00
Adam J. Stewart
db657d938d Refactor IntelInstaller into IntelPackage base class (#4300)
* Refactor IntelInstaller into IntelPackage base class

* Move license attributes from __init__ to class-level

* Flake8 fixes: remove unused imports

* Fix logic that writes the silent.cfg file

* More specific version numbers for Intel MPI

* Rework logic that selects components to install

* Final changes necessary to get intel package working

* Various updates to intel-parallel-studio

* Add latest version of every Intel package

* Add environment variables for Intel packages

* Update env vars for intel package

* Finalize components for intel-parallel-studio package

Adds a +tbb variant to intel-parallel-studio.
The tbb package was renamed to intel-tbb.
Now both intel-tbb and intel-parallel-studio+tbb
provide tbb.

* Overhaul environment variables set by intel-parallel-studio

* Point dependent packages to the correct MPI wrappers

* Never default to intel-parallel-studio

* Gather env vars by sourcing setup scripts

* Use mpiicc instead of mpicc when using Intel compiler

* Undo change to ARCH

* Add changes from intel-mpi to intel-parallel-studio

* Add comment explaining mpicc vs mpiicc

* Prepend env vars containing 'PATH' or separators

* Flake8 fix

* Fix bugs in from_sourcing_file

* Indentation fix

* Prepend, not set if contains separator

* Fix license symlinking broken by changes to intel-parallel-studio

* Use comments instead of docstrings to document attributes

* Flake8 fixes

* Use a set instead of a list to prevent duplicate components

* Fix MKL and MPI library linking directories

* Remove +all variant from intel-parallel-studio

* It is not possible to build with MKL, GCC, and OpenMP at this time

* Found a workaround for locating GCC libraries

* Typos and variable names

* Fix initialization of empty LibraryList
2017-08-16 12:21:07 -05:00
Patrick Gartung
ab56c742ca Create, install and relocate tarballs of installed packages
Adds the "buildcache" command to spack. The buildcache command is
used to create gpg signatures for archives of installed spack
packages; the signatures and archives are placed together in a
directory that can be added to a spack mirror. A user can retrieve
the archives from a mirror and verify their integrity using the
buildcache command. It is often the case that the user's Spack
instance is located in a different path compared to the Spack
instance used to generate the package archive and signature, so
this includes logic to relocate the RPATHs generated by Spack.
2017-08-14 14:32:27 -07:00
Massimiliano Culpo
5184edb15f Added a custom action for --clean and --dirty. (#5081)
The action `CleanOrDirtyAction` has been added. It sets the default
value for `dest` to `spack.dirty`, and changes it according to the flags
passed via command line. Added unit tests to check that the arguments
are parsed correctly. Removed lines in `PackageBase` that were setting
the default value of dirty according to what was in the configuration.
2017-08-14 11:29:18 -07:00
scheibelp
4d9ef49b49 Decode process stream only for python3
Popen.communicate outputs a str object for python2 and a bytes
object for python3. This updates the Executable.__call__ function
to call .decode on the output of Popen.communicate only for python3.
This ensures that Executable.__call__ returns a str for python2 and
python3.
2017-08-14 11:23:03 -07:00
Massimiliano Culpo
41c87a71a8 patch: get correct package directory for a given package
fixes #4236
fixes #5002

When a package is defined in more than one repository,
RepoPath.dirname_for_package_name may return the path
to either definition. This sidesteps that ambiguity by 
accessing the module associated with the package definition.
2017-08-11 19:18:52 -07:00
becker33
79f9548a9a bugfix for module_cmd (#5038)
* bugfix for modulecmd when bash is symlinked to sh

* update test to make sure module_cmd can interpret sh
2017-08-09 12:14:35 -07:00
Massimiliano Culpo
faeb1b77b2 Merged 'purge' command with 'clean' and deleted 'purge' (#4970)
* Merged 'purge' command with 'clean'. Deleted 'purge'. fixes #2942

'spack purge' has been merged with 'spack clean'. Documentation has been
updated accordingly. The 'clean' and 'purge' behavior are not mutually
exclusive, and they log brief information to tty while they go.

* Fixed a wrong reference to spack clean in the docs

* Added tests for 'spack clean'. Updated bash completion.
2017-08-09 10:02:38 -07:00
Sergey Kosukhin
e463461ed1 Bugfixes for compiler detection on the Cray platform. (#3075)
* Typo fixes in docstrings.

* Let OS classes know if the paths they get were explicitly specified by user.

* Fixed regexp for cray compiler version matching.

* Replaced LinuxDistro with CrayFrontend for the Cray platform's frontend.
2017-08-09 09:00:34 -07:00
scheibelp
5a94cee216 Variant satisfaction for indirect dependencies
Fixes #4898

Constraints that were supposed to be conditionally activated for
specified values of a single-valued variant were being activated
unconditionally in the case that the variant was associated with
an implicit dependency. For example if X->Y->Z and Y places a
conditional constraint on Z for a given single-valued variant on
Y, then it would have been applied unconditionally when
concretizing X.
2017-08-07 10:48:48 -07:00
Adam J. Stewart
a31ce17f0b Various fixes to package name URL parsing (#4978) 2017-08-05 10:15:47 -05:00
Adam J. Stewart
c7df12f698 Massive conversion from Package to CMakePackage (#4975) 2017-08-05 10:15:18 -05:00
Adam J. Stewart
7eb263effe Add a SConsPackage base class (#4936)
* Add a SConsPackage base class

* Make Matlab extendable

* Most dependencies are actually required

* Cantera requires older version of fmt
2017-08-04 16:52:10 -05:00
Adam J. Stewart
b8ed61cfea Make CMake the default build system (#4862) 2017-08-04 14:53:05 -05:00
Adam J. Stewart
452f382293 Add a QMakePackage base class (#4925)
* Add a QMakePackage base class

* Fix sqlite linking bug in qt-creator

* Add latest version of qt-creator

* Add latest version of qwt

* Use raw strings for regular expressions

* Increase minimum required version of qt

* Add comment about specific version of sqlite required

* Fixes for latest version of qwt and qt-creator

* Older versions of Qwt only work with older versions of Qt
2017-08-04 08:46:07 -07:00
Adam J. Stewart
4e269510c5 Fix trailing whitespace at the end of headers.cpp_flags (#4957) 2017-08-03 14:24:51 -05:00
George Hartzell
36496b9174 Fix crashes when running spack install under nohup (#4926)
* Fix crashes when running spack install under nohup

Fixes #4919

For reasons that I do not entire understand, duplicate_stream() throws
an '[Errno 22] Invalid argument' exception when it tries to
`os.fdopen()` the duplicated file descriptor generated by
`os.dup(original.fileno())`.  See spack/llnl/util/lang.py, line
394-ish.

This happens when run under `nohup`, which supposedly has hooked
`stdin` to `/dev/null`.

It seems like opening and using `devnull` on the `input_stream` in
this situation is a reasonable way to handle the problem.

* Be more specific about error being handled.

Only catch the specific error that happens when trying to dup
the stdin that nohup provides.

Catching e as a StandardErorr and then
`type(e).__name__` tells me that it's an OSError.

Printing e.errno tells me that it's 22

Double checking tells me that 22 is EINVAL.

Phew.
2017-08-03 10:33:16 -07:00
Sergey Kosukhin
963eb99b7f Account for hyphens in package names when searching for libraries. (#4948) 2017-08-03 09:17:07 +02:00
Todd Gamblin
44ce0adbd5 Fix color bug in Spec.format() introduced by #3013 2017-08-01 17:40:54 -07:00
Todd Gamblin
b88f55e523 Add spack dependencies command and tests for it and dependents. 2017-08-01 17:40:54 -07:00
Todd Gamblin
af3c794ab5 document and make display_specs more versatile 2017-08-01 17:40:54 -07:00
Todd Gamblin
b575d008bd Fix issue with case check and spack -m 2017-08-01 17:40:54 -07:00
Todd Gamblin
c8b2100630 Refactor installed_dependents -> installed_relatives 2017-08-01 17:40:54 -07:00
Todd Gamblin
36b3dd8cfe Package.possible_dependencies() descends into virtuals. 2017-08-01 17:40:54 -07:00
Todd Gamblin
b9606e3157 Add --transitive option to spack dependents 2017-08-01 17:40:54 -07:00
Todd Gamblin
6928cf7a68 spack dependents lists possible dependencies by default. 2017-08-01 17:40:54 -07:00
Todd Gamblin
bd94a17066 Remove last vestiges of "special" deptypes.
- Remove `special_types` dict in spec.py, as only 'all' is still used
- Still allow 'all' to be used as a deptype
- Simplify `canonical_deptype` function
- Clean up args in spack graph
- Add tests
2017-08-01 17:40:54 -07:00
Todd Gamblin
43f576cf19 Remove unused code. 2017-08-01 17:40:54 -07:00
Todd Gamblin
f2ddcfac5f Add --all argument to spack dependents
--all causes spack dependents to list all possible dependents for a
package, rather than actual dependents for an installed spec.
2017-08-01 17:40:54 -07:00
Adam J. Stewart
82735deafd Clarify docs on using a hash in a spec (#4908) 2017-07-31 13:13:39 -07:00
scheibelp
69a6c8ef78 Fix preference for X.Y version when mixed with X.Y.Z versions (#4922)
For packages which contain a mix of versions with formats X.Y and
X.Y.Z, if the user entered an X.Y version as a preference in
packages.yaml, Spack would get confused and favor any version A.B.Z
where X=A and Y=B. In the case where there is a mix of these version
types, this commit updates preferences so Spack will favor an exact
match.
2017-07-31 13:11:08 -07:00
paulhopkins
1c7e5724d9 Add --color=[always|never|auto] argument; fix color when piping (#3013)
* Disable spec colorization when redirecting stdout and add command line flag to re-enable
* Add command line `--color` flag to control output colorization
* Add options to `llnl.util.tty.color` to allow color to be auto/always/never
* Add `Spec.cformat()` function to be used when `format()` should have auto-coloring
2017-07-31 12:57:47 -07:00
Adam J. Stewart
b33f92da34 Improve version detection for URLs with dynamic after version (#4902) 2017-07-26 17:43:54 -05:00
Adam J. Stewart
07aec4366f Add universal build_type variant to CMakePackage (#4797)
* Add universal build_type variant to CMakePackage
* Override build_type in some packages with different possible values
* Remove reference to no longer existent debug variant
* Update CBTF packages with new build_type variant
* Keep note on build size of LLVM
2017-07-25 16:34:43 -07:00
Gregory Lee
42717bd8e8 fix config.guess patch for ppc64le (#4858)
* fix config.guess patch for ppc64le

* explicit patch for config.guess not required
2017-07-25 13:44:51 -07:00
Adam J. Stewart
250ee413e9 Change Version formatting properties and functions to return Version objects (#4834)
* Change version.up_to() to return Version() object
* Add unit tests for Version.up_to()
* Fix packages that expected up_to() to return a string
* Ensure that up_to() preserves separator characters
* Use version indexing instead of up_to
* Make all Version formatting properties return Version objects
* Update docs
* Tests need to test string representation
2017-07-24 13:02:13 -07:00
Todd Gamblin
f159246d1d Make testing spack commands simpler (#4868)
Adds SpackCommand class allowing Spack commands to be easily in Python

Example usage:

    from spack.main import SpackCommand
    info = SpackCommand('info')
    out, err = info('mpich')
    print(info.returncode)

This allows easier testing of Spack commands.

Also:
* Simplify command tests
* Simplify mocking in command tests.
* Simplify module command test
* Simplify python command test
* Simplify uninstall command test
* Simplify url command test
* SpackCommand uses more compatible output redirection
2017-07-22 21:27:54 -07:00
becker33
f962aba6ce Allow packages to control handling of compiler flags (#4421)
* Initial work on flag trapping using functions called <flag>_handler and default_flag_handler

* Update packages so they do not obliterate flags

* Added append to EnvironmentModifications class

* changed EnvironmentModifications to have append_flags method

* changed flag_val to be a tuple

* Increased test coverage

* added documentation of flag handling
2017-07-19 20:12:00 -07:00
Adam J. Stewart
5fc0243d35 Improve version detection of release versions (#4816) 2017-07-18 22:48:39 -05:00
becker33
d2a63d55fa Open ended variants (#4746)
* Change directives to allow open-ended variants more easily

* make None default to open-ended
2017-07-18 10:03:15 -07:00
Adam J. Stewart
1215c3b20c Change path to CMakeLists.txt to be relative to root, not pwd (#4420)
* Change path to CMakeLists.txt to be relative to root, not pwd

* Changes requested during code review

* Revert back to old naming of root_cmakelists_dir
* Make relative directory more clear in docs

* Revert change causing build_type AttributeError

* Fix forgotten abs_path var

* Update CLHEP with new relative path

* Update more packages with new root_cmakelists_dir syntax
2017-07-18 09:58:19 -07:00
Massimiliano Culpo
5a1ee22575 package: removed default no-op patch (#4103)
* package: removed default no-op patch fixes #4085

* do_patch: handles NoSuchMethodError nicely
2017-07-18 09:53:35 -07:00
George Hartzell
ff906faf9a Typo: submdoules -> submodules (#4716) 2017-07-12 07:48:31 +02:00
Gregory Lee
28cb1e4379 patch config.guess after autoreconf step (#4604) 2017-07-06 23:07:54 -05:00
Todd Gamblin
b4d1654e68 Parametrized lock test and make it work with MPI
- Lock test can be run either as a node-local test or as an MPI test.

- Lock test is now parametrized by filesystem, so you can test the
  locking capabilities of your NFS, Lustre, or GPFS filesystem.  See docs
  for details.
2017-07-04 11:41:37 -07:00
Todd Gamblin
bd7a591df1 Make filesytem more resilient to concurrent updates.
- Uses O_CREAT for touch (for guaranteed atomic open on NFS, multi-node)
- Ignore concurrent create errors in mkdirp
2017-07-04 11:41:37 -07:00
Todd Gamblin
326e2f7f66 Ported lock test to pytest. 2017-07-04 11:41:37 -07:00
Adam J. Stewart
9933d759ac Update hdfgroup packages to new URL structure (#4643)
* Update hdfgroup packages to new URL structure

* Update docs now that HDF5 URL isn't that complicated
2017-06-29 21:38:47 -05:00
EmreAtes
898c7f8838 add mpi to providers to remove virtual package error (#4608) 2017-06-28 12:24:29 -05:00
becker33
b1861b29ef Added install option to read spec from file (#4611) 2017-06-27 12:27:16 -07:00
Adam J. Stewart
ad1382e664 Don't immediately raise an error when an editor is not found (#4587)
* Don't immediately raise an error when an editor is not found
* If no editor is found, raise an error only if we try to use it.
2017-06-25 20:42:38 -07:00
Adam J. Stewart
e5ce7b1639 Allow arbitrary Prefix attributes (#4591)
* Allow arbitrary Prefix attributes
* Test attribute type as well

* Flake8 fixes

* Remove __new__ method

* Fewer uses of join_path in the docs
2017-06-24 22:39:31 -07:00
Todd Gamblin
cac4362f64 Make LICENSE recognizable by GitHub. (#4598) 2017-06-24 22:22:55 -07:00
Massimiliano Culpo
b7ca7274b8 mv variants: packages are now needed only during normalization (#4129)
* mv variants: packages are now needed only during normalization

The relationship among different types of variants have been weakened,
in the sense that now it is permitted to compare MV, SV and BV among
each other. The mechanism that permits this is an implicit conversion
of the variant passed as argument to the type of the variant asking
to execute a constrain, satisfies, etc. operation.

* asbtract variant: added a new type of variant

An abstract variant is like a multi valued variant, but behaves
differently on "satisfies" requests, because it will reply "True"
to requests that **it could** satisfy eventually.

Tests have been modified to reflect the fact that abstract variants
are now what get parsed from expressions like `foo=bar` given by users.

* Removed 'concrete=' and 'normal=' kwargs from Spec.__init__

These two keyword arguments where only used in one test module to force
a Spec to 'appear' concrete. I suspect they are just a leftover from
another refactoring, as now there's the private method '_mark_concrete'
that does essentially the same job. Removed them to reduce a bit the
clutter in Spec.

* Moved yaml related functions from MultiValuedVariant to AbstractVariant.

This is to fix the erros that are occurring in epfl-scitas#73, and that
I can't reproduce locally.
2017-06-23 13:36:29 -07:00
becker33
689c1d2f0c fix issue #4577 (#4579) 2017-06-21 18:33:11 -05:00
becker33
a113101126 Module cmd fix (#3250)
* Parse modules in a way that works for both lmod and tcl

* added test and made method more robust

* refactoring for pythonic clarity

* Improved detection of 'module' shell function + refactored module utilities into spack.util.module_cmd

* Improved regex to reject nested parentheses we are not prepared to handle

* make tests backwards compatible with python 2.6

* Improved regex to account for sh being aliased to bash and used in bash module definition on some systems

* Improve test compatibility with lmod

* Added error for None module_cmd

* Add test for get_module_cmd_from_which()

Add test for get_module_cmd_from_which().
Add -c argument to Popen call to typeset -f module in get_module_cmd_from_bash().

* Increased detection options

Included BASH_FUNC_module() variable outside of typeset as a detection option
This should work on bash even in restricted_shell mode
Kept the typeset detection as an option in case the module function is not exported in bash

Also added try statements to tests, with environment recreation in finally blocks.

* More tests added; some hackiness

* increased test coverage for util/module_cmd
2017-06-21 09:58:41 -07:00
becker33
541496dfe1 System config (#4518)
* Code changes to enable system config scope in /etc

Files will go in either /etc/spack or /etc/spack/<platform>
Required minor changes to conftest.

* Updated documentation to match new config scope
2017-06-16 12:31:56 -07:00
Todd Gamblin
790b06e0c3 bugfix: support EDITOR values with spaces (#4523)
- previous code called `which` on $EDITOR, but that doesn't work for
  EDITORs like `emacs -nw` or `emacsclient -t -nw`.

- This patch just trusts EDITOR if it is set (same as previous
  behavior), and only uses the defaults if it's not.
2017-06-16 14:03:21 +02:00
Massimiliano Culpo
8b5e94976d issue 4492: DependencyMap.concrete checks for unconditional dependencies (#4499)
* issue 4492: added xfailing test, added owner to DependencyMap

* DependencyMap.concrete checks if we have unconditional dependencies

This fixes #4492 and #4107 using some heuristics to avoid an infinite
recursion among Spec.satisfies, Spec.concrete and DependencyMap.concrete

The idea, as suggested by @becker33, is to check just for unconditional
dependencies. This is not covering the whole space and a package with
just conditional dependencies can still fail in the same way. It should
cover though all the **real** packages we have in our repo so far.
2017-06-16 12:41:15 +02:00
Mario Melara
da67ee9790 Fix tests on cray (#4298)
* Check for CRAYPE_VERSION instead of path

Architecture tests would fail on Cray since it would not find
the expected path. To make the test correctly work on Cray search
for the CRAYPE version instead.

* Catch SystemExit error in case flake8 not in path

On shared systems having flake8 can involve starting own virtual env.
Skip the test if no flake8 is found to avoid failure reporting.

* Add compatibility to 1.5 svnadmin create

The flag added is needed to correctly create svn repos on NERSC systems.
This could be unnecessary for other sites. I'd like to see others
test before this change gets merged.
2017-06-15 15:16:14 -07:00
Adam J. Stewart
41e4a034ff Add latest version of JDK (#4317)
* Add latest version of JDK

* Use a more specific URL to get curl to work

* Remove failing unit test
2017-06-15 12:40:55 +02:00
Todd Gamblin
8c2447272e Fix dashes in variant parsing (#4498)
- Skip spack flake8 test when flake8 is not installed.
- Fix parsing of dashes in specs broken by new help parser.
    - use argparse.REMAINDER instead of narg='?'
    - don't interpret parts of specs like -mpi as arguments.
2017-06-15 11:32:55 +02:00
Adam J. Stewart
e627447417 Prefer vim to vi for default editor (#4230)
* vim > vi
* Allow which to accept multiple args
* Update __init__ to use which with multiple args
* Fix doc tests
2017-06-15 11:27:18 +02:00
Nicolas Richart
f06c23ef42 Adding package namd (#4321)
* Initial version of the namd package

* Modified charm to consider compile against intel/intel-mpi

* Correction of namd to compile with intel-mkl and intel compiler

* Adding inclue64 in the prefix

* adding property for the build directory

* removing useless function build
2017-06-14 13:11:30 -05:00
scheibelp
1e69d9d1a9 Override partial installs by default - part three (#4331)
* During install, remove prior unfinished installs

If a user performs an installation which fails, in some cases the
install prefix is still present, and the stage path may also be
present. With this commit, unless the user specifies
'--keep-prefix', installs are guaranteed to begin with a clean
slate. The database is used to decide whether an install finished,
since a database record is not added until the end of the install
process.

* test updates

* repair_partial uses keep_prefix and keep_stage

* use of mock stage object to ensure that stage is destroyed when it should be destroyed (and otherwise not)

* add --restage option to 'install' command; when this option is not set, the default is to reuse a stage if it is found.
2017-06-13 09:15:51 -07:00
Adam J. Stewart
0de653ff01 Add an installcheck phase to MakefilePackage (#4476)
* Add an installcheck phase to MakefilePackage

* Minor changes to ESMF
2017-06-12 09:47:46 -05:00
Todd Gamblin
c67f647785 Move description to top of spack info (#4475) 2017-06-09 21:02:16 -07:00
Adam J. Stewart
36b8ea2f92 Add default list_url for GitLab, BitBucket, and CRAN (#4439)
* Add default list_url for GitLab, BitBucket, and CRAN

* Fix flake and doc tests
2017-06-09 12:28:39 -05:00
Adam J. Stewart
218992862c Move gpg section of docs to Getting Started (#4446) 2017-06-09 12:27:29 -05:00
Adam J. Stewart
85fd8f0b31 Fix url parse offset for SourceForge downloads (#4458) 2017-06-09 08:53:40 +02:00
Adam J. Stewart
1b9af88572 Supress output from gpg --version during tests (#4441) 2017-06-07 11:52:28 -05:00
Stas Sergienko
8018f6cdf6 Fixed duplicated spec: nag@6.1 line in getting started guide (#4445) 2017-06-07 11:50:56 -05:00
Adam J. Stewart
d9d5135ec9 Fix spack info bug for Python 3 (#4391) 2017-05-30 13:37:56 -05:00
Adam J. Stewart
f9ac965fb9 Document known issue with R concretization (#4313) 2017-05-27 12:51:03 -05:00
Adam J. Stewart
d3a82ce632 Fix typo in mod_to_class docstring (#4371) 2017-05-26 22:05:54 -05:00
Adam J. Stewart
6f0ac9d54c Add --configure-args/vars support to RPackage (#4289)
* Add --configure-args/vars support to RPackage

* Docstring formatting change
2017-05-26 16:37:06 -05:00
Ben Boeckel
f38d250e50 gpg: add 'spack gpg subcommand (#3845)
- Add a `spack gpg` subcommand in anticipation of signed binaries.
- GPG keys are stored in var/spack/gpg, and the spack gpg command manages them.
- Docs are included on the command.
2017-05-26 10:31:04 -07:00
George Hartzell
26440accab Touch up string expansion. (#4344)
* Touch up string expansion.

I'm chasing this:

```
$ (module purge; spack install perl %gcc/5.4.0)
==> Error: No installed spec matches the hash: '%s'
```

There's something deeper going on, but the error message isn't helpful.

After this change it tells me this:

```
$ (module purge; spack install perl %gcc/5.4.0)
==> Error: No installed spec matches the hash: '5.4.0'
```

Which is weird because `5.4.0` is not a hash...  Whatever is going on here, the error message needs to be fixed.

* Flake8 whitespace
2017-05-25 13:00:58 -05:00
becker33
12ab882eba Fix issues parsing multiple anonymous specs (#4199)
* fix parser
* Removed xfails
* cleaned up debug print statements
* make use of these changes in gcc
* Added comment explaining unreachable line, line left for added protection
2017-05-24 17:13:18 -07:00
Adam J. Stewart
315bda3487 Fix PGI version detection: 17.4-0 -> 17.4 (#4251) 2017-05-24 06:57:31 -05:00
Todd Gamblin
32c570913d Move doc dependencies to requirements.txt for readthedocs (#4280)
* Move doc dependencies to requirements.txt for readthedocs

* Move sphinx to doc requirements.
2017-05-17 20:45:03 -05:00
Todd Gamblin
3e8662aaa7 fix bug with executables setting their own environment. (#4237) 2017-05-17 11:37:06 -05:00
Adam J. Stewart
cafc3cc3ca Sphinx no longer supports Python 2.6 (#4266)
* Sphinx no longer supports Python 2.6

* Update vendored sphinxcontrib.programoutput from 0.9.0 to 0.10.0

* Documentation cannot be built in parallel

* Let Travis install programoutput for us

* Remove vendored sphinxcontrib-programoutput

Recent updates to the sphinx package prevent the vendored version
from being found in sys.path. We don't vendor sphinx, so it doesn't
make sense to vendor sphinxcontrib-programoutput either.
2017-05-17 11:36:02 -05:00
Adam J. Stewart
b630c06773 Sphinx no longer ignores first argument (#4243)
* Sphinx no longer ignores first argument
* Duplicate first argument for maximum compatibility
2017-05-16 14:24:35 -07:00
Adam J. Stewart
1a6b4afe7f Add helpful error message for uncompressed downloads (#4205) 2017-05-12 09:52:01 -05:00
Adam J. Stewart
e7973dd290 Fix typo in PythonPackage documentation (#4221) 2017-05-11 19:05:02 -05:00
Massimiliano Culpo
f8b3eff01c filesystem.py: fixed bug introduced in #3367 (scrambled order in output) (#4156)
PR #3367 inadvertently changed the semantics of _find_recursive and
_find_non_recursive so that the returned list are not ordered as the
input search list. This commit restores the original semantic, and adds
tests to verify it.
2017-05-11 10:29:08 -07:00
Massimiliano Culpo
306f158c73 cp2k: fixed compilation issues for intel stack
Added DFLAGS to the `make.inc` file being written.
These macros are also added to the language specific variables
like CFLAGS, CXXFLAGS and FCFLAGS. Changed `spec.satisfies('foo')`
with `'foo' in spec` in `intel-mkl`, see #4135. Added a basic
build interface to `intel-mpi`.
2017-05-09 18:46:42 +02:00
Massimiliano Culpo
3efa9bd296 spec_syntax: added xfailing tests for cases in #4144 (#4151)
It seems that parse_anonymous_spec may fail if more than one part
(variant, version range, etc.) is given to the function. Added tests to
code against to fix the problem in #4144.
2017-05-08 13:24:37 -07:00