Commit graph

3076 commits

Author SHA1 Message Date
Todd Gamblin
8b549f664c env: move add, remove, and concretize to top-level commands 2018-11-09 00:31:24 -08:00
Todd Gamblin
e63b45b293 env: moved all spack env install functionality into spack install
- moved get_env from cmd/env.py to environment.py

- spack install will now install into the active environment when no
  arguments are provided.  It looks:
  1. at the command line
  2. for a local spack.yaml file
  3. for any currently activated environment
2018-11-09 00:31:24 -08:00
Todd Gamblin
08e4720ed9 env: remove all -e arguments on subcommands
- add and remove now require an active environment
- update tests to use with <ENV> instead of -e
2018-11-09 00:31:24 -08:00
Todd Gamblin
d483e6e17b env: currently activated environment cannot be destroyed 2018-11-09 00:31:24 -08:00
Todd Gamblin
40af955b94 env: prevent any active environments from interfering with tests
- ensure that `SPACK_ENV` is unset before tests
- ensure that `spack.environment.active` is deactivated if set
2018-11-09 00:31:24 -08:00
Todd Gamblin
c27b78ee36 env: remove upgrade() and relocate() for now
- these won't be in the first release of environments
- they'll be added back in later
2018-11-09 00:31:24 -08:00
Todd Gamblin
36623a27fd env: add test to ensure config precedence is high-to-low 2018-11-09 00:31:24 -08:00
Todd Gamblin
66aa3426ac env: make install_status output more concise 2018-11-09 00:31:24 -08:00
Todd Gamblin
a1818f971f env: environments can be named or created in directories
- `spack env create <name>` works as before

- `spack env create <path>` now works as well -- environments can be
  created in their own directories outside of Spack.

- `spack install` will look for a `spack.yaml` file in the current
  directory, and will install the entire project from the environment

- The Environment class has been refactored so that it does not depend on
  the internal Spack environment root; it just takes a path and operates
  on an environment in that path (so internal and external envs are
  handled the same)

- The named environment interface has been hoisted to the
  spack.environment module level.

- env.yaml is now spack.yaml in all places.  It was easier to go with one
  name for these files than to try to handle logic for both env.yaml and
  spack.yaml.
2018-11-09 00:31:24 -08:00
Todd Gamblin
9fb37dfd76 env: spack install SPEC installs into currently active environment.
- install will now add (if necessary), concretize, and install a single
  spec into the active environment.
2018-11-09 00:31:24 -08:00
Todd Gamblin
3fd9fc8994 env: spack env install automatically concretizes specs 2018-11-09 00:31:24 -08:00
Todd Gamblin
d14f7b82bb env: add spack env activate/deactivate and shell support
- `spack env activate foo`: sets SPACK_ENV to the current active env name

- `spack env deactivate`: unsets SPACK_ENV, deactivates the environment

- added support to setup_env.sh and setup_env.csh

- other env commands work properly with SPACK_ENV, as with an environment
  arguments.

- command-line --env arguments take precedence over the active
  environment, if given.
2018-11-09 00:31:24 -08:00
Todd Gamblin
15c5c36eaf env: bugfix: spack env list won't fail if var/spack/environments doesn't exist 2018-11-09 00:31:24 -08:00
Todd Gamblin
ce230fa3f4 env: rework environments
- env.yaml is now meaningful; it contains authoritative user specs

  - concretize diffs user specs in env.yaml and env.json to allow user to
    add/remove by simply updating env.yaml

  - comments are preserved when env.yaml is updated by add/unadd

  - env.yaml can contain configuration and include external configuration
    either from merged files or from config scopes

  - there is only one file format to remember (env.yaml, no separate init
    format)

- env.json is now env.lock, and it stores the *last* user specs to be
  concretized, along with full provenance.
  - internal structure was modified slightly for readability
  - env.lock contains a _meta section with metadata, in case needed

- added more tests for environments

- env commands follow Spack conventions; no more `spack env foo install`
2018-11-09 00:31:24 -08:00
Todd Gamblin
6af5dfbbc2 config: allow env.yaml to contain configuration in a single file
- add `SingleFileScope` to configuration, which allows us to pull config
  sections from a single file.

