summaryrefslogtreecommitdiff
path: root/src/buildtool/main/install_cas.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-08 16:50:01 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-16 17:51:12 +0200
commitde3ef374983d987d8ffd8e8516a4877fe68b3e4e (patch)
treec430a4e73e8ce33e796b5e67eda577bf0b22178a /src/buildtool/main/install_cas.cpp
parent57b7ec186b740b94df030e2f064c28148dd30749 (diff)
downloadjustbuild-de3ef374983d987d8ffd8e8516a4877fe68b3e4e.tar.gz
Use RemoteExecutionConfig instances stored in ApiBundle
...wherever an ApiBundle is already being passed.
Diffstat (limited to 'src/buildtool/main/install_cas.cpp')
-rw-r--r--src/buildtool/main/install_cas.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/buildtool/main/install_cas.cpp b/src/buildtool/main/install_cas.cpp
index 2e1b6917..dcf696ab 100644
--- a/src/buildtool/main/install_cas.cpp
+++ b/src/buildtool/main/install_cas.cpp
@@ -30,17 +30,19 @@
namespace {
[[nodiscard]] auto InvalidSizeString(std::string const& size_str,
- std::string const& hash) noexcept -> bool {
+ std::string const& hash,
+ bool has_remote) noexcept -> bool {
static auto const kEmptyHash = HashFunction::ComputeBlobHash("");
return Compatibility::IsCompatible() and // native mode is fine
(size_str == "0" or size_str.empty()) and // not "0" or "" is fine
kEmptyHash.HexString() != hash and // empty hash is fine
- RemoteExecutionConfig::RemoteAddress(); // local is fine
+ has_remote; // local is fine
}
} // namespace
-[[nodiscard]] auto ObjectInfoFromLiberalString(std::string const& s) noexcept
+[[nodiscard]] auto ObjectInfoFromLiberalString(std::string const& s,
+ bool has_remote) noexcept
-> Artifact::ObjectInfo {
std::istringstream iss(s);
std::string id{};
@@ -56,7 +58,7 @@ namespace {
if (not iss.eof()) {
std::getline(iss, type, ']');
}
- if (InvalidSizeString(size_str, id)) {
+ if (InvalidSizeString(size_str, id, has_remote)) {
Logger::Log(
LogLevel::Warning,
"{} size in object-id is not supported in compatiblity mode.",
@@ -73,7 +75,8 @@ namespace {
#ifndef BOOTSTRAP_BUILD_TOOL
auto FetchAndInstallArtifacts(ApiBundle const& apis,
FetchArguments const& clargs) -> bool {
- auto object_info = ObjectInfoFromLiberalString(clargs.object_id);
+ auto object_info = ObjectInfoFromLiberalString(
+ clargs.object_id, apis.remote_config.RemoteAddress().has_value());
if (clargs.remember) {
if (not apis.remote->ParallelRetrieveToCas(