summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/build_environment.py2
-rw-r--r--lib/spack/spack/cmd/common/arguments.py2
-rw-r--r--lib/spack/spack/fetch_strategy.py2
-rw-r--r--lib/spack/spack/installer.py6
-rw-r--r--lib/spack/spack/test/cmd/install.py30
-rw-r--r--var/spack/repos/builtin.mock/packages/gcc/package.py23
6 files changed, 61 insertions, 4 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index 21ab6895ec..5e6ea00ce6 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -415,7 +415,7 @@ def _set_variables_for_single_module(pkg, module):
if getattr(module, marker, False):
return
- jobs = spack.config.get('config:build_jobs') if pkg.parallel else 1
+ jobs = spack.config.get('config:build_jobs', 16) if pkg.parallel else 1
jobs = min(jobs, multiprocessing.cpu_count())
assert jobs is not None, "no default set for config:build_jobs"
diff --git a/lib/spack/spack/cmd/common/arguments.py b/lib/spack/spack/cmd/common/arguments.py
index b93f265c7a..e5945bda9c 100644
--- a/lib/spack/spack/cmd/common/arguments.py
+++ b/lib/spack/spack/cmd/common/arguments.py
@@ -111,7 +111,7 @@ class SetParallelJobs(argparse.Action):
def default(self):
# This default is coded as a property so that look-up
# of this value is done only on demand
- return min(spack.config.get('config:build_jobs'),
+ return min(spack.config.get('config:build_jobs', 16),
multiprocessing.cpu_count())
@default.setter
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index d7613ae58a..c6200565e5 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -336,7 +336,7 @@ class URLFetchStrategy(FetchStrategy):
else:
curl_args.append('-sS') # just errors when not.
- connect_timeout = spack.config.get('config:connect_timeout')
+ connect_timeout = spack.config.get('config:connect_timeout', 10)
if self.extra_options:
cookie = self.extra_options.get('cookie')
diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py
index 213a85f0dc..2bad1e8818 100644
--- a/lib/spack/spack/installer.py
+++ b/lib/spack/spack/installer.py
@@ -1466,6 +1466,12 @@ class PackageInstaller(object):
if lock is not None:
self._update_installed(task)
_print_installed_pkg(pkg.prefix)
+
+ # It's an already installed compiler, add it to the config
+ if task.compiler:
+ spack.compilers.add_compilers_to_config(
+ spack.compilers.find_compilers([pkg.spec.prefix]))
+
else:
# At this point we've failed to get a write or a read
# lock, which means another process has taken a write
diff --git a/lib/spack/spack/test/cmd/install.py b/lib/spack/spack/test/cmd/install.py
index 1d4a0c6827..dd52cea406 100644
--- a/lib/spack/spack/test/cmd/install.py
+++ b/lib/spack/spack/test/cmd/install.py
@@ -15,11 +15,12 @@ import pytest
import llnl.util.filesystem as fs
import spack.config
+import spack.compilers as compilers
import spack.hash_types as ht
import spack.package
import spack.cmd.install
from spack.error import SpackError
-from spack.spec import Spec
+from spack.spec import Spec, CompilerSpec
from spack.main import SpackCommand
import spack.environment as ev
@@ -718,3 +719,30 @@ def test_cdash_auth_token(tmpdir, install_mockery, capfd):
'--log-format=cdash',
'a')
assert 'Using CDash auth token from environment' in out
+
+
+def test_compiler_bootstrap(
+ install_mockery, mock_packages, mock_fetch, mock_archive,
+ mutable_config, monkeypatch):
+ 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()
+
+ # Test succeeds if it does not raise an error
+ install('a%gcc@2.0')
+
+
+@pytest.mark.regression('16221')
+def test_compiler_bootstrap_already_installed(
+ install_mockery, mock_packages, mock_fetch, mock_archive,
+ mutable_config, monkeypatch):
+ 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()
+
+ # Test succeeds if it does not raise an error
+ install('gcc@2.0')
+ install('a%gcc@2.0')
diff --git a/var/spack/repos/builtin.mock/packages/gcc/package.py b/var/spack/repos/builtin.mock/packages/gcc/package.py
new file mode 100644
index 0000000000..03b45a6e12
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/gcc/package.py
@@ -0,0 +1,23 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class Gcc(Package):
+ """Simple compiler package."""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/gcc-1.0.tar.gz"
+
+ version('1.0', '0123456789abcdef0123456789abcdef')
+ version('2.0', '2.0_a_hash')
+
+ def install(self, spec, prefix):
+ # Create the minimal compiler that will fool `spack compiler find`
+ mkdirp(prefix.bin)
+ with open(prefix.bin.gcc, 'w') as f:
+ f.write('#!/bin/bash\necho "%s"' % str(spec.version))
+ set_executable(prefix.bin.gcc)