- update `env.yaml` and tests to ensure that the env.yaml schema works
  when pulling configurtion from the env file.
2018-11-09 00:31:24 -08:00
Todd Gamblin
9ee2623486 env: rename spack env list to spack env status 2018-11-09 00:31:24 -08:00
Todd Gamblin
c19000038b schemas: rework schemas so that they can be included from other files
- Each schema now has a top-level `properties` and `schema` attribute.

- The `properties` is a fragment that can be included in other
  jsonschemas, via Python, not via '$ref'

- Th `schema` is a complete `jsonschema` with `title` and `$schema`
  properties.
2018-11-09 00:31:24 -08:00
Todd Gamblin
83323f4e71 bugfix: Avoid KeyError in compilers.yaml version check 2018-11-09 00:31:24 -08:00
Todd Gamblin
84140c6cd3 env: add -e as global spack argument, make spack -e <env> spec work
- add -E/--exact-env instead of --use-env-repo
- simplify env handling in `spack find`
2018-11-09 00:31:24 -08:00
Todd Gamblin
180d804615 env: add --env argument to spack location 2018-11-09 00:31:24 -08:00
Todd Gamblin
47e60d5ef8 env: add --env argument to spack find
- add a common argument for `-e/--env`
- modify the database to support queries on subsets of hashes
- allow `spack find` to be filtered by hashes in an environment
2018-11-09 00:31:24 -08:00
Todd Gamblin
ea7648ff84 bugfix: identical specs with different DAG hashes don't shadow each other
- logic used in `spack find` was hiding duplicate installations if their
  hashes were different

- short hash doesn't work in this scenario, since specs are structurally
  identical

- ConstraintAction always works on a DB query, so use the DAG hash to
  ensure uniqueness
2018-11-09 00:31:24 -08:00
Todd Gamblin
3e94c4d573 env: move main Environment class and logic to spack.environment
- `spack.environment` is now the home for most of the infrastructure
   around Spack environments

- refactor `cmd/env.py` to use everything from spack.environment

- refactor the cmd/env test to use pytest and fixtures
2018-11-09 00:31:24 -08:00
Todd Gamblin
0e60fcccfb utils: merge spack.environment into spack.util.environment
- `spack.util.environment` is the new home for routines that modify
  environment variables.

- This is to make room for `spack.environment` to contain new routines
  for dealing with spack environments
2018-11-09 00:31:24 -08:00
Todd Gamblin
cd075b04d2 env: refactor imports in cmd/env.py and tests 2018-11-09 00:31:24 -08:00
Todd Gamblin
b738b7b05b env: refactor subparsers in env.py
- Instead of one method with all parsers, each subcommand gets two
  functions: `setup_<cmd>_parser()` and `environment_<cmd>()`

- the `setup_parser()` and `env()` functions now generate the parser
  based on these and a list of subcommands.

