diff options
author | Scott Wittenburg <scott.wittenburg@kitware.com> | 2020-07-17 12:13:36 -0600 |
---|---|---|
committer | Gregory Becker <becker33@llnl.gov> | 2020-07-23 13:53:46 -0700 |
commit | 9cbe358f848831ba559f1cf6e0b417a23548438d (patch) | |
tree | 259d8517f2299e99c454d9ad0742e7d7a06e68de | |
parent | 27af499b5298d256f158a3999ded4ec37b198f80 (diff) | |
download | spack-9cbe358f848831ba559f1cf6e0b417a23548438d.tar.gz spack-9cbe358f848831ba559f1cf6e0b417a23548438d.tar.bz2 spack-9cbe358f848831ba559f1cf6e0b417a23548438d.tar.xz spack-9cbe358f848831ba559f1cf6e0b417a23548438d.zip |
Bugfix/install missing compiler from buildcache (#17536)
Ensure compilers installed from buildcache are registered.
-rw-r--r-- | lib/spack/spack/installer.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/install.py | 37 |
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index 978296e051..b9ae0f46fa 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -1057,6 +1057,9 @@ class PackageInstaller(object): if use_cache and \ _install_from_cache(pkg, cache_only, explicit, unsigned): self._update_installed(task) + if task.compiler: + spack.compilers.add_compilers_to_config( + spack.compilers.find_compilers([pkg.spec.prefix])) return pkg.run_tests = (tests is True or tests and pkg.name in tests) diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py index 9ffd166e37..eb8813387b 100644 --- a/lib/spack/spack/test/cmd/install.py +++ b/lib/spack/spack/test/cmd/install.py @@ -29,6 +29,9 @@ from six.moves.urllib.error import HTTPError, URLError install = SpackCommand('install') env = SpackCommand('env') add = SpackCommand('add') +mirror = SpackCommand('mirror') +uninstall = SpackCommand('uninstall') +buildcache = SpackCommand('buildcache') @pytest.fixture() @@ -733,6 +736,40 @@ def test_compiler_bootstrap( install('a%gcc@2.0') +def test_compiler_bootstrap_from_binary_mirror( + install_mockery_mutable_config, mock_packages, mock_fetch, + mock_archive, mutable_config, monkeypatch, tmpdir): + """Make sure installing compiler from buildcache registers compiler""" + + # Create a temp mirror directory for buildcache usage + mirror_dir = tmpdir.join('mirror_dir') + mirror_url = 'file://{0}'.format(mirror_dir.strpath) + + # Install a compiler, because we want to put it in a buildcache + install('gcc@2.0') + + # Put installed compiler in the buildcache + buildcache('create', '-u', '-a', '-f', '-d', mirror_dir.strpath, 'gcc@2.0') + + # Now uninstall the compiler + uninstall('-y', 'gcc@2.0') + + monkeypatch.setattr(spack.concretize.Concretizer, + 'check_for_compiler_existence', False) + spack.config.set('config:install_missing_compilers', True) + assert CompilerSpec('gcc@2.0') not in compilers.all_compiler_specs() + + # Configure the mirror where we put that buildcache w/ the compiler + mirror('add', 'test-mirror', mirror_url) + + # Now make sure that when the compiler is installed from binary mirror, + # it also gets configured as a compiler. Test succeeds if it does not + # raise an error + install('--no-check-signature', '--cache-only', '--only', + 'dependencies', 'b%gcc@2.0') + install('--no-cache', '--only', 'package', 'b%gcc@2.0') + + @pytest.mark.regression('16221') def test_compiler_bootstrap_already_installed( install_mockery_mutable_config, mock_packages, mock_fetch, |