From 2a047701f16ab174d01519c206917a2ea5f9bab1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 18 Sep 2023 17:07:10 +0300 Subject: Properly re-collect existing packages scheduled for recursive re-collection even if their collection has been pruned --- bpkg/pkg-build-collect.cxx | 27 ++++++++++++++++++++++++--- bpkg/pkg-build.cxx | 6 +++++- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'bpkg') diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx index 5c9212b..159871b 100644 --- a/bpkg/pkg-build-collect.cxx +++ b/bpkg/pkg-build-collect.cxx @@ -3150,7 +3150,7 @@ namespace bpkg // Note that while collect_build() may prefer an existing entry in // the map and return NULL, the recursive collection of this - // preferred entry may have been postponed due to the existing + // preferred entry may has been postponed due to the existing // dependent (see collect_build_prerequisites() for details). Now, // we can potentially be recursively collecting such a dependent // after its re-evaluation to some earlier than this dependency @@ -5544,7 +5544,12 @@ namespace bpkg for (bool prog (find_if (postponed_recs.begin (), postponed_recs.end (), [] (const build_package* p) { - return !p->recursive_collection; + // Note that we check for the dependencies + // presence rather than for the + // recursive_collection flag (see below for + // details). + // + return !p->dependencies; }) != postponed_recs.end () || !postponed_repo.empty () || !postponed_cfgs.negotiated () || @@ -5560,7 +5565,17 @@ namespace bpkg postponed_packages pcs; for (build_package* p: postponed_recs) { - if (!p->recursive_collection) + // Note that we check for the dependencies presence rather than for + // the recursive_collection flag to also recollect the existing + // dependents which, for example, may have been specified on the + // command line and whose recursive collection has been pruned since + // there were no reason to collect it (configured, no upgrade, + // etc). Also note that this time we expect the collection to be + // enforced with the build_recollect flag. + // + assert ((p->flags & build_package::build_recollect) != 0); + + if (!p->dependencies) { package_key pk (p->db, p->name ()); @@ -5612,7 +5627,13 @@ namespace bpkg // due to it's own existing dependents. // if (p->recursive_collection) + { + // Must be present since the re-collection is enforced. + // + assert (p->dependencies); + prog = true; + } } } diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index e2dea9d..f13c114 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -4472,7 +4472,11 @@ namespace bpkg if (find_if (postponed_recs.begin (), postponed_recs.end (), [] (const build_package* p) { - return !p->recursive_collection; + // Note that we check for the dependencies presence + // rather than for the recursive_collection flag + // (see collect_build_postponed() for details). + // + return !p->dependencies; }) != postponed_recs.end () || !postponed_repo.empty () || !postponed_alts.empty () || -- cgit v1.1