diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-10-07 22:36:01 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-10-08 16:23:51 +0300 |
commit | 9b6086440aa261fc376c8293df2345050658dd2b (patch) | |
tree | 8f632c035566a469c9eca32b34659bc48ef6a4b2 /bpkg/database.cxx | |
parent | aa2df902257cb939a36a515e34b0559cd3c24462 (diff) |
Allow building build module in multiple configurations if they belong to different configuration clusters
Diffstat (limited to 'bpkg/database.cxx')
-rw-r--r-- | bpkg/database.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bpkg/database.cxx b/bpkg/database.cxx index dd6790a..4f3b102 100644 --- a/bpkg/database.cxx +++ b/bpkg/database.cxx @@ -936,6 +936,39 @@ namespace bpkg empty_string /* type */); } + linked_databases database:: + cluster_configs (bool sys_rep) + { + linked_databases r; + + // If the database is not in the resulting list, then add it and its + // dependent and dependency configurations, recursively. + // + auto add = [&r, sys_rep] (database& db, const auto& add) + { + if (std::find (r.begin (), r.end (), db) != r.end ()) + return; + + r.push_back (db); + + { + linked_databases cs (db.dependency_configs ()); + for (auto i (cs.begin_linked ()); i != cs.end (); ++i) + add (*i, add); + } + + { + linked_databases cs (db.dependent_configs (sys_rep)); + for (auto i (cs.begin_linked ()); i != cs.end (); ++i) + add (*i, add); + } + }; + + add (*this, add); + + return r; + } + database& database:: find_attached (uint64_t id, bool s) { |