From c0aa72da202d5f5b6d516ac6f5de4f36df3c9456 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 2 Jul 2024 17:45:28 +0300 Subject: Fix precollect lambda in pkg-build to properly override dependency constraints --- bpkg/pkg-build-collect.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx index c7be96a..45b148c 100644 --- a/bpkg/pkg-build-collect.cxx +++ b/bpkg/pkg-build-collect.cxx @@ -2557,8 +2557,9 @@ namespace bpkg const lazy_shared_ptr& af ( pkg.repository_fragment); - for (const dependency& dp: da) + for (auto di (da.begin ()); di != da.end (); ) { + const dependency& dp (*di); const package_name& dn (dp.name); if (buildtime && pdb.type == build2_config_type) @@ -2753,7 +2754,10 @@ namespace bpkg assert (unamended || replacement); if (!(replacement || (unamended && ud))) + { + ++di; continue; + } } if (dsp->state == package_state::broken) @@ -3029,6 +3033,14 @@ namespace bpkg apc (sdb, move (cd)); db = &sdb.find_attached (*lc->id); + + // If the above callback has also collected the dependency + // (may be the case for a system dependency spec), then just + // re-iterate the collection of this dependency, potentially + // overriding its version constraint. + // + if (map_.find (*db, dn) != map_.end ()) + continue; } ddb = db; // Switch to the dependency configuration. @@ -3328,6 +3340,8 @@ namespace bpkg specified, force, ru}); + + ++di; } // Now, as we have pre-collected the dependency builds, if -- cgit v1.1