aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-build.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bpkg/pkg-build.cxx')
-rw-r--r--bpkg/pkg-build.cxx38
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 ());
}
}
}