summaryrefslogtreecommitdiff
path: root/buildstream/_context.py
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream/_context.py')
-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.