From 3d872575f9b97365a6baa53a81cf104e2cfb5baa Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 24 May 2023 00:59:08 +0300 Subject: Fix assertion failure in build_packages::collect_order_dependents() --- bpkg/pkg-build-collect.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bpkg/pkg-build-collect.cxx b/bpkg/pkg-build-collect.cxx index 2bcd515..98b76b9 100644 --- a/bpkg/pkg-build-collect.cxx +++ b/bpkg/pkg-build-collect.cxx @@ -5886,12 +5886,20 @@ namespace bpkg auto i (find_if (deps.begin (), deps.end (), [&p] (const auto& v) {return v.first == &p;})); - // It doesn't seems that we can be adding the same - // unsatisfactory dependency twice. + // Skip the dependency if it is already in the list. // - assert (i == deps.end ()); + // Note that we can be adding the same unsatisfactory dependency + // multiple times via different dependency paths. For example: + // + // 1. libboost-core -> libboost-mpl -> libboost-regex + // 2. libboost-utility -> libboost-mpl -> libboost-regex + // + // In this case, however, the constraint should be the same. + // + assert (i == deps.end () || i->second == c); - deps.push_back (make_pair (&p, move (c))); + if (i == deps.end ()) + deps.push_back (make_pair (&p, move (c))); } else { -- cgit v1.1