From 2f4a589f869a3667f60499a71eb24c6add533193 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 21 Feb 2023 16:33:05 +0100 Subject: ExecutionApi: Retrieve to correct CAS directly ... by keeping track of each blob being a file or executable and storing it to the correct local physical CAS directory. The new flag is merely a hint and only used by the local execution API. Leaving it out will still correctly transfer the blob but may cause unnecessary duplicates in file CAS. --- src/buildtool/execution_api/local/local_api.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/buildtool/execution_api/local/local_api.hpp') diff --git a/src/buildtool/execution_api/local/local_api.hpp b/src/buildtool/execution_api/local/local_api.hpp index 02fa4fa6..1528ff23 100644 --- a/src/buildtool/execution_api/local/local_api.hpp +++ b/src/buildtool/execution_api/local/local_api.hpp @@ -194,7 +194,8 @@ class LocalApi final : public IExecutionApi { // Collect blob. try { - container.Emplace(BazelBlob{digest, *content}); + container.Emplace( + BazelBlob{digest, *content, IsExecutableObject(info.type)}); } catch (std::exception const& ex) { Logger::Log( LogLevel::Error, "failed to emplace blob: ", ex.what()); @@ -211,8 +212,9 @@ class LocalApi final : public IExecutionApi { -> bool final { for (auto const& blob : blobs) { auto const is_tree = NativeSupport::IsTree(blob.digest.hash()); - auto cas_digest = is_tree ? storage_->StoreTree(blob.data) - : storage_->StoreBlob(blob.data); + auto cas_digest = + is_tree ? storage_->StoreTree(blob.data) + : storage_->StoreBlob(blob.data, blob.is_exec); if (not cas_digest or not std::equal_to{}( *cas_digest, blob.digest)) { return false; -- cgit v1.2.3