aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-06-30 11:12:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-06-30 11:12:00 +0200
commit02ca64902b7461e4700b82bd627802c436658c8b (patch)
tree781e002b1c2ba715fcdd4c883986b6c6d34a265f
parentab1be40924c6bac764f31cfd665e5041530c0a02 (diff)
Allow re-adding identical dependency to non-existent dependent
-rw-r--r--bpkg/pkg-build-collect.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx
index 9d4c17a..2e7cc42 100644
--- a/bpkg/pkg-build-collect.cxx
+++ b/bpkg/pkg-build-collect.cxx
@@ -515,17 +515,22 @@ namespace bpkg
{
if (dependency* d = find_dependency (dep.position))
{
- // Feels like we can accumulate dependencies into an existing
- // position only for an existing dependent.
- //
- assert (existing);
-
for (package_key& p: dep)
{
// Add the dependency unless it's already there.
//
if (find (d->begin (), d->end (), p) == d->end ())
+ {
+ // Feels like we can accumulate new dependencies into an existing
+ // position only for an existing dependent. Note that we could still
+ // try to add an (supposedly) identical entry for a non-existent
+ // dependent (via some murky paths). Feels like this should be
+ // harmless.
+ //
+ assert (existing);
+
d->push_back (move (p));
+ }
}
// Set the has_alternative flag for an existing dependent. Note that
@@ -534,7 +539,10 @@ namespace bpkg
if (dep.has_alternative)
{
if (!d->has_alternative)
+ {
+ assert (existing); // As above.
d->has_alternative = *dep.has_alternative;
+ }
else
assert (*d->has_alternative == *dep.has_alternative);
}