bootstrap: lazy bootstrapping of clingo and GnuPG (#44026)

Currently bootstrapping from source fails because clingo requires gnupg
requires clingo.

This commit stops eager bootstrapping. We don't need `patchelf` nor `gnupg`
generally. They're bootstrapped when needed.
This commit is contained in:
Harmen Stoppels 2024-05-06 14:02:39 +02:00 committed by GitHub
parent 1f31c3374c
commit dc71dcfdc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 4 deletions

View file

@ -5,7 +5,13 @@
"""Function and classes needed to bootstrap Spack itself.""" """Function and classes needed to bootstrap Spack itself."""
from .config import ensure_bootstrap_configuration, is_bootstrapping, store_path from .config import ensure_bootstrap_configuration, is_bootstrapping, store_path
from .core import all_core_root_specs, ensure_core_dependencies, ensure_patchelf_in_path_or_raise from .core import (
all_core_root_specs,
ensure_clingo_importable_or_raise,
ensure_core_dependencies,
ensure_gpg_in_path_or_raise,
ensure_patchelf_in_path_or_raise,
)
from .environment import BootstrapEnvironment, ensure_environment_dependencies from .environment import BootstrapEnvironment, ensure_environment_dependencies
from .status import status_message from .status import status_message
@ -13,6 +19,8 @@
"is_bootstrapping", "is_bootstrapping",
"ensure_bootstrap_configuration", "ensure_bootstrap_configuration",
"ensure_core_dependencies", "ensure_core_dependencies",
"ensure_gpg_in_path_or_raise",
"ensure_clingo_importable_or_raise",
"ensure_patchelf_in_path_or_raise", "ensure_patchelf_in_path_or_raise",
"all_core_root_specs", "all_core_root_specs",
"ensure_environment_dependencies", "ensure_environment_dependencies",

View file

@ -1415,7 +1415,7 @@ def _concretize_separately(self, tests=False):
# Ensure we don't try to bootstrap clingo in parallel # Ensure we don't try to bootstrap clingo in parallel
if spack.config.get("config:concretizer", "clingo") == "clingo": if spack.config.get("config:concretizer", "clingo") == "clingo":
with spack.bootstrap.ensure_bootstrap_configuration(): with spack.bootstrap.ensure_bootstrap_configuration():
spack.bootstrap.ensure_core_dependencies() spack.bootstrap.ensure_clingo_importable_or_raise()
# Ensure all the indexes have been built or updated, since # Ensure all the indexes have been built or updated, since
# otherwise the processes in the pool may timeout on waiting # otherwise the processes in the pool may timeout on waiting

View file

@ -195,7 +195,7 @@ def _bootstrap_clingo() -> ModuleType:
import spack.bootstrap import spack.bootstrap
with spack.bootstrap.ensure_bootstrap_configuration(): with spack.bootstrap.ensure_bootstrap_configuration():
spack.bootstrap.ensure_core_dependencies() spack.bootstrap.ensure_clingo_importable_or_raise()
clingo_mod = importlib.import_module("clingo") clingo_mod = importlib.import_module("clingo")
return clingo_mod return clingo_mod

View file

@ -60,7 +60,7 @@ def init(gnupghome=None, force=False):
# Set the executable objects for "gpg" and "gpgconf" # Set the executable objects for "gpg" and "gpgconf"
with spack.bootstrap.ensure_bootstrap_configuration(): with spack.bootstrap.ensure_bootstrap_configuration():
spack.bootstrap.ensure_core_dependencies() spack.bootstrap.ensure_gpg_in_path_or_raise()
GPG, GPGCONF = _gpg(), _gpgconf() GPG, GPGCONF = _gpg(), _gpgconf()
GPG.add_default_env("GNUPGHOME", GNUPGHOME) GPG.add_default_env("GNUPGHOME", GNUPGHOME)