diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-07-28 22:04:29 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-07-31 19:35:21 +0300 |
commit | 67d42b48930f65a7e270e153f1ca627c5241d17b (patch) | |
tree | 817d36b4718793b6475cfdf59fd1ffe2d0b9e344 /bpkg/package-query.cxx | |
parent | da6d239d0771142b795d18105aac8d130e85c5ba (diff) |
Fix unexpected 'no package available for dependency' error when building from archives (GH issue #303)
Diffstat (limited to 'bpkg/package-query.cxx')
-rw-r--r-- | bpkg/package-query.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
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 <bpkg/package-odb.hxx> #include <bpkg/database.hxx> #include <bpkg/rep-mask.hxx> +#include <bpkg/satisfaction.hxx> using namespace std; @@ -26,6 +27,34 @@ namespace bpkg return i != imaginary_stubs.end () ? *i : nullptr; } + vector<pair<reference_wrapper<database>, + shared_ptr<available_package>>> existing_packages; + + pair<shared_ptr<available_package>, lazy_shared_ptr<repository_fragment>> + find_existing (const package_name& name, + const optional<version_constraint>& c, + const lazy_shared_ptr<repository_fragment>& rf) + { + database& db (rf.database ()); + + pair<shared_ptr<available_package>, + lazy_shared_ptr<repository_fragment>> 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<repository_fragment> (db, empty_string); + break; + } + } + + return r; + } + linked_databases repo_configs; linked_databases |