summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2024-01-08 22:09:53 +0100
committerGitHub <noreply@github.com>2024-01-08 22:09:53 +0100
commitaa768938fffca137855b6d58a03dda8746489b9a (patch)
treed6b56a6c7364b25ba3bb803a73cbb73dd3372ab4
parentcdb8fd68e2dc78cc2b0a4e59202d29390df9e96f (diff)
downloadspack-aa768938fffca137855b6d58a03dda8746489b9a.tar.gz
spack-aa768938fffca137855b6d58a03dda8746489b9a.tar.bz2
spack-aa768938fffca137855b6d58a03dda8746489b9a.tar.xz
spack-aa768938fffca137855b6d58a03dda8746489b9a.zip
Do not add ^gcc-runtime to externals (#41994)
This commit ensures that gcc-runtime is only injected as a dependency to non-external packages
-rw-r--r--lib/spack/spack/solver/asp.py1
-rw-r--r--lib/spack/spack/test/concretize_compiler_runtimes.py24
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index dd4ed9e0c2..f545db58ae 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -2927,6 +2927,7 @@ class RuntimePropertyRecorder:
body_clauses = self._setup.spec_clauses(when_spec, body=True)
body_str = (
f" {f',{os.linesep} '.join(str(x) for x in body_clauses)},\n"
+ f" not external({node_variable}),\n"
f" not runtime(Package)"
).replace(f'"{placeholder}"', f"{node_variable}")
head_clauses = self._setup.spec_clauses(dependency_spec, body=False)
diff --git a/lib/spack/spack/test/concretize_compiler_runtimes.py b/lib/spack/spack/test/concretize_compiler_runtimes.py
index 18eff16fe9..f331e9a7f8 100644
--- a/lib/spack/spack/test/concretize_compiler_runtimes.py
+++ b/lib/spack/spack/test/concretize_compiler_runtimes.py
@@ -13,7 +13,10 @@ import spack.solver.asp
import spack.spec
from spack.version import Version
-pytestmark = [pytest.mark.only_clingo("Original concretizer does not support compiler runtimes")]
+pytestmark = [
+ pytest.mark.only_clingo("Original concretizer does not support compiler runtimes"),
+ pytest.mark.usefixtures("enable_runtimes"),
+]
@pytest.fixture
@@ -31,7 +34,7 @@ def enable_runtimes():
spack.solver.asp.WITH_RUNTIME = original
-def test_correct_gcc_runtime_is_injected_as_dependency(runtime_repo, enable_runtimes):
+def test_correct_gcc_runtime_is_injected_as_dependency(runtime_repo):
s = spack.spec.Spec("a%gcc@10.2.1 ^b%gcc@4.5.0").concretized()
a, b = s["a"], s["b"]
@@ -40,3 +43,20 @@ def test_correct_gcc_runtime_is_injected_as_dependency(runtime_repo, enable_runt
# And the gcc-runtime version should be that of the newest gcc used in the dag.
assert a["gcc-runtime"].version == Version("10.2.1")
+
+
+@pytest.mark.regression("41972")
+def test_external_nodes_do_not_have_runtimes(runtime_repo, mutable_config, tmp_path):
+ """Tests that external nodes don't have runtime dependencies."""
+
+ packages_yaml = {"b": {"externals": [{"spec": "b@1.0", "prefix": f"{str(tmp_path)}"}]}}
+ spack.config.set("packages", packages_yaml)
+
+ s = spack.spec.Spec("a%gcc@10.2.1").concretized()
+
+ a, b = s["a"], s["b"]
+
+ # Since b is an external, it doesn't depend on gcc-runtime
+ assert a.dependencies("gcc-runtime")
+ assert a.dependencies("b")
+ assert not b.dependencies("gcc-runtime")