aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-07-02 17:45:28 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-07-04 10:38:41 +0300
commita5bb94b4b9a7b63277db7c8e27925eca87dbd0b3 (patch)
treed1a5fcb555672daca8664bb9c6453b98991eb15f
parentd681335bc7650cea9fb04653893a9deb9e479af7 (diff)
Fix precollect lambda in pkg-build to properly override dependency constraints
-rw-r--r--bpkg/pkg-build-collect.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx
index c7be96a..d71bb3b 100644
--- a/bpkg/pkg-build-collect.cxx
+++ b/bpkg/pkg-build-collect.cxx
@@ -2557,8 +2557,9 @@ namespace bpkg
const lazy_shared_ptr<repository_fragment>& 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,15 @@ namespace bpkg
apc (sdb, move (cd));
db = &sdb.find_attached (*lc->id);
+
+ // If the above apc() call has also collected this dependency
+ // (may be the case for a system dependency spec), then just
+ // re-iterate the pre-collection of this dependency,
+ // potentially overriding its version constraint using the
+ // command line spec.
+ //
+ if (map_.find (*db, dn) != map_.end ())
+ continue;
}
ddb = db; // Switch to the dependency configuration.
@@ -3328,6 +3341,8 @@ namespace bpkg
specified,
force,
ru});
+
+ ++di;
}
// Now, as we have pre-collected the dependency builds, if