You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:45:42 UTC
[buildstream] 04/13: Add artifact directory
This is an automated email from the ASF dual-hosted git repository.
not-in-ldap pushed a commit to branch tpollard/artifacttemp
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 7d4c2d4e85b00d783b63c488572d3e9f11c10082
Author: Raoul Hidalgo Charman <ra...@codethink.co.uk>
AuthorDate: Thu Mar 28 12:59:40 2019 +0000
Add artifact directory
This will be used to store artifact protos.
Part of #974
---
buildstream/_artifactcache.py | 6 ++++++
buildstream/_context.py | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/buildstream/_artifactcache.py b/buildstream/_artifactcache.py
index 5b0ccac..eae1a93 100644
--- a/buildstream/_artifactcache.py
+++ b/buildstream/_artifactcache.py
@@ -17,6 +17,8 @@
# Authors:
# Tristan Maat <tr...@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 fffeea1..93e3f62 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')