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:13:49 UTC

[buildstream] 28/43: casbaseddirectory: Remove roundtrip checking code

This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch jmac/cas_to_cas_oct_v2
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 7d9d395051f7e8b1b032d32c75549cc1cf181ce6
Author: Jim MacArthur <ji...@codethink.co.uk>
AuthorDate: Thu Oct 25 17:32:05 2018 +0100

    casbaseddirectory: Remove roundtrip checking code
---
 buildstream/storage/_casbaseddirectory.py | 28 +---------------------------
 1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py
index 6a25602..e30a23d 100644
--- a/buildstream/storage/_casbaseddirectory.py
+++ b/buildstream/storage/_casbaseddirectory.py
@@ -835,39 +835,17 @@ class CasBasedDirectory(Directory):
 
         print("Directory before import: {}".format(self.show_files_recursive()))
 
-        # Sync self
+        # Sync self (necessary?)
         self._recalculate_recursing_down()
         if self.parent:
             self.parent._recalculate_recursing_up(self)
         
-        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):
-            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")
             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")
-            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):
@@ -891,10 +869,6 @@ class CasBasedDirectory(Directory):
         self._recalculate_recursing_down()
         if self.parent:
             self.parent._recalculate_recursing_up(self)
-        if duplicate_cas:
-            if duplicate_cas.ref.hash != self.ref.hash:
-                self.showdiff(duplicate_cas)
-                raise VirtualDirectoryError("Mismatch between file-imported result {} and cas-to-cas imported result {}.".format(duplicate_cas.ref.hash,self.ref.hash))
 
         return result