summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr/setup.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-02-25 10:14:53 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-03-10 16:28:59 +0100
commit10eabcf67a3089ce9be57df2389ef6af0123eb8b (patch)
tree8eb81e12f900625a2ac58f89826022b757f5ca85 /src/other_tools/just_mr/setup.cpp
parent3c2d0d460485bde1e2ccf2d45e6f438adff4ce47 (diff)
downloadjustbuild-10eabcf67a3089ce9be57df2389ef6af0123eb8b.tar.gz
Invocation meta-data: include repository-config digest
To do so, extend multi-repo setup to also return the digest of the configuration file.
Diffstat (limited to 'src/other_tools/just_mr/setup.cpp')
-rw-r--r--src/other_tools/just_mr/setup.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index 5fb8dfed..9ba02fa7 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -30,6 +30,7 @@
#include "nlohmann/json.hpp"
#include "src/buildtool/build_engine/expression/expression.hpp"
#include "src/buildtool/build_engine/expression/expression_ptr.hpp"
+#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/common/remote/remote_common.hpp"
#include "src/buildtool/common/user_structs.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
@@ -51,7 +52,6 @@
#include "src/buildtool/multithreading/task_system.hpp"
#include "src/buildtool/progress_reporting/base_progress_reporter.hpp"
#include "src/buildtool/serve_api/remote/serve_api.hpp"
-#include "src/buildtool/storage/fs_utils.hpp"
#include "src/buildtool/storage/garbage_collector.hpp"
#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/just_mr/progress_reporting/progress_reporter.hpp"
@@ -82,7 +82,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
Storage const& native_storage,
bool interactive,
std::string const& multi_repo_tool_name)
- -> std::optional<std::filesystem::path> {
+ -> std::optional<std::pair<std::filesystem::path, std::string>> {
// provide report
Logger::Log(LogLevel::Info, "Performing repositories setup");
// set anchor dir to setup_root; current dir will be reverted when anchor
@@ -536,5 +536,14 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
return std::nullopt;
}
// if successful, return the output config
- return StorageUtils::AddToCAS(native_storage, mr_config.dump(2));
+ auto const& cas = native_storage.CAS();
+ auto digest = cas.StoreBlob(mr_config.dump(2));
+ if (not digest) {
+ return std::nullopt;
+ }
+ auto blob_path = cas.BlobPath(*digest, /*is_executable=*/false);
+ if (not blob_path) {
+ return std::nullopt;
+ }
+ return std::make_optional(std::make_pair(*blob_path, digest->hash()));
}