summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2019-03-28 12:59:40 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-05-15 10:18:26 +0000
commit1d3f336641c08f1b047ac5d20c3577b94fc57a18 (patch)
tree98dc867f3c4192ec4918d22138c775254d30b762
parent2f4023f3555f588aa8fc70494b08bf95b3db6463 (diff)
downloadbuildstream-1d3f336641c08f1b047ac5d20c3577b94fc57a18.tar.gz
Add artifact directory
This will be used to store artifact protos. Part of #974
-rw-r--r--buildstream/_artifactcache.py6
-rw-r--r--buildstream/_context.py4
2 files changed, 10 insertions, 0 deletions
diff --git a/buildstream/_artifactcache.py b/buildstream/_artifactcache.py
index 5b0ccacc4..eae1a9311 100644
--- a/buildstream/_artifactcache.py
+++ b/buildstream/_artifactcache.py
@@ -17,6 +17,8 @@
# Authors:
# Tristan Maat <tristan.maat@codethink.co.uk>
+import os
+
from ._basecache import BaseCache
from .types import _KeyStrength
from ._exceptions import ArtifactError, CASCacheError, CASError
@@ -55,6 +57,10 @@ class ArtifactCache(BaseCache):
self._required_elements = set() # The elements required for this session
+ # create artifact directory
+ self.artifactdir = context.artifactdir
+ os.makedirs(self.artifactdir, exist_ok=True)
+
self.casquota.add_ref_callbacks(self.required_artifacts)
self.casquota.add_remove_callbacks((lambda x: not x.startswith('@'), self.remove))
diff --git a/buildstream/_context.py b/buildstream/_context.py
index fffeea17e..93e3f62b5 100644
--- a/buildstream/_context.py
+++ b/buildstream/_context.py
@@ -75,6 +75,9 @@ class Context():
# The directory for CAS
self.casdir = None
+ # The directory for artifact protos
+ self.artifactdir = None
+
# The directory for temporary files
self.tmpdir = None
@@ -230,6 +233,7 @@ class Context():
self.tmpdir = os.path.join(self.cachedir, 'tmp')
self.casdir = os.path.join(self.cachedir, 'cas')
self.builddir = os.path.join(self.cachedir, 'build')
+ self.artifactdir = os.path.join(self.cachedir, 'artifacts')
# Move old artifact cas to cas if it exists and create symlink
old_casdir = os.path.join(self.cachedir, 'artifacts', 'cas')