diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-05-05 21:37:17 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-05-10 15:18:27 +0300 |
commit | 51b35a2d4305a2f302be62a370c4b00b2a215279 (patch) | |
tree | e3a6f7da4217f63415d47cf727c5ba3a4650b7d7 /bpkg/package.cxx | |
parent | 38b4313922e26781ef4e362d3c9ae6d4a78559cb (diff) |
Add support for --patch option
Diffstat (limited to 'bpkg/package.cxx')
-rw-r--r-- | bpkg/package.cxx | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/bpkg/package.cxx b/bpkg/package.cxx index 4880623..ccaf6ba 100644 --- a/bpkg/package.cxx +++ b/bpkg/package.cxx @@ -194,11 +194,9 @@ namespace bpkg { for (const shared_ptr<repository_fragment> r: rps) { - shared_ptr<repository_fragment> ar (filter (r, ap, prereq)); - - if (ar != nullptr) + if (shared_ptr<repository_fragment> rf = filter (r, ap, prereq)) { - aps.emplace_back (move (ap), move (ar)); + aps.emplace_back (move (ap), move (rf)); break; } } @@ -207,6 +205,26 @@ namespace bpkg return aps; } + pair<shared_ptr<available_package>, shared_ptr<repository_fragment>> + filter_one (const vector<shared_ptr<repository_fragment>>& rps, + odb::result<available_package>&& apr, + bool prereq) + { + using result = pair<shared_ptr<available_package>, + shared_ptr<repository_fragment>>; + + for (shared_ptr<available_package> ap: pointer_result (apr)) + { + for (const shared_ptr<repository_fragment> r: rps) + { + if (shared_ptr<repository_fragment> rf = filter (r, ap, prereq)) + return result (move (ap), move (rf)); + } + } + + return result (); + } + void check_any_available (const dir_path& c, transaction& t, |