summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-01-23 15:35:24 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-01-23 16:50:37 +0100
commitc932331dccab9406404d0a4bbc177eb39fa77dc4 (patch)
tree757ffeb07a38fb7ba53fa9bf481351b2b5f36338 /src/other_tools/root_maps
parentda7259a14d7267b5c8f17fd21640ff4d890bbb20 (diff)
downloadjustbuild-c932331dccab9406404d0a4bbc177eb39fa77dc4.tar.gz
JustMr: Replace calls to CheckServeHasAbsentRoot with direct calls to serve
Diffstat (limited to 'src/other_tools/root_maps')
-rw-r--r--src/other_tools/root_maps/TARGETS18
-rw-r--r--src/other_tools/root_maps/commit_git_map.cpp7
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp7
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp18
-rw-r--r--src/other_tools/root_maps/foreign_file_git_map.cpp7
-rw-r--r--src/other_tools/root_maps/fpath_git_map.cpp9
-rw-r--r--src/other_tools/root_maps/tree_id_git_map.cpp10
7 files changed, 47 insertions, 29 deletions
diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS
index 5d530b2a..bc3d05ac 100644
--- a/src/other_tools/root_maps/TARGETS
+++ b/src/other_tools/root_maps/TARGETS
@@ -18,8 +18,7 @@
]
, "stage": ["src", "other_tools", "root_maps"]
, "private-deps":
- [ "root_utils"
- , ["@", "fmt", "", "fmt"]
+ [ ["@", "fmt", "", "fmt"]
, ["src/buildtool/common", "artifact_digest_factory"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/crypto", "hash_function"]
@@ -57,8 +56,7 @@
]
, "stage": ["src", "other_tools", "root_maps"]
, "private-deps":
- [ "root_utils"
- , ["@", "fmt", "", "fmt"]
+ [ ["@", "fmt", "", "fmt"]
, ["src/buildtool/common", "artifact_digest_factory"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/crypto", "hash_function"]
@@ -98,8 +96,7 @@
]
, "stage": ["src", "other_tools", "root_maps"]
, "private-deps":
- [ "root_utils"
- , ["@", "fmt", "", "fmt"]
+ [ ["@", "fmt", "", "fmt"]
, ["src/buildtool/common", "artifact_digest_factory"]
, ["src/buildtool/crypto", "hash_function"]
, ["src/buildtool/file_system", "file_root"]
@@ -135,8 +132,7 @@
]
, "stage": ["src", "other_tools", "root_maps"]
, "private-deps":
- [ "root_utils"
- , ["@", "fmt", "", "fmt"]
+ [ ["@", "fmt", "", "fmt"]
, ["src/buildtool/common", "artifact_digest_factory"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/crypto", "hash_function"]
@@ -171,8 +167,7 @@
, ["src/other_tools/ops_maps", "import_to_git_map"]
]
, "private-deps":
- [ "root_utils"
- , ["@", "fmt", "", "fmt"]
+ [ ["@", "fmt", "", "fmt"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/crypto", "hash_info"]
, ["src/buildtool/file_system", "file_root"]
@@ -209,8 +204,7 @@
]
, "stage": ["src", "other_tools", "root_maps"]
, "private-deps":
- [ "root_utils"
- , ["@", "fmt", "", "fmt"]
+ [ ["@", "fmt", "", "fmt"]
, ["src/buildtool/common", "common"]
, ["src/buildtool/common", "config"]
, ["src/buildtool/execution_api/serve", "mr_git_api"]
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp
index e00c97cb..9acc5e1b 100644
--- a/src/other_tools/root_maps/commit_git_map.cpp
+++ b/src/other_tools/root_maps/commit_git_map.cpp
@@ -35,7 +35,6 @@
#include "src/buildtool/storage/fs_utils.hpp"
#include "src/other_tools/git_operations/git_ops_types.hpp"
#include "src/other_tools/git_operations/git_repo_remote.hpp"
-#include "src/other_tools/root_maps/root_utils.hpp"
#include "src/utils/cpp/expected.hpp"
#include "src/utils/cpp/path.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
@@ -79,8 +78,12 @@ void EnsureRootAsAbsent(std::string const& tree_id,
// this is an absent root
if (serve != nullptr) {
// check if the serve endpoint has this root
- auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger);
+ auto const has_tree = serve->CheckRootTree(tree_id);
if (not has_tree) {
+ (*logger)(fmt::format("Checking that the serve endpoint knows tree "
+ "{} failed.",
+ tree_id),
+ /*fatal=*/true);
return;
}
if (not *has_tree) {
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index 3e5dc3e0..2e112927 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -35,7 +35,6 @@
#include "src/buildtool/storage/fs_utils.hpp"
#include "src/other_tools/git_operations/git_ops_types.hpp"
#include "src/other_tools/git_operations/git_repo_remote.hpp"
-#include "src/other_tools/root_maps/root_utils.hpp"
#include "src/utils/archive/archive_ops.hpp"
#include "src/utils/cpp/expected.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
@@ -74,8 +73,12 @@ void EnsureRootAsAbsent(
// this is an absent root
if (serve != nullptr) {
// check if the serve endpoint has this root
- auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger);
+ auto const has_tree = serve->CheckRootTree(tree_id);
if (not has_tree) {
+ (*logger)(fmt::format("Checking that the serve endpoint knows tree "
+ "{} failed.",
+ tree_id),
+ /*fatal=*/true);
return;
}
if (not *has_tree) {
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index 213b4f94..44213cd9 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -31,7 +31,6 @@
#include "src/buildtool/multithreading/task_system.hpp"
#include "src/buildtool/storage/fs_utils.hpp"
#include "src/other_tools/git_operations/git_ops_types.hpp"
-#include "src/other_tools/root_maps/root_utils.hpp"
#include "src/utils/cpp/expected.hpp"
#include "src/utils/cpp/hex_string.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
@@ -209,9 +208,14 @@ auto CreateDistdirGitMap(
if (key.absent) {
if (serve != nullptr) {
// check if serve endpoint has this root
- auto has_tree = CheckServeHasAbsentRoot(
- *serve, distdir_tree_id, logger);
+ auto const has_tree =
+ serve->CheckRootTree(distdir_tree_id);
if (not has_tree) {
+ (*logger)(fmt::format("Checking that the serve "
+ "endpoint knows tree "
+ "{} failed.",
+ distdir_tree_id),
+ /*fatal=*/true);
return;
}
if (not *has_tree) {
@@ -350,9 +354,13 @@ auto CreateDistdirGitMap(
if (key.absent) {
if (serve != nullptr) {
// first check if serve endpoint has tree
- auto has_tree =
- CheckServeHasAbsentRoot(*serve, tree_id, logger);
+ auto const has_tree = serve->CheckRootTree(tree_id);
if (not has_tree) {
+ (*logger)(fmt::format("Checking that the serve "
+ "endpoint knows tree "
+ "{} failed.",
+ tree_id),
+ /*fatal=*/true);
return;
}
if (*has_tree) {
diff --git a/src/other_tools/root_maps/foreign_file_git_map.cpp b/src/other_tools/root_maps/foreign_file_git_map.cpp
index 1a5d4b9d..fef07ca8 100644
--- a/src/other_tools/root_maps/foreign_file_git_map.cpp
+++ b/src/other_tools/root_maps/foreign_file_git_map.cpp
@@ -33,7 +33,6 @@
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/multithreading/task_system.hpp"
#include "src/buildtool/storage/fs_utils.hpp"
-#include "src/other_tools/root_maps/root_utils.hpp"
#include "src/utils/cpp/expected.hpp"
#include "src/utils/cpp/hex_string.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
@@ -161,8 +160,12 @@ void HandleAbsentForeignFile(ForeignFileInfo const& key,
}
auto tree_id = ToHexString(tree->first);
if (serve != nullptr) {
- auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger);
+ auto const has_tree = serve->CheckRootTree(tree_id);
if (not has_tree) {
+ (*logger)(fmt::format("Checking that the serve endpoint knows tree "
+ "{} failed.",
+ tree_id),
+ /*fatal=*/true);
return;
}
if (*has_tree) {
diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp
index c1d93e61..4f9e3685 100644
--- a/src/other_tools/root_maps/fpath_git_map.cpp
+++ b/src/other_tools/root_maps/fpath_git_map.cpp
@@ -28,7 +28,6 @@
#include "src/buildtool/storage/fs_utils.hpp"
#include "src/other_tools/git_operations/git_ops_types.hpp"
#include "src/other_tools/git_operations/git_repo_remote.hpp"
-#include "src/other_tools/root_maps/root_utils.hpp"
#include "src/utils/cpp/expected.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
@@ -47,9 +46,13 @@ void CheckServeAndSetRoot(std::string const& tree_id,
// be able to build against it. If root is not absent, do not fail if we
// don't have a suitable remote endpoint, but warn user nonetheless.
if (serve != nullptr) {
- auto has_tree = CheckServeHasAbsentRoot(*serve, tree_id, logger);
+ auto const has_tree = serve->CheckRootTree(tree_id);
if (not has_tree) {
- return; // fatal
+ (*logger)(fmt::format("Checking that the serve endpoint knows tree "
+ "{} failed.",
+ tree_id),
+ /*fatal=*/true);
+ return;
}
if (not *has_tree) {
auto digest =
diff --git a/src/other_tools/root_maps/tree_id_git_map.cpp b/src/other_tools/root_maps/tree_id_git_map.cpp
index 8ab53daa..9968053a 100644
--- a/src/other_tools/root_maps/tree_id_git_map.cpp
+++ b/src/other_tools/root_maps/tree_id_git_map.cpp
@@ -30,7 +30,6 @@
#include "src/buildtool/multithreading/task_system.hpp"
#include "src/other_tools/git_operations/git_ops_types.hpp"
#include "src/other_tools/git_operations/git_repo_remote.hpp"
-#include "src/other_tools/root_maps/root_utils.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
namespace {
@@ -198,9 +197,14 @@ auto CreateTreeIdGitMap(
if (key.absent and not fetch_absent) {
if (serve != nullptr) {
// check serve endpoint
- auto has_tree = CheckServeHasAbsentRoot(
- *serve, key.tree_info.tree_hash.Hash(), logger);
+ auto const has_tree =
+ serve->CheckRootTree(key.tree_info.tree_hash.Hash());
if (not has_tree) {
+ (*logger)(fmt::format(
+ "Checking that the serve endpoint knows tree "
+ "{} failed.",
+ key.tree_info.tree_hash.Hash()),
+ /*fatal=*/true);
return;
}
if (*has_tree) {