From 67d42b48930f65a7e270e153f1ca627c5241d17b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 28 Jul 2023 22:04:29 +0300 Subject: Fix unexpected 'no package available for dependency' error when building from archives (GH issue #303) --- bpkg/package-query.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'bpkg/package-query.cxx') diff --git a/bpkg/package-query.cxx b/bpkg/package-query.cxx index 9705579..0c6d459 100644 --- a/bpkg/package-query.cxx +++ b/bpkg/package-query.cxx @@ -7,6 +7,7 @@ #include #include #include +#include using namespace std; @@ -26,6 +27,34 @@ namespace bpkg return i != imaginary_stubs.end () ? *i : nullptr; } + vector, + shared_ptr>> existing_packages; + + pair, lazy_shared_ptr> + find_existing (const package_name& name, + const optional& c, + const lazy_shared_ptr& rf) + { + database& db (rf.database ()); + + pair, + lazy_shared_ptr> r; + + for (const auto& p: existing_packages) + { + if (p.first == db && + p.second->id.name == name && + (!c || satisfies (p.second->version, *c))) + { + r.first = p.second; + r.second = lazy_shared_ptr (db, empty_string); + break; + } + } + + return r; + } + linked_databases repo_configs; linked_databases -- cgit v1.1