summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/main.py2
-rw-r--r--lib/spack/spack/package_base.py18
-rw-r--r--lib/spack/spack/test/conftest.py5
3 files changed, 24 insertions, 1 deletions
diff --git a/lib/spack/spack/main.py b/lib/spack/spack/main.py
index 56a4dc0e33..bcdc7d7599 100644
--- a/lib/spack/spack/main.py
+++ b/lib/spack/spack/main.py
@@ -36,6 +36,7 @@ import spack.cmd
import spack.config
import spack.environment as ev
import spack.modules
+import spack.package_base
import spack.paths
import spack.platforms
import spack.repo
@@ -607,6 +608,7 @@ def setup_main_options(args):
[(key, [spack.paths.mock_packages_path])]
)
spack.repo.PATH = spack.repo.create(spack.config.CONFIG)
+ spack.package_base.WITH_GCC_RUNTIME = False
# If the user asked for it, don't check ssl certs.
if args.insecure:
diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py
index 7d8f7104df..bf8ed56d95 100644
--- a/lib/spack/spack/package_base.py
+++ b/lib/spack/spack/package_base.py
@@ -53,6 +53,7 @@ import spack.url
import spack.util.environment
import spack.util.path
import spack.util.web
+from spack.directives import _depends_on
from spack.filesystem_view import YamlFilesystemView
from spack.install_test import (
PackageTest,
@@ -76,6 +77,7 @@ FLAG_HANDLER_TYPE = Callable[[str, Iterable[str]], FLAG_HANDLER_RETURN_TYPE]
"""Allowed URL schemes for spack packages."""
_ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "file", "git"]
+WITH_GCC_RUNTIME = True
#: Filename for the Spack build/install log.
_spack_build_logfile = "spack-build-out.txt"
@@ -371,6 +373,20 @@ def on_package_attributes(**attr_dict):
return _execute_under_condition
+class BinaryPackage:
+ """This adds a universal dependency on gcc-runtime."""
+
+ def maybe_depend_on_gcc_runtime(self):
+ # Do not depend on itself, and allow tests to disable this universal dep
+ if self.name == "gcc-runtime" or not WITH_GCC_RUNTIME:
+ return
+ for v in ["13", "12", "11", "10", "9", "8", "7", "6", "5", "4"]:
+ _depends_on(self, f"gcc-runtime@{v}:", type="link", when=f"%gcc@{v} platform=linux")
+ _depends_on(self, f"gcc-runtime@{v}:", type="link", when=f"%gcc@{v} platform=cray")
+
+ _directives_to_be_executed = [maybe_depend_on_gcc_runtime]
+
+
class PackageViewMixin:
"""This collects all functionality related to adding installed Spack
package to views. Packages can customize how they are added to views by
@@ -433,7 +449,7 @@ class PackageViewMixin:
Pb = TypeVar("Pb", bound="PackageBase")
-class PackageBase(WindowsRPath, PackageViewMixin, metaclass=PackageMeta):
+class PackageBase(WindowsRPath, PackageViewMixin, BinaryPackage, metaclass=PackageMeta):
"""This is the superclass for all spack packages.
***The Package class***
diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py
index 785d986018..df9a43a123 100644
--- a/lib/spack/spack/test/conftest.py
+++ b/lib/spack/spack/test/conftest.py
@@ -57,6 +57,11 @@ from spack.fetch_strategy import URLFetchStrategy
from spack.util.pattern import Bunch
+@pytest.fixture(scope="session", autouse=True)
+def drop_gcc_runtime():
+ spack.package_base.WITH_GCC_RUNTIME = False
+
+
def ensure_configuration_fixture_run_before(request):
"""Ensure that fixture mutating the configuration run before the one where
the function is called.