From dfc5cf288c1017ef62390489cb534848aef5a9a6 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 29 Mar 2016 04:35:41 -0700 Subject: Fix bug in restage - Restage previously only removed the source directory from the stage. - Now removes any other directories in stage as well. --- lib/spack/spack/fetch_strategy.py | 10 ++++++++-- 1 file 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): -- cgit v1.2.3-70-g09d2