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.
This commit is contained in:
parent
31640652c7
commit
bb03ce7281
@ -19,7 +19,6 @@
|
|||||||
import spack.tengine
|
import spack.tengine
|
||||||
import spack.util.cpus
|
import spack.util.cpus
|
||||||
import spack.util.executable
|
import spack.util.executable
|
||||||
from spack.environment import depfile
|
|
||||||
|
|
||||||
from ._common import _root_spec
|
from ._common import _root_spec
|
||||||
from .config import root_path, spec_for_current_python, store_path
|
from .config import root_path, spec_for_current_python, store_path
|
||||||
@ -86,12 +85,9 @@ def __init__(self) -> None:
|
|||||||
super().__init__(self.environment_root())
|
super().__init__(self.environment_root())
|
||||||
|
|
||||||
def update_installations(self) -> None:
|
def update_installations(self) -> None:
|
||||||
"""Update the installations of this environment.
|
"""Update the installations of this environment."""
|
||||||
|
log_enabled = tty.is_debug() or tty.is_verbose()
|
||||||
The update is done using a depfile on Linux and macOS, and using the ``install_all``
|
with tty.SuppressOutput(msg_enabled=log_enabled, warn_enabled=log_enabled):
|
||||||
method of environments on Windows.
|
|
||||||
"""
|
|
||||||
with tty.SuppressOutput(msg_enabled=False, warn_enabled=False):
|
|
||||||
specs = self.concretize()
|
specs = self.concretize()
|
||||||
if specs:
|
if specs:
|
||||||
colorized_specs = [
|
colorized_specs = [
|
||||||
@ -100,10 +96,8 @@ def update_installations(self) -> None:
|
|||||||
]
|
]
|
||||||
tty.msg(f"[BOOTSTRAPPING] Installing dependencies ({', '.join(colorized_specs)})")
|
tty.msg(f"[BOOTSTRAPPING] Installing dependencies ({', '.join(colorized_specs)})")
|
||||||
self.write(regenerate=False)
|
self.write(regenerate=False)
|
||||||
if sys.platform == "win32":
|
with tty.SuppressOutput(msg_enabled=log_enabled, warn_enabled=log_enabled):
|
||||||
self.install_all()
|
self.install_all()
|
||||||
else:
|
|
||||||
self._install_with_depfile()
|
|
||||||
self.write(regenerate=True)
|
self.write(regenerate=True)
|
||||||
|
|
||||||
def update_syspath_and_environ(self) -> None:
|
def update_syspath_and_environ(self) -> None:
|
||||||
@ -122,25 +116,6 @@ def update_syspath_and_environ(self) -> None:
|
|||||||
+ [str(x) for x in self.pythonpaths()]
|
+ [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:
|
def _write_spack_yaml_file(self) -> None:
|
||||||
tty.msg(
|
tty.msg(
|
||||||
"[BOOTSTRAPPING] Spack has missing dependencies, creating a bootstrapping environment"
|
"[BOOTSTRAPPING] Spack has missing dependencies, creating a bootstrapping environment"
|
||||||
|
@ -357,6 +357,7 @@ def _print_installed_pkg(message: str) -> None:
|
|||||||
Args:
|
Args:
|
||||||
message (str): message to be output
|
message (str): message to be output
|
||||||
"""
|
"""
|
||||||
|
if tty.msg_enabled():
|
||||||
print(colorize("@*g{[+]} ") + spack.util.path.debug_padded_filter(message))
|
print(colorize("@*g{[+]} ") + spack.util.path.debug_padded_filter(message))
|
||||||
|
|
||||||
|
|
||||||
@ -2007,7 +2008,9 @@ def install(self) -> None:
|
|||||||
|
|
||||||
# Only enable the terminal status line when we're in a tty without debug info
|
# Only enable the terminal status line when we're in a tty without debug info
|
||||||
# enabled, so that the output does not get cluttered.
|
# 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:
|
while self.build_pq:
|
||||||
task = self._pop_task()
|
task = self._pop_task()
|
||||||
|
@ -17,6 +17,8 @@ spack:
|
|||||||
root: {{ store_path }}
|
root: {{ store_path }}
|
||||||
padded_length: 0
|
padded_length: 0
|
||||||
|
|
||||||
|
install_status: false
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
python:
|
python:
|
||||||
buildable: false
|
buildable: false
|
||||||
|
Loading…
Reference in New Issue
Block a user