diff options
author | Jürg Billeter <j@bitron.ch> | 2020-03-03 18:07:34 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-03-10 15:46:04 +0000 |
commit | 77138b8a5ec78c701c7d93de1bd74e58ed023467 (patch) | |
tree | 9628c759005dc8c50c30505cbe6e401c23adff83 /src | |
parent | 49877ff6bd1fb9ae3a18b50357e0645d70d62c7e (diff) | |
download | buildstream-77138b8a5ec78c701c7d93de1bd74e58ed023467.tar.gz |
_casbaseddirectory.py: Tweak _add_file() parameters
Separate `name` from `path` to allow adding temporary files.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildstream/storage/_casbaseddirectory.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py index 51d9909fd..d700a25a6 100644 --- a/src/buildstream/storage/_casbaseddirectory.py +++ b/src/buildstream/storage/_casbaseddirectory.py @@ -191,8 +191,7 @@ class CasBasedDirectory(Directory): return newdir - def _add_file(self, basename, filename, modified=False, can_link=False, properties=None): - path = os.path.join(basename, filename) + def _add_file(self, name, path, modified=False, can_link=False, properties=None): digest = self.cas_cache.add_object(path=path, link_directly=can_link) is_executable = os.access(path, os.X_OK) node_properties = [] @@ -205,14 +204,14 @@ class CasBasedDirectory(Directory): node_properties.append(node_property) entry = IndexEntry( - filename, + name, _FileType.REGULAR_FILE, digest=digest, is_executable=is_executable, - modified=modified or filename in self.index, + modified=modified or name in self.index, node_properties=node_properties, ) - self.index[filename] = entry + self.index[name] = entry self.__invalidate_digest() @@ -517,8 +516,8 @@ class CasBasedDirectory(Directory): result = FileListResult() if self._check_replacement(os.path.basename(external_pathspec), os.path.dirname(external_pathspec), result): self._add_file( - os.path.dirname(external_pathspec), os.path.basename(external_pathspec), + external_pathspec, modified=os.path.basename(external_pathspec) in result.overwritten, properties=properties, ) |