Fix bugs that crept into spack clean when stage was refactored.
This commit is contained in:
parent
19df908cb6
commit
42610be2e5
@ -48,8 +48,7 @@ def clean(parser, args):
|
|||||||
|
|
||||||
specs = spack.cmd.parse_specs(args.packages, concretize=True)
|
specs = spack.cmd.parse_specs(args.packages, concretize=True)
|
||||||
for spec in specs:
|
for spec in specs:
|
||||||
tty.msg("Cleaning for spec:", spec)
|
package = packages.get(spec)
|
||||||
package = packages.get(spec.name)
|
|
||||||
if args.dist:
|
if args.dist:
|
||||||
package.do_clean_dist()
|
package.do_clean_dist()
|
||||||
elif args.work:
|
elif args.work:
|
||||||
|
@ -386,6 +386,8 @@ def version(self):
|
|||||||
@property
|
@property
|
||||||
def stage(self):
|
def stage(self):
|
||||||
if not self.spec.concrete:
|
if not self.spec.concrete:
|
||||||
|
print self.spec
|
||||||
|
print self.spec.concrete
|
||||||
raise ValueError("Can only get a stage for a concrete package.")
|
raise ValueError("Can only get a stage for a concrete package.")
|
||||||
|
|
||||||
if self._stage is None:
|
if self._stage is None:
|
||||||
@ -564,8 +566,6 @@ def do_fetch(self):
|
|||||||
"""Creates a stage directory and downloads the taball for this package.
|
"""Creates a stage directory and downloads the taball for this package.
|
||||||
Working directory will be set to the stage directory.
|
Working directory will be set to the stage directory.
|
||||||
"""
|
"""
|
||||||
self.stage.setup()
|
|
||||||
|
|
||||||
if spack.do_checksum and not self.version in self.versions:
|
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 "
|
tty.die("Cannot fetch %s@%s safely; there is no checksum on file for this "
|
||||||
"version." % (self.name, self.version),
|
"version." % (self.name, self.version),
|
||||||
|
@ -42,8 +42,8 @@ class Stage(object):
|
|||||||
expanded, and built before being installed. It also handles downloading
|
expanded, and built before being installed. It also handles downloading
|
||||||
the archive. A stage's lifecycle looks like this:
|
the archive. A stage's lifecycle looks like this:
|
||||||
|
|
||||||
setup()
|
Stage()
|
||||||
Create the stage directory.
|
Constructor creates the stage directory.
|
||||||
fetch()
|
fetch()
|
||||||
Fetch a source archive into the stage.
|
Fetch a source archive into the stage.
|
||||||
expand_archive()
|
expand_archive()
|
||||||
@ -80,7 +80,9 @@ def __init__(self, url, **kwargs):
|
|||||||
|
|
||||||
self.tmp_root = find_tmp_root()
|
self.tmp_root = find_tmp_root()
|
||||||
self.url = url
|
self.url = url
|
||||||
self.path = None # This will be set after setup is called.
|
|
||||||
|
self.path = None
|
||||||
|
self._setup()
|
||||||
|
|
||||||
|
|
||||||
def _cleanup_dead_links(self):
|
def _cleanup_dead_links(self):
|
||||||
@ -131,7 +133,7 @@ def _need_to_create_path(self):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def setup(self):
|
def _setup(self):
|
||||||
"""Creates the stage directory.
|
"""Creates the stage directory.
|
||||||
If spack.use_tmp_stage is False, the stage directory is created
|
If spack.use_tmp_stage is False, the stage directory is created
|
||||||
directly under spack.stage_path.
|
directly under spack.stage_path.
|
||||||
@ -206,7 +208,6 @@ def expanded_archive_path(self):
|
|||||||
|
|
||||||
def chdir(self):
|
def chdir(self):
|
||||||
"""Changes directory to the stage path. Or dies if it is not set up."""
|
"""Changes directory to the stage path. Or dies if it is not set up."""
|
||||||
self.setup()
|
|
||||||
if os.path.isdir(self.path):
|
if os.path.isdir(self.path):
|
||||||
os.chdir(self.path)
|
os.chdir(self.path)
|
||||||
else:
|
else:
|
||||||
|
@ -190,7 +190,6 @@ def check_destroy(self, stage, stage_name):
|
|||||||
|
|
||||||
def checkSetupAndDestroy(self, stage_name=None):
|
def checkSetupAndDestroy(self, stage_name=None):
|
||||||
stage = Stage(archive_url, name=stage_name)
|
stage = Stage(archive_url, name=stage_name)
|
||||||
stage.setup()
|
|
||||||
self.check_setup(stage, stage_name)
|
self.check_setup(stage, stage_name)
|
||||||
|
|
||||||
stage.destroy()
|
stage.destroy()
|
||||||
|
Loading…
Reference in New Issue
Block a user