aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-28 16:11:19 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-11-28 16:11:19 +0000
commit2534dec6e213c440debf4f532c4b7485406d97e7 (patch)
treeffdc940198a4265076dbe5880d38a94633d41b58
parentb62bde7b2bfd6848ded669fb20a0fbad495608c3 (diff)
downloadpaludis-2534dec6e213c440debf4f532c4b7485406d97e7.tar.gz
paludis-2534dec6e213c440debf4f532c4b7485406d97e7.tar.xz
cave search --index --matching
Fixes: ticket:1043
-rw-r--r--src/clients/cave/cmd_find_candidates.cc38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/clients/cave/cmd_find_candidates.cc b/src/clients/cave/cmd_find_candidates.cc
index 737ba55..6923599 100644
--- a/src/clients/cave/cmd_find_candidates.cc
+++ b/src/clients/cave/cmd_find_candidates.cc
@@ -35,6 +35,7 @@
#include <paludis/user_dep_spec.hh>
#include <paludis/package_id.hh>
#include <paludis/mask.hh>
+#include <paludis/match_package.hh>
#include <paludis/util/set.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
@@ -167,15 +168,10 @@ FindCandidatesCommand::run_hosted(
std::list<std::string> specs;
- if (search_options.a_matching.specified())
- {
- throw InternalError(PALUDIS_HERE, "not yet");
- }
- else
- SearchExtrasHandle::get_instance()->find_candidates_function(db, specs,
- search_options.a_all_versions.specified(),
- search_options.a_visible.specified(),
- name_description_substring_hint);
+ SearchExtrasHandle::get_instance()->find_candidates_function(db, specs,
+ search_options.a_all_versions.specified(),
+ search_options.a_visible.specified(),
+ name_description_substring_hint);
SearchExtrasHandle::get_instance()->cleanup_db_function(db);
@@ -183,6 +179,30 @@ FindCandidatesCommand::run_hosted(
s != s_end ; ++s)
{
step("Checking indexed candidates");
+
+ std::list<PackageDepSpec> matches;
+ for (args::StringSetArg::ConstIterator k(search_options.a_matching.begin_args()),
+ k_end(search_options.a_matching.end_args()) ;
+ k != k_end ; ++k)
+ matches.push_back(parse_user_package_dep_spec(*k, env.get(), { updso_allow_wildcards }));
+
+ if (! matches.empty())
+ {
+ bool ok(false);
+
+ for (auto m(matches.begin()), m_end(matches.end()) ;
+ m != m_end ; ++m)
+ if (match_package(*env, *m, **(*env)[selection::RequireExactlyOne(generator::Matches(
+ parse_user_package_dep_spec(*s, env.get(), { }), { }))]->begin(), { }))
+ {
+ ok = true;
+ break;
+ }
+
+ if (! ok)
+ continue;
+ }
+
yield(parse_user_package_dep_spec(*s, env.get(), { }));
}
}