You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:05:21 UTC
[buildstream] 04/26: cascache: Add properties to CaptureTree
requests
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch traveltissues/mr4
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 4f7a3105658e5842aca28a9048a7a39a97eb14f0
Author: Darius Makovsky <tr...@protonmail.com>
AuthorDate: Mon Dec 2 11:59:40 2019 +0000
cascache: Add properties to CaptureTree requests
---
src/buildstream/_cas/cascache.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index 9c0b46d..519de6e 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -26,6 +26,7 @@ import ctypes
import multiprocessing
import signal
import time
+from typing import Optional, List
import grpc
@@ -34,7 +35,7 @@ from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
from .._protos.build.buildgrid import local_cas_pb2
from .. import _signals, utils
-from ..types import FastEnum
+from ..types import FastEnum, SourceRef
from .._exceptions import CASCacheError
from .casdprocessmanager import CASDProcessManager
@@ -339,15 +340,21 @@ class CASCache:
#
# Args:
# path (str): Path to directory to import
+ # properties Optional[List[str]]: List of properties to request
#
# Returns:
# (Digest): The digest of the imported directory
#
- def import_directory(self, path):
+ def import_directory(self, path: str, properties: Optional[List[str]] = None) -> SourceRef:
local_cas = self.get_local_cas()
request = local_cas_pb2.CaptureTreeRequest()
request.path.append(path)
+
+ if properties:
+ for _property in properties:
+ request.node_properties.append(_property)
+
response = local_cas.CaptureTree(request)
if len(response.responses) != 1: