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 +++++++++++++++++++++++++++------------------- bpkg/pkg-build-collect.hxx | 6 ++++ tests/pkg-build.testscript | 10 ------ 3 files changed, 55 insertions(+), 44 deletions(-) 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. diff --git a/bpkg/pkg-build-collect.hxx b/bpkg/pkg-build-collect.hxx index d3bcb79..d5a07b5 100644 --- a/bpkg/pkg-build-collect.hxx +++ b/bpkg/pkg-build-collect.hxx @@ -184,6 +184,12 @@ namespace bpkg // bool recursive_collection; + // Return true if the recursive collection started but has been postponed + // for any reason. + // + bool + recursive_collection_postponed () const; + // Hold flags. Note that we only "increase" the hold_package value that is // already in the selected package. // diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index b6aadba..34b0663 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -14516,11 +14516,6 @@ test.arguments += --sys-no-query build plan: new libbox/1.0.0 (required by tez) config.libbox.extras=true (set by tez) - reconfigure/update tex/1.0.0 (required by tiz) - config.tex.extras=true (set by tiz) - config.tex.libfoo_extras=true (set by tex) - reconfigure tiz/1.0.0 (dependent of libbar) - config.tiz.tex_extras=true (set by tiz) drop libbaz/1.0.0 (unused) downgrade toz/0.1.0 (required by tez) config.toz.extras=true (set by tez) @@ -14944,11 +14939,6 @@ test.arguments += --sys-no-query build plan: new libbaz/1.0.0 (required by toz) config.libbaz.extras=true (set by toz) - reconfigure/update tex/1.0.0 (required by tix, tiz) - config.tex.extras=true (set by tix) - config.tex.libfoo_extras=true (set by tex) - reconfigure tiz/1.0.0 (dependent of libbar) - config.tiz.tex_extras=true (set by tiz) new tix/1.0.0 upgrade toz/1.0.0 config.toz.extras=true (set by tuz) -- cgit v1.1