Commit graph

3674 commits

Author SHA1 Message Date
Todd Gamblin
cf9de058aa
multimethods: avoid calling caller_locals() in Python 3 (#13238)
Python 3 metaclasses have a `__prepare__` method that lets us save the
class's dictionary before it is constructed.  In Python 2 we had to walk
up the stack using our `caller_locals()` method to get at this.  Using
`__prepare__` is much faster as it doesn't require us to use `inspect`.

This makes multimethods use the faster `__prepare__` method in Python3,
while still using `caller_locals()` in Python 2.  We try to reduce the
use of caller locals using caching to speed up Python 2 a little bit.
2019-10-17 06:40:23 -07:00
Todd Gamblin
e65b7f8ebf
importing: make importlib_importer recognize .pyc cache (#13239)
Our importer was always parsing from source (which is considerably
slower) because the source size recorded in the .pyc file differed from
the size of the input file.

Override path_stats in the prepending importer to fool it into thinking
that the source size is the size *with* the prepended code.
2019-10-16 17:07:18 -07:00
Michael Kuhn
ffe87ed49f filter_file: fix multiple invocations on the same file (#13234)
Since the backup file is only created on the first invocation, it will
contain the original file without any modifications. Further invocations
will then read the backup file, effectively reverting prior invocations.

This can be reproduced easily by trying to install likwid, which will
try to install into /usr/local. Work around this by creating a temporary
file to read from.
2019-10-16 15:15:24 -07:00
Tamara Dahlgren
1ef71376f2 Bugfix: stage directory permissions and cleaning (#12733)
* This updates stage names to use "spack-stage-" as a prefix.
  This avoids removing non-Spack directories in "spack clean" as
  c141e99 did (in this case so long as they don't contain the
  prefix "spack-stage-"), and also addresses a follow-up issue
  where Spack stage directories were not removed.
* Spack now does more-stringent checking of expected permissions for
  staging directories. For a given stage root that includes a user
  component, all directories before the user component that are
  created by Spack are expected to match the permissions of their
  parent; the user component and all deeper directories are expected
  to be accessible to the user (read/write/execute).
2019-10-16 14:55:37 -07:00
Greg Becker
94e80933f0 Feature: installed file verification (#12841)
This feature generates a verification manifest for each installed
package and provides a command, "spack verify", which can be used to
compare the current file checksums/permissions with those calculated
at installed time.

Verification includes

* Checksums of files
* File permissions
* Modification time
* File size

Packages installed before this PR will be skipped during verification.
To verify such a package you must reinstall it.

The spack verify command has three modes.

* With the -a,--all option it will check every installed package.
* With the -f,--files option, it will check some specific files,
  determine which package they belong to, and confirm that they have
  not been changed.
* With the -s,--specs option or by default, it will check some
  specific packages that no files havae changed.
2019-10-15 14:24:52 -07:00
Massimiliano Culpo
d33b0ffc50 lmod: module files are written in a root folder named by target family (#13121)
fixes #13005

This commit fixes an issue with the name of the root directory for
module file hierarchies. Since #3206 the root folder was named after
the microarchitecture used for the spec, which is too specific and
not backward compatible for lmod hierarchies. Here we compute the
root folder name using the target family instead of the target name
itself and we add target information in the 'whatis' portion of the
module file.
2019-10-15 11:20:49 -07:00
Massimiliano Culpo
5cd28847e8 filter_file uses "surrogateescape" error handling (#12765)
From Python docs:
--
'surrogateescape' will represent any incorrect bytes as code points in
the Unicode Private Use Area ranging from U+DC80 to U+DCFF. These
private code points will then be turned back into the same bytes when
the surrogateescape error handler is used when writing data. This is
useful for processing files in an unknown encoding.
--

This will allow us to process files with unknown encodings.

To accommodate the case of self-extracting bash scripts, filter_file
can now stop filtering text input if a certain marker is found. The
marker must be passed at call time via the "stop_at" function argument.
At that point the file will be reopened in binary mode and copied
verbatim.

* use "surrogateescape" error handling to ignore unknown chars
* permit to stop filtering if a marker is found
* add unit tests for non-ASCII and mixed text/binary files
2019-10-14 20:35:14 -07:00
Greg Becker
3f46f03c83
bugfix: install --only dependencies works in env (#13090)
* bugfix: install --only dependents works in env

includes regression testing
2019-10-14 17:50:38 -07:00
Todd Gamblin
385d2bf3fa
commands: add resource stats to spack url stats (#13205)
`spack url stats` now also looks at packages' resources when outputting
statistics.

Example:

```
$ spack url stats
==> URL stats for 3531 packages:
--------------------------------------------------------------
stat                    versions        %   resources        %
--------------------------------------------------------------
url                         8335    89.3%         339    89.0%
    schemes
        https               6489    69.5%          93    24.4%
        ftp                   32     0.3%           8     2.1%
        http                1763    18.9%         237    62.2%
        file                  51     0.5%           1     0.3%
    checksums
        md5                   26     0.3%           0     0.0%
        sha256              8306    89.0%         336    88.2%
        no checksum            3     0.0%           3     0.8%
--------------------------------------------------------------
go                             1     0.0%           0     0.0%
--------------------------------------------------------------
hg                             7     0.1%           0     0.0%
--------------------------------------------------------------
no code                        4     0.0%           0     0.0%
--------------------------------------------------------------
svn                            4     0.0%          16     4.2%
--------------------------------------------------------------
git                          981    10.5%          26     6.8%
    branch                   442     4.7%           4     1.0%
    commit                   362     3.9%          14     3.7%
    no ref                    36     0.4%           2     0.5%
    tag                      141     1.5%           6     1.6%
--------------------------------------------------------------
```
2019-10-14 08:58:01 -07:00
Adam J. Stewart
e1cf35a82b Fix svn tests, skip if svnadmin not found (#13137) 2019-10-14 10:40:20 +02:00
Greg Becker
1808ba3c68 install: add --cache-only option (#12729)
* add `--cache-only` option to install
* testing for `--cache-only`
* remove extraneous stage creation at stage destroy time
2019-10-12 11:43:37 -07:00
Todd Gamblin
64bdc3251f checksums: enforce that all mainline packages use sha256 checksums
- Add a test that verifies checksums on all packages

- Also add an attribute to packages that indicates whether they need a
  manual download or not, and add an exception in the tests for these
  packages until we can verify them.
2019-10-12 07:19:43 -07:00
Massimiliano Culpo
f8a4a3802c Autotools build system to patch config.guess based on a range check 2019-10-11 21:21:57 -07:00
Massimiliano Culpo
8dd95c1705 Fixed options to compile generic code on ppc64 and ppc64le 2019-10-11 21:20:28 -07:00
Patrick Gartung
d248b0e9d5
Fix python3 errors from string and byte concatenation (#13141) 2019-10-11 03:21:45 -05:00
Tamara Dahlgren
93a44c822c tests: cleanup config:build_stage handling (fixes #12651, #12798) 2019-10-10 16:50:05 -07:00
Tamara Dahlgren
87cdfa2c25 Add support for nested "overrides" scopes. 2019-10-10 16:50:05 -07:00
Massimiliano Culpo
b07460ab5f Added NEON to the list of features required for the aarch64 family
Both floating-point and NEON are required in all standard ARMv8
implementations. Theoretically though specialized markets can support
no NEON or floating-point at all. Source:

https://developer.arm.com/docs/den0024/latest/aarch64-floating-point-and-neon

On the other hand the base procedure call standard for Aarch64
"assumes the availability of the vector registers for passing
floating-point and SIMD arguments". Further "the Arm 64-bit
architecture defines two mandatory register banks: a general-purpose
register bank which can be used for scalar integer processing and
pointer arithmetic; and a SIMD and Floating-Point register bank".
Source:

https://developer.arm.com/docs/ihi0055/latest/procedure-call-standard-for-the-arm-64-bit-architecture

This makes customization of Aarch64 with no NEON instruction set
available so unlikely that we can consider them a feature of the
generic family.
2019-10-10 16:24:36 -07:00
Massimiliano Culpo
77444dff10 ArchSpec: fix constraint satisfaction for targets
fixes #13111

Due to a missing case we were treating a single target that was not
equal to the one we were comparing to as a range open on the right.
2019-10-10 16:22:38 -07:00
Patrick Gartung
5b879459c7
Buildcache: pass string.encode('utf-8') for old_dir and new_dir to replace_prefix_bin. (#13114)
This should fix a Python3 error from concatenating strings and bytes.
2019-10-09 20:36:47 -05:00
Massimiliano Culpo
acbb2af528 "No Spack mirror configured": demoted the warning to a debug message (#13082)
fixes #12010
2019-10-09 07:13:37 -05:00
Adam J. Stewart
72d8febc4e Add macOS Catalina support (#13070) 2019-10-07 23:59:33 -07:00
Massimiliano Culpo
9faee51e22 Spack environments can concretize specs together (#11372)
This PR adds a 'concretize' entry to an environment's spec.yaml file
which controls how user specs are concretized. By default it is
set to 'separately' which means that each spec added by the user is
concretized separately (the behavior of environments before this PR).
If set to 'together', the environment will concretize all of the
added user specs together; this means that all specs and their
dependencies will be consistent with each other (for example, a
user could develop code linked against the set of libraries in the
environment without conflicts).

If the environment was previously concretized, this will re-concretize
all specs, in which case previously-installed specs may no longer be
used by the environment (in this sense, adding a new spec to an
environment with 'concretize: together' can be significantly more
expensive).

The 'concretize: together' setting is not compatible with Spec
matrices; this PR adds a check to look for multiple instances of the
same package added to the environment and fails early when
'concretize: together' is set (to avoid confusing messages about
conflicts later on).
2019-10-07 09:53:23 -07:00
Pariksheet Nanda
19e6f55647 doc: fix #12245 non-functional libdwarf dependency (#12515)
Applying accepted fix from spack/spack.io#4
2019-10-05 21:07:18 -05:00
Michael Kuhn
bdb92f2d91 Consistently support pkg-config files in share subdirectory (#12838)
While the build environment already takes share/pkgconfig into account,
the generated module files etc. only consider lib/pkgconfig and
lib64/pkgconfig.
2019-10-05 21:03:35 -05:00
Massimiliano Culpo
6a1021b81c bugfix: issue with custom dotkit root in config.yaml (#13046)
When removing support for dotkit in #11986 the code trying to set the
paths of the various module files was not updated to skip it. This
results in a failure because of a key error after the deprecation
warning is displayed to user.

This commit fixes the issue and adds a unit test for regression.
Note that code for Spack chains has been updated accordingly but
no unit test has been added for that case.
2019-10-04 23:42:21 -07:00
Adam J. Stewart
24f8d1042b
Update compilers.yaml location in Getting Started docs (#13029) 2019-10-03 10:31:32 -05:00
Massimiliano Culpo
78577c0a90
Generic x86_64 code compiled with GCC uses non deprecated mtune flags (#13022)
fixes #12928
2019-10-03 10:31:03 +02:00
Massimiliano Culpo
76b9c56110 Remove support for generating dotkit files (#11986)
Dotkit is being used only at a few sites and has been deprecated on new
machines. This commit removes all the code that provide support for the
generation of dotkit module files.

A new validator named "deprecatedProperties" has been added to the
jsonschema validators. It permits to prompt a warning message or exit
with an error if a property that has been marked as deprecated is
encountered.

* Removed references to dotkit in the docs
* Removed references to dotkit in setup-env-test.sh
* Added a unit test for the 'deprecatedProperties' schema validator
2019-10-02 22:15:01 -07:00
t-karatsu
a3a0e1cd2e fujitsu compiler: Add 'required_libs'. (#13014) 2019-10-02 11:55:08 -05:00
Patrick Gartung
2a739ed03e
Replace expensive store.reindex() call with db.add() call. (#13021) 2019-10-02 11:30:28 -05:00
Patrick Gartung
9dfec4a57c
'spack buildcache list' should show all buildaches available. (#13002)
* binary cache: show all packages for compatible differing targets

* Don't restrict spack buildcache list to arch or os

* Fix from merge conflict
2019-10-01 22:54:22 -05:00
Massimiliano Culpo
1b18ec90ab Add all compatible system types directory to module paths
fixes #12915
closes #12916

Since Spack has support for specific targets it might happen that
software is built for targets that are not exactly the host because
it was either an explicit user request or the compiler being used is
too old to support the host.

Modules for different targets are written into different directories
and by default Spack was adding to MODULEPATH only the directory
corresponding to the current host. This PR modifies this behavior to
add all the directories that are **compatible** with the current host.
2019-10-01 19:18:27 -07:00
Greg Becker
b92977492d binary cache: show all packages for compatible differing targets (#12943) 2019-10-01 17:03:28 -05:00
Jeffrey Salmond
76178f31ca When removing a file from a view, don't fail if it doesn't exist (#12960)
Sometimes when remove_file is called on a link, that link is missing
(perhaps ctrl-C happened halfway through a previous action). As
removing a non-existent file is no problem, this patch changes the
behavior so Spack continues rather than stopping with an error.

Currently you would see

  ValueError: /path/to/dir is not a link tree!

and now it continues with a warning.
2019-10-01 10:29:10 -07:00
Todd Gamblin
a12c032509 make license check slightly more lenient
bin/spack now needs to have a "-*- python -*-" line after the shebang, so
that emacs will interpret it as a python file instead of as a shell
script.  Add one line to the license check limit to accommodate this.
2019-09-29 09:32:04 -07:00
Massimiliano Culpo
9117dfd118 Add all the 'generic' architectures that are mentioned in recipes (#12958)
LLVM, mesa and other packages check for these generic
microarchitectures. One solution is to let Spack know they exist.
2019-09-28 21:47:05 -07:00
Glenn P Johnson
08a6577861 Fix perl build when using Build.PL
This fixes #12852 where perl builds that use Build.PL will fail when the
shebang of the Build script produced from the configure step is too
long.
2019-09-26 13:38:13 -07:00
Patrick Gartung
7dae058f91
Relocate mach-o binaries using macholib on linux. (#12946)
Changes deps and rpaths for bins and libs, changes id for libs.
2019-09-26 13:04:58 -05:00
eugeneswalker
950338aa92 add --no-deps opt to buildcache-create (#12956) 2019-09-26 12:23:59 -05:00
Patrick Gartung
321e956fa9
External: add macholib and altgraph needed to relocate Mach-o binaries on Linux (#12909) 2019-09-26 11:48:22 -05:00
Adam J. Stewart
065cbe89fe Fix "specific target" detection in Python 3 (#12906)
The output of subprocess.check_output is a byte string in Python 3. This causes dictionary lookup to fail later on.

A try-except around this function prevented this error from being noticed. Removed this so that more errors can propagate out.
2019-09-24 09:47:54 -07:00
Patrick Gartung
6dd9dbc071
Change get_patchelf to immediately return patchelf path if found (#12925) 2019-09-24 08:38:19 -05:00
t-karatsu
9aca0a17f4 Fujitsu compilers: added 'verbose_flag' method (#12922) 2019-09-24 11:17:29 +02:00
Todd Gamblin
18d63a239f bugfix: use string keys to set preferred targets (#12921)
Preferred targets were failing because we were looking them up by
Microarchitecture object, not by string.

- [x] Add a call to `str()` to fix target lookup.
- [x] Add a test to exercise this part of concretization.
- [x] Add documentation for setting `target` in `packages.yaml`
2019-09-24 10:18:48 +02:00
Massimiliano Culpo
2468ccee58 AMD: fix architecture hierarchy (zen) (#12913)
* microarchitectures: zen starts from x86_64, not from excavator
* Unit tests: fixed a test that is wrong with the new modeling
* microarchitectures: fixed features and inheritance for 15h family

bulldozer doesn't inherit from barcelona (10h) + added xop, lwp and tbm
instruction sets to the 15h family (it distinguish the family from 17h)
2019-09-23 21:54:13 -07:00
Adam J. Stewart
d6555f64b0
Fix detection of Apple Clang 11.0.0 (#12912) 2019-09-23 17:25:33 -05:00
Tamara Dahlgren
08e77e1b41
tests: more template creation tests (#12882)
Addresses #12804 

This PR adds the creation of the remaining (16) templates to ensure we can create them with expected content. The goal is to facilitate catching during testing.
2019-09-23 10:18:50 -07:00
Todd Gamblin
b4e148b562 externals: add note to jsonschema about modifications (#12895) 2019-09-22 09:43:57 -05:00
Todd Gamblin
7a1dd517b8 externals: avoid importing requests in jsonschema
Spack doesn't need `requests`, and neither does `jsonschema`, but
`jsonschema` tries to import it, and it'll succeed if `requests` is on
your machine (which is likely, given how popular it is).  This commit
removes the import to improve Spack's startup time a bit.

On a mac with SSD, the import of requests is ~28% of Spack's startup time
when run as `spack --print-shell-vars sh,modules` (.069 / .25 seconds),
which is what `setup-env.sh` runs.

On a Linux cluster where Python is mounted from NFS, this reduces
`setup-env.sh` source time from ~1s to .75s.

Note: This issue will be eliminated if we upgrade to a newer `jsonschema`
(we'd need to drop Python 2.6 for that).  See
https://github.com/Julian/jsonschema/pull/388.
2019-09-21 17:57:36 -07:00
Scott Wittenburg
db4d52d923 Fix how 'gpg --list-secret-keys ...' output is parsed 2019-09-20 11:33:58 -06:00
Gregory Becker
c43f105359 targets: add mic_knl target to microarchitectures.json
- This is needed to support Cray machines -- we need an architecture
  mic_knl > x86_64

- We used Cray's naming scheme for this target to make it work seamlessly
  with the module-based detection sccheme on Cray.  mic_knl is pretty
  much dead, so this will be the last succh target.  We will need to work
  wtih Cray and other vendors in the future.
2019-09-20 00:51:37 -07:00
Massimiliano Culpo
7daf860991 targets: adjust packages to use new specific targets semantics
Seamless translation from 'target=<generic>' to either
- target.family == <generic> (in methods)
- 'target=<generic>:' (in directives)

Also updated docs to show ranges in directives.
2019-09-20 00:51:37 -07:00
Massimiliano Culpo
3c4322bf1a targets: Spack targets can now be fine-grained microarchitectures
Spack can now:

- label ppc64, ppc64le, x86_64, etc. builds with specific
  microarchitecture-specific names, like 'haswell', 'skylake' or
  'icelake'.

- detect the host architecture of a machine from /proc/cpuinfo or similar
  tools.

- Understand which microarchitectures are compatible with which (for
  binary reuse)

- Understand which compiler flags are needed (for GCC, so far) to build
  binaries for particular microarchitectures.

All of this is managed through a JSON file (microarchitectures.json) that
contains detailed auto-detection, compiler flag, and compatibility
information for specific microarchitecture targets.  The `llnl.util.cpu`
module implements a library that allows detection and comparison of
microarchitectures based on the data in this file.

The `target` part of Spack specs is now essentially a Microarchitecture
object, and Specs' targets can be compared for compatibility as well.
This allows us to label optimized binary packages at a granularity that
enables them to be reused on compatible machines.  Previously, we only
knew that a package was built for x86_64, NOT which x86_64 machines it
was usable on.

Currently this feature supports Intel, Power, and AMD chips. Support for
ARM is forthcoming.

Specifics:

- Add microarchitectures.json with descriptions of architectures

- Relaxed semantic of compiler's "target" attribute.  Before this change
  the semantic to check if a compiler could be viable for a given target
  was exact match. This made sense as the finest granularity of targets
  was architecture families.  As now we can target micro-architectures,
  this commit changes the semantic by interpreting as the architecture
  family what is stored in the compiler's "target" attribute. A compiler
  is then a viable choice if the target being concretized belongs to the
  same family. Similarly when a new compiler is detected the architecture
  family is stored in the "target" attribute.

- Make Spack's `cc` compiler wrapper inject target-specific flags on the
  command line

- Architecture concretization updated to use the same algorithm as
  compiler concretization

- Micro-architecture features, vendor, generation etc. are included in
  the package hash.  Generic architectures, such as x86_64 or ppc64, are
  still dumped using the name only.

- If the compiler for a target is not supported exit with an intelligible
  error message. If the compiler support is unknown don't try to use
  optimization flags.

- Support and define feature aliases (e.g., sse3 -> ssse3) in
  microarchitectures.json and on Microarchitecture objects. Feature
  aliases are defined in targets.json and map a name (the "alias") to a
  list of rules that must be met for the test to be successful. The rules
  that are available can be extended later using a decorator.

- Implement subset semantics for comparing microarchitectures (treat
  microarchitectures as a partial order, i.e. (a < b), (a == b) and (b <
  a) can all be false.

- Implement logic to automatically demote the default target if the
  compiler being used is too old to optimize for it. Updated docs to make
  this behavior explicit.  This avoids surprising the user if the default
  compiler is older than the host architecture.

This commit adds unit tests to verify the semantics of target ranges and
target lists in constraints. The implementation to allow target ranges
and lists is minimal and doesn't add any new type.  A more careful
refactor that takes into account the type system might be due later.

Co-authored-by: Gregory Becker <becker33.llnl.gov>
2019-09-20 00:51:37 -07:00
Gregory Becker
dfabf5d6b1 targets: first pass at target detection for linux
Add llnl.util.cpu_name, with initial support for detecting different
microarchitectures on Linux.  This also adds preliminary changes for
compiler support and variants to control the optimizatoin levels by
target.

This does not yet include translations of targets to particular
compilers; that is left to another PR.

Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
2019-09-20 00:51:37 -07:00
Patrick Gartung
a940ff34d7
Put back the use of otool and install_name_tool when running on macOS. Only use machotools on linux. (#12867)
Move verbose messages to debug level

get_patchelf should return None for test platform as well because create_buildinfo invokes patchelf to get rpaths.
2019-09-19 17:16:26 -05:00
Patrick Gartung
7c0c31361a
Update buildcache creation and installation to allow mach-o binary relocation using py-machotools on linux or macos. (#12858)
Update py-machotools dependencies and versions.
2019-09-18 07:24:45 -05:00
Scott Wittenburg
56894b8805 Support yaml paths anywhere specs are handled on CLI (#12561)
Update command-line (CLI) parsing to understand references to yaml
files that store Spack specs. Where a file reference is encountered,
the full Spec in the file will be read in. A file reference may
appear anywhere that a spec could appear before. For example, if you
write "spack spec -y openmpi > openmpi.yaml" you may then install the
spec using the yaml file by running "spack install ./openmpi.yaml";
you can also refer to dependencies in this way (e.g.
"spack install foo^./openmpi.yaml").

There are two requirements for file references:

* A file path entered on the CLI must include a "/" even if the file
  exists in your current working directory. For example, if you
  create an openmpi.yaml file as above and run
  "spack install openmpi.yaml" from the same directory, it will
  report an error.
* A file path entered on the CLI must end with ".yaml"

This commit adds error messages to clearly inform the user of both
violations.
2019-09-17 19:45:37 -07:00
Peter Scheibel
141a1648e6 implicit rpaths filtering (#12789)
* implicit_rpaths are now removed from compilers.yaml config and are always instantiated dynamically, this occurs one time in the build_environment module

* per-compiler list required libraries (e.g. libstdc++, libgfortran) and whitelist directories from rpaths including those libraries. Remove non-whitelisted implicit rpaths. Some libraries default for all compilers.

* reintroduce 'implicit_rpaths' as a config variable that can be used to disable Spack insertion of compiler RPATHs generated at build time.
2019-09-17 17:45:21 -05:00
Adam J. Stewart
21e4b1752e Fix generic body during package creation (#12804)
Fixes incomplete change in #11981 

Use the proper variable (`body_def`) during package creation for package subclasses.
2019-09-17 09:37:46 -07:00
Adam J. Stewart
dce45aa299 Allow build to proceed with failed compiler lib detection (#12756)
Fixes #12732
Fixes #12767

c22a145 added automatic detection and RPATHing of compiler libraries
to Spack builds. However, in cases where the parsing/detection logic
fails this was terminating the build. This makes the compiler library
detection "best-effort" and reports an issue when the detection fails
rather than terminating the build.
2019-09-16 19:09:28 -07:00
Adam J. Stewart
5eac8130b3 Quote shell variable values (#12759)
This updates logic which sets shell variables to quote the values,
which is necessary when the value contains a space (e.g. PATH).
2019-09-16 11:10:36 -07:00
Scott Wittenburg
1050fa5546 Fixes identified in ecp facilities hackathon fixes:
- improve mirror git repo management
- minio s3 implementation needs endpoint_url
- Remove image key from rebuild-index job
- Remove image, rely on tags instead
2019-09-13 22:57:15 -07:00
Scott Wittenburg
6d745a56fd Implement an optional compiler bootstrapping phase 2019-09-13 22:57:15 -07:00
Scott Wittenburg
5323a5cff9 Remove CombinatorialSpecSet in favor of environments + stacks 2019-09-13 22:57:15 -07:00
Scott Wittenburg
fabbb3d58a Refactor release-jobs cmd based on use of environments (no docker either) 2019-09-13 22:57:15 -07:00
Scott Wittenburg
73c161b7de Add schema for new gitlab-ci and cdash additions to environment 2019-09-13 22:57:15 -07:00
Greg Becker
b1868f35ec
module parsing: make heuristic to get paths from modules more robust (#12693)
* module parsing: make heuristic to get paths from modules more robust

* refactor module parsing
2019-09-11 10:51:44 -07:00
Massimiliano Culpo
bd0fed7090 clang: add another regex for version detection (#12769)
This is similar to #10191. The Ubuntu package for clang 8.0.0 displays
a very unusual version string, and we need this new regex to detect it
as just 8.0.0

Unit test have been complemented by the output that was failing
detection.
2019-09-09 11:37:04 -05:00
Adam J. Stewart
bff667051b
Fix PyQt installation (#12479)
* Fix PyQt installation

* Switch dependency type

* Replace SIP dependency with resource

* Relax py-pyqt4 Qt dependency
2019-09-08 10:48:50 -05:00
Todd Gamblin
a2220f3150 flake8: make entire repository pass spack flake8 -a
- Fix trailing whitespace missed by the bug described in #12755.

- Fix other style issues that have crept in over time (this can happen
  when flake8 adds new checks with new versions)
2019-09-07 23:59:10 -07:00
Todd Gamblin
0ec80e8f16
flake8: only add E501 exemptions when absolutely necessary (#12755)
E501 (line too long) exemptions are probably our most common ones -- we
add them for directives, URLs, hashes, etc. in packages.  But we
currently add them even when a line *doesn't* need them, which can mask
trailing whitespace errors.

This changes `spack flake8` so that it will only add E501 exemptions if
the line is *actually* too long.

Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com>
2019-09-07 23:58:12 -07:00
Adam J. Stewart
a4aa1b5a05
Update docs on module loads command (#12702) 2019-09-07 18:32:02 -05:00
Greg Becker
3f1c78128e
make env view loading unconditional (#12719) 2019-09-05 18:15:36 -07:00
Chris Green
7f8fe11e4d Improve mock_archive versatility; Remove unwanted ALLOWED_ARCHIVE_TYPES. (#12513)
mock_archive can now take multiple extension / tar option pairs (default matches old behavior).

url_fetch.test_fetch tests more archive types.

compression.EXTS split into EXTS and NOTAR_EXTS to avoid unwanted, non-meaningful combinatoric extensions such as .tar.tbz2.
2019-09-04 13:49:00 -05:00
Todd Gamblin
6b619daef3 specs: better lookup by hash; allow references to missing dependency hashes
- previously spec parsing didn't allow you to look up missing (but still
  known) specs by hash

- This allows you to reference and potentially reinstall
  force-uninstalled dependencies

- add testing for force uninstall and for reference by spec

- cmd/install tests now use mutable_database
2019-09-04 00:25:36 -07:00
Tamara Dahlgren
c141e99e06 Use spack/user-specific stage root by default; stage cleaning (#12516)
* When cleaning the stage root, only remove directories that appear
  to be used for staging Spack packages. Previously Spack was clearing
  all directories in the stage root, which could remove content not
  related to Spack if the user chose a staging root which contains
  files/directories not managed by Spack.
* The documentation is updated with warnings about choosing a stage
  directory that is only managed by Spack (although generally the
  check added in this PR for "spack clean" should avoid removing
  content that was not created by Spack)
* The default stage directory (in config.yaml) is now
  $tempdir/$user/spack-stage and the logic is updated to omit the
  $user portion of this path if $tempdir already contains a $user
  directory.
* When creating stage root assign user read/write permissions to all
  directories in the path under $user. Previously Spack was assigning
  the permissions of the first existing parent directory
2019-09-03 16:31:27 -07:00
Todd Gamblin
d79f85d763 perf: spack find -p now does only one DB transaction
`spec.prefix` reads from Spack's database, and if you do this with
multiple consecutive read transactions, it can take a long time.  Or, at
least, you can see the paths get written out one by one.

This uses an outer read transaction to ensure that actual disk locks are
acquired only once for the whole `spack find` operation, and that each
transaction inside `spec.prefix` is an in-memory operation. This speeds
up `spack find -p` a lot.
2019-09-03 07:41:38 -07:00
Todd Gamblin
da7fed86a8 tests: add tests for spack extensions command
- add tests for `spack extensions`
- refactor `test_activations` test to use real extensions.
2019-09-02 19:24:48 -07:00
Todd Gamblin
1b877e8e0f tests and completions for spack find --json and spack find --format 2019-09-02 19:24:48 -07:00
Todd Gamblin
2dc7467760 tests: remove extraneous print statement 2019-09-02 19:24:48 -07:00
Todd Gamblin
d4bad06202 refactor: clean up spack find, make spack find -dp work properly
Refactor `spack.cmd.display_specs()` and `spack find` so that any options
can be used together with -d. This cleans up the display logic
considerably, as there are no longer multiple "modes".
2019-09-02 19:24:48 -07:00
Todd Gamblin
987d8cbaaa docs: add docs for spack find --format and spack find --json
- add docs for `spack find --format`
- add docs for `spack find --json`
- update references to Spec.format() docs and add links
2019-09-02 19:24:48 -07:00
Todd Gamblin
1a1f5674df command: add spack find --json
This is another machine-readable version of `spack find`.  Supplying the
`--json` argument causes specs to be written out as json records,
easily filered with tools like jq.

e.g.:

    $ spack find --json python | jq -C ".[] | { name, version } "
    [
      {
        "name": "python",
        "version": "2.7.16"
      },
      {
        "name": "bzip2",
        "version": "1.0.8"
      }
    ]
2019-09-02 19:24:48 -07:00
Todd Gamblin
64af0a9874 command: add spack find --format
- spack find --format allows you to supply a format string and have specs
  output in a more machine-readable way, without dedcoration

e.g.:

    spack find --format "{name}-{version}-{hash}"
    autoconf-2.69-icynozk7ti6h4ezzgonqe6jgw5f3ulx4
    automake-1.16.1-o5v3tc77kesgonxjbmeqlwfmb5qzj7zy
    bzip2-1.0.6-syohzw57v2jfag5du2x4bowziw3m5p67
    ...

or:

    spack find --format "{hash}"
    icynozk7ti6h4ezzgonqe6jgw5f3ulx4
    o5v3tc77kesgonxjbmeqlwfmb5qzj7zy
    syohzw57v2jfag5du2x4bowziw3m5p67
    ...

This is intended to make it much easier to script with `spack find`
2019-09-02 19:24:48 -07:00
Peter Scheibel
9432d4c7ee
Archive all patches in a package after install (#12653)
When Spack installs a package it writes the package.py file and
patches to a separate repository (which reflects the state of the
package at the time it was installed). Previously, Spack only wrote
patches that were used at installation time. This updates the
archiving step to include all patch files that are relevant to the
package (in case that repository is used in another context).
2019-08-30 10:33:18 -07:00
t-karatsu
0c421589e6 Fujitsu compiler: Add flags for c11/c99 (#12622)
* Fujitsu compiler: Add flags for c11/c99

* Add unit tests about supported flags
2019-08-30 11:25:34 -05:00
Greg Becker
c8b613d261 fix packaging_guide variant table (#12296) 2019-08-29 09:35:48 -06:00
Geoffrey M Oxberry
56fd9bc7b6 AutotoolsPackage: remove redundant libtoolize call
This commit removes redundant calls to `libtoolize` and `aclocal`.

Some configurations, such as a Spack user using macOS with a
Homebrew-installed `libtool` added to their `packages.yaml`, have
`autoreconf` and GNU libtoolize installed as `glibtoolize`, but not
`libtoolize`. While Spack installations of `libtool` built from source
would install `glibtoolize` and symlink `libtoolize` to `glibtoolize`,
an external installation of GNU libtoolize as `glibtoolize` will not
have such a symlink, and thus the call `m.libtoolize()` will throw an
error because `libtoolize` does not exist at the path referenced by
`m.libtoolize()` (i.e.,
`self.spec['libtool'].prefix.bin.join('libtoolize')).

However, on these same systems, `autoreconf` runs correctly, and calls
`glibtoolize` instead of `libtoolize`, when appropriate. Thus,
removing the call to `libtoolize` should resolve the error mentioned
above.

The redundant call to `aclocal` is also removed in this commit because
the maintainers of GNU Automake state that "`aclocal` is expected to
disappear" and suggest that downstream users never call `aclocal`
directly -- rather, they suggest calling `autoreconf` instead.
2019-08-27 18:03:56 -07:00
Massimiliano Culpo
2e8aa6cb24 Configuration schema are checked against jsonschema draft 4 meta-schema (#10247)
fixes #10246
2019-08-27 09:31:18 -06:00
Adam J. Stewart
f31e87935e
RPackage docs: use cloud.r-project.org (#12471) 2019-08-25 12:34:58 -05:00
Ben Boeckel
c22a145344 Add implicit rpaths to compiler detection (#7153)
Uses code from CMake to detect implicit link paths from compilers
System paths are filtered out of implicit link paths
Implicit link paths added to compiler config and object under `implicit_rpaths`
Implicit link paths added as rpaths to compile line through env/cc wrapper

Authored by: "Ben Boeckel <ben.boeckel@kitware.com>"
Co-authored by: "Peter Scheibel <scheibel1@llnl.gov>"
Co-authored by: "Gregory Becker <becker33@llnl.gov>"
2019-08-24 06:21:45 -07:00
Tamara Dahlgren
b42324c23b bugfix: template create constructor args (#12536)
c9e214f updated template creation by passing **kwargs to package
template classes but the template classes were not updated to accept
them; this adds **kwargs to package template initializers where they
are needed.
2019-08-23 10:45:17 -07:00
Seth R. Johnson
c86006e948 Skip invisible non-packages in package directory. (#12467)
Having a non-directory invisible file causes `spack find` to die. This
fixes the logic to ignore invalid module names but only warn if they're
visible.
```
NotADirectoryError: [Errno 20] Not a directory: '/spack/var/spack/repos/builtin/packages/.DS_Store/package.py'
```
2019-08-23 06:42:17 +02:00
Tamara Dahlgren
c9e214f6d3 Spack BundlePackage: a group of other packages (#11981)
This adds a special package type to Spack which is used to aggregate
a set of packages that a user might commonly install together; it
does not include any source code itself and does not require a
download URL like other Spack packages. It may include an 'install'
method to generate scripts, and Spack will run post-install hooks
(including module generation).

* Add new BundlePackage type
* Update the Xsdk package to be a BundlePackage and remove the
  'install' method (previously it had a noop install method)
* "spack create --template" now takes "bundle" as an option
* Rename cmd_create_repo fixture to "mock_test_repo" and relocate it
  to shared pytest fixtures
* Add unit tests for BundlePackage behavior
2019-08-22 11:08:23 -07:00
Greg Becker
5af2378ece compiler install: fix bug in construction of compiler spec (#12507) 2019-08-22 09:57:53 -07:00
Peter Scheibel
661b1da5d0
'spack spec --yaml' command now writes build deps to yaml (#12317)
This allows "spack spec --yaml" to generate a spec YAML file that can
be used with "spack install -f". Before, this would fail in cases
where the spec had build dependencies.
2019-08-21 18:32:31 -07:00
Chris Green
2499c047f0 Emacs directives for fill-column setting. 2019-08-21 18:21:05 -07:00
Chris Green
ad4309b782 Fetch strategies: new global option no_cache, new git option get_full_repo.
* All fetch strategies now accept the Boolean version keyword option `no_cache` in order to allow per-version control of cache-ability.
* New git-specific version keyword option `get_full_repo` (Boolean). When true, disables the default `--depth 1` and `--single-branch` optimizations that are applied if supported by the git version and (in the former case) transport protocol.
* The try / catch blog attempting `--depth 1` and retrying on failure has been removed in favor of more accurately ascertaining when the `--depth` option should work based on git version and protocol choice. Any failure is now treated as a real problem, and the clone is only attempted once.
* Test improvements:
  * `mock_git_repository.checks[type_of_test].args['git']` is now specified as the URL (with leading `file://`) in order to avoid complaints when using `--depth`.
  * New type_of_test `tag-branch`.
  * mock_git_repository now provides `git_exe`.
  * Improved the action of the `git_version` fixture, which was previously hard-wired.
  * New tests of `--single-branch` and `--depth 1` behavior.
* Add documentation of new options to the packaging guide.
2019-08-21 18:21:05 -07:00
Chris Green
ccb688f575 Fix to option text for help command. (#12444) 2019-08-21 17:11:24 -07:00
Peter Scheibel
5127d95b2e properly format message with all paths that could not be used. also report canonicalized paths vs. Spack config variables like 'tempdir' (#12492) 2019-08-21 15:46:12 -07:00
Chris Green
2441c0bad7 pkg command uses a working directory for git invocations rather than -C. (#12491) 2019-08-21 09:31:27 -07:00
Greg Becker
3b115fffb1 permissions: fix file permissions on intermediate install directories (#12399)
- mkdirp now takes arguments to allow it to properly set permissions on created directories.
- Two arguments (group and mode) set permissions for the leaf directory.
- Intermediate directories can inherit permissions from either the topmost existing directory (the parent) or the leaf.
2019-08-20 23:08:02 -07:00
Todd Gamblin
368bf2d69c
stage: avoid using group name in _first_accessible_path()
On machines where $TMP is owned by a gid with no name, this avoids the
following error when the default spack stage does not exist:

    (spackbook):spack$ spack clean
    ==> Removing all temporary build stages
    ==> Error: 'getgrgid(): gid not found: 57095'

Spack needs to deal with gids directly unless users pass them in.
2019-08-20 14:52:53 -07:00
Tamara Dahlgren
aed204e409
cleanup: remove extraneous prints (#12474)
Removes messages accidentally introduced in #12072 .
2019-08-19 14:49:09 -07:00
Peter Scheibel
31ff791180 features: Update compiler caching (#7675)
Compiler caching was using the `id()` function to refer to configuration dictionary objects. If these objects are garbage-collected, this can produce incorrect results (false positive cache hits). This change replaces `id()` with an object that keeps a reference to the config dictionary so that it is not garbage-collected.
2019-08-19 11:24:05 -07:00
Tamara Dahlgren
0ea6e0f817
features: Remove stage symlinks (#12072)
Fixes #11163

The goal of this work is to simplify stage directory structures by eliminating use of symbolic links. This means, among other things, that` $spack/var/spack/stage` will no longer be the core staging directory. Instead, the first accessible `config:build_stage` path will be used.

Spack will no longer automatically append `spack-stage` (or the like) to configured build stage directories so the onus of distinguishing the directory from other work -- so the other work is not automatically removed with a `spack clean` operation -- falls on the user.
2019-08-19 10:31:24 -07:00
Zack Galbreath
cef1e4e0b4 Do not report on packages installed from the cache (#12336)
Skip generating reports for any packages that were found in the binary cache.
2019-08-16 10:19:11 -07:00
Greg Becker
0307b5a3dc mirrors: make spack mirror environment aware (#12345)
Allow "spack mirror" with no spec arguments to create a mirror for the
active environment (download all concretized specs in the environment)
2019-08-15 18:45:17 -07:00
Peter Scheibel
1f6befabb1
Fix "spack loads" when retrieving upstream modules (#12203)
Fixes #12062

406c791 addressed "spack module load" for upstream modules but not
the "spack module loads" command. This applies the same fixes from
406c791 to "spack module loads".
2019-08-13 11:09:40 -07:00
Massimiliano Culpo
ab4b5deb97 bugfix: Python 2.6 parsing error (#11867)
Apparently shlex.split can't deal with unicode encoded characters in
Python2.6. The solution is to convert to str before calling the
function.
2019-08-11 13:00:36 -07:00
Greg Becker
be6ac6ce6d bugfix: nested matrices in spec lists (#12320)
* stack concretization: fix handling of variant names with dashes
* spec_list: bugfix for handling nested matrices
2019-08-08 20:53:31 -07:00
Adam J. Stewart
44f4ad7bbf Allow Spack to uninstall external extensions without permissions (#11991)
* Allow Spack to uninstall external extensions without permissions

Raise when self.projections is not empty
2019-08-08 17:46:14 -07:00
Pariksheet Nanda
72bb7646fe docs: fix compiler config (#12330)
It's no longer possible to set compiler flags under as an entry under
"paths" in compilers.yaml; instead the user must list these under the
"flags" section. This updates the docs accordingly.
2019-08-08 16:47:24 -07:00
Adam J. Stewart
b4862be875 Fix typo in yaml config docs (#12312) 2019-08-08 10:56:11 +02:00
Greg Becker
36fbd6cf4c bugfix: spack stacks mixed dependency and non-dep constraints (#12315)
Spack stacks drop invalid dependencies applied to packages by a
spec_list matrix operation

Without this fix, Spack would raise an error if orthogonal dependency
constraints and non-dependency constraints were applied to the same
package by a matrix and the dependency constraint was invalid for
that package. This is an error, fixed by this PR.

An example failing configuration:

spack:
  definitions:
  - packages: [libelf, hdf5+mpi]
  - compilers: ['%gcc']
  - mpis: [^openmpi]

  specs:
  - matrix:
    - $packages
    - $compilers
    - $mpis
2019-08-07 18:34:41 -07:00
Peter Scheibel
92ec732f9a compiler bootstrapping: enable both single-node and multi-node DAGS(#12310)
5f74f22 enabled installing compilers for dependencies but not for the root package (and in particular not for DAGs which consist of one package)

this enables bootstrapping compilers for both types of DAGs
2019-08-07 14:43:25 -07:00
Tamara Dahlgren
951d42596b tests: explain and test dependency flattening routines (#11993)
- Add comments to explain that `install_dependency_symlinks` and `flatten_dependencies` are actually used.
- Add a test that exercises the routines.
2019-08-06 17:11:23 -07:00
Greg Becker
15884a679b
mirrors: mirror config should use spack variable expansions (#9027)
- ensure that `$spack` and other variables are substituted into mirror
  paths
2019-08-06 13:54:50 -07:00
Greg Becker
3b4d6ddc03 stacks: fix reference handling in env.write() (#12096)
* stacks: Fix env.write to properly write references
* stacks: regression test for 12095
2019-08-06 12:53:41 -07:00
Pariksheet Nanda
f68cdd1ad0 Fix typo in config (#12267)
Using "compilers" with the "s" is an invalid config section and throws an error.

Traceback (most recent call last):
  File "spack/bin/spack", line 48, in <module>
    sys.exit(spack.main.main())
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/main.py", line 633, in main
    env = ev.find_environment(args)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 263, in find_environment
    return Environment(env)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 534, in __init__
    self._read_manifest(f)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 561, in _read_manifest
    self.yaml = _read_yaml(f)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 402, in _read_yaml
    validate(data, filename)
  File "/home/omsai/src/libkmap/spack/lib/spack/spack/environment.py", line 395, in validate
    e, data, filename, e.instance.lc.line + 1)
spack.config.ConfigFormatError: /home/omsai/src/libkmap/spack.yaml:15: Additional properties are not allowed ('compilers' was unexpected)
2019-08-03 20:18:44 -05:00
Adam J. Stewart
98605bba0d Fix CNL version detection (#12207) 2019-08-03 12:00:30 -07:00
Massimiliano Culpo
90756d0428 Refactor UI logic out of Environment.concretize (#12213)
Environment.concretize returns newly-concretized specs rather than
printing them; as a result, the _display argument is removed from
Environment.concretize (originally only used to avoid printing specs
during unit testing). Command logic which invokes
Environment.concretize prints these explicitly.
2019-08-02 17:27:51 -07:00
Seth R. Johnson
46027bea13 Fix QT4 build for mac (#10944)
This updates the Spack QT package to enable building qt version 4 on
MacOS. 

This includes the following changes to the qt package:

* add version 4.8.7
* add option to build with or without shared libs
* add options to disable tools, ssl, sql, and freetype support
* add qt4-tools patch when building qt@4+tools
* add option to build as a framework (only available on MacOS)
* replace qt4-el-capitan patch with qt4-mac patch (which includes the
  edits from qt4-el-capitan)
* apply qt4-pcre-include-conflict.patch only for version 4.8.6
  (rather than all 4.x versions)
* apply qt4-gcc-and-webkit.patch for 4.x versions before 4.8.7 and
  create a separate qt4-gcc-and-webkit-487.patch for version 4.8.7
* update patch function for qt@4 on MacOS to update configure
  variables relevant to Spack (e.g. PREFIX)
* add option to build freetype with Spack, as a vendored dependency
  of QT, or not at all (default is to build with Spack)

This includes the following edits outside of the qt package:

* Update MacOS version utility function to return all parts of the
  Mac version (rather than just the first two)
* gettext package: implement "libs"
* python package: add gettext as a dependency
2019-08-01 10:22:35 -07:00
Patrick Gartung
4ff14bd0b2
Buildcache: skip binary string replacement with padding when the new install path is longer than the old install path. (#12227)
* Raise an exception and exit with a meaningful message when binary path substitution fails.

* Skip binary text replacement with padding and issue a warning when the new install path is longer than the old install path.
2019-08-01 12:07:04 -05:00
Levi Baber
8ec9ebc92f should not need bin prefix on spack command (#12215) 2019-07-31 12:58:01 -05:00
Todd Gamblin
33701cc355
docs: update tutorial slides for PEARC19 2019-07-31 12:55:59 -05:00
Adam J. Stewart
f7d1df4d3a
Update Package Creation Tutorial for PEARC19 (#12209)
* Update Package Creation Tutorial for PEARC19

* A few remaining fixes

* Fix section link
2019-07-31 12:54:09 -05:00
Christoph Junghans
4ea5e177cd
CMake: make ninja verbose as well (#12200) 2019-07-31 08:41:58 -06:00
Javier Cervantes
a948954886 Print environment name when removing active env (#12198) 2019-07-31 14:40:11 +02:00
Adam J. Stewart
d973fca00e Fix Sphinx deprecation warning when building docs (#12205)
* Fix Sphinx deprecation warning when building docs

* Set minimum required version of Sphinx
2019-07-31 10:23:56 +02:00
Adam J. Stewart
b34da4e108
Add SIPPackage base class (#12157) 2019-07-30 17:12:48 -05:00
Adam J. Stewart
23420a6524 Typo fixes in Environments Tutorial (#12107) 2019-07-29 17:13:56 -05:00
Greg Becker
f78fc30032 intel: Add mpicc wrapper bindir to dependent env (#12132) 2019-07-29 12:04:15 -07:00
Gregory Lee
e8a71089a6 use Excecutable instead of exec for editing licenses (#11968)
* fix defunct editor exit in #11691
2019-07-25 11:48:32 -07:00
Todd Gamblin
b0abbfecb8 new command: spack maintainers queries package maintainers
- We don't currently make enough use of the maintainers field on
  packages, though we could use it to assign reviews.

- add a command that allows maintainers to be queried
  - can ask who is maintaining a package or packages
  - can ask what packages users are maintaining
  - can list all maintained or unmaintained packages

- add tests for the command
2019-07-24 14:10:08 -07:00
Tamara Dahlgren
7411347a29 tests: Test install of unconcretized spec (#12099) 2019-07-24 13:30:27 -05:00
Massimiliano Culpo
6fac0ae687 Fixed a name clash in the 'from_environment_diff' function (#12116)
* Added a unit test reproducing the failure in 12085

* Fixed name clash in the 'from_environment_diff' function

The bug reported in #12085 stemmed from a name clash among variables,
introduced during the refactor in #10753 and not caught by unit tests
and reviews.
2019-07-24 10:25:24 -05:00
Adam J. Stewart
58427a7102
Typo fixes in Spack Environments docs (#12100) 2019-07-23 17:42:16 -05:00
Greg Becker
daac376862
error messages: include whole spec for "no externals found" message (#12070)
* Provide better error message when matching externals are found for package marked not buildable
2019-07-23 13:58:07 -05:00
Gregory Becker
a086dda82f hashing: fix caching of dependency hashes in to_node_dict 2019-07-23 08:58:49 -07:00
Todd Gamblin
3cb40e1c02 commands: add tests for all subcommands of spack pkg 2019-07-22 23:01:45 -07:00
Todd Gamblin
0b17bccdce commands: add spack pkg changed subcommand, better test support
- Add `spack pkg changed` to show changed and added packages for a
  commit.

- Make `spack pkg` support tests better.
2019-07-22 23:01:45 -07:00
Denis Davydov
8cef81363c gcc: support without command line tools (#11040) 2019-07-22 16:53:50 -05:00
Adam J. Stewart
2d144316a8 Fix version scraping for CRAN packages (#12021)
* Fix version scraping for CRAN packages
* Remove set literals
2019-07-22 13:05:55 -07:00
Todd Gamblin
cc4094bb9b bugfix: env.write() should stringify Spec lists.
- Setting specs from lockfiles was not correctly stringifying concretized
  user specs.

- Fix `_set_user_specs_from_lockfile`

- Add some validation code to `SpecList` constructor
2019-07-22 13:45:34 -05:00
Peter Josef Scheibel
7ec1d320a8 hashes: consolidate and make hashing logic more consistent
Spack has evolved to have three types of hash functions, and it's
becoming hard to tell when each one is called. Whlie we aren't yet ready
to get rid of them, we can refactor them so that the code is clearer and
easier to track.

- Add a `hash_types` module with concise descriptors for hashes.

- Consolidate hashing logic in a private `Spec._spec_hash()` function.

- `dag_hash()`, `build_hash()`, and `full_hash()` all call `_spec_hash()`

- `to_node_dict()`, `to_dict()`, `to_yaml()` and `to_json()` now take a
  `hash` parameter consistent with the one that `_spec_hash()` requires.

Co-authored-by: Todd Gamblin <tgamblin@llnl.gov>
2019-07-22 13:45:34 -05:00
Peter Josef Scheibel
0715b512a1 env: environments index specs by full DAG w/build deps
- ensure that Spec._build_hash attr is defined
- add logic to compute _build_hash when it is not already computed (e.g. for specs prior to this PR)
- add test to ensure that different instance of a build dep are preserved
- test conversion of old env lockfile format to new format
- tests: avoid view creation, DAG display in tests using MockPackage
- add regression test for more-general bug also fixed by this PR
- update lockfile version since the way we are maintaining hashes has changed
- write out backup for version-1 lockfiles and test that
2019-07-22 13:45:34 -05:00
Adam J. Stewart
7d954720ff Add OpenMP flag for Apple Clang (#12049) 2019-07-20 13:40:36 -07:00
Massimiliano Culpo
a2cb26f520 tests: speed up tests that rely on the database fixture (#12031)
The database and mutable_database fixtures were installing and uninstalling the same specs multiple times to ensure the database for tests has the correct state.

This commit optimizes the procedure by caching the state in an external directory, and copying it in instead of going through the installation or uninstallation again.

The database fixture is meant not to be modified by tests. This commit enforces this invariant by making the database read-only before starting the test.

* Added missing db markers to tests
* Added test for uninstall_by_spec
* `database` fixture now returns a read-only database
* Tests that modify the DB now use `mutable_database` fixture
2019-07-20 10:18:50 -07:00
Greg Becker
67cd524e93 environment views: refactor stripping build deps (#12069) 2019-07-20 09:45:20 -07:00
Greg Becker
8ec098716b compilers: don't raise errors for duplicate compiler definitions (#11910)
Summary:
- Allow multiple definitions of compiler in compilers.yaml (use first instance)
- Still print debug messages when there are duplicates, to assist users in finding this issue.

Merging configs from different scopes can result in multiple compiler being present in the same configuration list.  Instead of raising when there are duplicates, take the one with highest precedence.

Print a debug message instead of raising, so that we can still diagnose this.  We don't have a good way of warning the user about inconsistent configuration *in the same file* -- we'd need to dig into YAML file/line info for that.
2019-07-20 00:42:12 -07:00
Todd Gamblin
993ee7f199 environments: add activate/deactivate tests, work wtih set -u
- [x] Add shell tests to ensure that `spack env activate`, `spack env
  deactivate`, and `despacktivate` continue to work.

- [x] Also ensure that activate and deactivate both work with `set -u`
2019-07-20 00:36:56 -07:00
Greg Becker
4f9131fdc2 Package inheritance: Find patch files defined in parent classes using MRO (#12051)
Fixes #8908, 11844

Use Python MRO to find patch files from parent classes.
2019-07-19 18:08:05 -07:00
albestro
3a026f1412 Fix #11240 (#11995)
* extends mkdirs with permissions for intermediate folders

Does not use os.makedirs mode parameter because its behavior is changed
with Python 3.7 (it ignores it for intermediate dirs), and moreover it
was not possible to set different modes for newly-created folders
and leaf folder.

reference:
- https://bugs.python.org/issue19930
- https://docs.python.org/3.7/library/os.html#os.makedirs

* comment mkdirp step easing code understanding

* revert mkdir to default for package metapath

since metapath is nested in package folder, there is no need
to specify permissions for intermediate folders because the prefix
already exists.

* comment create_install_directory package modes
2019-07-19 10:13:29 -05:00
Gregory Becker
ba0cd4d912 concretization: fix transient hang in python 3.5
Bug relates to the interplay between:
1. random dict orders in python 3.5
2. bugfix in initial implementation of stacks for `_concretize_dependencies`
   when `self._dependencies` is empty
3. bug in coconcretization algorithm computation of split specs

Result was transient hang in coconcretization.
Fixed #3 (bug in coconcretization) to resolve.
2019-07-18 19:28:50 -07:00
Gregory Becker
ec6e5b0fd3 stacks: add option to link only roots or all specs, default to all 2019-07-18 19:28:50 -07:00
Gregory Becker
7ec89aa036 stacks: refactor view descriptors into a separate object 2019-07-18 19:28:50 -07:00
Gregory Becker
6661cb1926 refactor: clean up Environment class
- remove redundant code in Environment.__init__
- use socket.gethostname() instead of which('hostname')
- refactor updating SpecList references
- refactor 'specs' literals to a single variable for default list name
- use six.string_types for python 2/3 compatibility
2019-07-18 19:28:50 -07:00
Gregory Becker
88295d927e bugfix: spec lists can now include multiple references 2019-07-18 19:28:50 -07:00
Gregory Becker
9577ade3ce stacks: use new format string syntax in environments code
- Change old spec expressions to use Spack's new spec formatting sytnax.
2019-07-18 19:28:50 -07:00
Gregory Becker
2f6af64157 docs: Add documentation for views in environments 2019-07-18 19:28:50 -07:00
Gregory Becker
cebf1fd668 stacks: update view management for multiple/combinatorial views
This adds notion of a default view, other views in environments
2019-07-18 19:28:50 -07:00
Gregory Becker
d0bfe0d6a8 stacks: environment add/remove respect multiply-defined lists 2019-07-18 19:28:50 -07:00
Gregory Becker
f9e6de5474 stacks: allow force-removing from a speclist used in a matrix 2019-07-18 19:28:50 -07:00
Gregory Becker
533a8d7c82 stacks: update environment add/remove algorithms 2019-07-18 19:28:50 -07:00
Gregory Becker
6cfbfcc967 concretization: regression test for constrain() with deps
- ensure that `Spec('foo').constrain('foo ^bar')` works
- prior to stacks implementation, this constraint would have done nothing.
2019-07-18 19:28:50 -07:00
Gregory Becker
12c8996294 docs: initial documentation for environments 2019-07-18 19:28:50 -07:00
Gregory Becker
d450a2fce2 stacks: initial implementation of stacks on environments
- stack syntax in env schema
- switch environment specs over to SpecList object
- add stack functionality to environments
- handle definition extensions through stack.yaml and SpecList
- implement conditional definitions
- tests
2019-07-18 19:28:50 -07:00
Adam J. Stewart
7f3048c8af
Add support for .txz and .tbz2 file extensions (#12048) 2019-07-17 16:23:23 -05:00
Tamara Dahlgren
b856e24444 tests: uninstall_by_spec error and rpath_args tests (#11971)
* tests: Add uninstall_by_spec error tests.

These tests were originally included in PR #11797.
2019-07-17 15:08:08 -05:00
Greg Becker
5cf8878185 feature: Allow developers to use Spack for partial builds (#12006)
Added new diy option.
2019-07-17 11:46:56 -07:00
Massimiliano Culpo
2fe1ecbaa2 Ignore Modules v4 environment variables in from_sourcing_file (#10753)
* from_sourcing_file: fixed a bug + added a few ignored variables

closes #7536

Credits for this change goes to mgsternberg (original author of #7536)

The new variables being ignored are specific to Modules v4.

* Use Spack Executable in 'EnvironmentModifications.from_sourcing_file'

Using this class avoids duplicating lower level logic to decode
stdout and handle non-zero return codes

* Extracted a function that returns the environment after sourcing files

The logic in `EnvironmentModifications.from_sourcing_file` has been
simplified by extracting a function that returns a dictionary with the
environment one would have after sourcing the files passed as argument.

* Further refactoring of EnvironmentModifications.from_sourcing_file

Extracted a function that sanitizes a dictionary removing keys that are
blacklisted, but keeping those that are whitelisted. Blacklisting and
whitelisting can be done on literals or regex.

Extracted a new factory that creates an instance of
EnvironmentModifications from a diff of two environments.

* Added unit tests

* PS1 is blacklisted + more readable names for some variables
2019-07-16 10:54:33 -05:00
Michael Kuhn
a7e915d38b Fix build_jobs exceeding number of cores
All documentation mentions that `build_jobs` is limited by the number of
cores available in the system. This is also enforced when setting it via
`--jobs`. However, when setting it via `config.yaml`, it can exceed the
number of cores available, making builds run out of memory.
2019-07-15 11:40:49 -07:00
Glenn Johnson
3f83a2a7d8 Add auto-dispatch specification to Intel packages (#11697)
This PR adds the ability to specify the auto-dispatch targets that can
be used by the Intel compilers. The `-ax` flag will be written to the
respective compiler configuration files. This ability is very handy when
wanting to build optimized builds for various architectures. This PR
does not set any optimization flags, however.
2019-07-15 11:37:54 -07:00
Massimiliano Culpo
5acbe449e5 spack uninstall can uninstall specs with multiple roots (#11977)
Fixes #3690
Fixes #5637

Uninstalling dependents of a spec was relying on a traversal of the
parents done by inspecting spec._dependents. This is in turn a
DependencyMap that maps a package name to a single DependencySpec object
(an edge in the DAG) and cannot thus model the case where a spec has
multiple configurations of the same parent package installed (for
example if different versions of the same Python library depend on
the same Python installation).

This commit works around this issue by constructing the list of specs to
be uninstalled in an alternative way, and adds tests to verify the
behavior. The core issue with DependencyMap is not resolved here.
2019-07-15 10:30:01 -07:00
Tim Fuller
5bc15b2d9a find_libraries searches lib and lib64 before prefix (#11958)
The default library search for a package checks the lib/ and lib64/
directories for libraries before the root prefix, in order to save
time when searching for libraries provided by externals (which e.g.
may have '/usr/' as their root).

This moves that logic into the "find_libraries" utility method so
packages implementing their own custom library search logic can
benefit from it.

This also updates packages which appear to be replicating this logic
exactly, replacing it with a single call to "find_libraries".
2019-07-12 17:46:47 -07:00
Oliver Breitwieser
d1af7ae5ab Copy --{use,no}-cache from install to bootstrap (#11786) 2019-07-12 16:30:12 -07:00
Carson Woods
76f1ee5f32 'spack compiler add' resolves relative path to absolute path (#11792)
Fixes #11782

Spack was not properly resolving relative paths to absolute paths
when a relative path was passed to "spack compiler add [PATH]".
Now, if provided a relative path, the absolute path is written to
compilers.yaml rather than the relative path.
2019-07-12 16:06:26 -07:00
Tamara Dahlgren
d615d0a1ec Add template creation test, --skip-editor option (#11970)
* Add template creation test
* Added --skip-editor option to "spack create": normally
  "spack create" opens an editor for the user after generating a
  package file; when the --skip-editor option is used, "spack create"
  only generates the package file and does not open an editor
* Added --skip-editor option to bash completion
2019-07-12 11:22:09 -07:00
t-karatsu
adbb9e2d8e Fix pic_flag and test contents about Fujitsu compiler. (#11996) 2019-07-12 10:34:08 -05:00
Todd Gamblin
91e35541ee
bugfix: show dot after namespaces in spack find -N (#11945)
- Namepsaces were shown without dots after the new format strings were
  added.

- Add a test for `spack find` to ensure that find -N shows the right
  output.
2019-07-12 08:32:47 -07:00
Tamara Dahlgren
05b6a5e53d test: Extra possible-dependencies coverage check (#11988) 2019-07-11 17:15:21 -07:00
Tamara Dahlgren
e3299e6923 Rename build logs and make names consistent (#11806)
Fixes #11781

* Rename build log to spack-build-log.txt
* Rename environment variables file to spack-build-env.txt
* The name of the log and env files is now the same during the build
  and after the build completes
* Update packages which referred to the build log/env files
* For packages installed before this commit using older names for the
  build and env files, search for the older names
2019-07-11 13:32:06 -07:00
Todd Gamblin
c2de2558b6
tutorial: correct image link on tutorial page 2019-07-10 00:56:25 -07:00
Todd Gamblin
0cd64d7b6e
tutorial: updates slides for DOE/NSF workshop. 2019-07-10 00:50:59 -07:00
Todd Gamblin
51b58f1478
bugfix: conflicts should print out the spec that has the conflict (#11947)
- Fix a bug introdcued by removing parse_anonymous_spec()

- Conflicts' when specs are now *actually* anonymous, and the name of the
  package is implicit, so we need to remember to add it back to error
  messages.
2019-07-08 08:00:43 -07:00
Todd Gamblin
d2e5b8474a
bugfix: always generate a stack trace when spack is run with --debug (#11940)
- We weren't previously printing stack traces on SystemExit or
  KeyboardInterrupts.

- Either raise or print the stacktrace in these cases.
2019-07-05 19:57:00 -07:00
Todd Gamblin
515b4045e9 specs: remove parse_anonymous_spec(); use Spec() instead
- `parse_anonymous_spec()` is a vestige of the days when Spack didn't
  support nameless specs.  We don't need it anymore because now we can
  write Spec() for a spec that will match anything, and satisfies()
  semantics work properly for anonymous specs.

- Delete `parse_anonymous_spec()` and replace its uses with simple calls
  to the Spec() constructor.

- make then handling of when='...' specs in directives more consistent.

- clean up Spec.__contains__()

- refactor directives and tests slightly to accommodate the change.
2019-07-01 18:45:44 -07:00
Todd Gamblin
12b9fad7b6 cray: use the cle-release file to determine CNL version
- CNL OS previously used the *Cray PE* version to determine the OS
  version.  Cray does not synchronize PE and CLE releases; you can run
  CLE7 with PrgEnv 6 (and NERSC currently does).

- Fix Spack's OS detection by using the cle-release file to detect the OS
  version.  This file is updated with every CLE OS release.

- Add some tests for our parsing logic
2019-07-01 18:36:02 -07:00
Patrick Gartung
9bf9c0cec3
buildcache: add replace_prefix_bin function to deal with hard coded paths in libraries and executables. (#11882) 2019-07-01 10:16:23 -05:00
Todd Gamblin
4189640ee8 style: remove unnecessary NOQA exceptions 2019-06-30 16:01:23 -07:00
Peter Scheibel
9c16b4a7f6 Allow uninstalling missing packages (#11874)
Remove package access from directory_layout; add regression test to ensure
that specs can be uninstalled without a package being known
2019-06-29 16:04:15 -07:00
Mark W. Krentel
8aa8b50f91 docs: add example for an external module in packages.yaml
Add an example of a 'modules:' entry for an external package in
packages.yaml.  The 'External Packages' section of 'Build
Customization' mentions 'paths:' and 'modules:' and gives an
example of paths, but not modules.
2019-06-28 11:59:10 -07:00
Toyohisa Kameyama
b185f87c55 Add --frontend and --backend option to spack arch command (#11746) 2019-06-26 08:19:46 -07:00
Patrick Gartung
30ce818fc4
Fix for #10063 : install from source if buildcache with different DAG exist (#11834)
* Fix for #10063 : install from source if buildcache with different DAG exist

* Flake8
2019-06-24 21:09:24 -05:00
Peter Scheibel
1ae03b327c
Use Stage.archive_file to access non-expanded download (#11817)
Fixes #11816

Allow packages to refer to non-expanded downloads (e.g. a single
script) using Stage.archive_file. This addresses a regression from
#11688 and adds a unit test for it.
2019-06-21 16:56:38 -07:00
Adam J. Stewart
9b8215ce9d Ignore pgcc-llvm and friends, default to pgcc (#11703)
This change reverts to the previous behavior of only looking for pgcc
and friends, not pgcc-llvm and friends.

The llvm variant doesn't support all the same features as the
traditional variant of the pgi code generator; this change avoids
treating the llvm variant as a default pgi compiler.

This retains the changes in #10704 which accept the "LLVM" suffix of
the version string of the PGI compiler, which allows users to
explicitly add the llvm-pgi compiler if desired.
2019-06-20 19:07:29 -07:00
Peter Scheibel
284ae9d1cc
Resources: use expanded archive name by default (#11688)
For resources, it is desirable to use the expanded archive name of
the resource as the name of the directory when adding it to the root
staging area.

#11528 established 'spack-src' as the universal directory where
source files are placed, which also affected the behavior of
resources managed with Stages.

This adds a new property ('srcdir') to Stage to remember the name of
the expanded source directory, and uses this as the default name when
placing a resource directory in the root staging area.

This also:

* Ensures that downloaded sources are archived using the expanded
  archive name (otherwise Spack will not be able to determine the
  original directory name when using a cached archive).
* Updates working_dir context manager to guarantee restoration of
  original working directory when an exception occurs
* Adds a "temp_cwd" context manager which creates a temporary
  directory and sets it as the working directory
2019-06-20 11:09:31 -07:00
Gregory Lee
8706ac1479 fixed spec dependence attribute writing. Fixes #11686 (#11776) 2019-06-19 04:13:12 +02:00
Greg Becker
9a4917644a Remove test dependency on /usr/bin/gcc (#11769)
The regression test for #11678 fails on at least some Mac OS systems
because they have a /usr/bin/gcc that is secretly clang.

This PR replaces the dependency on a system gcc executable with a
test-generated script that generates the expected output for the
compiler logic.
2019-06-18 18:23:02 -07:00
Elizabeth Fischer
f886c7e59d Rename build.out to build.txt (#11749)
Rename build.out to build.txt; makes it easier when people post log files to the Spack mailing list.
2019-06-18 10:32:00 -07:00
Tamara Dahlgren
6e067a05c7 bugfix: use config fixture for stage tests (#11701)
Some tests introduced in #11528 temporarily set the user's `config:build_stage`, which affected (or created) a config.yaml file in the user's `$HOME/.spack` directory that could leave entries behind if the tests fail.

This change ensures only temporary configuration files are used/affected by these tests.
2019-06-17 11:38:34 +02:00
Tamara Dahlgren
a551e4329e docs: updates for stage.source_path (#11702) 2019-06-17 11:36:22 +02:00
Todd Gamblin
45c65a255a
docs: update tutorial page for ISC19 tutorial (#11742) 2019-06-16 12:35:12 +02:00
Michael Kuhn
f3671244e4 docs: fix config tutorial (#11715)
This fixes a few typos, adds a hint to `spack config blame` and brings
the variant specification in line with other docs sections.
2019-06-15 21:34:32 +02:00
Tamara Dahlgren
1b8f641016
Ensure mock configuration directory is cleaned up on session exit. (#11700) 2019-06-13 16:41:00 -07:00
Tamara Dahlgren
25b21c093a Add tests for "spack location" command (#11661)
The "spack location" command was previously untested. This also adds
a check to ensure that composite Stages can report whether they were
expanded (this property was previously only recorded in Stage but not
in CompositeStage).
2019-06-13 12:20:13 -07:00
Tamara Dahlgren
5cf62e69ce Always treat DIYStage as expanded (#11663)
DIYStage, used to treat a user-managed directory as a staging area,
should always be considered expanded (i.e. the source has been
decompressed if it was stored in an archive).

This also:

* Adds checks to ensure that the path used to instantiate a
  DIYStage refers to an existing directory.
* Adds tests to check the behavior of DIYStage (including behavior
  added here, but it was generally untested before).
2019-06-13 11:14:35 -07:00
Tamara Dahlgren
16530f84be Update remaining packages to use Stage.source_path (#11662)
#11528 updated Stage to always store a Package's source in a fixed
directory accessible via `Stage.source_path` This left behind a
number of packages which were expecting to access the source code
via `Stage.path`. This Updates those packages to use
`Stage.source_path` instead.

This also updates the name of the fixed directory: The original name
of the fixed directory was "src", so if an expanded archive created a
"src" directory, then users inspecting the directory structure could
see paths like "src/src" (which wasn't wrong but could be confusing).
Therefore this also updates the name of the fixed directory to
"spack-src".
2019-06-12 17:07:47 -07:00
Massimiliano Culpo
3ce90741a3 Make "spack compiler find" check PATH by default (#11683)
Fixes #11678

`spack compiler find` was not searching `PATH` when provided with no
arguments. ea7910a updated the API for the search function and the
command logic did not update how it called this function. This also
adds a test to ensure that `spack compiler find` will collect
compilers from `PATH`.
2019-06-12 15:28:16 -07:00
Adam J. Stewart
4e812090c0
Add additional common C++ and Fortran header file extensions (#11600)
* Add additional common C++ and Fortran header file extensions

* Add .hxx extension

* Add .txx and .tcc extensions

* Add .icc extension
2019-06-11 20:13:55 -04:00
Chuck Atkins
91205545f0 Add extra logic for C std flags on PGI, XL, and Cray (#11635) 2019-06-11 14:15:55 +02:00
Peter Scheibel
406c791b88
Fix recursive module find for upstream dependencies (#11304)
"spack module tcl find -r <spec>" (and equivalents for other module
systems) was failing when a dependency was installed in an upstream
Spack instance. This updates the module index to handle locating
module files for upstream Spack installations (encapsulating the
logic in a new class called UpstreamModuleIndex); the updated index
handles the case where a Spack installation has multiple upstream
instances.

Note that if a module is not available locally but we are using the
local package, then we shouldn't use a module (i.e. if the package is
also installed upstream, and there is a module file for it, Spack
should not use that module). Likewise, if we are instance X using
upstreams Y and Z like X->Y->Z, and if we are using a package from
instance Y, then we should only use a module from instance Y. This
commit includes tests to check that this is handled properly.
2019-06-10 16:56:11 -07:00
Peter Scheibel
f31711b84e concretization: don't apply build-dep constraints for installed packages (#11594)
Spack currently tries to unify everything in the DAG, but this is too strict for build dependencies, where it is fine to build a dependency with a tool that conflicts with a version fo that tool for a dependent's build.

To enable a workaround for conflicts among build dependencies, so that users can install in multiple steps to avoid these conflicts, make the following changes:

* Dont apply package dependency constraints for build deps of installed packages
* Avoid applying constraints for installed packages vs. concrete packages
* Mark all dependencies of installed packages as visited in normalization method
* don't remove dependency links for concrete specs in flat_dependencies

Also add tests:
* Update test to ensure that link dependencies of installed packages have constraints applied
* Add test to check for proper handling of transitive dependencies (which is currently not the case)
2019-06-08 11:43:26 -07:00
Axel Huebl
61333dc606 spack list: latest version (JSON) (#11652)
List the latest version of each package in JSON encoding.
Preparation for consumption for a "spack badge" service.
2019-06-07 14:14:08 -07:00
Massimiliano Culpo
6d56d45454 Compiler search uses a pool of workers (#10190)
- spack.compilers.find_compilers now uses a multiprocess.pool.ThreadPool to execute
  system commands for the detection of compiler versions.

- A few memoized functions have been introduced to avoid poking the filesystem multiple
  times for the same results.

- Performance is much improved, and Spack no longer fork-bombs the system when doing a `compiler find`
2019-06-07 09:57:26 -07:00
Todd Gamblin
06cc799fd3
commands: remove unused spack list --format=rst (#11651)
- We use `spack list --foramt=html` now, as it is much faster and doesn't
  make the docs build take forever.

- Remove `spack list --format=rst` as it is no longer used.
2019-06-06 18:26:43 -07:00
Todd Gamblin
0c13c3f91f
bugfix: StageComposite must include the expanded property` (#11647) 2019-06-06 14:09:19 -07:00
Jennifer Herting
541578a456 tests: package_sanity now checks packages in 3rd-party repos (#11637) 2019-06-06 09:18:43 -07:00
Tamara Dahlgren
b76fc827ec tests: add extra coverage for fetch strategy tests 2019-06-05 22:41:28 -07:00
Tamara Dahlgren
1842873f85 stage: make source_path available before stage is built
- `stage.source_path` was previously overloaded; it returned `None` if it
  didn't exist and this was used by client code
  - we want to be able to know the `source_path` before it's created

- make stage.source_path available before it exists.
  - use a well-known stage source path name, `$stage_path/src` that is
    available when `Stage` is instantiated but does not exist until it's
    "expanded"
  - client code can now use the variable before the stage is created.
  - client code can test whether the tarball is expanded by using the new
    `stage.expanded` property instead of testing whether `source_path` is
    `None`

- add tests for the new source_path semantics
2019-06-05 22:41:28 -07:00
Tamara Dahlgren
eb584d895b refactor: remove unused spack.stage._get_mirrors() function 2019-06-05 22:41:28 -07:00
Tamara Dahlgren
8e3fd3f7c2 tty: make tty.* print exception types
- make tty.msg, tty.info, etc. print the exception type and stringified
  message if the message argument is an exception.

- simplify parts of the code that call tty.debug(str(e))

- add extra tty.debug statements in places where exceptions were
  previously ignored
2019-06-05 22:41:28 -07:00
Justin S
f4e7786786 clang: fix error messages in c11_flag, cxx17_flag (#11632) 2019-06-05 23:51:38 +02:00
Todd Gamblin
dc8af3023e graph: refactor static graphs
- `spack graph --static` (and `spack.graph.dot_graph`) now do the "right
  thing" and print the possible dependency graph of provided packages.

- `spack graph --static` no longer concretizes specs, as it only relies
  on class level metadata

- Previously the behavior was not consistent -- `spack graph --static`
  would graph possible dependencies of concrete specs, but would only
  include some of them.  The new code properly pursues all possible
  dependencies, and allows traversing by different dependency types.
2019-06-05 06:11:18 -07:00
Todd Gamblin
2e22fc1090 spack dependencies: support --deptype argument
- `spack dependencies` can now take a --deptype argument to only traverse
  particular deptypes

- add a new "common" argument for deptype in spack.cmd.common.arguments

- Database.installed_relatives() can now also take a deptype argument
  - this is used by `spack dependencies --installed`
2019-06-05 06:11:18 -07:00
Todd Gamblin
3dac78fc19 package: make possible_dependencies consider deptypes
- `PackageBase.possible_dependencies` now:
  - accepts a deptype param that controls dependency types traversed
  - returns a dict mapping possible depnames to their immediate possible
    dependencies (this lets you build a graph easily)

- Add tests for PackageBaes
2019-06-05 06:11:18 -07:00
Todd Gamblin
087a511da7 refactor: remove vestigial ALLOWED_URL_SCHEMES from package.py 2019-06-05 06:11:18 -07:00
Todd Gamblin
87e6cb9f72 refactor: make Package.name consistent with other class attributes
- The 'name' attribute for packages was being set in DirectiveMeta, which
  wasn't consistent with other class properties (like fullname, etc.)

- Move it to be a class property of `PackageMeta`, and add the
  corresponding property method wrapper on `PackageBase`
2019-06-05 06:11:18 -07:00
Todd Gamblin
3f5141d629 refactor: make PackageBase.possible_dependencies() a class method. 2019-06-05 06:11:18 -07:00
Justin S
4ac64e6cd8 add C standard flags to compiler classes (#11618)
* add c99_flag, c11_flag to compiler class

* implement c99_flag, c11_flag for gcc

* implement c99_flag, c11_flag for arm

* implement c99_flag for cce

* implement c99_flag, c11_flag for clang

* implement c99_flag, c11_flag for intel

* implement c99_flag, c11_flag for xl
2019-06-05 11:43:11 +02:00
Greg Becker
0990f12dd9 modules: set permissions based on package configuration (#11337)
Previously, module files were not set with the same permissions as the package installation.  For world-readable packages, this would not cause a problem.  For group readable packages, it does:

```
packages:
  mypackage:
    permissions:
      group: mygroup
      read: group
      write: group
```

In this case, the modulefile is unreadable by members of the group other than the one who installed it.  Add logic to the modulefile writers to set the permissions based on the configuration in `packages.yaml`
2019-06-04 19:15:47 -04:00
Patrick Gartung
964a1d5997
Buildcache relocate.py error fix (#11616)
* Add a trailing / if file --mime does not return a mimetype with a / in it

* Flake8
2019-06-04 14:39:04 -05:00
Patrick Gartung
88473a8da3
Build cache: relocate path to spack/bin/sbang in text files. (#11592)
* Build cache: relocate path to spack/bin/sbang in text files.

* Found in testing.

* update packaging test

* Make sbang replacement including #!/bin/bash. Add an additional spack prefix replacement to fix stage directory references.

* flake8

* Use buildinfo.get() so old buildcaches without buildinfo['spackprefix'] can be read.
2019-05-31 11:33:29 -05:00
Massimiliano Culpo
01ece824e1 Cap the maximum number of build jobs (#11373)
* config:build_jobs now controls the number of parallel jobs to spawn during
builds, but cannot ever exceed the number of cores on the machine.

* The default is set to 16 or the number of available cores, whatever
is lowest.

* Updated docs to reflect the changes done to limit parallel builds
2019-05-28 06:42:04 -07:00
Todd Gamblin
3ae5262182
docs: set gettext_uuid to False to reduce churn (#11567)
- `gettext_uuid=True` makes every commit update every .pot file in spack/localized-docs,
  and speeds up the internationalized doc build slightly.

- Optimize for less repository churn, and use `python-levenshtein` to accelerate 
  the build instead.
2019-05-27 13:42:27 -07:00
Axel Huebl
6d54212b94 mirror create: non-zero return code (#8585)
`mirror create` should return a non-zero return code if errors
occured.
2019-05-27 13:01:01 +02:00
Todd Gamblin
d6f2ff1426 link_tree: add option to merge link trees with relative targets
- previous version of link trees would only do absolute symlinks

- this version can do relative links using merge(relative=True)
2019-05-26 18:23:44 -07:00
Todd Gamblin
f32843528e docs: make docs build relocatable for localized builds
- make all Spack paths relative to a `_spack_root` symlink, so that we
  can easily relocate the docs build *outside* lib/spack/docs

- set some useful defaults for gettext translation variables in conf.py

- update `relativeinclude` and other references to the spack root in the
  RST files to use _spack_root
2019-05-26 18:23:44 -07:00
Todd Gamblin
8bf1bd4637 docs: remove legacy import for Sphinx 1.7 2019-05-26 18:23:44 -07:00
Todd Gamblin
e1c5d1378b docs: match ReadTheDocs; use -W (warnings as errors) with Sphinx 2019-05-26 18:23:44 -07:00
Todd Gamblin
3340d586c4 commands: add --update option to spack list
- Add a `--update FILE` option to `spack list`
- Output is written to the file only if any package is newer than the file
- Simplify the code in docs/conf.py using this new option
2019-05-26 18:23:44 -07:00
Todd Gamblin
6380f1917a commands: Add --header and --update options to spack commands
The Spack documentation currently hard-codes some functionality in
`conf.py`, which makes the doc build less "pluggable" for things like
localized doc builds.

In particular, we unconditionally generate an index of commands and a
package list as part of the docs, but those should really only be done if
things are not up to date.

This commit does the following:

- Add `--header` option to `spack commands` so that it can do the work of
  prepending text to its output.

- Add `--update FILE` option to `spack commands` that makes it generate a
  new command index *only* if FILE is out of date w.r.t. commands in the
  Spack source.

- Simplify code in `conf.py` to use these options and only update the
  command index when needed.
2019-05-26 18:23:44 -07:00
Todd Gamblin
43aaf8c404 docs: Use HDF5 as the example package for spack graph 2019-05-26 18:23:44 -07:00
Massimiliano Culpo
c291866b9a build env: simplify handling of parallel jobs (#11524)
This PR implements several refactors requested in #11373, specifically:

- Config scopes are used to handle builtin defaults, command line overrides 
  and package overrides (`parallel=False`)
- `Package.make_jobs` attribute has been removed; `make_jobs` remains
  as a module-scope variable in the build environment.
- The use of the argument `-j` has been rationalized across commands
  - move '-j'/'--jobs' argument into `spack.cmd.common.arguments`
- Add unit tests to check that setting parallel jobs works as expected
  - add new test to ensure that build job setting is isolated to each build
- Fix packages that used `Package.make_jobs` (i.e. `bazel`)
2019-05-24 11:45:22 -07:00
Todd Gamblin
ab21b3d194 docs: truncate spack list output in basic usage
`spack list` output is very long and takes up a lot of space in the docs.
Truncate it to just 10 lines and link to the package list page.
2019-05-23 12:40:01 -07:00
t-karatsu
1e9bb8c512 Add Fujitsu compiler to Spack. (#11287)
* Add Fujitsu compiler to Spack.

* Fixes for flake8

* Chenges location of FCC to subdirectory called case-insensitive

* Add compiler tests for Fujitsu compiler

* Modify the logic of taking compiler version for new version of Fujitsu compiler
2019-05-21 20:31:14 -05:00
Adam J. Stewart
e2065fad72 Make flake8 check spack script as well as .py files (#11513)
* Make flake8 check bin/spack
2019-05-20 13:39:25 -07:00
Mario Melara
4d71117080 Get Cray OS version from PrgEnv-cray (#10774)
The regex used for finding the Cray OS version from the PrgEnv-cray
module was not exact and was at times pulling the version from other
PrgEnv modules. This updates the regular expression to be more exact.
2019-05-20 11:06:02 -07:00