You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:12:25 UTC

[buildstream] 01/13: Add artifact directory

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tpollard/prototemp
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c65ba16fb630b1f184b49aa1d720865133c7fef6
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 7a6f2ea..215fb51 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')