- it is now easier to associate the arguments with the subcommand.
2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
31cb2041c3 env: add spack env command, along with env.yaml schema and tests
Co-authored-by: Elizabeth Fischer <rpf2116@columbia.edu>
2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
4b2f51d063 env: preserve command_line as the scope of highest precedence
Co-authored-by: Elizabeth Fischer <rpf2116@columbia.edu>
2018-11-09 00:31:24 -08:00
Elizabeth Fischer
d1cce990cd env: refactor common arguments 2018-11-09 00:31:24 -08:00
Elizabeth Fischer
037457adc9 specs: save/restore concrete & patches when exporting/importing Specs 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
7f224b616d specs: _concrete should never be cleared when copying Specs 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
acdb391931 specs: add convenience function for reading spec dependencies from node dict 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
4daa164fbf specs: allow writing full spec (including build deps) to dict 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
e6c6ab64b8 env: rename 'spack env' command to 'spack build-env' 2018-11-09 00:31:24 -08:00
Peter Josef Scheibel
bb8da72f0c env: renamed 'environment' test 2018-11-09 00:31:24 -08:00
Peter Scheibel
7d97e8b067 New repo for advanced packaging tutorial (#9711)
* modified tutorial packages

* update hint in hdf5 tutorial file (typo for suggested argument)

* add repo.yaml to tutorial repository

* update tutorial docs to refer user to tutorial package repository

* flake edits

* recommend site scope vs. defaults

* you don't specify the repo's name when adding a repo, just the path
2018-11-06 19:57:32 -08:00
Peter Scheibel
058cf81312 Binary caching: remove symlinks, copy files instead (#9747)
* omit symlinks and create file copies when making a binary cache of a package

* unrelated flake edits involving regexes that recent flake is now angry about
2018-11-06 19:56:03 -08:00
Zack Galbreath
30eda8b837 cdash: report clean results to CDash server (#9564)
* Record stdout for packages without errors

  Previously our reporter only stored stdout if something went wrong
  while installing a package.  This prevented us from properly reporting
  on steps where everything went as expected.

* More robustly report all phases to CDash

  Previously if a phase generated no output it would not be reported to CDash.
  For example, consider the following output:

    ==> Executing phase: 'configure'
    ==> Executing phase: 'build'

  This would not generate a report for the configure phase. Now it does.

* Add test case for CDash reporting clean builds

* Fix default directory for CDash reports

  The default 'cdash_report' directory name was getting overwritten
  by 'junit-report'.

* Upload the build phase first to CDash

  Older versions of CDash expect Build.xml to be the first file uploaded
  for any given build.

* Define cdash_phase before referring to it
2018-11-06 16:09:47 -08:00
Massimiliano Culpo
05779d911f Adapted the code of the non-daemonic pool to recent python versions
fixes #9739

The non-daemonic pool relies heavily on implementation details of the
multiprocessing package. In this commit we provide an implementation
that fits recent python versions.
2018-11-06 16:02:37 -08:00
Nick Forrington
9f5865a68d compilers: add arm compiler detection to Spack
- added arm.py with support for detecting `armclang` and `armflang`

Co-authored-by: Srinath Vadlamani <srinath.vadlamani@arm.com>
2018-11-02 12:53:50 -07:00
Tim Fuller
fc25ba1b22 Parse the ${NAMESPACE} format string in a spec's format method. (#9686)
This allows installing software on a namespace basis by including ${NAMESPACE} in `install_path_scheme`. e.g.,

```
cat ~/.spack/config.yaml
config:
  install_path_scheme:
      "${ARCHITECTURE}/${NAMESPACE}/${COMPILERNAME}-${COMPILERVER}/${PACKAGE}-${VERSION}-${HASH}"
```
2018-10-31 20:07:07 -07:00
Satish Balay
fb849a4b7f static_to_shared_library: separate options from option values (#9690)
The 'static_to_shared_library' function takes a compiler Executable,
which is intended to be invoked with a list of arguments; the
arguments must be separated from their values in the list, given
the way that 'Executable.__call__' invokes the underlying executable.
'static_to_shared_library' was not doing this, which this commit fixes.
2018-10-31 12:49:04 -07:00
Todd Gamblin
2912cf3e17
compilers: update clang fortran compiler wrapper selection (#9678)
Clang has support for using different fortran compilers with the Clang executable.

Spack includes logic to select a compiler wrapper symlink which refers to the fortran executable (since some build systems depend on the name of the compiler, e.g. 'gfortran' or 'flang').

This selection was previously based on the architecture, and chose incorrectly in some situations (e.g. for clang/gfortran on Linux). This replaces architecture-based wrapper selection with a selection that is based on the name of the Fortran compiler executable.
2018-10-30 23:00:43 -07:00
Levi Baber
72fa122101 tests: add test for FIXME boilerplate to package_sanity (#9285)
* package_sanity: add test_no_fixme
* cleanup & better assert message
2018-10-30 13:44:25 -07:00
Todd Gamblin
b27fbfb379
config: spack config blame now colors filenames in config output (#9656)
- it was hard to distinguish all-gray filenames
- added rotating colors to `spack config blame`
2018-10-26 22:19:11 -07:00
Omar Padron
aa1c814c75 docker: unite Dockerfiles; auto-deploy images to DockerHub (#9329)
* Unite Dockerfiles - add build/run/push scripts
* update docker documentation
* update .travis.yml
* switch to using a preprocessor on Dockerfiles
* skip building docker images on pull requests
* update files with copyright info
* tweak when travis builds for docker files are done
2018-10-26 10:15:05 -07:00
Massimiliano Culpo
da537d2211
Fix autoload of direct dependencies for python (#9630)
fixes #9624

merge_config_rules was using `strict=False` to check if a spec
satisfies a constraint, which loosely translates to "this spec has
no conflict with the constraint, so I can potentially add it to the
spec". We want instead `strict=True` which means "the spec satisfies
the constraint right now".
2018-10-25 23:56:03 +02:00
Todd Gamblin
a1f90d5b8c
bugfix: use OS default permissions for mkdirp when mode is not provided (#9604)
- #8773 made the default mode 0o777, which is what's documented but
   mkdirp actually takes the OS default or umask by default

- revert to the Python default by default, and only set the mode when
  asked explicitly.
2018-10-24 11:36:41 -07:00
Javier Cervantes
02f67b5c16 Fix typo in help message (#9599) 2018-10-24 12:40:35 +02:00
Satish Balay
79e25032e8 Bug fix: Module PATH check (#9574)
#9100 added a warning message when a path extracted from a module file
did not appear to be a valid filesystem path. This check was applied
to a variable which could be a list of paths, which would erroneously
trigger the warning. This commit updates the check to run at the
actual point where the path has been extracted.
2018-10-22 18:10:49 -07:00
Todd Gamblin
ccd5a5fb7b license: exclude ignored files from the license check (#9578)
Previously, if you built the docs, you'd get license errors for
generated .rst files. This removes them from the list of licensed
files.
2018-10-22 11:13:30 -07:00
Michael Kuhn
7070d9fcd4 Allow setting language of compiler messages (#9486)
* Add a build_language config.yaml option which controls the language
  of compiler messages
* build_language defaults to "C", in which case the compiler messages
  will be in English. This allows Spack log parsing to detect and
  highlight error messages (since the regular expressions to find
  error messages are in English)
* The user can use the default language in their environment by setting
  the build_language config variable to null or ''
2018-10-18 12:55:58 -07:00
Todd Gamblin
e2e0b5df1c relicense: add spack license command
- `spack license list-files`: list all files that should have license headers
- `spack license list-lgpl`:  list files still under LGPL-2.1
- `spack license verify`:     check that license headers are correct

- Added `spack license verify` to style tests
2018-10-17 14:42:06 -07:00
Todd Gamblin
7cb5638516 relicense: add Apache2/MIT header to spack create 2018-10-17 14:42:06 -07:00
Todd Gamblin
eea786f4e8 relicense: replace LGPL headers with Apache-2.0/MIT SPDX headers
- remove the old LGPL license headers from all files in Spack
- add SPDX headers to all files
  - core and most packages are (Apache-2.0 OR MIT)
  - a very small number of remaining packages are LGPL-2.1-only
2018-10-17 14:42:06 -07:00
Mark W. Krentel
e5e8d89ad9 docs: add note about compilers with modules (#9520)
compilers.yaml can track a module that is needed for a compiler, but
Spack does not fill this in automatically. This adds a note to the
documentation informing the user how to do this.
2018-10-16 15:34:22 -07:00
Michael Kuhn
cc6e765d28 meson: explicitly add --libdir (#9504)
If we do not specify libdir explicitly, Meson chooses something like
lib/x86_64-linux-gnu, which causes problems when trying to find libraries
and pkg-config files.
2018-10-15 11:14:59 -07:00
Peter Scheibel
6977d933c8
buildcache install: generate modules (#9509)
Spack packages installed using spack buildcache were not running
post-install hooks, which create module files and manage licenses
(if necessary).

This was already occurring for Spack packages installed with
spack install --use-cache
2018-10-12 10:43:06 -07:00
Greg Becker
d1a5113cfe permissions: add permission configuration to packages.yaml (#8773)
Spack can now be configured to assign permissions to the files installed by a package.

In the `packages.yaml` file under `permissions`, the attributes `read`, `write`, and `group` control the package permissions. These attributes can be set per-package, or for all packages under `all`. If permissions are set under `all` and for a specific package, the package-specific settings take precedence.  The `read` and `write` attributes take one of `user`, `group`, and `world`.

   packages:
    all:
      permissions:
        write: group
        group: spack
    my_app:
      permissions:
        read: group
        group: my_team
2018-10-11 14:29:07 -07:00
Zack Galbreath
bc8bb9dfaf Make CDash reporting easier to use (#9357)
* Better default CLI arguments for CDash reporting

--log-format=cdash is now implied if you specify the --cdash-upload-url
option to spack install.

We also now default to writing CTest XML files to cdash_report/ when using
the CDash reporter if no --log-file argument was specified.

* Improved documentation on how to use the CDash reporter
2018-10-10 22:29:14 -07:00
Greg Becker
ca0d9ae7f0
Make builtin flag handlers available in package scope (#8668)
* Push default flag handlers into module scope

* Preserve backwards compatibility of builtin flag handler names

Ensure Spack continues to work for packages using the `Package.env_flags` idiom and equivalent.

* update docs and tests to match

* Update packages to match new syntax
2018-10-09 15:18:31 -07:00
Greg Becker
97d0dd2390
Update Spack on Cray docs for singularity platform=linux workaround (#9398) 2018-10-02 14:58:40 -07:00
Peter Scheibel
28f6a4a095
Module path parsing: CRAY_LD_LIBRARY_PATH and PACKAGE_DIR (#9374)
Fix two bugs with module file parsing:

* Detection of the CRAY_LD_LIBRARY_PATH variable was broken by #9100.
  This fixes it and adds a test for it.
* For module names like "foo-bar/1.0", the associated PACKAGE_DIR
  environment variable name would be "FOO_BAR_DIR", but Spack was not
  parsing the components and not converting "-" to "_"
2018-09-27 19:40:22 -07:00
Peter Scheibel
28c0dd9148
Increase and customize lock timeouts (#9219)
Fixes #9166

This is intended to reduce errors related to lock timeouts by making
the following changes:

* Improves error reporting when acquiring a lock fails (addressing
  #9166) - there is no longer an attempt to release the lock if an
  acquire fails
* By default locks taken on individual packages no longer have a
  timeout. This allows multiple spack instances to install overlapping
  dependency DAGs. For debugging purposes, a timeout can be added by
  setting 'package_lock_timeout' in config.yaml
* Reduces the polling frequency when trying to acquire a lock, to
  reduce impact in the case where NFS is overtaxed. A simple
  adaptive strategy is implemented, which starts with a polling
  interval of .1 seconds and quickly increases to .5 seconds
  (originally it would poll up to 10^5 times per second).
  A test is added to check the polling interval generation logic.
* The timeout for Spack's whole-database lock (e.g. for managing
  information about installed packages) is increased from 60s to
  120s
* Users can configure the whole-database lock timeout using the
  'db_lock_timout' setting in config.yaml

Generally, Spack locks (those created using spack.llnl.util.lock.Lock)
now have no timeout by default

This does not address implementations of NFS that do not support file
locking, or detect cases where services that may be required
(nfslock/statd) aren't running.

Users may want to be able to more-aggressively release locks when
they know they are the only one using their Spack instance, and they
encounter lock errors after a crash (e.g. a remote terminal disconnect
mentioned in #8915).
2018-09-25 18:58:51 -07:00
Denis Davydov
d2bd5177da macos: add mojave (#9322) 2018-09-24 12:20:49 -07:00
scheibelp
95850a7a5e
report error if failed process captures stderr (#9293)
When a Spack Executable was configured to capture stderr and the
process failed, the error messages of the process were discarded.
This made it difficult to understand why the process failed. The
exception is now updated to include the stderr of the process when
the Executable captures stderr.
2018-09-19 17:29:15 -07:00
Adam J. Stewart
133dd7a4ac Fix version parsing for cistem package (#9260)
Adds 'code' to the list of suffixes that are excluded from version
parsing of URLs, such that if a URL contains the string
'cistem-1.0.0-beta-source-code', a version X will substitute in to
produce a URL with cistem-X-source-code ('source' was already excluded).
The 'cistem' package version is updated to make use of this (and fix
a fetching bug with the cistem package). A unit test is added to check
this parsing case.
2018-09-18 19:29:18 -07:00
scheibelp
22fbb3dba7
Bug fix: module file path parsing (#9100)
Improve Spack's parsing of module show to eliminate some false
positives (e.g. accepting MODULEPATH when it is in fact looking for
PATH). This makes the following changes:

* Updates the pattern searching for several paths to avoid the case
  where they are prefixes of unwanted paths
* Adds a warning message when an extracted path doesn't exist (which
  may help catch future module parsing bugs faster)
* Adds a test with the content mentioned in #9083
2018-09-12 18:15:31 -07:00
Michael Kuhn
add0c8fe11 test: Make flag_handlers tests use mock repo (#9132)
Without this change, openssl's new perl dependency makes the tests fail.
2018-09-06 18:41:26 +02:00
becker33
f6fff8f343 Spack environment updates take precedence (#9107)
Spack originally handled environment modifications in the following
order:

 1. clear environment variables
    (unless Spack was invoked with --dirty)
 2. apply spack-specific environment variable updates,
    including variables set by Spack core like CC/PKG_CONFIG_PATH
	and those set by installed dependencies (e.g. in
	setup_dependent_environment)
 3. load all external/compiler modules

1 and 2 were done together. This splits 1 into its own function and
imposes the following order for environment modifications:

 1. clear environment variables
 2. load all external/compiler modules
 3. apply spack-specific environment variable updates

As a result, prepend-path actions taken by Spack (or installed Spack
dependencies) take precedence over prepend-path actions from compiler
and external modules. Additionally, when Spack (or a package
dependency) sets/unsets an environment variable, that will override
the actions of external/compiler modules.
2018-09-05 17:28:39 -07:00
Sergey Kosukhin
f9617b2ad8 Extended set of environment modification commands. (#8996) 2018-09-05 10:56:45 -07:00
Chris Green
dd27662b40 Enable testing in parallel when using CMake. (#8484)
* Add 'extra_env' argument to Executable.__call__: this will be added
  to the environment but does not affect whether the current
  environment is reused. If 'env' is not set, then the current
  environment is copied and the variables from 'extra_env' are added
  to it.
* MakeExecutable can take a 'jobs_env' parameter that specifies the
  name of an environment variable used to set the level of parallelism.
  This is added to 'extra_env' (so does not affect whether the current
  environment is reused).
* CMake-based Spack packages set 'jobs_env' when executing the 'test'
  target for make and ninja (which does not use -j)
2018-09-04 11:37:19 -07:00
Adam J. Stewart
0ca69fef42 Better warning message when fetching non-existent URL 2018-09-03 20:42:01 -07:00
Michael Sternberg
d95fdc8441 Update instructions to initialize Spack-global license files (#8991)
* Suggest adding contents before the explanatory comment to avoid
  issue #6534
* Mention that the license file may not need to be edited
2018-08-29 22:04:14 -07:00
Michael Sternberg
a86f22d755 Intel prefixes (#7469)
Consolidate prefix calculation logic for intel packages into the
IntelPackage class.

Add documentation on installing Intel packages with Spack an
(alternatively) adding them as external packages in Spack.
2018-08-29 21:09:34 -07:00
Andreas Baumbach
5aded248a5 spack view suggests -I option for merge conflict (#9035) 2018-08-29 13:10:55 -04:00
Andreas Baumbach
7d61ef5078 import spack load error message (#9088)
It now additionally prints spec hash and options
2018-08-27 21:26:24 -04:00
Massimiliano Culpo
6f5a68a58d Moved functions returning default scopes to spack.config
The functions returning the default scope to be modified or listed
have been moved from spack.cmd to spack.config.

Lmod now writes the guessed core compiler in the default modify scope
instead of the 'site' scope.
2018-08-27 14:49:50 -07:00
Massimiliano Culpo
8ecf5ae2ee Spack can guess lmod core compilers, if none is already present
closes #8916

Currently Spack ends with an error if asked to write lmod modules files
and the 'core_compilers' entry is not found in `modules.yaml`. After
this PR an attempt will be made to guess that entry and the site
configuration file will be updated accordingly.

This is similar to what Spack already does to guess compilers on first
run.
2018-08-27 14:49:50 -07:00
Adam J. Stewart
cc01e89d6b
Update to latest version of pytest and dependencies (#9087)
* Update to latest version of pytest and dependencies

* Fix bug in installation tests
2018-08-25 14:12:46 -05:00
Todd Gamblin
3c292de6bd bugfix: 'submodules' attribute should imply git fetch
- 'submodules' wasn't properly declared as an optional attribute for git
  fetcher

- add it and add a test.
2018-08-25 10:20:39 -07:00
Todd Gamblin
3f0e6d04e0 commands: add spack url stats command
This command prints out stats about all package versions, like so:

$ spack url stats
==> 6070 total versions for 2827 packages:
------------------------------------
url                    5411    89.1%
  schemes
    https              3822    70.6%
    http               1527    28.2%
    ftp                  27     0.5%
    file                 35     0.6%
  checksums
    sha512                6     0.1%
    sha256              163     3.0%
    sha1                 81     1.5%
    md5                5161    95.4%
------------------------------------
svn                       3     0.0%
------------------------------------
hg                        5     0.1%
------------------------------------
go                        1     0.0%
------------------------------------
git                     650    10.7%
  security
    no commit           384    59.1%
    commit              266    40.9%
------------------------------------
2018-08-25 10:20:39 -07:00
Todd Gamblin
82820efe37 Remove Python 3.3 from testing.
- Support for Python 3.3 isn't really needed, as nothing uses it as the
  default system Python, and nearly everyone will have a newer Python 3
  version installed.
2018-08-24 16:22:37 -07:00
Adam J. Stewart
5e8a9ddaed More consistent colored messages from activate/deactivate (#9036)
* More consistent colored messages from activate/deactivate

* Make 'activating' the default, make 'activated' the debug
2018-08-22 22:09:51 -07:00
Massimiliano Culpo
85f84aabed Added a new target message to comply with newer versions of GNU Make (#9068)
#fixes 9067

Unit tests were failing on a system with GNU Make v 4.1
2018-08-22 09:32:25 -05:00
Todd Gamblin
c0855d9bd5 tests: add tests for warnings in build output
- add tests for build warnings and error messages
- simplify some code in build environment with plural() function
2018-08-21 21:21:53 -07:00
Adam J. Stewart
0b0887f48f Display warnings if no errors are found in build log 2018-08-21 21:21:53 -07:00
Adam J. Stewart
f97550e149 Fix error caused by missing spack-build.out build log 2018-08-21 14:16:50 -07:00
Todd Gamblin
63004e3de1 yaml: use ruamel.yaml instead of pyyaml
- ruamel.yaml allows round-tripping comments from/to files
- ruamel.yaml is single-source, python2/python3 compatible
2018-08-20 16:36:04 -07:00
Adam J. Stewart
2e8a820afd Even better Makefile target parsing (#8819)
#8223 replaced regex-based makefile target parsing with an invocation of
"make -q". #8818 discovered that "make -q" can result in an error for some
packages.

Also, the "make -q" strategy relied on interpreting the error code, which only
worked for GNU Make and not BSD Make (which was deemed acceptable at
the time). As an added bonus, this implementation ignores the exit code and
instead parses STDERR for any indications that the target does not exist; this
works for both GNU Make and BSD Make.

#8223 also updated ninja target detection to use "ninja -t targets". This does
not change that behavior but makes it more-explicit with "ninja -t targets all"

This also adds tests for detection of "make" and "ninja" targets.
2018-08-20 17:42:28 -04:00
scheibelp
638cc64571
install_tree: symlink handling and add 'ignore' option (#9019)
Fixes #9001

#8289 added support for install_tree and copy_tree to merge into an existing
directory structure. However, it did not properly handle relative symlinks and
also removed support for the 'ignore' keyword. Additionally, some of the tests
were overly-strict when checking the permissions on the copied files.

This updates the install_tree/copy_tree methods and their tests:

* copy_tree/install_tree now preserve relative link targets (if the symlink in the
  source directory structure is relative, the symlink created in the destination
  will be relative)
* Added support for 'ignore' argument back to copy_tree/install_tree (removed
  in #8289). It is no longer the object output by shutil.ignore_patterns: you pass a
  function that accepts a path relative to the source and returns whether that
  path should be copied.
* The openfoam packages (currently the only ones making use of the 'ignore'
  argument) are updated for the new API
* When a symlink target is absolute, copy_tree and install_tree now rewrite the
  source prefix to be the destination prefix
* copy_tree tests no longer check permissions: copy_tree doesn't enforce
  anything about permissions so its tests don't check for that
* install_tree tests no longer check for exact permission matching since it can add
  file permissions
2018-08-17 22:08:38 -04:00
Todd Gamblin
39c9bbfbbb imports: spack uses importlib instead of imp when available
- `imp` is deprecated and seems to have started having some weird
  issues on certain Linux versions.
  - In particular, the file argument to `load_source` is ignored on
    arch linux with Python 3.7.

- `imp` is the only way to do imports in 2.6, so we'll keep it around for
  now and use it if importlib won't work.

- `importlib` is the new import system, and it allows us to get
  lower-level access to the import implementation.

- This consolidates all import logic into `spack.util.imp`, and make it
  use `importlib` if it's avialable.
2018-08-16 16:00:44 -07:00
Adam J. Stewart
ac6d929897 Fix spack versions behavior when no URL (#8967)
* Fix spack versions behavior when no URL
* Unit test packages without URLs or safe versions
2018-08-16 08:42:23 -07:00
Adam J. Stewart
73c978ddd9 install_tree, copy_tree can install into existing directory structures (#8289)
Replace use of `shutil.copytree` with `copy_tree` and `install_tree` functions in `llnl.util.filesystem`.

- `copy_tree` copies without setting permissions.  It should be used to copy files around in the build directory.
- `install_tree` copies files and sets permissions.  It should be used to copy files into the installation directory.
- `install` and `copy` are analogous single-file functions.
- add more extensive tests for these functions
- update packages to use these functions.
2018-08-15 09:30:09 -07:00
Todd Gamblin
62026ce302 tests: make the dependency patching test more complete
- dependency patching test didn't attempt to apply patches; just to see
  whether they were on the spec.

- it applies the patch now and verifies that that patch was applied.
2018-08-14 14:33:50 -07:00
Tom Merrick
b1182741d4 Branch with the meson build-system (#8467)
* Branch with the meson build-system

* Fix build_environment for dual loads and add create code

* Add documentation

* Fixed option list

* Update build_system_guess for meson

* Fixed documentation errors

* Added meson to build and configure and updated documentation

* fix typos
2018-08-10 12:52:09 -05:00
Scott Wittenburg
2278c65d0a spec: make full_hash look like dag_hash (#8911) 2018-08-09 09:00:49 -07:00
Todd Gamblin
ed79d6a11b bugfix: cc handles spaces in flag variables properly
- cc cleanup caused a parsing regression in flag handling

- We added proper quoting to array expansions, but flag variables were
  never actually converted to arrays. Old code relied on this.

This commit:
- Adds reads to convert flags to arrays.
- Makes the cc test check for improper space handling to prevent future
  regressions.
2018-08-09 08:00:22 -07:00
Todd Gamblin
bb5d83890d cc: refactor flag adding so that it's not in reverse order
- flags were prepended in reverse order to args, but this makes it hard
  to see what order they'll be in on the final command line.

- add them in the order they'll appear to make cc easier to maintain.

- simplify code for assembling the command line

- fix separator used in SPACK_SYSTEM_DIRS test
2018-08-08 01:51:51 -07:00
Todd Gamblin
4210f839e2 cc: restore ccache support in the wrapper, add a regression test
- Add back ccache support to the wrapper.
- Add a regression test to make sure ccache is working properly.
2018-08-08 01:51:51 -07:00