summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps
diff options
context:
space:
mode:
Diffstat (limited to 'src/other_tools/root_maps')
-rw-r--r--src/other_tools/root_maps/TARGETS6
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp47
-rw-r--r--src/other_tools/root_maps/distdir_git_map.cpp45
-rw-r--r--src/other_tools/root_maps/fpath_git_map.cpp3
-rw-r--r--src/other_tools/root_maps/tree_id_git_map.cpp53
5 files changed, 79 insertions, 75 deletions
diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS
index 57b80bbb..d2bb01a3 100644
--- a/src/other_tools/root_maps/TARGETS
+++ b/src/other_tools/root_maps/TARGETS
@@ -14,6 +14,8 @@
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/local", "config"]
, ["src/buildtool/execution_api/local", "local"]
+ , ["src/buildtool/storage", "config"]
+ , ["src/buildtool/storage", "storage"]
, ["src/utils/cpp", "tmp_dir"]
, ["src/buildtool/file_system", "file_storage"]
, ["src/other_tools/just_mr/progress_reporting", "progress"]
@@ -52,6 +54,7 @@
, "private-deps":
[ ["src/other_tools/just_mr", "utils"]
, ["src/buildtool/execution_api/local", "config"]
+ , ["src/buildtool/storage", "config"]
, ["src/utils/cpp", "tmp_dir"]
]
}
@@ -69,6 +72,8 @@
[ ["src/other_tools/utils", "archive_ops"]
, ["src/buildtool/execution_api/local", "local"]
, ["src/buildtool/file_system", "file_storage"]
+ , ["src/buildtool/storage", "storage"]
+ , ["src/buildtool/storage", "config"]
, ["src/other_tools/just_mr/progress_reporting", "progress"]
, ["src/other_tools/just_mr/progress_reporting", "statistics"]
]
@@ -87,6 +92,7 @@
[ ["src/other_tools/ops_maps", "critical_git_op_map"]
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/file_system", "file_system_manager"]
+ , ["src/buildtool/storage", "config"]
, ["src/buildtool/system", "system_command"]
, ["src/other_tools/git_operations", "git_repo_remote"]
, ["src/other_tools/just_mr", "utils"]
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index 80072fee..9af1c49c 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -15,6 +15,7 @@
#include "src/other_tools/root_maps/content_git_map.hpp"
#include "src/buildtool/file_system/file_storage.hpp"
+#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/just_mr/progress_reporting/statistics.hpp"
@@ -67,15 +68,14 @@ auto CreateContentGitMap(
}
// ensure Git cache
// define Git operation to be done
- GitOpKey op_key = {
- {
- JustMR::Utils::GetGitCacheRoot(), // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
- },
- GitOpType::ENSURE_INIT};
+ GitOpKey op_key = {{
+ StorageConfig::GitRoot(), // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
+ },
+ GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
@@ -114,14 +114,14 @@ auto CreateContentGitMap(
return;
}
// set the workspace root
- (*setter)(std::pair(
- nlohmann::json::array(
- {"git tree",
- *subtree_hash,
- JustMR::Utils::GetGitCacheRoot().string()}),
- true));
+ (*setter)(
+ std::pair(nlohmann::json::array(
+ {"git tree",
+ *subtree_hash,
+ StorageConfig::GitRoot().string()}),
+ true));
},
- [logger, target_path = JustMR::Utils::GetGitCacheRoot()](
+ [logger, target_path = StorageConfig::GitRoot()](
auto const& msg, bool fatal) {
(*logger)(fmt::format("While running critical Git "
"op ENSURE_INIT for "
@@ -204,7 +204,7 @@ auto CreateContentGitMap(
}
// we look for subtree in Git cache
auto just_git_cas =
- GitCAS::Open(JustMR::Utils::GetGitCacheRoot());
+ GitCAS::Open(StorageConfig::GitRoot());
if (not just_git_cas) {
(*logger)(
"Could not open Git cache object database!",
@@ -239,13 +239,12 @@ auto CreateContentGitMap(
return;
}
// set the workspace root
- (*setter)(
- std::pair(nlohmann::json::array(
- {"git tree",
- *subtree_hash,
- JustMR::Utils::GetGitCacheRoot()
- .string()}),
- false));
+ (*setter)(std::pair(
+ nlohmann::json::array(
+ {"git tree",
+ *subtree_hash,
+ StorageConfig::GitRoot().string()}),
+ false));
},
[logger, target_path = tmp_dir->GetPath()](
auto const& msg, bool fatal) {
diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp
index 403247e4..952eeb75 100644
--- a/src/other_tools/root_maps/distdir_git_map.cpp
+++ b/src/other_tools/root_maps/distdir_git_map.cpp
@@ -18,6 +18,7 @@
#include "src/buildtool/execution_api/common/execution_common.hpp"
#include "src/buildtool/file_system/file_storage.hpp"
+#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/just_mr/progress_reporting/statistics.hpp"
@@ -76,15 +77,14 @@ auto CreateDistdirGitMap(
}
// ensure Git cache
// define Git operation to be done
- GitOpKey op_key = {
- {
- JustMR::Utils::GetGitCacheRoot(), // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
- },
- GitOpType::ENSURE_INIT};
+ GitOpKey op_key = {{
+ StorageConfig::GitRoot(), // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
+ },
+ GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
@@ -99,14 +99,14 @@ auto CreateDistdirGitMap(
}
// subdir is ".", so no need to deal with the Git cache
// set the workspace root
- (*setter)(std::pair(
- nlohmann::json::array(
- {"git tree",
- distdir_tree_id,
- JustMR::Utils::GetGitCacheRoot().string()}),
- true));
+ (*setter)(
+ std::pair(nlohmann::json::array(
+ {"git tree",
+ distdir_tree_id,
+ StorageConfig::GitRoot().string()}),
+ true));
},
- [logger, target_path = JustMR::Utils::GetGitCacheRoot()](
+ [logger, target_path = StorageConfig::GitRoot()](
auto const& msg, bool fatal) {
(*logger)(fmt::format("While running critical Git "
"op ENSURE_INIT for "
@@ -177,13 +177,12 @@ auto CreateDistdirGitMap(
return;
}
// set the workspace root
- (*setter)(
- std::pair(nlohmann::json::array(
- {"git tree",
- distdir_tree_id,
- JustMR::Utils::GetGitCacheRoot()
- .string()}),
- false));
+ (*setter)(std::pair(
+ nlohmann::json::array(
+ {"git tree",
+ distdir_tree_id,
+ StorageConfig::GitRoot().string()}),
+ false));
},
[logger, target_path = tmp_dir->GetPath()](
auto const& msg, bool fatal) {
diff --git a/src/other_tools/root_maps/fpath_git_map.cpp b/src/other_tools/root_maps/fpath_git_map.cpp
index d8de9fa1..1330ee99 100644
--- a/src/other_tools/root_maps/fpath_git_map.cpp
+++ b/src/other_tools/root_maps/fpath_git_map.cpp
@@ -15,6 +15,7 @@
#include "src/other_tools/root_maps/fpath_git_map.hpp"
#include "src/buildtool/execution_api/local/config.hpp"
+#include "src/buildtool/storage/config.hpp"
#include "src/other_tools/just_mr/utils.hpp"
#include "src/utils/cpp/tmp_dir.hpp"
@@ -163,7 +164,7 @@ auto CreateFilePathGitMap(
std::string tree = values[0]->first;
// set the workspace root
(*setter)(nlohmann::json::array(
- {"git tree", tree, JustMR::Utils::GetGitCacheRoot()}));
+ {"git tree", tree, StorageConfig::GitRoot()}));
},
[logger, target_path = key](auto const& msg, bool fatal) {
(*logger)(
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 d73057c4..a4a1c91a 100644
--- a/src/other_tools/root_maps/tree_id_git_map.cpp
+++ b/src/other_tools/root_maps/tree_id_git_map.cpp
@@ -17,6 +17,7 @@
#include "fmt/core.h"
#include "src/buildtool/execution_api/common/execution_common.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
+#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/system/system_command.hpp"
#include "src/other_tools/git_operations/git_repo_remote.hpp"
#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
@@ -35,10 +36,10 @@ void KeepCommitAndSetRoot(
TreeIdGitMap::LoggerPtr const& logger) {
// Keep tag for commit
GitOpKey op_key = {{
- JustMR::Utils::GetGitCacheRoot(), // target_path
- commit, // git_hash
- "", // branch
- "Keep referenced tree alive" // message
+ StorageConfig::GitRoot(), // target_path
+ commit, // git_hash
+ "", // branch
+ "Keep referenced tree alive" // message
},
GitOpType::KEEP_TAG};
critical_git_op_map->ConsumeAfterKeysReady(
@@ -57,12 +58,11 @@ void KeepCommitAndSetRoot(
}
// set the workspace root
JustMRProgress::Instance().TaskTracker().Start(tree_id_info.origin);
- (*ws_setter)(
- std::pair(nlohmann::json::array(
- {"git tree",
- tree_id_info.hash,
- JustMR::Utils::GetGitCacheRoot().string()}),
- false));
+ (*ws_setter)(std::pair(
+ nlohmann::json::array({"git tree",
+ tree_id_info.hash,
+ StorageConfig::GitRoot().string()}),
+ false));
},
[logger, commit, target_path = tmp_dir->GetPath()](auto const& msg,
bool fatal) {
@@ -92,11 +92,11 @@ auto CreateTreeIdGitMap(
// ensure Git cache
// define Git operation to be done
GitOpKey op_key = {{
- JustMR::Utils::GetGitCacheRoot(), // target_path
- "", // git_hash
- "", // branch
- std::nullopt, // message
- true // init_bare
+ StorageConfig::GitRoot(), // target_path
+ "", // git_hash
+ "", // branch
+ std::nullopt, // message
+ true // init_bare
},
GitOpType::ENSURE_INIT};
critical_git_op_map->ConsumeAfterKeysReady(
@@ -115,10 +115,9 @@ auto CreateTreeIdGitMap(
auto git_repo = GitRepoRemote::Open(
op_result.git_cas); // link fake repo to odb
if (not git_repo) {
- (*logger)(
- fmt::format("Could not open repository {}",
- JustMR::Utils::GetGitCacheRoot().string()),
- /*fatal=*/true);
+ (*logger)(fmt::format("Could not open repository {}",
+ StorageConfig::GitRoot().string()),
+ /*fatal=*/true);
return;
}
// setup wrapped logger
@@ -338,16 +337,16 @@ auto CreateTreeIdGitMap(
}
else {
// tree found, so return the git tree root as-is
- (*setter)(std::pair(
- nlohmann::json::array(
- {"git tree",
- key.hash,
- JustMR::Utils::GetGitCacheRoot().string()}),
- true));
+ (*setter)(
+ std::pair(nlohmann::json::array(
+ {"git tree",
+ key.hash,
+ StorageConfig::GitRoot().string()}),
+ true));
}
},
- [logger, target_path = JustMR::Utils::GetGitCacheRoot()](
- auto const& msg, bool fatal) {
+ [logger, target_path = StorageConfig::GitRoot()](auto const& msg,
+ bool fatal) {
(*logger)(fmt::format("While running critical Git "
"op ENSURE_INIT bare for "
"target {}:\n{}",