diff options
author | Jürg Billeter <j@bitron.ch> | 2019-02-27 10:22:50 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-02-28 12:12:38 +0100 |
commit | 3b54b647c18c3e64f385698dd2529342abeeb19f (patch) | |
tree | daeafaa12194d10f91e928923caf0a6cbe3e3d17 /buildstream | |
parent | 6740b17ba1b9dc1081207a7008b0b0c9fe6f7f4d (diff) | |
download | buildstream-3b54b647c18c3e64f385698dd2529342abeeb19f.tar.gz |
_context.py: Cleanup old extract directories
Extract directories are no longer used or created. This deletes extract
directories from older versions of BuildStream on startup.
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_context.py | 8 |
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. |