From 57637947f4ab41c43cbf775959bcde39f1d36403 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 19 Sep 2023 23:39:40 +0300 Subject: Fix configuration negotiation not to compare dependency's config checksums if collection is postponed --- bpkg/pkg-build-collect.cxx | 83 +++++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 34 deletions(-) (limited to 'bpkg/pkg-build-collect.cxx') diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx index 3581a6b..c7180d2 100644 --- a/bpkg/pkg-build-collect.cxx +++ b/bpkg/pkg-build-collect.cxx @@ -109,6 +109,15 @@ namespace bpkg } bool build_package:: + recursive_collection_postponed () const + { + assert (action && *action == build_package::build && available != nullptr); + + return dependencies && + dependencies->size () != available->dependencies.size (); + } + + bool build_package:: reconfigure () const { assert (action && *action != drop); @@ -3902,6 +3911,10 @@ namespace bpkg build_package* b (entered_build (p)); assert (b != nullptr); + assert (b->skeleton); // Should have been init'ed above. + + package_skeleton& ps (*b->skeleton); + if (!b->recursive_collection) { l5 ([&]{trace << "collecting cfg-postponed dependency " @@ -3909,10 +3922,6 @@ namespace bpkg << " of dependent " << pkg.available_name_version_db ();}); - assert (b->skeleton); // Should have been init'ed above. - - package_skeleton& ps (*b->skeleton); - // Similar to the inital negotiation case, verify and set // the dependent configuration for this dependency. // @@ -3953,21 +3962,6 @@ namespace bpkg postponed_deps, postponed_cfgs, unacceptable_alts); - - // Unless the dependency is already being reconfigured, - // reconfigure it if its configuration changes. - // - if (!b->reconfigure ()) - { - const shared_ptr& sp (b->selected); - - if (sp != nullptr && - sp->state == package_state::configured && - sp->config_checksum != ps.config_checksum ()) - { - b->flags |= build_package::adjust_reconfigure; - } - } } else l5 ([&]{trace << "dependency " @@ -3976,6 +3970,22 @@ namespace bpkg << pkg.available_name_version_db () << " is already (being) recursively " << "collected, skipping";}); + + // Unless the dependency collection has been postponed or it + // is already being reconfigured, reconfigure it if its + // configuration changes. + // + if (!b->recursive_collection_postponed () && !b->reconfigure ()) + { + const shared_ptr& sp (b->selected); + + if (sp != nullptr && + sp->state == package_state::configured && + sp->config_checksum != ps.config_checksum ()) + { + b->flags |= build_package::adjust_reconfigure; + } + } } return true; @@ -5487,26 +5497,31 @@ namespace bpkg postponed_deps, postponed_cfgs, unacceptable_alts); - - // Unless the dependency is already being reconfigured, reconfigure - // it if its configuration changes. - // - if (!b->reconfigure ()) - { - const shared_ptr& sp (b->selected); - - if (sp != nullptr && - sp->state == package_state::configured && - sp->config_checksum != ps.config_checksum ()) - { - b->flags |= build_package::adjust_reconfigure; - } - } } else l5 ([&]{trace << "dependency " << b->available_name_version_db () << " is already (being) recursively collected, " << "skipping";}); + + // Unless the dependency collection has been postponed or it is + // already being reconfigured, reconfigure it if its configuration + // changes. + // + if (!b->recursive_collection_postponed () && !b->reconfigure ()) + { + const shared_ptr& sp (b->selected); + + assert (b->skeleton); // Should have been init'ed above. + + package_skeleton& ps (*b->skeleton); + + if (sp != nullptr && + sp->state == package_state::configured && + sp->config_checksum != ps.config_checksum ()) + { + b->flags |= build_package::adjust_reconfigure; + } + } } // Continue processing dependents with this config. -- cgit v1.1