summaryrefslogtreecommitdiff
path: root/src/other_tools
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-01-21 15:58:54 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-01-23 16:50:37 +0100
commitd2eed1607c87a878e5336c891d44dbc40ef71476 (patch)
tree5b121b6d29c39a9d6391791f1de00f16d10b746a /src/other_tools
parent2f227907de0858dd18d7151252373002f482a6da (diff)
downloadjustbuild-d2eed1607c87a878e5336c891d44dbc40ef71476.tar.gz
JustMr: DistdirGitMap: Use serve calls
...instead of EnsureAbsentRootOnServe. And remove unused arguments.
Diffstat (limited to 'src/other_tools')
-rw-r--r--src/other_tools/just_mr/setup.cpp21
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp43
-rw-r--r--src/other_tools/root_maps/distdir_git_map.hpp1
3 files changed, 28 insertions, 37 deletions
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index 0f2b928a..07f74620 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -386,17 +386,16 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
common_args.just_path ? common_args.just_path->string()
: kDefaultJustPath);
- auto distdir_git_map = CreateDistdirGitMap(
- &content_cas_map,
- &import_to_git_map,
- &critical_git_op_map,
- serve ? &*serve : nullptr,
- &native_storage_config,
- compat_storage_config != nullptr ? &*compat_storage_config : nullptr,
- &native_storage,
- &(*apis.local),
- has_remote_api ? &*apis.remote : nullptr,
- common_args.jobs);
+ auto distdir_git_map =
+ CreateDistdirGitMap(&content_cas_map,
+ &import_to_git_map,
+ &critical_git_op_map,
+ serve ? &*serve : nullptr,
+ &native_storage_config,
+ &native_storage,
+ &(*apis.local),
+ has_remote_api ? &*apis.remote : nullptr,
+ common_args.jobs);
auto tree_id_git_map = CreateTreeIdGitMap(
&git_tree_fetch_map,
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index 49329908..213b4f94 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -147,7 +147,6 @@ auto CreateDistdirGitMap(
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
ServeApi const* serve,
gsl::not_null<StorageConfig const*> const& native_storage_config,
- StorageConfig const* compat_storage_config,
gsl::not_null<Storage const*> const& native_storage,
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
@@ -157,7 +156,6 @@ auto CreateDistdirGitMap(
critical_git_op_map,
serve,
native_storage_config,
- compat_storage_config,
native_storage,
local_api,
remote_api](auto ts,
@@ -197,9 +195,6 @@ auto CreateDistdirGitMap(
key,
serve,
native_storage_config,
- compat_storage_config,
- local_api,
- remote_api,
setter,
logger](auto const& values) {
GitOpValue op_result = *values[0];
@@ -255,31 +250,29 @@ auto CreateDistdirGitMap(
/*fatal=*/true);
return;
}
- if (remote_api == nullptr) {
- (*logger)(
- fmt::format(
- "Missing or incompatible "
- "remote-execution endpoint "
- "needed to sync workspace root "
- "{} with the serve endpoint.",
- distdir_tree_id),
- /*fatal=*/true);
+
+ auto digest = ArtifactDigestFactory::Create(
+ HashFunction::Type::GitSHA1,
+ distdir_tree_id,
+ /*size_unknown=*/0,
+ /*is_tree=*/true);
+ if (not digest.has_value()) {
+ (*logger)(std::move(digest).error(),
+ /*fatal=*/true);
return;
}
+
// the tree is known locally, so we upload
// it to remote CAS for the serve endpoint
// to retrieve it and set up the root
- if (not EnsureAbsentRootOnServe(
- *serve,
- distdir_tree_id,
- native_storage_config
- ->GitRoot(), /*repo_root*/
- native_storage_config,
- compat_storage_config,
- &*local_api,
- remote_api,
- logger,
- true /*no_sync_is_fatal*/)) {
+ auto uploaded = serve->UploadTree(
+ *digest,
+ native_storage_config->GitRoot());
+ if (not uploaded.has_value()) {
+ (*logger)(std::move(uploaded)
+ .error()
+ .Message(),
+ /*fatal=*/true);
return;
}
}
diff --git a/src/other_tools/root_maps/distdir_git_map.hpp b/src/other_tools/root_maps/distdir_git_map.hpp
index 7bd82ca0..98c466c6 100644
--- a/src/other_tools/root_maps/distdir_git_map.hpp
+++ b/src/other_tools/root_maps/distdir_git_map.hpp
@@ -62,7 +62,6 @@ using DistdirGitMap =
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
ServeApi const* serve,
gsl::not_null<StorageConfig const*> const& native_storage_config,
- StorageConfig const* compat_storage_config,
gsl::not_null<Storage const*> const& native_storage,
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,