summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr/setup_utils.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-12-02 12:45:45 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2024-12-03 14:11:38 +0100
commitd51dbc74c5aeb7a9380a9e18082bb2d25527ee89 (patch)
treeaeeef33f4fee67493d07fbce19362995856a0f67 /src/other_tools/just_mr/setup_utils.cpp
parentca028c50d0c1c2babf73ddaf757aa7d016f0e9d6 (diff)
downloadjustbuild-d51dbc74c5aeb7a9380a9e18082bb2d25527ee89.tar.gz
JustMR: treat computed roots like any other repository
...and process their bindings.
Diffstat (limited to 'src/other_tools/just_mr/setup_utils.cpp')
-rw-r--r--src/other_tools/just_mr/setup_utils.cpp31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp
index e69c3656..f469af80 100644
--- a/src/other_tools/just_mr/setup_utils.cpp
+++ b/src/other_tools/just_mr/setup_utils.cpp
@@ -69,22 +69,19 @@ void ReachableRepositories(
// use temporary sets to avoid duplicates
std::unordered_set<std::string> include_repos_set;
std::unordered_set<std::string> setup_repos_set;
- // computed must not contain overlay repos, so they are collected separately
- std::unordered_set<std::string> computed_repos_set{};
// traverse all bindings of main repository
for (std::queue<std::string> to_process({main}); not to_process.empty();
to_process.pop()) {
auto const& repo_name = to_process.front();
- if (include_repos_set.contains(repo_name) or
- computed_repos_set.contains(repo_name)) {
+ // Check the repo hasn't been processed yet
+ if (not include_repos_set.insert(repo_name).second) {
continue;
}
auto const repos_repo_name =
repos->Get(repo_name, Expression::none_t{});
if (not repos_repo_name.IsNotNull()) {
- include_repos_set.insert(repo_name);
continue;
}
WarnUnknownKeys(repo_name, repos_repo_name);
@@ -92,22 +89,18 @@ void ReachableRepositories(
auto const repository =
repos_repo_name->Get("repository", Expression::none_t{});
if (auto const crparser = ComputedRootParser::Create(&repository)) {
- computed_repos_set.insert(repo_name);
if (auto const target_repo = crparser->GetTargetRepository()) {
to_process.push(*target_repo);
}
}
- else {
- // if not computed, add it and repeat for its bindings
- include_repos_set.insert(repo_name);
- // check bindings
- auto bindings =
- repos_repo_name->Get("bindings", Expression::none_t{});
- if (bindings.IsNotNull() and bindings->IsMap()) {
- for (auto const& bound : bindings->Map().Values()) {
- if (bound.IsNotNull() and bound->IsString()) {
- to_process.push(bound->String());
- }
+
+ // check bindings
+ auto const bindings =
+ repos_repo_name->Get("bindings", Expression::none_t{});
+ if (bindings.IsNotNull() and bindings->IsMap()) {
+ for (auto const& bound : bindings->Map().Values()) {
+ if (bound.IsNotNull() and bound->IsString()) {
+ to_process.push(bound->String());
}
}
}
@@ -123,10 +116,6 @@ void ReachableRepositories(
}
setup_repos_set.insert(include_repos_set.begin(), include_repos_set.end());
- setup_repos_set.insert(computed_repos_set.begin(),
- computed_repos_set.end());
- include_repos_set.merge(std::move(computed_repos_set));
-
// copy to vectors
setup_repos->to_setup.clear();
setup_repos->to_setup.reserve(setup_repos_set.size());