summaryrefslogtreecommitdiff
path: root/buildstream
diff options
context:
space:
mode:
Diffstat (limited to 'buildstream')
-rw-r--r--buildstream/_artifactcache/artifactcache.py4
-rw-r--r--buildstream/_context.py7
2 files changed, 9 insertions, 2 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py
index 2121a432d..a156dc3bc 100644
--- a/buildstream/_artifactcache/artifactcache.py
+++ b/buildstream/_artifactcache/artifactcache.py
@@ -30,7 +30,7 @@ from .. import _signals
from .. import utils
from .. import _yaml
-from .cascache import CASCache, CASRemote, CASRemoteSpec
+from .cascache import CASRemote, CASRemoteSpec
CACHE_SIZE_FILE = "cache_size"
@@ -58,7 +58,7 @@ class ArtifactCache():
self.context = context
self.extractdir = os.path.join(context.artifactdir, 'extract')
- self.cas = CASCache(context.artifactdir)
+ self.cas = context.get_cascache()
self.global_remote_specs = []
self.project_remote_specs = {}
diff --git a/buildstream/_context.py b/buildstream/_context.py
index e8342d101..7ca60e7aa 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -31,6 +31,7 @@ from ._exceptions import LoadError, LoadErrorReason, BstError
from ._message import Message, MessageType
from ._profile import Topics, profile_start, profile_end
from ._artifactcache import ArtifactCache
+from ._artifactcache.cascache import CASCache
from ._workspaces import Workspaces
from .plugin import _plugin_lookup
@@ -141,6 +142,7 @@ class Context():
self._workspaces = None
self._log_handle = None
self._log_filename = None
+ self._cascache = None
# load()
#
@@ -620,6 +622,11 @@ class Context():
if not os.environ.get('XDG_DATA_HOME'):
os.environ['XDG_DATA_HOME'] = os.path.expanduser('~/.local/share')
+ def get_cascache(self):
+ if self._cascache is None:
+ self._cascache = CASCache(self.artifactdir)
+ return self._cascache
+
# _node_get_option_str()
#