From 849b2b0af9af3c401fe342b1f8da3d2ba8fb9251 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 18 Oct 2023 22:04:09 +0300 Subject: Postpone 'unable to satisfy constraints' failure similar to what we do in collect_order_dependents() --- bpkg/pkg-build-collect.hxx | 50 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'bpkg/pkg-build-collect.hxx') diff --git a/bpkg/pkg-build-collect.hxx b/bpkg/pkg-build-collect.hxx index d1acc33..181a86e 100644 --- a/bpkg/pkg-build-collect.hxx +++ b/bpkg/pkg-build-collect.hxx @@ -716,6 +716,13 @@ namespace bpkg // dropped, dependencies will be up/downgraded to a different versions, // etc). // + // Also note that we may discover that a being up/downgraded dependency + // doesn't satisfy an existing dependent which we re-collect recursively for + // some reason (configuration variables are specified, etc). In this case we + // may also postpone the failure in the hope that the problem will resolve + // naturally as it is described above (see collect_build() implementation + // for details). + // // Specifically, we cache such unsatisfied constraints, pretend that the // dependents don't impose them and proceed with the remaining // collecting/ordering, simulating the plan execution, and evaluating the @@ -728,7 +735,7 @@ namespace bpkg struct unsatisfied_dependent { package_key dependent; - vector> dependencies; + vector> dependencies; }; struct build_packages; @@ -736,6 +743,13 @@ namespace bpkg class unsatisfied_dependents: public vector { public: + // Add a dependent together with the unsatisfied dependency constraint. + // + void + add (const package_key& dependent, + const build_package* dependency, + const version_constraint&); + // Try to find the dependent entry and return NULL if not found. // unsatisfied_dependent* @@ -1130,6 +1144,14 @@ namespace bpkg return entered_build (p.db, p.name); } + // Return NULL if the dependent in the constraint is not a package name + // (command line, etc; see build_package::constraint_type for details). + // Otherwise, return the dependent package build which is expected to be + // collected. + // + const build_package* + dependent_build (const build_package::constraint_type&) const; + // Collect the package being built. Return its pointer if this package // version was, in fact, added to the map and NULL if it was already there // and the existing version was preferred or if the package build has been @@ -1176,6 +1198,7 @@ namespace bpkg build_package, replaced_versions&, postponed_configurations&, + unsatisfied_dependents&, build_package_refs* dep_chain = nullptr, const function& = nullptr, const function& = nullptr, @@ -1389,6 +1412,7 @@ namespace bpkg postponed_dependencies&, postponed_configurations&, unacceptable_alternatives&, + unsatisfied_dependents&, optional> reeval_pos = nullopt, const optional& orig_dep = nullopt); @@ -1407,7 +1431,8 @@ namespace bpkg postponed_existing_dependencies&, postponed_dependencies&, postponed_configurations&, - unacceptable_alternatives&); + unacceptable_alternatives&, + unsatisfied_dependents&); // Collect the repointed dependents and their replaced prerequisites, // recursively. @@ -1428,6 +1453,7 @@ namespace bpkg postponed_dependencies&, postponed_configurations&, unacceptable_alternatives&, + unsatisfied_dependents&, const function&, const function&); @@ -1459,6 +1485,7 @@ namespace bpkg postponed_configurations&, strings& postponed_cfgs_history, unacceptable_alternatives&, + unsatisfied_dependents&, const function&, const repointed_dependents&, const function&, @@ -1529,16 +1556,6 @@ namespace bpkg string& indent, std::set& printed) const; - // Wraps the above function for the case when the package is a dependent - // from the dependency's constraints list. Noop if the dependent is not a - // package name (command line, etc; see constraint_type for details). - // - void - print_constraints (diag_record&, - const build_package::constraint_type&, - string& indent, - std::set& printed) const; - // Verify that builds ordering is consistent across all the data // structures and the ordering expectations are fulfilled (real build // actions are all ordered, etc). @@ -1610,7 +1627,8 @@ namespace bpkg const pkg_build_options&, const existing_dependent&, replaced_versions&, - postponed_configurations&); + postponed_configurations&, + unsatisfied_dependents&); // Non-recursively collect an existing non-deviated dependent previously // returned by the query_existing_dependents() function call for the @@ -1622,7 +1640,8 @@ namespace bpkg const existing_dependent&, postponed_configuration::packages&& dependencies, replaced_versions&, - postponed_configurations&); + postponed_configurations&, + unsatisfied_dependents&); // Non-recursively collect an existing dependent previously returned by // the query_existing_dependents() function call with the @@ -1639,7 +1658,8 @@ namespace bpkg const existing_dependent&, replaced_versions&, postponed_packages& postponed_recs, - postponed_configurations&); + postponed_configurations&, + unsatisfied_dependents&); struct package_ref { -- cgit v1.1