From bb03ce7281e4cd058dd855bac6ea465b83fe8f2e Mon Sep 17 00:00:00 2001 From: Jordan Galby <67924449+Jordan474@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:09:49 +0100 Subject: Do not use depfile in bootstrap (#41458) - we don't have a fallback if make is not installed - we assume file system locking works - we don't verify that make is gnu make (bootstrapping fails on FreeBSD as a result) - there are some weird race conditions in writing spack.yaml on concurrent spack install - the view is updated after every package install instead of post environment install. --- lib/spack/spack/bootstrap/environment.py | 35 +++++--------------------------- lib/spack/spack/installer.py | 7 +++++-- 2 files changed, 10 insertions(+), 32 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/bootstrap/environment.py b/lib/spack/spack/bootstrap/environment.py index 71d54a8ad1..6a508109fc 100644 --- a/lib/spack/spack/bootstrap/environment.py +++ b/lib/spack/spack/bootstrap/environment.py @@ -19,7 +19,6 @@ import spack.environment import spack.tengine import spack.util.cpus import spack.util.executable -from spack.environment import depfile from ._common import _root_spec from .config import root_path, spec_for_current_python, store_path @@ -86,12 +85,9 @@ class BootstrapEnvironment(spack.environment.Environment): super().__init__(self.environment_root()) def update_installations(self) -> None: - """Update the installations of this environment. - - The update is done using a depfile on Linux and macOS, and using the ``install_all`` - method of environments on Windows. - """ - with tty.SuppressOutput(msg_enabled=False, warn_enabled=False): + """Update the installations of this environment.""" + log_enabled = tty.is_debug() or tty.is_verbose() + with tty.SuppressOutput(msg_enabled=log_enabled, warn_enabled=log_enabled): specs = self.concretize() if specs: colorized_specs = [ @@ -100,11 +96,9 @@ class BootstrapEnvironment(spack.environment.Environment): ] tty.msg(f"[BOOTSTRAPPING] Installing dependencies ({', '.join(colorized_specs)})") self.write(regenerate=False) - if sys.platform == "win32": + with tty.SuppressOutput(msg_enabled=log_enabled, warn_enabled=log_enabled): self.install_all() - else: - self._install_with_depfile() - self.write(regenerate=True) + self.write(regenerate=True) def update_syspath_and_environ(self) -> None: """Update ``sys.path`` and the PATH, PYTHONPATH environment variables to point to @@ -122,25 +116,6 @@ class BootstrapEnvironment(spack.environment.Environment): + [str(x) for x in self.pythonpaths()] ) - def _install_with_depfile(self) -> None: - model = depfile.MakefileModel.from_env(self) - template = spack.tengine.make_environment().get_template( - os.path.join("depfile", "Makefile") - ) - makefile = self.environment_root() / "Makefile" - makefile.write_text(template.render(model.to_dict())) - make = spack.util.executable.which("make") - kwargs = {} - if not tty.is_debug(): - kwargs = {"output": os.devnull, "error": os.devnull} - make( - "-C", - str(self.environment_root()), - "-j", - str(spack.util.cpus.determine_number_of_jobs(parallel=True)), - **kwargs, - ) - def _write_spack_yaml_file(self) -> None: tty.msg( "[BOOTSTRAPPING] Spack has missing dependencies, creating a bootstrapping environment" diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index 51f7034176..ef0f1f3b8b 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -357,7 +357,8 @@ def _print_installed_pkg(message: str) -> None: Args: message (str): message to be output """ - print(colorize("@*g{[+]} ") + spack.util.path.debug_padded_filter(message)) + if tty.msg_enabled(): + print(colorize("@*g{[+]} ") + spack.util.path.debug_padded_filter(message)) def print_install_test_log(pkg: "spack.package_base.PackageBase") -> None: @@ -2007,7 +2008,9 @@ class PackageInstaller: # Only enable the terminal status line when we're in a tty without debug info # enabled, so that the output does not get cluttered. - term_status = TermStatusLine(enabled=sys.stdout.isatty() and not tty.is_debug()) + term_status = TermStatusLine( + enabled=sys.stdout.isatty() and tty.msg_enabled() and not tty.is_debug() + ) while self.build_pq: task = self._pop_task() -- cgit v1.2.3-60-g2f50