aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-05-31 09:34:15 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2022-06-07 21:15:37 +0300
commit08fecf36ba7ad52d0143ac3107c7d644d02b96e4 (patch)
tree0cf66bbc07e3356f2352f1e2dc2b7a4835da0665
parentef1528b976b3273ac95b3899d7ea6f88a52c37b7 (diff)
Add initial version of configuration negotiation loop with sanity checks
-rw-r--r--bpkg/pkg-build.cxx44
1 files changed, 38 insertions, 6 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index e67cbb1..b3f4a98 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -2867,7 +2867,7 @@ namespace bpkg
// The being re-evaluated dependent cannot be recursively collected yet.
// Also, we don't expect it being configured as system.
//
- // Note, the configured package can still be re-evaluated after
+ // Note that the configured package can still be re-evaluated after
// collect_build_prerequisites() has been called but didn't end up with
// the recursive collection.
//
@@ -5753,14 +5753,46 @@ namespace bpkg
l5 ([&]{trace << "cfg-negotiate begin " << *pcfg;});
- // @@ Negotiate configuration.
-
- /*
- for (...)
+ // Negotiate the configuration.
+ //
+ for (auto b (pcfg->dependents.begin ()),
+ i (b),
+ e (pcfg->dependents.end ()); i != e; )
{
+ // The first step is to resolve package skeletons for the dependent
+ // and its dependencies.
+ //
+ // For the dependent, the skeleton should be already there (since we
+ // should have started recursively collecting it). For a dependency,
+ // it should not already be there (since we haven't yet started
+ // recursively collecting it). But we could be re-resolving the same
+ // dependency multiple times.
+ //
+ {
+ build_package* b (entered_build (i->first));
+ assert (b != nullptr && b->skeleton);
+ }
+
+ {
+ // A non-negotiated cluster must only have one depends position
+ // for each dependent.
+ //
+ assert (i->second.dependencies.size () == 1);
+
+ const postponed_configuration::dependency& ds (
+ i->second.dependencies.front ());
+
+ for (const package_key& pk: ds)
+ {
+ build_package* b (entered_build (pk));
+ assert (b != nullptr && !b->skeleton);
+ }
+ }
+
// up_negotiate (...);
+
+ ++i;
}
- */
// Being negotiated (so can only be up-negotiated).
//