Commit graph

2508 commits

Author SHA1 Message Date
scheibelp
45a8c03bdf Prefer later versions of compilers by default (#5234)
* Prefer later versions of compilers by default

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

jinja2 has been hooked into Spack.

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

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

* Improved the support for templates in module files.

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

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

* Added jinja2 and MarkupSafe to vendored packages.

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

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

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

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

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

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

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

* Extendable module file contexts + short description from docstring

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

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

* 'module refresh' regenerates all modules by default

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

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

* Fixed python3 compatibility, tests for Lmod and Tcl.

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

Fixed a few compatibility issues with python3.

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

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

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

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

Module file generation will cover the entries in modules.yaml

Also:

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

* Removed redundant arguments to RPackage and WafPackage.

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

* Fixed broken indentation + improved resiliency of refresh

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

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

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

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

- This fixes the string and the test
2017-09-17 15:31:32 -07:00
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