summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2021-05-18Bugfix: fetching oddly-named resources from local mirrors (#23300)Michael Kuhn1-1/+9
Spack uses curl to fetch URL resources. For locally-stored resources it uses curl's file protocol; when using this protocol, curl expects that the URL encoding conforms to RFC 3986 (which reserves characters like '?' and '=' for special use). We were not performing this encoding, and found a resource where curl was interpreting this in an unfavorable way (succeeding, but producing an empty file). This commit properly encodes URLs when using curl's file protocol. This error did not likely come up before because in most contexts Spack was either fetching via http or it was using URLs without offending characters (for example, the sha-based URLs in mirrors never contain these characters).
2021-05-17Revert "Separable module configurations (#22588)" (#23674)Harmen Stoppels29-491/+183
This reverts commit cefbe48c89209dc3df654795644973b1885cdea4.
2021-05-17performance: speed up existence checks in packages (#23661)Todd Gamblin3-24/+37
Spack doesn't require users to manually index their repos; it reindexes the indexes automatically when things change. To determine when to do this, it has to `stat()` all package files in each repository to make sure that indexes up to date with packages. We currently index virtual providers, patches by sha256, and tags on packages. When this was originally implemented, we ran the checker all the time, at startup, but that was slow (see #7587). But we didn't go far enough -- it still consults the checker and does all the stat operations just to see if a package exists (`Repo.exists()`). That might've been a wash in 2018, but as the number of packages has grown, it's gotten slower -- checking 5k packages is expensive and users see this for small operations. It's a win now to make `Repo.exists()` check files directly. **Fix:** This PR does a number of things to speed up `spack load`, `spack info`, and other commands: - [x] Make `Repo.exists()` check files directly again with `os.path.exists()` (this is the big one) - [x] Refactor `Spec.satisfies()` so that a checking for virtual packages only happens if needed (avoids some calls to exists()) - [x] Avoid calling `Repo.exists(spec)` in `Repo.get()`. `Repo.get()` will ultimately try to load a `package.py` file anyway; we can let the failure to load it indicate that the package doesn't exist, and avoid another call to exists(). - [x] Fix up some comments in spec parsing - [x] Call `UnknownPackageError` more consistently in `repo.py`
2021-05-15some fixes for command help strings (#23658)Todd Gamblin3-8/+5
- [x] `analyze` isn't commonly used; move it to long help (`spack -H` vs `spack -h`). Give it its own section. - [x] make it clear from `spack -h` that `spack module` can generate module files - [x] shorten help for `spack style`
2021-05-15do not sort projections alphabetically (#23649)Greg Becker1-3/+7
* do not sort projections alphabetically * add assertion for ordered dict
2021-05-14Separable module configurations (#22588)Greg Becker29-183/+491
Currently, module configurations are inconsistent because modulefiles are generated with the configs for the active environment, but are shared among all environments (and spack outside any environment). This PR fixes that by allowing Spack environments (or other spack config scopes) to define additional sets of modules to generate. Each set of modules can enable either lmod or tcl modules, and contains all of the previously available module configuration. The user defines the name of each module set -- the set configured in Spack by default is named "default", and is the one returned by module manipulation commands in the absence of user intervention. As part of this change, the module roots configuration moved from the `config` section to inside each module configuration. Additionally, it adds a feature that the modulefiles for an environment can be configured to be relative to an environment view rather than the underlying prefix. This will not be enabled by default, as it should only be enabled within an environment and for non-default views constructed with separate projections per-spec. TODO: - [x] code changes to support multiple module sets - [x] code changes to support modules relative to a view - [x] Tests for multiple module configurations - [x] Tests for modules relative to a view - [x] Backwards compatibility for module roots from config section - [x] Backwards compatibility for default module set without the name specified - [x] Tests for backwards compatibility
2021-05-13spec: simplify __str__ implementation (#23593)Massimiliano Culpo2-13/+10
The implementation for __str__ has been simplified to traverse the spec directly, and doesn't call anymore the flat_dependencies method. Dead code has been removed.
2021-05-13cc: change mode to ccld for loopopt edit (#23482)Frank Willmore2-4/+13
For configure (e.g. for hdf5) to pass, this option needs to be pulled out when invoked in ccld mode. I thought it had fixed the issue but I still saw it after that. After some digging, my guess is that I was able to get hdf5 to build with ifort instead of ifx. Lot of overlapping changes occurring at the time, as it were. There are still outstanding issues building hdf5 with ifx, and Intel is looking into what appears to be a compiler bug, but this manifests during build and is likely a separate issue. I have verified that the making the edit in 'ccld' mode removes the -loopopt=0 and enables hdf5 to pass configure. It should be fine to make the edit in 'ld' mode as well, but I have not tested that and didn't include an -or- condition for it.
2021-05-13config key error: fix format string (#23610)Greg Becker1-1/+1
2021-05-13env views: make view updates atomic (#23476)Greg Becker6-72/+172
Currently, environment views blink out of existence during the view regeneration, and are slowly built back up to their new and improved state. This is not good if other processes attempt to access the view -- they can see it in an inconsistent state. This PR fixes makes environment view updates atomic. This requires a level of indirection (via symlink, similar to nix or guix) from the view root to the underlying implementation on the filesystem. Now, an environment view at `/path/to/foo` is a symlink to `/path/to/._foo/<hash>`, where `<hash>` is a hash of the contents of the view. We construct the view in its content-keyed hash directory, create a new symlink to this directory, and atomically replace the symlink with one to the new view. This PR has a couple of other benefits: * It future-proofs environment views so that we can implement rollback. * It ensures that we don't leave users in an inconsistent state if building a new view fails for some reason. For background: * there is no atomic operation in posix that allows for a non-empty directory to be replaced. * There is an atomic `renameat2` in the linux kernel starting in version 3.15, but many filesystems don't support the system call, including NFS3 and NFS4, which makes it a poor implementation choice for an HPC tool, so we use the symlink approach that others tools like nix and guix have used successfully.
2021-05-12ASP-based solver: account for deprecated versions (#23491)Massimiliano Culpo4-1/+43
fixes #22351 The ASP-based solver now accounts for the presence in the DAG of deprecated versions and tries to minimize their number at highest priority.
2021-05-11Environments: add run deps to shell modifications (#23485)Peter Scheibel2-12/+42
When adding an Environment to a user's shell, Spack was only adding root specs. This now includes run dependencies of root specs.
2021-05-11ASP-based solver: variants set from cli are considered as defaults (#23542)Massimiliano Culpo3-7/+40
Variants explicitly set in an abstract root spec are considered as defaults for the package they refer to, and they override what is in packages.yaml and in package.py. This is relevant only for multi-valued variants, where a constraint may extend an already default value.
2021-05-11cray: fix parsing of module list (#23566)Howard Pritchard1-0/+1
The code for guessing cpu archtype based on craype modules names got confused, at least on LLNL RZ prototype systems. In particular a (L) or (D) at the end of a craype-x86-xxx or other cpu architecture module was geting the logic confused. With this patch, any white space + remaining characters in the moduel name are removed. Signed-off-by: Howard Pritchard <howardp@lanl.gov>
2021-05-11Updates and format tweaks to the release documentation (#22053)Tamara Dahlgren1-93/+131
2021-05-11Documentation: Refinement of "Checking an installation" (#22210)Tamara Dahlgren3-164/+703
There have been a lot of questions and some confusion recently surrounding Spack installation test capabilities so this PR is intended to clean up and refine the documentation for "Checking an installation". It aims to better distinguish between checks that are performed during an installation (i.e., build-time tests) and those that can be done days and weeks after the software has been installed (i.e., install (or smoke) tests).
2021-05-10bugfix: correct force_autoreconf method syntax (#23546)Tamara Dahlgren1-1/+1
2021-05-10compare full old_prefix and new_prefix instead of layout_root (#23506)eugeneswalker1-1/+1
2021-05-08clingo: don't skip tests that deal with file permissionsMassimiliano Culpo3-16/+0
When we first merged the ASP-based solver, unit-tests were run in a Docker container with root permissions and that was preventing a few tests to succeed. Since some time though, clingo is tested as a regular user within Github Actions VMs, so we should start to run checks again.
2021-05-07install cmd: --no-add in an env installs w/out concretize and addScott Wittenburg4-8/+196
In an active concretize environment, support installing one or more cli specs only if they are already present in the environment. The `--no-add` option is the default for root specs, but optional for dependency specs. I.e. if you `spack install <depspec>` in an environment, the dependency-only spec `depspec` will be added as a root of the environment before being installed. In addition, `spack install --no-add <spec>` fails if it does not find an unambiguous match for `spec`.
2021-05-07return concrete spec (as is advertised in the docstring)Peter Josef Scheibel1-1/+1
2021-05-07fix check when retrieving matching spec from environment when there is a ↵Peter Josef Scheibel2-1/+19
match with a root spec as well as with a dependency of a root spec
2021-05-07compilers: aocc is now also available as a Cray PrgEnv (#23289)Tiziano Müller1-0/+3
2021-05-07Show useful error in build-env (#23458)Harmen Stoppels2-11/+21
Instead of an out of bounds error tell the user to provide a spec
2021-05-06ASP-based solver: minimize mismatch of targets (#23462)Massimiliano Culpo1-32/+19
Like compilers targets now try to minimize mismatches, instead of maximizing matches. Deduction of mismatches is reworked to be the opposite of a match, since computing that is faster.
2021-05-06ASP-based solver: no intermediate package for concretizing together (#23307)Massimiliano Culpo2-0/+33
The ASP-based solver can natively manage cases where more than one root spec is given, and is able to concretize all the roots together (ensuring one spec per package at most). Modifications: - [x] When concretising together an environment the ASP-based solver calls directly its `solve` method rather than constructing a temporary fake root package.
2021-05-06Reduce visual noise during distributed build (#23338)Harmen Stoppels2-3/+7
2021-05-06Put a module object in sys.modules before executing module code (#23269)Massimiliano Culpo2-2/+39
The loading protocol mandates that the the module we are going to import needs to be already in sys.modules before its code is executed, so to prevent unbounded recursions and multiple loading. Loading a module from file exits early if the module is already in sys.modules
2021-05-05intel-oneapi packages: support root installs (#23401)Robert Cohn1-0/+21
When installing OneAPI packages as root (e.g. in a container), the installer places cache files in /var/intel/installercache that interfere with future Spack installs. This ensures that when running an installation as a root user that this is removed.
2021-05-03archspec: updated external dependency (#23311)Massimiliano Culpo3-13/+71
Added support for Apple M1, extended support for zen3 with more compiler flags.
2021-05-03Use Python's built-in machinery to import compilers (#23290)Massimiliano Culpo1-8/+7
2021-05-03cmd: improve shell support help message (#23410)Michael Kuhn1-1/+8
Users sometimes set up Spack's shell support but still call `bin/spack`, which results in the help message showing up again.
2021-05-03Use an environment variable to set the default stacktrace behavior (#23357)Harmen Stoppels1-0/+1
2021-04-28Make Spack able to apply gz compressed remote patches (#22823)Massimiliano Culpo2-2/+19
Modified ncbi-rmblastn to retrieve patches from remote
2021-04-28Fix intersection if a version is a prefix of another (#22941)BenWeber422-1/+6
* Added test for version intersections when one is prefix of another * Fix version intersection for prefixes
2021-04-28Read colorization from environment variable, if command line is not set (#23130)Harmen Stoppels2-2/+9
2021-04-27Import hooks using Python's built-in machinery (#23288)Massimiliano Culpo1-52/+66
The function we coded in Spack to load Python modules with arbitrary names from a file seem to have issues with local imports. For loading hooks though it is unnecessary to use such functions, since we don't care to bind a custom name to a module nor we have to load it from an unknown location. This PR thus modifies spack.hook in the following ways: - Use __import__ instead of spack.util.imp.load_source (this addresses #20005) - Sync module docstring with all the hooks we have - Avoid using memoization in a module function - Marked with a leading underscore all the names that are supposed to stay local
2021-04-27Don't report configure errors to CDash for successful packages (#23286)Zack Galbreath2-9/+28
Convert configure errors detected by our log scraper into warnings when the package being installed reports that it was successful.
2021-04-26Dyninst: Add dependencies for v11.0.0 (#23121)Tim Haines1-1/+1
Also update the mpileaks unit test to avoid a conflict on CentOS 6 where Dyninst >=11.0.0 no longer builds due to a compiler version conflict.
2021-04-23docs: be more precise on what `spack add ...` does (#23204)George Hartzell1-3/+3
This is as much a question as it is a minor fine-tuning of the docs. I've been known to add things to an environment by editing the `spack.yaml` file directly. When I read the previous version of this sentence, I was afraid that `spack add` was actually doing *two* things, modifying the `spack.yaml` and updating something else that defined the roots of the Environment. A bit of experimentation suggests that editing the `spack.yaml` file is sufficient to change the roots. Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-04-22Docs: Updated copyrights in files still using 2020 as ending year (#23215)Tamara Dahlgren4-4/+4
2021-04-21ASP-based solve: minimize compiler mismatches (#23016)Massimiliano Culpo2-32/+26
fixes #22718 Instead of trying to maximize the number of matches (preferred behavior), try to minimize the number of mismatches (unwanted behavior).
2021-04-21ASP-based solver: suppress warnings when constructing facts (#23090)Massimiliano Culpo1-1/+4
fixes #22786 Trying to get optimization flags for a specific target from a compiler may trigger warnings. In the context of constructing facts for the ASP-based solver we don't want to show these warnings to the user, so here we simply ignore them.
2021-04-20check for package in spec not variant (#23157)Chris White1-3/+3
2021-04-20Catch rstudio based URL for `cran` attribute in create.py (#23072)Glenn Johnson1-1/+1
2021-04-20Fixing typo tty.fail -> tty.die and monitor docstrings (#23152)Vanessasaurus1-37/+90
This isn't a significant issue, but I noticed that the docstring incorrectly references "tty.fail" and I wanted to quickly fix it to reflect the correct command, tty.die. I also wanted to fix the docstrings to not be large clumps, to what @tgamblin suggested after I wrote this - having one line at the top that is a quick summary, and more verbose after that.
2021-04-16docs: spack does not have a variant debug for libelf (#23021)Vanessasaurus1-3/+3
Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-04-15Return non-zero from CDash reporter when errors are detected (#22962)Zack Galbreath1-4/+12
2021-04-15Merge pull request #21930 from vsoch/add/spack-monitorVanessasaurus29-102/+2253
This provides initial support for [spack monitor](https://github.com/spack/spack-monitor), a web application that stores information and analysis about Spack installations. Spack can now contact a monitor server and upload analysis -- even after a build is already done. Specifically, this adds: - [x] monitor options for `spack install` - [x] `spack analyze` command - [x] hook architecture for analyzers - [x] separate build logs (in addition to the existing combined log) - [x] docs for spack analyze - [x] reworked developer docs, with hook docs - [x] analyzers for: - [x] config args - [x] environment variables - [x] installed files - [x] libabigail There is a lot more information in the docs contained in this PR, so consult those for full details on this feature. Additional tests will be added in a future PR.
2021-04-15Use `gethostname()` instead of `getfqdn()` for lock debug modevsoch2-2/+2
In debug mode, processes taking an exclusive lock write out their node name to the lock file. We were using `getfqdn()` for this, but it seems to produce inconsistent results when used from within some github actions containers. We get this error because getfqdn() seems to return a short name in one place and a fully qualified name in another: ``` File "/home/runner/work/spack/spack/lib/spack/spack/test/llnl/util/lock.py", line 1211, in p1 assert lock.host == self.host AssertionError: assert 'fv-az290-764....cloudapp.net' == 'fv-az290-764' - fv-az290-764.internal.cloudapp.net + fv-az290-764 !!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!! == 1 failed, 2547 passed, 7 skipped, 22 xfailed, 2 xpassed in 1238.67 seconds == ``` This seems to stem from https://bugs.python.org/issue5004. We don't really need to get a fully qualified hostname for debugging, so use `gethostname()` because its results are more consistent. This seems to fix the issue. Signed-off-by: vsoch <vsoch@users.noreply.github.com>