Fix bug in staging.

- Stage needs to account for symlinks in self.tmp_dir
- Use os.realpath on self.tmp_dir when checking to see if a stage needs to be rebuilt
This commit is contained in:
Todd Gamblin 2014-01-26 02:15:31 -08:00
parent 03a32f0d5b
commit 6d956f372f

View File

@ -110,11 +110,12 @@ def _need_to_create_path(self):
# Path looks ok, but need to check the target of the link.
if os.path.islink(self.path):
real_path = os.path.realpath(self.path)
real_tmp = os.path.realpath(self.tmp_root)
if spack.use_tmp_stage:
# If we're using a tmp dir, it's a link, and it points at the right spot,
# then keep it.
if (os.path.commonprefix((real_path, self.tmp_root)) == self.tmp_root
if (os.path.commonprefix((real_path, real_tmp)) == real_tmp
and os.path.exists(real_path)):
return False
else:
@ -266,7 +267,6 @@ def expand_archive(self):
downloaded.
"""
self.chdir()
if not self.archive_file:
tty.die("Attempt to expand archive before fetching.")