Fix bugs that crept into spack clean when stage was refactored.

This commit is contained in:
Todd Gamblin 2014-02-07 09:28:50 -08:00
parent 19df908cb6
commit 42610be2e5
4 changed files with 9 additions and 10 deletions

View file

@ -48,8 +48,7 @@ def clean(parser, args):
specs = spack.cmd.parse_specs(args.packages, concretize=True)
for spec in specs:
tty.msg("Cleaning for spec:", spec)
package = packages.get(spec.name)
package = packages.get(spec)
if args.dist:
package.do_clean_dist()
elif args.work:

View file

@ -386,6 +386,8 @@ def version(self):
@property
def stage(self):
if not self.spec.concrete:
print self.spec
print self.spec.concrete
raise ValueError("Can only get a stage for a concrete package.")
if self._stage is None:
@ -564,8 +566,6 @@ def do_fetch(self):
"""Creates a stage directory and downloads the taball for this package.
Working directory will be set to the stage directory.
"""
self.stage.setup()
if spack.do_checksum and not self.version in self.versions:
tty.die("Cannot fetch %s@%s safely; there is no checksum on file for this "
"version." % (self.name, self.version),

View file

@ -42,8 +42,8 @@ class Stage(object):
expanded, and built before being installed. It also handles downloading
the archive. A stage's lifecycle looks like this:
setup()
Create the stage directory.
Stage()
Constructor creates the stage directory.
fetch()
Fetch a source archive into the stage.
expand_archive()
@ -80,7 +80,9 @@ def __init__(self, url, **kwargs):
self.tmp_root = find_tmp_root()
self.url = url
self.path = None # This will be set after setup is called.
self.path = None
self._setup()
def _cleanup_dead_links(self):
@ -131,7 +133,7 @@ def _need_to_create_path(self):
return False
def setup(self):
def _setup(self):
"""Creates the stage directory.
If spack.use_tmp_stage is False, the stage directory is created
directly under spack.stage_path.
@ -206,7 +208,6 @@ def expanded_archive_path(self):
def chdir(self):
"""Changes directory to the stage path. Or dies if it is not set up."""
self.setup()
if os.path.isdir(self.path):
os.chdir(self.path)
else:

View file

@ -190,7 +190,6 @@ def check_destroy(self, stage, stage_name):
def checkSetupAndDestroy(self, stage_name=None):
stage = Stage(archive_url, name=stage_name)
stage.setup()
self.check_setup(stage, stage_name)
stage.destroy()