summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-02-27 10:22:50 +0100
committerJürg Billeter <j@bitron.ch>2019-02-28 05:14:47 +0100
commit05e26f5822c69dd060edae5728251f043c3bee04 (patch)
tree717f5d7e58624ce9135a8658117d65a9261fd807
parent115b2db3b633cb22fabaea0d15415c5e004130df (diff)
downloadbuildstream-juerg/virtual-artifact-directory.tar.gz
_context.py: Cleanup old extract directoriesjuerg/virtual-artifact-directory
Extract directories are no longer used or created. This deletes extract directories from older versions of BuildStream on startup.
-rw-r--r--buildstream/_context.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/buildstream/_context.py b/buildstream/_context.py
index 7e8a22998..8a9f485be 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -18,6 +18,7 @@
# Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
import os
+import shutil
import datetime
from collections import deque
from collections.abc import Mapping
@@ -226,6 +227,13 @@ class Context():
os.rename(old_casdir, self.casdir)
os.symlink(self.casdir, old_casdir)
+ # Cleanup old extract directories
+ old_extractdirs = [os.path.join(self.cachedir, 'artifacts', 'extract'),
+ os.path.join(self.cachedir, 'extract')]
+ for old_extractdir in old_extractdirs:
+ if os.path.isdir(old_extractdir):
+ shutil.rmtree(old_extractdir, ignore_errors=True)
+
# Load quota configuration
# We need to find the first existing directory in the path of our
# cachedir - the cachedir may not have been created yet.