Fix stage creation bug, simplify do_install code.
This commit is contained in:
parent
ad103dcafa
commit
e515042a36
@ -467,6 +467,11 @@ def _make_stage(self):
|
|||||||
stage = self._make_resource_stage(composite_stage[0], fetcher, resource)
|
stage = self._make_resource_stage(composite_stage[0], fetcher, resource)
|
||||||
# Append the item to the composite
|
# Append the item to the composite
|
||||||
composite_stage.append(stage)
|
composite_stage.append(stage)
|
||||||
|
|
||||||
|
# Create stage on first access. Needed because fetch, stage,
|
||||||
|
# patch, and install can be called independently of each
|
||||||
|
# other, so `with self.stage:` in do_install isn't sufficient.
|
||||||
|
composite_stage.create()
|
||||||
return composite_stage
|
return composite_stage
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -846,12 +851,26 @@ def do_install(self,
|
|||||||
|
|
||||||
tty.msg("Installing %s" % self.name)
|
tty.msg("Installing %s" % self.name)
|
||||||
|
|
||||||
|
# First, install dependencies recursively.
|
||||||
if not ignore_deps:
|
if not ignore_deps:
|
||||||
self.do_install_dependencies(
|
self.do_install_dependencies(
|
||||||
keep_prefix=keep_prefix, keep_stage=keep_stage, ignore_deps=ignore_deps,
|
keep_prefix=keep_prefix, keep_stage=keep_stage, ignore_deps=ignore_deps,
|
||||||
fake=fake, skip_patch=skip_patch, verbose=verbose,
|
fake=fake, skip_patch=skip_patch, verbose=verbose, make_jobs=make_jobs)
|
||||||
make_jobs=make_jobs)
|
|
||||||
|
|
||||||
|
def cleanup():
|
||||||
|
"""Handles removing install prefix on error."""
|
||||||
|
if not keep_prefix:
|
||||||
|
self.remove_prefix()
|
||||||
|
else:
|
||||||
|
tty.warn("Keeping install prefix in place despite error.",
|
||||||
|
"Spack will think this package is installed. " +
|
||||||
|
"Manually remove this directory to fix:",
|
||||||
|
self.prefix, wrap=True)
|
||||||
|
|
||||||
|
# Then install the package itself.
|
||||||
|
def real_work():
|
||||||
|
"""Forked for each build. Has its own process and python
|
||||||
|
module space set up by build_environment.fork()."""
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
if not fake:
|
if not fake:
|
||||||
if not skip_patch:
|
if not skip_patch:
|
||||||
@ -864,17 +883,6 @@ def do_install(self,
|
|||||||
# package naming scheme it likes.
|
# package naming scheme it likes.
|
||||||
spack.install_layout.create_install_directory(self.spec)
|
spack.install_layout.create_install_directory(self.spec)
|
||||||
|
|
||||||
def cleanup():
|
|
||||||
if not keep_prefix:
|
|
||||||
# If anything goes wrong, remove the install prefix
|
|
||||||
self.remove_prefix()
|
|
||||||
else:
|
|
||||||
tty.warn("Keeping install prefix in place despite error.",
|
|
||||||
"Spack will think this package is installed." +
|
|
||||||
"Manually remove this directory to fix:",
|
|
||||||
self.prefix, wrap=True)
|
|
||||||
|
|
||||||
def real_work():
|
|
||||||
try:
|
try:
|
||||||
tty.msg("Building %s" % self.name)
|
tty.msg("Building %s" % self.name)
|
||||||
|
|
||||||
@ -884,9 +892,9 @@ def real_work():
|
|||||||
# the directory is created.
|
# the directory is created.
|
||||||
spack.hooks.pre_install(self)
|
spack.hooks.pre_install(self)
|
||||||
|
|
||||||
# Set up process's build environment before running install.
|
|
||||||
if fake:
|
if fake:
|
||||||
self.do_fake_install()
|
self.do_fake_install()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Do the real install in the source directory.
|
# Do the real install in the source directory.
|
||||||
self.stage.chdir_to_source()
|
self.stage.chdir_to_source()
|
||||||
@ -904,14 +912,13 @@ def real_work():
|
|||||||
# Ensure that something was actually installed.
|
# Ensure that something was actually installed.
|
||||||
self._sanity_check_install()
|
self._sanity_check_install()
|
||||||
|
|
||||||
# Move build log into install directory on success
|
# Copy provenance into the install directory on success
|
||||||
if not fake:
|
|
||||||
log_install_path = spack.install_layout.build_log_path(self.spec)
|
log_install_path = spack.install_layout.build_log_path(self.spec)
|
||||||
env_install_path = spack.install_layout.build_env_path(self.spec)
|
env_install_path = spack.install_layout.build_env_path(self.spec)
|
||||||
|
packages_dir = spack.install_layout.build_packages_path(self.spec)
|
||||||
|
|
||||||
install(log_path, log_install_path)
|
install(log_path, log_install_path)
|
||||||
install(env_path, env_install_path)
|
install(env_path, env_install_path)
|
||||||
|
|
||||||
packages_dir = spack.install_layout.build_packages_path(self.spec)
|
|
||||||
dump_packages(self.spec, packages_dir)
|
dump_packages(self.spec, packages_dir)
|
||||||
|
|
||||||
# Stop timer.
|
# Stop timer.
|
||||||
|
Loading…
Reference in New Issue
Block a user