diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2024-01-22 17:19:32 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2024-01-22 17:20:15 +0100 |
commit | 3eef9c42eadfe9088814cb93ece7435fe97fe8fb (patch) | |
tree | f3c99c83aa62dba358778ffd540a73a858e47998 | |
parent | 7a08d2cdfa37f70b95c963585a392af18298c06a (diff) | |
download | justbuild-3eef9c42eadfe9088814cb93ece7435fe97fe8fb.tar.gz |
just-mr: Honor archive mirrors when only fetching
... which were only honored when doing fetch and setup.
-rw-r--r-- | src/other_tools/just_mr/fetch.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index d5e72f28..47b4586c 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -235,6 +235,32 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, auto repo_desc_sha512 = (*resolved_repo_desc) ->Get("sha512", Expression::none_t{}); + auto repo_desc_mirrors = + (*resolved_repo_desc) + ->Get("mirrors", Expression::list_t{}); + std::vector<std::string> mirrors{}; + if (repo_desc_mirrors->IsList()) { + mirrors.reserve(repo_desc_mirrors->List().size()); + for (auto const& elem : repo_desc_mirrors->List()) { + if (not elem->IsString()) { + Logger::Log( + LogLevel::Error, + "Config: Unsupported list entry {} in " + "optional field \"mirrors\"", + elem->ToString()); + return kExitFetchError; + } + mirrors.emplace_back(elem->String()); + } + } + else { + Logger::Log(LogLevel::Error, + "Config: Optional field \"mirrors\" " + "should be a list of strings, but " + "found: {}", + repo_desc_mirrors->ToString()); + return kExitFetchError; + } ArchiveRepoInfo archive_info = { .archive = @@ -245,6 +271,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, repo_desc_distfile->String()) : std::nullopt, .fetch_url = repo_desc_fetch->get()->String(), + .mirrors = std::move(mirrors), .sha256 = repo_desc_sha256->IsString() ? std::make_optional( repo_desc_sha256->String()) |