From d51dbc74c5aeb7a9380a9e18082bb2d25527ee89 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Mon, 2 Dec 2024 12:45:45 +0100 Subject: JustMR: treat computed roots like any other repository ...and process their bindings. --- src/other_tools/just_mr/setup_utils.cpp | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'src/other_tools/just_mr/setup_utils.cpp') 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 include_repos_set; std::unordered_set setup_repos_set; - // computed must not contain overlay repos, so they are collected separately - std::unordered_set computed_repos_set{}; // traverse all bindings of main repository for (std::queue 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()); -- cgit v1.2.3