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/pkg-build.cxx | |
parent | aa2df902257cb939a36a515e34b0559cd3c24462 (diff) |
Allow building build module in multiple configurations if they belong to different configuration clusters
Diffstat (limited to 'bpkg/pkg-build.cxx')
-rw-r--r-- | bpkg/pkg-build.cxx | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 51bd224..dd48440 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -6218,15 +6218,18 @@ namespace bpkg verify_dependencies); // Now, verify that none of the build2 modules may simultaneously be - // built in multiple configurations, accross all (potentially - // unrelated) dependency trees. + // built in multiple configurations which belong to the same linked + // configuration cluster. // // For that we use the `package_prereqs` map: its key set refers to // all the packages potentially involved into the build (explicitly // or implicitly). // { - map<package_name, database&> build2_mods; + // List of module packages together with the linked configuration + // clusters they belong to. + // + vector<pair<config_package, linked_databases>> build2_mods; for (const auto& pp: package_prereqs) { @@ -6249,22 +6252,33 @@ namespace bpkg continue; } - auto i (build2_mods.emplace (cp.name, cp.db)); - - if (!i.second) + // Make sure the module's database doesn't belong to any other + // cluster this module is also configured in. + // + for (const auto& m: build2_mods) { - database& db (i.first->second); + if (m.first.name != cp.name) + continue; // The `package_prereqs` map can only contain the same package // twice if databases differ. // - assert (db != cp.db); + assert (m.first.db != cp.db); + + const linked_databases& lcc (m.second); - fail << "building build system module " << cp.name << " in " - << "multiple configurations" << - info << db.config_orig << - info << cp.db.config_orig; + if (find (lcc.begin (), lcc.end (), cp.db) != lcc.end ()) + { + fail << "building build system module " << cp.name + << " in multiple configurations" << + info << m.first.db.config_orig << + info << cp.db.config_orig; + } } + + // Add the module and its cluster to the list. + // + build2_mods.emplace_back (cp, cp.db.cluster_configs ()); } } } |