`Package.stage` no longer implicitly makes stage directory

- Be explicit about stage creation during the install process.

- This avoids accidental creation of stages
  - e.g., during `spack install --fake`, stages were erroneously recreated
    after being destroyed
This commit is contained in:
Todd Gamblin 2017-10-15 23:57:01 -07:00
parent 894a1a73a4
commit 44bebd7a8f

View File

@ -771,16 +771,16 @@ def _make_stage(self):
@property
def stage(self):
"""Get the build staging area for this package.
This automatically instantiates a ``Stage`` object if the package
doesn't have one yet, but it does not create the Stage directory
on the filesystem.
"""
if not self.spec.concrete:
raise ValueError("Can only get a stage for a concrete package.")
if self._stage is None:
self._stage = self._make_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.
self._stage.create()
return self._stage
@stage.setter
@ -974,8 +974,8 @@ def do_fetch(self, mirror_only=False):
raise FetchError("Will not fetch %s" %
self.spec.format('$_$@'), ck_msg)
self.stage.create()
self.stage.fetch(mirror_only)
self._fetch_time = time.time() - start_time
if spack.do_checksum and self.version in self.versions:
@ -988,7 +988,7 @@ def do_stage(self, mirror_only=False):
if not self.spec.concrete:
raise ValueError("Can only stage concrete packages.")
self.do_fetch(mirror_only)
self.do_fetch(mirror_only) # this will create the stage
self.stage.expand_archive()
if not os.listdir(self.stage.path):
@ -1033,7 +1033,7 @@ def do_patch(self):
if not self.spec.concrete:
raise ValueError("Can only patch concrete packages.")
# Kick off the stage first.
# Kick off the stage first. This creates the stage.
self.do_stage()
# Package can add its own patch function.