diff options
-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, |