diff --git a/etc/spack/defaults/concretizer.yaml b/etc/spack/defaults/concretizer.yaml index 5512cde24d..5bbf580bcf 100644 --- a/etc/spack/defaults/concretizer.yaml +++ b/etc/spack/defaults/concretizer.yaml @@ -15,7 +15,7 @@ concretizer: # as possible, rather than building. If `false`, we'll always give you a fresh # concretization. If `dependencies`, we'll only reuse dependencies but # give you a fresh concretization for your root specs. - reuse: dependencies + reuse: true # Options that tune which targets are considered for concretization. The # concretization process is very sensitive to the number targets, and the time # needed to reach a solution increases noticeably with the number of targets diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py index 631dd835fc..dc79a7eead 100644 --- a/lib/spack/spack/solver/asp.py +++ b/lib/spack/spack/solver/asp.py @@ -3566,7 +3566,7 @@ def __init__(self): # These properties are settable via spack configuration, and overridable # by setting them directly as properties. - self.reuse = spack.config.get("concretizer:reuse", False) + self.reuse = spack.config.get("concretizer:reuse", True) @staticmethod def _check_input_and_extract_concrete_specs(specs): diff --git a/lib/spack/spack/test/cmd/common/arguments.py b/lib/spack/spack/test/cmd/common/arguments.py index c1f75e99f3..3d2deac479 100644 --- a/lib/spack/spack/test/cmd/common/arguments.py +++ b/lib/spack/spack/test/cmd/common/arguments.py @@ -123,17 +123,18 @@ def test_root_and_dep_match_returns_root(mock_packages, mutable_mock_env_path): @pytest.mark.parametrize( - "arg,config", [("--reuse", True), ("--fresh", False), ("--reuse-deps", "dependencies")] + "arg,conf", [("--reuse", True), ("--fresh", False), ("--reuse-deps", "dependencies")] ) -def test_concretizer_arguments(mutable_config, mock_packages, arg, config): +def test_concretizer_arguments(mutable_config, mock_packages, arg, conf): """Ensure that ConfigSetAction is doing the right thing.""" spec = spack.main.SpackCommand("spec") - assert spack.config.get("concretizer:reuse", None) is None + assert spack.config.get("concretizer:reuse", None, scope="command_line") is None spec(arg, "zlib") - assert spack.config.get("concretizer:reuse", None) == config + assert spack.config.get("concretizer:reuse", None) == conf + assert spack.config.get("concretizer:reuse", None, scope="command_line") == conf def test_use_buildcache_type(): diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 070e79da0f..9faaa08f06 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -1346,6 +1346,9 @@ def mock_fn(*args, **kwargs): def test_reuse_installed_packages_when_package_def_changes( self, context, mutable_database, repo_with_changing_recipe ): + # test applies only with reuse turned off in concretizer + spack.config.set("concretizer:reuse", False) + # Install a spec root = Spec("root").concretized() dependency = root["changing"].copy() @@ -2120,7 +2123,11 @@ def test_external_python_extension_find_dependency_from_installed(self, monkeypa # install python external python = Spec("python").concretized() - monkeypatch.setattr(spack.store.STORE.db, "query", lambda x: [python]) + + def query(*args, **kwargs): + return [python] + + monkeypatch.setattr(spack.store.STORE.db, "query", query) # ensure that we can't be faking this by getting it from config external_conf.pop("python") diff --git a/lib/spack/spack/test/data/config/concretizer.yaml b/lib/spack/spack/test/data/config/concretizer.yaml index 0dd810163d..538182c957 100644 --- a/lib/spack/spack/test/data/config/concretizer.yaml +++ b/lib/spack/spack/test/data/config/concretizer.yaml @@ -1,5 +1,5 @@ concretizer: - # reuse is missing on purpose, see "test_concretizer_arguments" + reuse: True targets: granularity: microarchitectures host_compatible: false