summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-02-27 14:39:19 +0100
committerJürg Billeter <j@bitron.ch>2019-03-06 10:31:06 +0100
commite989f4a809a753529303cc0f5ff7e652fda37573 (patch)
tree13c61d031069108de3c915699304b431a865990c
parent9db874cd2d615cd51557dbd2ac2c39269d681a99 (diff)
downloadbuildstream-e989f4a809a753529303cc0f5ff7e652fda37573.tar.gz
_casbaseddirectory.py: Don't set relative_pathname in _check_replacement
We already have relative_pathname in the caller. Reuse that instead of calling os.path.join().
-rw-r--r--buildstream/storage/_casbaseddirectory.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py
index d88b58a1c..9d1c8ab63 100644
--- a/buildstream/storage/_casbaseddirectory.py
+++ b/buildstream/storage/_casbaseddirectory.py
@@ -223,14 +223,13 @@ class CasBasedDirectory(Directory):
return current_dir
- def _check_replacement(self, name, path_prefix, fileListResult):
+ def _check_replacement(self, name, relative_pathname, fileListResult):
""" Checks whether 'name' exists, and if so, whether we can overwrite it.
If we can, add the name to 'overwritten_files' and delete the existing entry.
Returns 'True' if the import should go ahead.
fileListResult.overwritten and fileListResult.ignore are updated depending
on the result. """
existing_entry = self.index.get(name)
- relative_pathname = os.path.join(path_prefix, name)
if existing_entry is None:
return True
elif existing_entry.type == _FileType.DIRECTORY:
@@ -282,11 +281,11 @@ class CasBasedDirectory(Directory):
continue
if direntry.is_file(follow_symlinks=False):
- if self._check_replacement(direntry.name, path_prefix, result):
+ if self._check_replacement(direntry.name, relative_pathname, result):
self._add_file(source_directory, direntry.name, modified=relative_pathname in result.overwritten)
result.files_written.append(relative_pathname)
elif direntry.is_symlink():
- if self._check_replacement(direntry.name, path_prefix, result):
+ if self._check_replacement(direntry.name, relative_pathname, result):
self._copy_link_from_filesystem(source_directory, direntry.name)
result.files_written.append(relative_pathname)
@@ -347,7 +346,7 @@ class CasBasedDirectory(Directory):
continue
if not is_dir:
- if self._check_replacement(name, path_prefix, result):
+ if self._check_replacement(name, relative_pathname, result):
if entry.type == _FileType.REGULAR_FILE:
self.index[name] = IndexEntry(name, _FileType.REGULAR_FILE,
digest=entry.digest,