aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-11-11 16:28:56 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2007-11-11 16:28:56 +0000
commitee5451e860fb571e4fadb7a865077d95bfaf9d24 (patch)
treebc06dec767f1cc71e580a69006508b672925a7f6 /src
parent15e745302f54207940b8cf43e1aa1764b81e3bdb (diff)
downloadpaludis-ee5451e860fb571e4fadb7a865077d95bfaf9d24.tar.gz
paludis-ee5451e860fb571e4fadb7a865077d95bfaf9d24.tar.xz
Use Query to generate potential candidates for FuzzyCandidatesFinder
Diffstat (limited to 'src')
-rw-r--r--src/clients/adjutrix/find_reverse_deps.cc2
-rw-r--r--src/clients/adjutrix/what_needs_keywording.cc3
-rw-r--r--src/clients/paludis/do_contents.cc2
-rw-r--r--src/clients/paludis/query.cc2
-rw-r--r--src/clients/paludis/uninstall.cc3
-rw-r--r--src/output/console_install_task.cc23
6 files changed, 25 insertions, 10 deletions
diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc
index 8dd45d892..5a39ee9a7 100644
--- a/src/clients/adjutrix/find_reverse_deps.cc
+++ b/src/clients/adjutrix/find_reverse_deps.cc
@@ -286,7 +286,7 @@ int do_find_reverse_deps(NoConfigEnvironment & env)
cerr << " * " << e.backtrace("\n * ");
cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(env, e.name());
+ FuzzyCandidatesFinder f(env, e.name(), query::All());
if (f.begin() == f.end())
cerr << "No suggestions found." << endl;
diff --git a/src/clients/adjutrix/what_needs_keywording.cc b/src/clients/adjutrix/what_needs_keywording.cc
index 1a92d7d31..62e4c3f9f 100644
--- a/src/clients/adjutrix/what_needs_keywording.cc
+++ b/src/clients/adjutrix/what_needs_keywording.cc
@@ -36,6 +36,7 @@
#include <paludis/metadata_key.hh>
#include <paludis/mask.hh>
#include <paludis/fuzzy_finder.hh>
+#include <paludis/query.hh>
#include <set>
#include <map>
@@ -101,7 +102,7 @@ int do_what_needs_keywording(NoConfigEnvironment & env)
cerr << " * " << e.backtrace("\n * ");
cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(env, e.name());
+ FuzzyCandidatesFinder f(env, e.name(), query::All());
if (f.begin() == f.end())
cerr << "No suggestions found." << endl;
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index 51a455f8c..b948845f6 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -155,7 +155,7 @@ do_contents(tr1::shared_ptr<Environment> env)
cerr << " * " << e.backtrace("\n * ");
cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(*env, e.name());
+ FuzzyCandidatesFinder f(*env, e.name(), query::InstalledAtRoot(env->root()));
if (f.begin() == f.end())
cerr << "No suggestions found." << endl;
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index d9087f27d..a0ac5c4a3 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -191,7 +191,7 @@ int do_query(tr1::shared_ptr<Environment> env)
cerr << " * " << e.backtrace("\n * ");
cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(*env, e.name());
+ FuzzyCandidatesFinder f(*env, e.name(), query::All());
if (f.begin() == f.end())
cerr << "No suggestions found." << endl;
diff --git a/src/clients/paludis/uninstall.cc b/src/clients/paludis/uninstall.cc
index 912b53572..e1d5b2810 100644
--- a/src/clients/paludis/uninstall.cc
+++ b/src/clients/paludis/uninstall.cc
@@ -27,6 +27,7 @@
#include <paludis/package_database.hh>
#include <paludis/action.hh>
#include <paludis/fuzzy_finder.hh>
+#include <paludis/query.hh>
#include <iostream>
#include <limits>
@@ -295,7 +296,7 @@ namespace
cerr << " * " << e.backtrace("\n * ");
cerr << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(*env, e.name());
+ FuzzyCandidatesFinder f(*env, e.name(), query::InstalledAtRoot(env->root()));
if (f.begin() == f.end())
cerr << "No suggestions found." << endl;
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 1b40cbffd..6d14b3d3a 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -181,7 +181,7 @@ ConsoleInstallTask::try_to_add_target(const std::string & s)
output_stream() << " * " << e.backtrace("\n * ");
output_stream() << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(*environment(), e.name());
+ FuzzyCandidatesFinder f(*environment(), e.name(), query::SupportsAction<InstallAction>() & query::NotMasked());
if (f.begin() == f.end())
output_stream() << "No suggestions found." << endl;
@@ -1452,15 +1452,16 @@ ConsoleInstallTask::on_no_such_package_error(const NoSuchPackageError & e)
output_stream() << " * " << e.backtrace("\n * ");
output_stream() << "Could not find '" << e.name() << "'. Looking for suggestions:" << endl;
- FuzzyCandidatesFinder f(*environment(), e.name());
+ FuzzyCandidatesFinder f(*environment(), e.name(),
+ query::SupportsAction<InstallAction>() & query::NotMasked());
if (f.begin() == f.end())
output_stream() << "No suggestions found." << endl;
else
output_stream() << "Suggestions:" << endl;
- for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()),
- c_end(f.end()) ; c != c_end ; ++c)
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), c_end(f.end())
+ ; c != c_end ; ++c)
output_stream() << " * " << colour(cl_package_name, *c) << endl;
output_stream() << endl;
}
@@ -1478,7 +1479,19 @@ ConsoleInstallTask::on_all_masked_error(const AllMaskedError & e)
output_stream() << endl;
output_stream() << "Query error:" << endl;
output_stream() << " * " << e.backtrace("\n * ");
- output_stream() << "No versions of '" << e.query() << "' are available" << endl;
+ output_stream() << "No versions of '" << e.query() << "' are available. Looking for suggestions:" << endl;
+
+ FuzzyCandidatesFinder f(*environment(), stringify(e.query()),
+ query::SupportsAction<InstallAction>() & query::NotMasked());
+
+ if (f.begin() == f.end())
+ output_stream() << "No suggestions found." << endl;
+ else
+ output_stream() << "Suggestions:" << endl;
+
+ for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), c_end(f.end())
+ ; c != c_end ; ++c)
+ output_stream() << " * " << colour(cl_package_name, *c) << endl;
}
else
{