diff options
author | Jürg Billeter <j@bitron.ch> | 2020-02-18 09:55:50 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-02-27 12:33:57 +0000 |
commit | 685ba2933c2371b56070ce7bee9b16ad478f12f9 (patch) | |
tree | ea7ccc517554ca9c367001a082751b91e55e3e4f /src | |
parent | 29feba0f8e1d902079920a306379854907aeb6f7 (diff) | |
download | buildstream-685ba2933c2371b56070ce7bee9b16ad478f12f9.tar.gz |
_casbaseddirectory.py: Add support for directory node properties
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/storage/_casbaseddirectory.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py index a39bb65b3..a42a9f87c 100644 --- a/src/buildstream/storage/_casbaseddirectory.py +++ b/src/buildstream/storage/_casbaseddirectory.py @@ -140,6 +140,7 @@ class CasBasedDirectory(Directory): self.__digest = None self.index = {} self.parent = parent + self.__node_properties = [] self._reset(digest=digest) def _reset(self, *, digest=None): @@ -156,6 +157,8 @@ class CasBasedDirectory(Directory): except FileNotFoundError as e: raise VirtualDirectoryError("Directory not found in local cache: {}".format(e)) from e + self.__node_properties = list(pb2_directory.node_properties) + for entry in pb2_directory.directories: self.index[entry.name] = IndexEntry(entry.name, _FileType.DIRECTORY, digest=entry.digest) for entry in pb2_directory.files: @@ -759,6 +762,10 @@ class CasBasedDirectory(Directory): # Create updated Directory proto pb2_directory = remote_execution_pb2.Directory() + if self.__node_properties: + node_properties = sorted(self.__node_properties, key=lambda prop: prop.name) + pb2_directory.node_properties.extend(node_properties) + for name, entry in sorted(self.index.items()): if entry.type == _FileType.DIRECTORY: dirnode = pb2_directory.directories.add() |