Commit graph

3088 commits

Author SHA1 Message Date
Zack Galbreath
847c1216d0 Generate CDash reports for build/install step 2018-05-15 05:43:07 -07:00
Zack Galbreath
ae0ba373b8 CDash report for concretization errors
Capture any concretization errors and record them in a CTest Update.xml file.
2018-05-15 05:43:07 -07:00
Zack Galbreath
d7581697a5 CDash report for configure step
Generate CTest XML file containing configure output
2018-05-15 05:43:07 -07:00
Zack Galbreath
f35d5bbf2b Capture source line number in CTest log parser 2018-05-15 05:43:07 -07:00
Zack Galbreath
d174d6618f Fix typo in comment 2018-05-15 05:43:07 -07:00
Zack Galbreath
072f907831 Add CDash as a valid reporting format 2018-05-15 05:43:07 -07:00
Zack Galbreath
e4e8c72fa1 Initialize report generator before parsing specs
This will allow us to generate reports for concretization errors
2018-05-15 05:43:07 -07:00
Zack Galbreath
de01d70ae4 Allow --overwrite and --log-format to be used together
Restructure the logic of the spack install command to allow these two
command-line arguments to be used at the same time.
2018-05-15 05:43:07 -07:00
Zack Galbreath
6c5dbdd9cd Format-agnostic data structure for reports
Replace the JUnit-specific terms 'testsuite' and 'testcase' with
'spec' and 'package', respectively.
2018-05-15 05:43:07 -07:00
Massimiliano Culpo
b4859e10e2 Packages can tune the list of files to be archived at the end of install (#7760)
Fixes #2781

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

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

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

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

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

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

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

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

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

* More GitLab packages use the API.

* find_list_url for GitLab's API URLs.

* Flake8

* Url for 'hacckernels'.

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

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

fixes #1355

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

Formatting of the output changed slightly.

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

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

* Avoid printing headers if stdout is not a tty

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

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

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

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

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

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

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

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

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

Extract code from load_module into unload_module.

* Unload modules to create a clean env on Cray

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

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

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

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

* Update tests

Updated tests and got rid of unnecessary code.

* Also update documentation to reflect this new ability.

* Add default path scheme to config.yaml

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

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

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

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

* Expose the possibility to query for installation date

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

* Extended docstring for Database._add

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

* Allow 'pretty date' formats from command line

* Substituted kwargs with explicit arguments

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

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

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

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

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

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

* Add test for disabling compiler existence check

* Update compiler existence checking logic

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

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

- restructure code to do recursion and mark visited packages properly

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

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

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

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

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

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

This also adds:

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

* [spack/spec.py] Fix style.

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

* incorporate feedback from @ax3l

* fix docs/improve ssh handling

* experiment with custom prompt

* add arch/fix missing core_compilers key

* add centos/minor tweaks

* make prompt experiment optional

* workaround problem with latest fedora docker image

* add docker documentation page to index toc

* try another documentation fix

* switch arch linux base to base/archlinux

* update the git urls in the Dockerfiles

* add opensuse

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* Improve performance of log parsing

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

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

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

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

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

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

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

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

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

* Parallelize log parsing

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

* Marking url command tests as slow

* Marking every test that uses database as slow

* Marking tests that import files as slow

* Marking gpg tests as slow

* Marking all versions and one list tests as slow

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

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

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

* Don't use classes to group tests together

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

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

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

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

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

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

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

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

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

* Polished report generation + added tests for failures and errors

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

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

Implements #6611

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

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

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

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

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

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

* Use absolute imports also for python 2.6

See PEP-328 for more information on the subject

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

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

* Note source of more obscure libraries

* We aren't upgrading jsonschema after all

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* finished update for basics tutorial

* missed two lines

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

* formatting

* fix header

* Change GNU Make to Make

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

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

* Remove floating `

* Add requested changes, and examples of subclasses

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

* Flake8 fixes and new files for classes

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

* Minor edits

Edits in formatting and made some sentence changes

* Flake8 fixes

More flake8 fixes

* Flake8 fix

* Change section order on tutorial and minor edits

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

* Add requested changes and more details

Added more details to Cmake, Makefile and Python Packages.

* Fixed formatting and minor edits

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

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

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

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

* Update packaging tutorial

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

* advanced packaging tutorial: improved phrasing

Thanks Denis and Hartzell!

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

First draft for the SC17 update. This includes:

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

* Added reference to #5582 + committed Dockerfiles

Also fixed a couple of typos spotted by Denis.

* module file tutorial: added section on template customization

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

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

* module file tutorial: improved phrasing and layout.

Thanks Hartzell!

* module file tutorial: added vim and nano to editors

* module file tutorial: fixed typo

* Fixed typos

Thanks Adam!

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

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

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

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

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

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

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

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

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

* add spec to db after installing from binary cache

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

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

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

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

* print package prefix after installing from binary cache

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

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

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

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

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

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

That lets us do this:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

- This caches the result of parsing the compiler config

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

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

* fix for macOS as well

* found in testing

* flake8

* fix testing on macOS

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

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

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

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

* add macOS_version() helper function

* flake8 fixes

* update oce and trilinos

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

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

* Add an extra test case for the empty list command

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

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

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

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

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

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

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

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

* Remove vestigial deptype_query argument to Spec.traverse()

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

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

* Don't print redundant messages when installing dependencies

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

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

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

Add a package definition for aspell.

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

* Flake8 cleanup

* Use six's version of urlparse

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

* Fix incorrect trimming regexp

* Clean up dictionary build

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

* Use a helper method to generate info for variants

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

* Convert aspell to an extendable package

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

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

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

* Create AspellDictPackage and use it for the dictionaries

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

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

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

* Typo: pakcage -> package

* Address some commentary

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

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

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

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

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

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

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

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

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

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

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

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

By modification time:

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

3 days ago     360    100.0
```

Or by percent contribution:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

jinja2 has been hooked into Spack.

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

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

* Improved the support for templates in module files.

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

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

* Added jinja2 and MarkupSafe to vendored packages.

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

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

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

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

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

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

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

* Extendable module file contexts + short description from docstring

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

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

* 'module refresh' regenerates all modules by default

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

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

* Fixed python3 compatibility, tests for Lmod and Tcl.

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

Fixed a few compatibility issues with python3.

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

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

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

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

Module file generation will cover the entries in modules.yaml

Also:

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

* Removed redundant arguments to RPackage and WafPackage.

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

* Fixed broken indentation + improved resiliency of refresh

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

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

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

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

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