summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-03-29 04:35:41 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-03-29 04:35:41 -0700
commitdfc5cf288c1017ef62390489cb534848aef5a9a6 (patch)
treebd3675ae57776cc63dea1be12c2502a4764962f0 /lib
parentb0b882cbb3d903a85413acb0439a02d6ac9e26fc (diff)
downloadspack-dfc5cf288c1017ef62390489cb534848aef5a9a6.tar.gz
spack-dfc5cf288c1017ef62390489cb534848aef5a9a6.tar.bz2
spack-dfc5cf288c1017ef62390489cb534848aef5a9a6.tar.xz
spack-dfc5cf288c1017ef62390489cb534848aef5a9a6.zip
Fix bug in restage
- Restage previously only removed the source directory from the stage. - Now removes any other directories in stage as well.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/fetch_strategy.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 0d0a7db8a9..4ea87bea7e 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -289,8 +289,14 @@ class URLFetchStrategy(FetchStrategy):
if not self.archive_file:
raise NoArchiveFileError("Tried to reset URLFetchStrategy before fetching",
"Failed on reset() for URL %s" % self.url)
- if self.stage.source_path:
- shutil.rmtree(self.stage.source_path, ignore_errors=True)
+
+ # Remove everythigng but the archive from the stage
+ for filename in os.listdir(self.stage.path):
+ abspath = os.path.join(self.stage.path, filename)
+ if abspath != self.archive_file:
+ shutil.rmtree(abspath, ignore_errors=True)
+
+ # Expand the archive again
self.expand()
def __repr__(self):