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:10:33 UTC
[buildstream] 14/21: Make the duplication test optional in
cas_based_directory
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch jmac/cas_to_cas_oct
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit b28b6c9edea2c9171c0b8e7f83fcabe81ee93959
Author: Jim MacArthur <ji...@codethink.co.uk>
AuthorDate: Thu Oct 25 16:48:23 2018 +0100
Make the duplication test optional in cas_based_directory
---
buildstream/storage/_casbaseddirectory.py | 35 +++++++++++++++----------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py
index bef9acf..7b356a4 100644
--- a/buildstream/storage/_casbaseddirectory.py
+++ b/buildstream/storage/_casbaseddirectory.py
@@ -853,35 +853,34 @@ class CasBasedDirectory(Directory):
if self.parent:
self.parent._recalculate_recursing_up(self)
- # Duplicate the current directory
-
+ duplicate_test = False
print("Original CAS before CAS-based import: {}".format(self.show_files_recursive()))
print("Original CAS hash: {}".format(self.ref.hash))
duplicate_cas = None
self._verify_unique()
if isinstance(external_pathspec, CasBasedDirectory):
- duplicate_cas = CasBasedDirectory(self.context, ref=copy.copy(self.ref))
- duplicate_cas._verify_unique()
+ if duplicate_test:
+ duplicate_cas = CasBasedDirectory(self.context, ref=copy.copy(self.ref))
+ duplicate_cas._verify_unique()
+ print("Duplicated CAS before file-based import: {}".format(duplicate_cas.show_files_recursive()))
+ print("Duplicate CAS hash: {}".format(duplicate_cas.ref.hash))
print("-"*80 + "Performing direct CAS-to-CAS import")
- print("Duplicated CAS before file-based import: {}".format(duplicate_cas.show_files_recursive()))
- print("Duplicate CAS hash: {}".format(duplicate_cas.ref.hash))
result = self._import_cas_into_cas(external_pathspec, files=files)
self._verify_unique()
print("Result of cas-to-cas import: {}".format(self.show_files_recursive()))
print("-"*80 + "Performing round-trip import via file system")
- with tempfile.TemporaryDirectory(prefix="roundtrip") as tmpdir:
- external_pathspec.export_files(tmpdir)
- if files is None:
- files = list(list_relative_paths(tmpdir))
- print("Importing from filesystem: filelist is: {}".format(files))
- duplicate_cas._import_files_from_directory(tmpdir, files=files)
- duplicate_cas._recalculate_recursing_down()
- if duplicate_cas.parent:
- duplicate_cas.parent._recalculate_recursing_up(duplicate_cas)
- print("Result of direct import: {}".format(duplicate_cas.show_files_recursive()))
-
-
+ if duplicate_test:
+ with tempfile.TemporaryDirectory(prefix="roundtrip") as tmpdir:
+ external_pathspec.export_files(tmpdir)
+ if files is None:
+ files = list(list_relative_paths(tmpdir))
+ print("Importing from filesystem: filelist is: {}".format(files))
+ duplicate_cas._import_files_from_directory(tmpdir, files=files)
+ duplicate_cas._recalculate_recursing_down()
+ if duplicate_cas.parent:
+ duplicate_cas.parent._recalculate_recursing_up(duplicate_cas)
+ print("Result of direct import: {}".format(duplicate_cas.show_files_recursive()))
else:
print("-"*80 + "Performing initial import")
if isinstance(external_pathspec, FileBasedDirectory):