From c882214273793c52f2865e068aa0499c610a2f37 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Mon, 14 Aug 2023 12:29:15 +0200 Subject: spack bootstrap dev: detect git as an external (#39417) #36770 added git as a dependency to `setuptools-scm`. This in turn makes `git` a transitive dependency for our bootstrapping process. Since `git` may take a long time to build, and is found on most systems, try to detect it as an external. --- lib/spack/spack/bootstrap/core.py | 11 +++++++++-- lib/spack/spack/bootstrap/environment.py | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/bootstrap/core.py b/lib/spack/spack/bootstrap/core.py index 8f19bc590e..2dc56504a0 100644 --- a/lib/spack/spack/bootstrap/core.py +++ b/lib/spack/spack/bootstrap/core.py @@ -480,11 +480,18 @@ def _add_externals_if_missing() -> None: spack.repo.PATH.get_pkg_class("bison"), # GnuPG spack.repo.PATH.get_pkg_class("gawk"), + # develop deps + spack.repo.PATH.get_pkg_class("git"), ] if IS_WINDOWS: search_list.append(spack.repo.PATH.get_pkg_class("winbison")) - detected_packages = spack.detection.by_executable(search_list) - spack.detection.update_configuration(detected_packages, scope="bootstrap") + externals = spack.detection.by_executable(search_list) + # System git is typically deprecated, so mark as non-buildable to force it as external + non_buildable_externals = {k: externals.pop(k) for k in ("git",) if k in externals} + spack.detection.update_configuration(externals, scope="bootstrap", buildable=True) + spack.detection.update_configuration( + non_buildable_externals, scope="bootstrap", buildable=False + ) def clingo_root_spec() -> str: diff --git a/lib/spack/spack/bootstrap/environment.py b/lib/spack/spack/bootstrap/environment.py index 158b7ecae3..a2086160f6 100644 --- a/lib/spack/spack/bootstrap/environment.py +++ b/lib/spack/spack/bootstrap/environment.py @@ -23,6 +23,7 @@ from spack.environment import depfile from ._common import _root_spec from .config import root_path, spec_for_current_python, store_path +from .core import _add_externals_if_missing class BootstrapEnvironment(spack.environment.Environment): @@ -185,6 +186,7 @@ def pytest_root_spec() -> str: def ensure_environment_dependencies() -> None: """Ensure Spack dependencies from the bootstrap environment are installed and ready to use""" + _add_externals_if_missing() with BootstrapEnvironment() as env: env.update_installations() env.update_syspath_and_environ() -- cgit v1.2.3-60-g2f50