diff options
author | bst-marge-bot <marge-bot@buildstream.build> | 2019-06-12 16:46:15 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-06-12 16:46:15 +0000 |
commit | 147190b6dc5094cdc550e1250c5bda027796b0d9 (patch) | |
tree | a37b8716aabf2a14c01a7ee6066366c6db911f81 | |
parent | 16a7683365404e93ffc11c87f8d80e9f1651ccb8 (diff) | |
parent | dcdcb0d7f83e1ab68db420e4286452cd513871cf (diff) | |
download | buildstream-147190b6dc5094cdc550e1250c5bda027796b0d9.tar.gz |
Merge branch 'juerg/cas-dead-code' into 'master'
cascache.py: Remove unused methods commit() and _commit_directory()
See merge request BuildStream/buildstream!1395
-rw-r--r-- | src/buildstream/_cas/cascache.py | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index ad8013d18..58527d4cb 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -186,20 +186,6 @@ class CASCache(): fullpath = os.path.join(dest, symlinknode.name) os.symlink(symlinknode.target, fullpath) - # commit(): - # - # Commit directory to cache. - # - # Args: - # refs (list): The refs to set - # path (str): The directory to import - # - def commit(self, refs, path): - tree = self._commit_directory(path) - - for ref in refs: - self.set_ref(ref, tree) - # diff(): # # Return a list of files that have been added or modified between @@ -785,48 +771,6 @@ class CASCache(): # Something went wrong here raise CASCacheError("System error while removing ref '{}': {}".format(ref, e)) from e - # _commit_directory(): - # - # Adds local directory to content addressable store. - # - # Adds files, symbolic links and recursively other directories in - # a local directory to the content addressable store. - # - # Args: - # path (str): Path to the directory to add. - # dir_digest (Digest): An optional Digest object to use. - # - # Returns: - # (Digest): Digest object for the directory added. - # - def _commit_directory(self, path, *, dir_digest=None): - directory = remote_execution_pb2.Directory() - - for name in sorted(os.listdir(path)): - full_path = os.path.join(path, name) - mode = os.lstat(full_path).st_mode - if stat.S_ISDIR(mode): - dirnode = directory.directories.add() - dirnode.name = name - self._commit_directory(full_path, dir_digest=dirnode.digest) - elif stat.S_ISREG(mode): - filenode = directory.files.add() - filenode.name = name - self.add_object(path=full_path, digest=filenode.digest) - filenode.is_executable = (mode & stat.S_IXUSR) == stat.S_IXUSR - elif stat.S_ISLNK(mode): - symlinknode = directory.symlinks.add() - symlinknode.name = name - symlinknode.target = os.readlink(full_path) - elif stat.S_ISSOCK(mode): - # The process serving the socket can't be cached anyway - pass - else: - raise CASCacheError("Unsupported file type for {}".format(full_path)) - - return self.add_object(digest=dir_digest, - buffer=directory.SerializeToString()) - def _get_subdir(self, tree, subdir): head, name = os.path.split(subdir) if head: |