summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2021-09-13Bugfix: Correct checksum's sha256 when retrieve from remote (#25831)Tamara Dahlgren1-0/+10
2021-09-13Bugfix: spack test debug requires Spack tty (#25897)Tamara Dahlgren1-1/+1
2021-09-10[docs] document official gfortran macOS precompiled binaries (#25818)Stephen McDowell1-3/+5
* document official gfortran macOS precompiled binaries * compile without -vvv ;) {squash this}
2021-09-10Remove dead code in installer (#24035)Harmen Stoppels3-69/+0
Currently as part of installing a package, we lock a prefix, check if it exists, and create it if not; the logic for creating the prefix included a check for the existence of that prefix (and raised an exception if it did), which was redundant. This also includes removal of tests which were not verifying anything (they pass with or without the modifications in this PR).
2021-09-09CUDA official GCC conflicts (#25054)albestro1-6/+21
* update CUDA 11 / GCC compatibility range * additional unofficial conflict * minor changes to comments
2021-09-09Refactor unit-tests in test/architecture.py (#25848)Massimiliano Culpo5-121/+101
Modifications: - Export platforms from spack.platforms directly, so that client modules don't have to import submodules - Use only plain imports in test/architecture.py - Parametrized test in test/architecture.py and put most of the setup/teardown in fixtures
2021-09-09specs: move to new spec.json format with build provenance (#22845)Nathan Hanford34-674/+1195
This is a major rework of Spack's core core `spec.yaml` metadata format. It moves from `spec.yaml` to `spec.json` for speed, and it changes the format in several ways. Specifically: 1. The spec format now has a `_meta` section with a version (now set to version `2`). This will simplify major changes like this one in the future. 2. The node list in spec dictionaries is no longer keyed by name. Instead, it is a list of records with no required key. The name, hash, etc. are fields in the dictionary records like any other. 3. Dependencies can be keyed by any hash (`hash`, `full_hash`, `build_hash`). 4. `build_spec` provenance from #20262 is included in the spec format. This means that, for spliced specs, we preserve the *full* provenance of how to build, and we can reproduce a spliced spec from the original builds that produced it. **NOTE**: Because we have switched the spec format, this PR changes Spack's hashing algorithm. This means that after this commit, Spack will think a lot of things need rebuilds. There are two major benefits this PR provides: * The switch to JSON format speeds up Spack significantly, as Python's builtin JSON implementation is orders of magnitude faster than YAML. * The new Spec format will soon allow us to represent DAGs with potentially multiple versions of the same dependency -- e.g., for build dependencies or for compilers-as-dependencies. This PR lays the necessary groundwork for those features. The old `spec.yaml` format continues to be supported, but is now considered a legacy format, and Spack will opportunistically convert these to the new `spec.json` format.
2021-09-08Account for bootstrapping from sources niche caseMassimiliano Culpo1-7/+23
This modification accounts for: 1. Bootstrapping from sources using system, non-standard Python 2. Using later an ABI compatible standard Python interpreter
2021-09-08Fix clingo bootstrapping on rhel + ppc64leMassimiliano Culpo1-0/+53
The system Python interpreter on rhel is patched to have slightly different names for some architectures. This makes it incompatible with manylinux generated extensions for ppc64le. To fix this issue when bootstrapping Spack we generate on-the-fly symbolic links to the name expected by the current interpreter if it differs from the default. Links: https://github.com/pypa/manylinux/issues/687 https://src.fedoraproject.org/fork/churchyard/rpms/python3/blame/00274-fix-arch-names.patch?identifier=test_email-mktime
2021-09-08Disable module generation during bootstrappingMassimiliano Culpo5-7/+41
2021-09-08url stats: add `--show-issues` option (#25792)Todd Gamblin4-36/+91
* tests: make `spack url [stats|summary]` work on mock packages Mock packages have historically had mock hashes, but this means they're also invalid as far as Spack's hash detection is concerned. - [x] convert all hashes in mock package to md5 or sha256 - [x] ensure that all mock packages have a URL - [x] ignore some special cases with multiple VCS fetchers * url stats: add `--show-issues` option `spack url stats` tells us how many URLs are using what protocol, type of checksum, etc., but it previously did not tell us which packages and URLs had the issues. This adds a `--show-issues` option to show URLs with insecure (`http`) URLs or `md5` hashes (which are now deprecated by NIST).
2021-09-08lib/spack/env/cc: tolerate trailing / in elements of $PATH (#25733)bernhardkaindl2-1/+35
Fixes removal of SPACK_ENV_PATH from PATH in the presence of trailing slashes in the elements of PATH: The compiler wrapper has to ensure that it is not called nested like it would happen when gcc's collect2 uses PATH to call the linker ld, or else the compilation fails. To prevent nested calls, the compiler wrapper removes the elements of SPACK_ENV_PATH from PATH. Sadly, the autotest framework appends a slash to each element of PATH when adding AUTOTEST_PATH to the PATH for the tests, and some tests like those of GNU bison run cc inside the test. Thus, ensure that PATH cleanup works even with trailing slashes. This fixes the autotest suite of bison, compiling hundreds of bison-generated test cases in a autotest-generated testsuite. Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
2021-09-07docs: minor grammar fix (#25814)Stephen McDowell1-1/+1
2021-09-03Always disable leftover active environment after testsHarmen Stoppels1-12/+12
2021-09-03Don't error when removing scope that does not existHarmen Stoppels1-1/+2
2021-09-02start of work to add spack audit packages-https checker (#25670)Vanessasaurus3-4/+92
This PR will add a new audit, specifically for spack package homepage urls (and eventually other kinds I suspect) to see if there is an http address that can be changed to https. Usage is as follows: ```bash $ spack audit packages-https <package> ``` And in list view: ```bash $ spack audit list generic: Generic checks relying on global variables configs: Sanity checks on compilers.yaml Sanity checks on packages.yaml packages: Sanity checks on specs used in directives packages-https: Sanity checks on https checks of package urls, etc. ``` I think it would be unwise to include with packages, because when run for all, since we do requests it takes a long time. I also like the idea of more well scoped checks - likely there will be other addresses for http/https within a package that we eventually check. For now, there are two error cases - one is when an https url is tried but there is some SSL error (or other error that means we cannot update to https): ```bash $ spack audit packages-https zoltan PKG-HTTPS-DIRECTIVES: 1 issue found 1. Error with attempting https for "zoltan": <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'www.cs.sandia.gov'. (_ssl.c:1125)> ``` This is either not fixable, or could be fixed with a change to the url or (better) contacting the site owners to ask about some certificate or similar. The second case is when there is an http that needs to be https, which is a huge issue now, but hopefully not after this spack PR. ```bash $ spack audit packages-https xman Package "xman" uses http but has a valid https endpoint. ``` And then when a package is fixed: ```bash $ spack audit packages-https zlib PKG-HTTPS-DIRECTIVES: 0 issues found. ``` And that's mostly it. :) Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com>
2021-09-01Add variant to allow unsupported compiler & CUDA combinations (#19736)David Beckingsale1-84/+82
Sometimes users need to be able to override the conflicts in `CudaPacakge`. This introduces a variant to enable/disable them.
2021-09-01Speed-up two unit tests by using builtin.mock instead of builtin (#25544)Harmen Stoppels1-2/+2
2021-08-30Add documentation on compiler `environment` (#25508)kwryankrattiger1-0/+28
2021-08-28Add a __reduce__ method to Spec (#25658)Massimiliano Culpo1-22/+38
* Add a __reduce__ method to Spec fixes #23892 The recursion limit seems to be due to the default way in which a Spec is serialized, following all the attributes. It's still not clear to me why this is related to being in an environment, but in any case we already have methods to serialize Specs to disk in JSON and YAML format. Here we use them to pickle a Spec instance too. * Downgrade to build-hash Hopefully nothing will change the package in between serializing the spec and sending it to the child process. * Add support for Python 2
2021-08-27Fix: --overwrite backs up old install dir, but it gets destroyed anyways ↵Harmen Stoppels3-5/+30
(#25583) * Make sure PackageInstaller does not remove the just-restored install dir after failure in spack install --overwrite * Remove cryptic error message and rethrow actual error
2021-08-27Load package environment prior to stand-alone/smoke test execution (#25619)Tamara Dahlgren1-0/+9
2021-08-27Add ld.gold and ld.lld compiler wrapper (#25626)Jordan Galby3-1/+3
The gcc compiler can be configured to use `ld.gold` by default. It will then call `ld.gold` explicitly when linking. When so, spack need to have a ld.gold wrapper in PATH to inject rpaths link flags etc... Also I wouldn't be surprised to see some package calling `ld.gold` directly. As for ld.gold, the argument could be made that we want to support any package that could call ld.lld.
2021-08-27Make `SpecBuildInterface` pickleable (#25628)Massimiliano Culpo1-1/+6
* Add a __reduce__ method to SpecBuildInterface This class was confusing pickle when being serialized, due to its scary nature of being an object that disguise as another type. * Add more MacOS tests, switch them to clingo * Fix condition syntax * Remove Python v3.6 and v3.9 with macOS
2021-08-26Make env (de)activate error with -e, -E, -D flags (#25625)Harmen Stoppels2-0/+33
* Make sure that spack -e. env activate b and spack -e. env deactivate error * Add a test
2021-08-26Conditionally remove 'context' from kwargs in _urlopen (#25316)Paul Kuberry1-3/+9
* Conditionally remove 'context' from kwargs in _urlopen Previously, 'context' is purged from kwargs in _urlopen to conform to varying support for 'context' in different versions of urllib. This fix tries to use 'context', and then removes it if an exception is thrown and tries again. * Specify error type in try statement in _urlopen Specify TypeError when checking if 'context' is in kwargs for _urlopen. Also, if try fails, check that 'context' is in the error message before removing from kwargs.
2021-08-26Speedup environment activation, part 2 (#25633)Adam J. Stewart2-8/+13
This is a direct followup to #13557 which caches additional attributes that were added in #24095 that are expensive to compute. I had to reopen #25556 in another PR to invalidate the GitLab CI cache, but see #25556 for prior discussion. ### Before ```console $ time spack env activate . real 2m13.037s user 1m25.584s sys 0m43.654s $ time spack env view regenerate ==> Updating view at /Users/Adam/.spack/.spack-env/view real 16m3.541s user 10m28.892s sys 4m57.816s $ time spack env deactivate real 2m30.974s user 1m38.090s sys 0m49.781s ``` ### After ```console $ time spack env activate . real 0m8.937s user 0m7.323s sys 0m1.074s $ time spack env view regenerate ==> Updating view at /Users/Adam/.spack/.spack-env/view real 2m22.024s user 1m44.739s sys 0m30.717s $ time spack env deactivate real 0m10.398s user 0m8.414s sys 0m1.630s ``` Fixes #25555 Fixes #25541 * Speedup environment activation, part 2 * Only query distutils a single time * Fix KeyError bug * Make vermin happy * Manual memoize * Add comment on cross-compiling * Use platform-specific include directory * Fix multiple bugs * Fix python_inc discrepancy * Fix import tests
2021-08-26Set pubkey trust to ultimate during `gpg trust` (#24976)Harmen Stoppels1-3/+42
* Set pubkey trust to ultimate during `gpg trust` Tries to solve the same problem as #24760 without surpressing stderr from gpg commands. This PR makes every imported key trusted in the gpg database. Note: I've outlined [here](https://github.com/spack/spack/pull/24760#issuecomment-883183175) that gpg's trust model makes sense, since how can we trust a random public key we download from a binary cache? * Fix test
2021-08-26Ensure environment are deactivated when bootstrapping (#25607)Massimiliano Culpo5-23/+52
Fixes #25603 This commit adds a new context manager to temporarily deactivate active environments. This context manager is used when setting up bootstrapping configuration to make sure that the current environment is not affected by operations on the bootstrap store. * Preserve exit code 1 if nothing is found * Use context manager for the environment
2021-08-26Remove references to self.install_test_root from packaging guide (#25238)Tamara Dahlgren1-27/+19
2021-08-26Avoid double loop in subprocess_context.store_patches (#25621)Massimiliano Culpo1-10/+9
fixes #21643 As far as I can see the double loop is not needed, since "patch" is never used and the items in the list are tuples of three values.
2021-08-26Remove fork_context from llnl.util.lang (#25620)Massimiliano Culpo1-18/+0
This object was introduced in #18124, and was later superseded by #18205 and removed any use if the object.
2021-08-26Regression test for version selection with preferences (#25602)Massimiliano Culpo2-0/+14
This commit adds a regression test for version selection with preferences in `packages.yaml`. Before PR 25585 we used negative weights in a minimization to select the optimal version. This may lead to situations where a dependency may make the version score of dependents "better" if it is preferred in packages.yaml.
2021-08-25Bugfix: reinstalling updated develop specs (#25579)Harmen Stoppels1-6/+2
PackageInstaller and Package.installed disagree over what it means for a package to be installed: PackageInstaller believes it should be enough for a database entry to exist, whereas Package.installed requires a database entry & a prefix directory. This leads to the following niche issue: * a develop spec in an environment is successfully installed * then somehow its install prefix is removed (e.g. through a bug fixed in #25583) * you modify the sources and reinstall the environment 1. spack checks pkg.installed and realizes the develop spec is NOT installed, therefore it doesn't need to have 'overwrite: true' 2. the installer gets the build task and checks the database and realizes the spec IS installed, hence it doesn't have to install it. 3. the develop spec is not rebuilt. The solution is to make PackageInstaller and pkg.installed agree over what it means to be installed, and this PR does that by dropping the prefix directory check from pkg.installed, so that it only checks the database. As a result, spack will create a build task with overwrite: true for the develop spec, and the installer in fact handles overwrite requests fine even if the install prefix doesn't exist (it just does a normal install).
2021-08-25environment: match concrete specs only if they have the same build hash (#25575)Massimiliano Culpo1-0/+15
see #25563 When we have a concrete environment and we ask to install a concrete spec from a file, currently Spack returns a list of specs that are all the one that match the argument DAG hash. Instead we want to compare build hashes, which also account for build-only dependencies.
2021-08-25installation: filter padding from binary installs, too (#25600)Todd Gamblin1-2/+7
#25303 filtered padding from build output, but it's still there in binary install/relocate output, so our CI logs are still quite long and frequently hit the limit. - [x] add context handler from #25303 to buildcache installation as well
2021-08-25Make `spack graph -i` environment-aware (#25599)Todd Gamblin2-2/+18
This allows you to run `spack graph --installed` from within an environment and get a dot graph of its concrete specs. - [x] make `spack graph -i` environment-aware - [x] add code to the generated dot graph to ensure roots have min rank (i.e., they're all at the top or left of the DAG)
2021-08-24bootstrap: use `sys.exec_prefix` to set up external python correctly (#25593)Todd Gamblin1-1/+1
Bootstrapping clingo on macOS on `develop` gives errors like this: ``` ==> Error: RuntimeError: Unable to locate python command in /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/bin /Users/gamblin2/Workspace/spack/var/spack/repos/builtin/packages/python/package.py:662, in command: 659 return Executable(path) 660 else: 661 msg = 'Unable to locate {0} command in {1}' >> 662 raise RuntimeError(msg.format(self.name, self.prefix.bin)) ``` On macOS, `python` is laid out differently. In particular, `sys.executable` is here: ```console Python 2.7.16 (default, May 8 2021, 11:48:02) [GCC Apple LLVM 12.0.5 (clang-1205.0.19.59.6) [+internal-os, ptrauth-isa=deploy on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.executable '/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python' ``` Based on that, you'd think that `/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents` would be where you'd look for a `bin` directory, but you (and Spack) would be wrong: ```console $ ls /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/ Info.plist MacOS/ PkgInfo Resources/ _CodeSignature/ version.plist ``` You need to look in `sys.exec_prefix` ``` >>> sys.exec_prefix '/System/Library/Frameworks/Python.framework/Versions/2.7' ``` Which looks much more like a standard prefix, with understandable `bin`, `lib`, and `include` directories: ```console $ ls /System/Library/Frameworks/Python.framework/Versions/2.7 Extras/ Mac/ Resources/ bin/ lib/ Headers@ Python* _CodeSignature/ include/ $ ls -l /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python lrwxr-xr-x 1 root wheel 7B Jan 1 2020 /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python@ -> python2 ``` - [x] change `bootstrap.py` to use the `sys.exec_prefix` as the external prefix, instead of just getting the parent directory of the executable.
2021-08-25bugfix: Correct source of PID for -ddd installation outputs (#25596)Tamara Dahlgren1-2/+2
2021-08-24bootstrap: fix printing for python 2 (#25592)Todd Gamblin2-0/+4
2021-08-24locks: only open lockfiles once instead of for every lock held (#24794)Todd Gamblin1-20/+128
This adds lockfile tracking to Spack's lock mechanism, so that we ensure that there is only one open file descriptor per inode. The `fcntl` locks that Spack uses are associated with an inode and a process. This is convenient, because if a process exits, it releases its locks. Unfortunately, this also means that if you close a file, *all* locks associated with that file's inode are released, regardless of whether the process has any other open file descriptors on it. Because of this, we need to track open lock files so that we only close them when a process no longer needs them. We do this by tracking each lockfile by its inode and process id. This has several nice properties: 1. Tracking by pid ensures that, if we fork, we don't inadvertently track the parent process's lockfiles. `fcntl` locks are not inherited across forks, so we'll just track new lockfiles in the child. 2. Tracking by inode ensures that referencs are counted per inode, and that we don't inadvertently close a file whose inode still has open locks. 3. Tracking by both pid and inode ensures that we only open lockfiles the minimum number of times necessary for the locks we have. Note: as mentioned elsewhere, these locks aren't thread safe -- they're designed to work in Python and assume the GIL. Tasks: - [x] Introduce an `OpenFileTracker` class to track open file descriptors by inode. - [x] Reference-count open file descriptors and only close them if they're no longer needed (this avoids inadvertently releasing locks that should not be released).
2021-08-24Fix bindist network issues (#25587)Harmen Stoppels1-1/+3
* Fix bindist network issues * Another one using the network
2021-08-24ASP-based solver: rework version facts (#25585)Massimiliano Culpo2-87/+105
This commit rework version facts so that: 1. All the information on versions is collected before emitting the facts 2. The same kind of atom is emitted for versions stemming from different origins (package.py vs. packages.yaml) In the end all the possible versions for a given package are totally ordered and they are given different and increasing weights staring from zero. This refactor allow us to avoid using negative weights, which in some configurations may make parent node score "better" and lead to unexpected "optimal" results.
2021-08-23Spelling fixes (#25570)Paul Spencer1-2/+2
2021-08-21Document how to handle changing build systems (#25174)Adam J. Stewart3-0/+352
2021-08-20Fix spelling mistake in the word "monitor" (#25486)Paul Spencer1-1/+1
2021-08-20Pipelines: use shared pr mirror for pipeline generation and builds (#25529)Scott Wittenburg2-2/+19
Once PR binary graduation is deployed, the shared PR mirror will contain binaries just built by a merged PR, before the subsequent develop pipeline has had time to finish. Using the shared PR mirror as a source of binaries will reduce the number of times we have to rebuild the same full hash.
2021-08-20Fix broken develop as CI didn't run on latest merge commit (#25531)Harmen Stoppels1-1/+1
* CI for #25439 was not run on the latest merge commit, and fails after #25470 * Make it consistent
2021-08-19New `spack.environment.active_environment` api, and make spack.environment ↵Harmen Stoppels51-215/+176
not depend on spack.cmd. (#25439) * Refactor active environment getters - Make `spack.environment.active_environment` a trivial getter for the active environment, replacing `spack.environment.get_env` when the arguments are not needed - New method `spack.cmd.require_active_environment(cmd_name)` for commands that require an environment (rather than abusing get_env/active_environment) - Clean up calling code to call spack.environment.active_environment or spack.cmd.require_active_environment as appropriate - Remove the `-e` parsing from `active_environment`, because `main.py` is responsible for processing `-e` and already activates the environment. - Move `spack.environment.find_environment` to `spack.cmd.find_environment`, to avoid having spack.environment aware of argparse. - Refactor `spack install` command so argument parsing is all handled in the command, no argparse in spack.environment or spack.installer - Update documentation * Python 2: toplevel import errors only with 'as ev' In two files, `import spack.environment as ev` leads to errors These errors are not well understood ("'module' object has no attribute 'environment'"). All other files standardize on the above syntax.
2021-08-19buildcache: Add environment-aware buildcache sync command (#25470)Scott Wittenburg2-0/+228