aboutsummaryrefslogtreecommitdiff
path: root/bdep/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-24 11:49:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-24 11:49:44 +0200
commit04be612dead00c36c8c6ff748c252e8e5d3b1e5c (patch)
tree33e30f2c34351057e7aa8e5dabef77cb0d2d5572 /bdep/init.cxx
parent28bf74a975589e6136c39ec679f2e4ddc089f649 (diff)
Allow multiple forwarded configurations
The new constraint is that such configurations should not have any common packages (a package cannot be forwarded to multiple configurations).
Diffstat (limited to 'bdep/init.cxx')
-rw-r--r--bdep/init.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/bdep/init.cxx b/bdep/init.cxx
index 04afd3c..1e794f8 100644
--- a/bdep/init.cxx
+++ b/bdep/init.cxx
@@ -94,6 +94,33 @@ namespace bdep
continue;
}
+ // If this configuration is forwarded, verify there is no other
+ // forwarded configuration that also has this package.
+ //
+ if (c->forward)
+ {
+ using query = bdep::query<configuration>;
+
+ for (const shared_ptr<configuration>& o:
+ pointer_result (db.query<configuration> (query::forward)))
+ {
+ if (o == c)
+ continue;
+
+ if (find_if (o->packages.begin (),
+ o->packages.end (),
+ [&p] (const package_state& s)
+ {
+ return p.name == s.name;
+ }) != o->packages.end ())
+ {
+ fail << "forwarded configuration " << *o << " also has package "
+ << p.name << " initialized" <<
+ info << "while initializing in forwarded configuration " << *c;
+ }
+ }
+ }
+
// If we are initializing multiple packages, print their names.
//
if (verb && pkgs.size () > 1)