diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-07-20 12:22:06 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-07-20 12:22:06 +0300 |
commit | d7dc4e0a96505464d2bbf1f045dc0e30404dbac0 (patch) | |
tree | fb7ab31ff2acd6f794b5ce2f02d7068d276c3233 | |
parent | 1aebd4750048f8c82a4f45e8670eac6bfdbb9ffb (diff) |
Don't creare new configuration cluster for dependency which already belongs to some cluster
-rw-r--r-- | bpkg/pkg-build-collect.cxx | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx index 83bb96a..9a60d4a 100644 --- a/bpkg/pkg-build-collect.cxx +++ b/bpkg/pkg-build-collect.cxx @@ -5333,9 +5333,26 @@ namespace bpkg replaced_vers, postponed_cfgs)); - postponed_cfgs.add (package_key (ed.db, ed.selected->name), - pos, - package_key (bp->db, bp->selected->name)); + // Can this dependency already belong to some configuration + // cluster? It feels like potentially it can. However, if it + // does then this cluster cannot be current (we would throw + // postpone_position) nor (being) negotiated (the dependent + // would have already been re-evaluated). Thus, if the + // dependency already belongs to some cluster we assume that + // this existing dependent will naturally be reevaluated up to + // this dependency later when their cluster is negotiated. + // Otherwise, we just create such a cluster. + // + package_key dep (bp->db, bp->selected->name); + + const postponed_configuration* cfg ( + postponed_cfgs.find_dependency (dep)); + + if (cfg == nullptr) + postponed_cfgs.add ( + package_key (ed.db, ed.selected->name), pos, move (dep)); + else + assert (cfg != pc && !cfg->negotiated); } l5 ([&]{trace << "postpone cfg-negotiation of " << *pc;}); |