aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-30 09:33:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-10-30 09:33:30 +0000
commit9fb047ef5afb5884f6a3ccf809d1614711653ef2 (patch)
tree72481de5576917b3fffdaa2cdce30d933df2d0b2
parent86fad01ae67aa270939331cf06c055a84e6740a0 (diff)
downloadpaludis-9fb047ef5afb5884f6a3ccf809d1614711653ef2.tar.gz
paludis-9fb047ef5afb5884f6a3ccf809d1614711653ef2.tar.xz
New improved inquisitio. Fixes: ticket:388
-rw-r--r--NEWS2
-rw-r--r--src/clients/inquisitio/Makefile.am20
-rw-r--r--src/clients/inquisitio/command_line.cc42
-rw-r--r--src/clients/inquisitio/command_line.hh36
-rw-r--r--src/clients/inquisitio/do_search.cc279
-rw-r--r--src/clients/inquisitio/exact_matcher.cc (renamed from src/clients/inquisitio/name_extractor.cc)37
-rw-r--r--src/clients/inquisitio/exact_matcher.hh (renamed from src/clients/inquisitio/description_extractor.hh)19
-rw-r--r--src/clients/inquisitio/extractor.cc32
-rw-r--r--src/clients/inquisitio/extractor.hh26
-rw-r--r--src/clients/inquisitio/key_extractor.cc403
-rw-r--r--src/clients/inquisitio/key_extractor.hh42
-rw-r--r--src/clients/inquisitio/matcher.hh2
-rw-r--r--src/clients/inquisitio/name_description_extractor.cc (renamed from src/clients/inquisitio/description_extractor.cc)43
-rw-r--r--src/clients/inquisitio/name_description_extractor.hh (renamed from src/clients/inquisitio/name_extractor.hh)11
-rw-r--r--src/clients/inquisitio/query_task.cc13
-rw-r--r--src/clients/inquisitio/query_task.hh11
16 files changed, 802 insertions, 216 deletions
diff --git a/NEWS b/NEWS
index d5e9024..00d2989 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ trunk/:
* Paludis now fully supports filenames containing spaces.
+ * New, much more flexible, faster inquisitio.
+
* Bug fixes: --dl-deps-default works again. More
robustness/compilance improvements for reconcilio, including
proper handling of ELF files that use the non-native byte order.
diff --git a/src/clients/inquisitio/Makefile.am b/src/clients/inquisitio/Makefile.am
index 884a63a..4bfbda1 100644
--- a/src/clients/inquisitio/Makefile.am
+++ b/src/clients/inquisitio/Makefile.am
@@ -28,15 +28,16 @@ man_inquisitio_LDADD = \
$(PCREPLUSPLUS_LIBS)
inquisitio_SOURCES = \
- command_line.hh command_line.cc \
- matcher.hh matcher.cc \
- pcre_matcher.hh pcre_matcher.cc \
- text_matcher.hh text_matcher.cc \
- extractor.hh extractor.cc \
- description_extractor.hh description_extractor.cc \
- name_extractor.hh name_extractor.cc \
- do_search.hh do_search.cc \
- query_task.hh query_task.cc \
+ command_line.hh command_line.cc \
+ matcher.hh matcher.cc \
+ pcre_matcher.hh pcre_matcher.cc \
+ text_matcher.hh text_matcher.cc \
+ exact_matcher.hh exact_matcher.cc \
+ do_search.hh do_search.cc \
+ query_task.hh query_task.cc \
+ extractor.hh extractor.cc \
+ name_description_extractor.hh name_description_extractor.cc \
+ key_extractor.hh key_extractor.cc \
inquisitio.cc
inquisitio_LDADD = \
@@ -85,3 +86,4 @@ distcheck-deps : distcheck-deps-subdirs
distcheck-deps-subdirs :
for s in $(SUBDIRS) . ; do if test x$$s = x. ; then $(MAKE) distcheck-deps-local || exit 1 ; \
else $(MAKE) -C $$s distcheck-deps || exit 1 ; fi ; done
+
diff --git a/src/clients/inquisitio/command_line.cc b/src/clients/inquisitio/command_line.cc
index 9238498..6264bd5 100644
--- a/src/clients/inquisitio/command_line.cc
+++ b/src/clients/inquisitio/command_line.cc
@@ -42,26 +42,42 @@ CommandLine::CommandLine() :
a_no_color(&a_no_colour, "no-color"),
a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"),
- search_args(this, "Search options",
- "Options that are relevant for the search action."),
- a_matcher(&search_args, "matcher", 'm', "Which match algorithm to use",
+ match_args(this, "Matching options",
+ "Options that control which packages are matched."),
+ a_keys(&match_args, "keys", 'k', "Match using listed metadata keys, rather than name and description"),
+ a_matcher(&match_args, "matcher", 'm', "Which match algorithm to use",
paludis::args::EnumArg::EnumArgOptions
("text", "Simple text match")
- ("pcre", "Regular expression match using pcre"),
+ ("pcre", "Regular expression match using pcre")
+ ("exact", "Exact text match"),
"text"),
- a_extractors(&search_args, "extractors", 'e', "Which extractors to use",
- paludis::args::StringSetArg::StringSetArgOptions
- ("description", "Match against description (default)")
- ("name", "Match against package name")
- ("homepage", "Match against homepage")),
+ a_flatten(&match_args, "flatten", 'f', "Flatten spec trees, rather than matching against individual items"),
+ a_enabled_only(&match_args, "enabled-only", 'e', "When searching spec trees, only look in enabled subtrees"),
- a_repository(&search_args, "repository", '\0', "Matches with this repository name only",
+ filter_args(this, "Filter options",
+ "Options that control whether or not a package is considered for matching."),
+
+ a_repository(&filter_args, "repository", 'r', "Matches with this repository name only",
paludis::args::StringSetArg::StringSetArgOptions(), &paludis::RepositoryNameValidator::validate),
- a_repository_format(&search_args, "repository-format", '\0', "Matches with this repository format only"),
- a_category(&search_args, "category", '\0', "Matches with this category name only",
+ a_repository_format(&filter_args, "repository-format", '\0', "Matches with this repository format only"),
+ a_category(&filter_args, "category", '\0', "Matches with this category name only",
paludis::args::StringSetArg::StringSetArgOptions(), &paludis::CategoryNamePartValidator::validate),
- a_package(&search_args, "package", '\0', "Matches with this package name only",
+ a_package(&filter_args, "package", '\0', "Matches with this package name only",
paludis::args::StringSetArg::StringSetArgOptions(), &paludis::PackageNamePartValidator::validate),
+ a_visible_only(&filter_args, "visible-only", 'v', "Only consider visible packages"),
+ a_kind(&filter_args, "kind", 'k', "Packages of this kind only",
+ paludis::args::EnumArg::EnumArgOptions
+ ("installable", "Installable packages")
+ ("installed", "Installed packages")
+ ("all", "All packages"),
+ "installable"),
+
+ output_args(this, "Output options",
+ "Options that control how output is generated."),
+
+ a_list(&output_args, "list", 'l', "Output a package name list only"),
+ a_show_dependencies(&output_args, "show-dependencies", 'D', "Show dependencies"),
+ a_show_metadata(&output_args, "show-metadata", 'M', "Show raw metadata"),
deprecated_args(this, "Deprecated options", "Deprecated options."),
a_config_suffix(&deprecated_args, "config-suffix", 'c',
diff --git a/src/clients/inquisitio/command_line.hh b/src/clients/inquisitio/command_line.hh
index 9ae4b9d..128ea2c 100644
--- a/src/clients/inquisitio/command_line.hh
+++ b/src/clients/inquisitio/command_line.hh
@@ -24,13 +24,6 @@
#include <paludis/util/instantiation_policy.hh>
#include <paludis/args/log_level_arg.hh>
-/** \file
- * Declarations for the CommandLine class.
- */
-
-/**
- * Our command line.
- */
class CommandLine :
public paludis::args::ArgsHandler,
public paludis::InstantiationPolicy<CommandLine, paludis::instantiation_method::SingletonTag>
@@ -38,10 +31,7 @@ class CommandLine :
friend class paludis::InstantiationPolicy<CommandLine, paludis::instantiation_method::SingletonTag>;
private:
- /// Constructor.
CommandLine();
-
- /// Destructor.
~CommandLine();
public:
@@ -76,17 +66,37 @@ class CommandLine :
///}
- ///\name Search arguments
+ ///\name Matching arguments
///\{
- paludis::args::ArgsGroup search_args;
+ paludis::args::ArgsGroup match_args;
+ paludis::args::StringSetArg a_keys;
paludis::args::EnumArg a_matcher;
- paludis::args::StringSetArg a_extractors;
+ paludis::args::SwitchArg a_flatten;
+ paludis::args::SwitchArg a_enabled_only;
+ ///\}
+
+ ///\name Filter arguments
+ ///\{
+
+ paludis::args::ArgsGroup filter_args;
paludis::args::StringSetArg a_repository;
paludis::args::StringSetArg a_repository_format;
paludis::args::StringSetArg a_category;
paludis::args::StringSetArg a_package;
+ paludis::args::SwitchArg a_visible_only;
+ paludis::args::EnumArg a_kind;
+
+ ///\}
+
+ ///\name Output arguments
+ ///\{
+
+ paludis::args::ArgsGroup output_args;
+ paludis::args::SwitchArg a_list;
+ paludis::args::SwitchArg a_show_dependencies;
+ paludis::args::SwitchArg a_show_metadata;
///\}
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc
index 82b187d..c5d5b5c 100644
--- a/src/clients/inquisitio/do_search.cc
+++ b/src/clients/inquisitio/do_search.cc
@@ -21,118 +21,257 @@
#include "command_line.hh"
#include "matcher.hh"
#include "extractor.hh"
+#include "key_extractor.hh"
+#include "name_description_extractor.hh"
#include "query_task.hh"
#include <paludis/environment.hh>
#include <paludis/query.hh>
#include <paludis/package_database.hh>
+#include <paludis/action.hh>
#include <paludis/package_id.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
+#include <paludis/util/future-impl.hh>
+#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/tr1_functional.hh>
#include <list>
#include <set>
+#include <map>
#include <iostream>
#include <algorithm>
using namespace paludis;
using namespace inquisitio;
+namespace
+{
+ struct Eligible
+ {
+ typedef bool result;
+
+ const bool visible_only;
+ tr1::shared_ptr<SupportsActionTestBase> action_test;
+
+ Eligible(const bool v, const std::string & k) :
+ visible_only(v)
+ {
+ if (k == "all")
+ {
+ }
+ else if (k == "installable")
+ action_test.reset(new SupportsActionTest<InstallAction>());
+ else if (k == "installed")
+ action_test.reset(new SupportsActionTest<InstalledAction>());
+ else
+ throw InternalError(PALUDIS_HERE, "Bad --kind '" + k + "'");
+ }
+
+ bool operator() (const PackageID & id) const
+ {
+ if (action_test && ! id.supports_action(*action_test))
+ return false;
+
+ if (visible_only)
+ return ! id.masked();
+ else
+ return true;
+ }
+ };
+
+ struct Matches
+ {
+ typedef bool result;
+
+ const std::list<tr1::shared_ptr<Matcher> > & matchers;
+ const std::list<tr1::shared_ptr<Extractor> > & extractors;
+
+ Matches(
+ const std::list<tr1::shared_ptr<Matcher> > & m,
+ const std::list<tr1::shared_ptr<Extractor> > & e) :
+ matchers(m),
+ extractors(e)
+ {
+ }
+
+ bool operator() (const PackageID & id) const
+ {
+ for (std::list<tr1::shared_ptr<Extractor> >::const_iterator e(extractors.begin()), e_end(extractors.end()) ;
+ e != e_end ; ++e)
+ for (std::list<tr1::shared_ptr<Matcher> >::const_iterator m(matchers.begin()), m_end(matchers.end()) ;
+ m != m_end ; ++m)
+ if ((**e)(**m, id))
+ return true;
+
+ return false;
+ }
+ };
+
+ tr1::shared_ptr<const PackageID> fetch_id(
+ const Environment & env,
+ const tr1::shared_ptr<const Repository> & r,
+ const QualifiedPackageName & q,
+ const tr1::function<bool (const PackageID &)> & e,
+ const tr1::function<bool (const PackageID &)> & m)
+ {
+ tr1::shared_ptr<const PackageIDSequence> ids(r->package_ids(q));
+ if (ids->empty())
+ return tr1::shared_ptr<const PackageID>();
+ else
+ {
+ std::list<tr1::shared_ptr<const PackageID> > sids(ids->begin(), ids->end());
+ PackageIDComparator c(env.package_database().get());
+ sids.sort(tr1::ref(c));
+
+ for (std::list<tr1::shared_ptr<const PackageID> >::const_reverse_iterator i(sids.rbegin()), i_end(sids.rend()) ;
+ i != i_end ; ++i)
+ if (e(**i))
+ {
+ if (m(**i))
+ return *i;
+ else
+ return tr1::shared_ptr<const PackageID>();
+ }
+
+ return tr1::shared_ptr<const PackageID>();
+ }
+ }
+}
+
int
do_search(const Environment & env)
{
- std::list<tr1::shared_ptr<Matcher> > matchers;
- std::list<tr1::shared_ptr<Extractor> > extractors;
+ using namespace tr1::placeholders;
+ std::list<tr1::shared_ptr<Matcher> > matchers;
for (CommandLine::ParametersConstIterator p(CommandLine::get_instance()->begin_parameters()),
p_end(CommandLine::get_instance()->end_parameters()) ; p != p_end ; ++p)
matchers.push_back(MatcherMaker::get_instance()->find_maker(
CommandLine::get_instance()->a_matcher.argument())(*p));
- for (paludis::args::StringSetArg::ConstIterator p(CommandLine::get_instance()->a_extractors.begin_args()),
- p_end(CommandLine::get_instance()->a_extractors.end_args()) ; p != p_end ; ++p)
- extractors.push_back(ExtractorMaker::get_instance()->find_maker(*p)(env));
-
- if (extractors.empty())
- extractors.push_back(ExtractorMaker::get_instance()->find_maker("name")(env));
-
- std::set<QualifiedPackageName> pkgs;
+ std::list<tr1::shared_ptr<Extractor> > extractors;
+ if (CommandLine::get_instance()->a_keys.begin_args() == CommandLine::get_instance()->a_keys.end_args())
+ extractors.push_back(make_shared_ptr(new NameDescriptionExtractor));
+ else
+ for (args::StringSetArg::ConstIterator i(CommandLine::get_instance()->a_keys.begin_args()),
+ i_end(CommandLine::get_instance()->a_keys.end_args()) ; i != i_end ; ++i)
+ extractors.push_back(make_shared_ptr(new KeyExtractor(*i,
+ CommandLine::get_instance()->a_flatten.specified(),
+ CommandLine::get_instance()->a_enabled_only.specified(),
+ env)));
- for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository>
- r(env.package_database()->begin_repositories()), r_end(env.package_database()->end_repositories()) ;
- r != r_end ; ++r)
+ std::list<tr1::shared_ptr<const Repository> > repos;
+ for (PackageDatabase::RepositoryConstIterator r(env.package_database()->begin_repositories()),
+ r_end(env.package_database()->end_repositories()) ; r != r_end ; ++r)
{
- if (CommandLine::get_instance()->a_repository.specified())
- if (CommandLine::get_instance()->a_repository.end_args() == std::find(
- CommandLine::get_instance()->a_repository.begin_args(),
+ if (CommandLine::get_instance()->a_repository.begin_args() != CommandLine::get_instance()->a_repository.end_args())
+ if (CommandLine::get_instance()->a_repository.end_args() ==
+ std::find_if(CommandLine::get_instance()->a_repository.begin_args(),
CommandLine::get_instance()->a_repository.end_args(),
- stringify(r->name())))
+ tr1::bind(std::equal_to<std::string>(), _1, stringify((*r)->name()))))
continue;
- if (CommandLine::get_instance()->a_repository_format.specified())
- if (CommandLine::get_instance()->a_repository_format.end_args() == std::find(
- CommandLine::get_instance()->a_repository_format.begin_args(),
+
+ if (CommandLine::get_instance()->a_repository_format.begin_args() != CommandLine::get_instance()->a_repository_format.end_args())
+ if (CommandLine::get_instance()->a_repository_format.end_args() ==
+ std::find_if(CommandLine::get_instance()->a_repository_format.begin_args(),
CommandLine::get_instance()->a_repository_format.end_args(),
- r->format()))
+ tr1::bind(std::equal_to<std::string>(), _1, stringify((*r)->format()))))
continue;
- tr1::shared_ptr<const CategoryNamePartSet> cat_names(r->category_names());
- for (CategoryNamePartSet::ConstIterator c(cat_names->begin()), c_end(cat_names->end()) ;
- c != c_end ; ++c)
+ if (CommandLine::get_instance()->a_kind.argument() == "installable")
{
- if (CommandLine::get_instance()->a_category.specified())
- if (CommandLine::get_instance()->a_category.end_args() == std::find(
- CommandLine::get_instance()->a_category.begin_args(),
- CommandLine::get_instance()->a_category.end_args(),
- stringify(*c)))
- continue;
-
- tr1::shared_ptr<const QualifiedPackageNameSet> pkg_names(r->package_names(*c));
- for (QualifiedPackageNameSet::ConstIterator p(pkg_names->begin()), p_end(pkg_names->end()) ;
- p != p_end ; ++p)
- pkgs.insert(*p);
+ if (! (*r)->some_ids_might_support_action(SupportsActionTest<InstallAction>()))
+ continue;
}
+ else if (CommandLine::get_instance()->a_kind.argument() == "installed")
+ {
+ if (! (*r)->some_ids_might_support_action(SupportsActionTest<InstalledAction>()))
+ continue;
+ }
+ else if (CommandLine::get_instance()->a_kind.argument() == "all")
+ {
+ }
+ else
+ throw InternalError(PALUDIS_HERE, "Bad --kind '" + CommandLine::get_instance()->a_kind.argument() + "'");
+
+ repos.push_back(*r);
}
- for (std::set<QualifiedPackageName>::const_iterator p(pkgs.begin()), p_end(pkgs.end()) ;
- p != p_end ; ++p)
+ std::set<CategoryNamePart> cats;
+ if (CommandLine::get_instance()->a_category.begin_args() != CommandLine::get_instance()->a_category.end_args())
+ std::copy(CommandLine::get_instance()->a_category.begin_args(), CommandLine::get_instance()->a_category.end_args(),
+ create_inserter<CategoryNamePart>(std::inserter(cats, cats.begin())));
+ else
{
- tr1::shared_ptr<const PackageIDSequence>
- entries(env.package_database()->query(
- query::Package(*p), qo_order_by_version)),
- preferred_entries(env.package_database()->query(query::Package(*p) &
- query::InstalledAtRoot(env.root()), qo_order_by_version));
-
- if (entries->empty())
- continue;
- if (preferred_entries->empty())
- preferred_entries = entries;
-
- tr1::shared_ptr<const PackageID> display_entry(*preferred_entries->last());
- for (PackageIDSequence::ConstIterator i(preferred_entries->begin()),
- i_end(preferred_entries->end()) ; i != i_end ; ++i)
- if (! (*i)->masked())
- display_entry = *i;
-
- bool match(false);
- for (std::list<tr1::shared_ptr<Extractor> >::const_iterator x(extractors.begin()),
- x_end(extractors.end()) ; x != x_end && ! match ; ++x)
- {
- std::string xx((**x)(*display_entry));
- for (std::list<tr1::shared_ptr<Matcher> >::const_iterator m(matchers.begin()),
- m_end(matchers.end()) ; m != m_end && ! match ; ++m)
- if ((**m)(xx))
- match = true;
- }
+ std::list<tr1::shared_ptr<Future<tr1::shared_ptr<const CategoryNamePartSet> > > > acats;
+ for (std::list<tr1::shared_ptr<const Repository> >::const_iterator r(repos.begin()), r_end(repos.end()) ;
+ r != r_end ; ++r)
+ acats.push_back(make_shared_ptr(new Future<tr1::shared_ptr<const CategoryNamePartSet> >(
+ tr1::bind(&Repository::category_names, *r))));
+
+ for (std::list<tr1::shared_ptr<Future<tr1::shared_ptr<const CategoryNamePartSet> > > >::const_iterator
+ c(acats.begin()), c_end(acats.end()) ;
+ c != c_end ; ++c)
+ std::copy((**c)()->begin(), (**c)()->end(), std::inserter(cats, cats.begin()));
+ }
- if (! match)
- continue;
+ std::set<QualifiedPackageName> qpns;
+ if (CommandLine::get_instance()->a_package.begin_args() != CommandLine::get_instance()->a_package.end_args())
+ {
+ for (std::set<CategoryNamePart>::const_iterator c(cats.begin()), c_end(cats.end()) ;
+ c != c_end ; ++c)
+ for (args::StringSetArg::ConstIterator i(CommandLine::get_instance()->a_package.begin_args()),
+ i_end(CommandLine::get_instance()->a_package.end_args()) ; i != i_end ; ++i)
+ qpns.insert(*c + PackageNamePart(*i));
+ }
+ else
+ {
+ std::list<tr1::shared_ptr<Future<tr1::shared_ptr<const QualifiedPackageNameSet> > > > aqpns;
+ for (std::list<tr1::shared_ptr<const Repository> >::const_iterator r(repos.begin()), r_end(repos.end()) ;
+ r != r_end ; ++r)
+ for (std::set<CategoryNamePart>::const_iterator c(cats.begin()), c_end(cats.end()) ;
+ c != c_end ; ++c)
+ aqpns.push_back(make_shared_ptr(new Future<tr1::shared_ptr<const QualifiedPackageNameSet> >(
+ tr1::bind(&Repository::package_names, *r, *c))));
- InquisitioQueryTask query(&env);
- query.show(PackageDepSpec(
- tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(display_entry->name()))),
- display_entry);
+ for (std::list<tr1::shared_ptr<Future<tr1::shared_ptr<const QualifiedPackageNameSet> > > >::const_iterator
+ q(aqpns.begin()), q_end(aqpns.end()) ;
+ q != q_end ; ++q)
+ std::copy((**q)()->begin(), (**q)()->end(), std::inserter(qpns, qpns.begin()));
}
+ Eligible eligible(
+ CommandLine::get_instance()->a_visible_only.specified(),
+ CommandLine::get_instance()->a_kind.argument());
+
+ Matches matches(
+ matchers,
+ extractors
+ );
+
+ std::multimap<QualifiedPackageName, tr1::shared_ptr<Future<tr1::shared_ptr<const PackageID> > > > ids;
+ for (std::list<tr1::shared_ptr<const Repository> >::const_iterator r(repos.begin()), r_end(repos.end()) ;
+ r != r_end ; ++r)
+ for (std::set<QualifiedPackageName>::const_iterator q(qpns.begin()), q_end(qpns.end()) ;
+ q != q_end ; ++q)
+ ids.insert(std::make_pair(*q, make_shared_ptr(new Future<tr1::shared_ptr<const PackageID> >(
+ tr1::bind(&fetch_id, tr1::cref(env), *r, *q, eligible, matches)))));
+
+ std::map<QualifiedPackageName, tr1::shared_ptr<const PackageID> > show_ids;
+ for (std::multimap<QualifiedPackageName, tr1::shared_ptr<Future<tr1::shared_ptr<const PackageID> > > >::const_iterator
+ i(ids.begin()), i_end(ids.end()) ; i != i_end ; ++i)
+ if ((*i->second)())
+ show_ids[i->first] = (*i->second)();
+
+ if (show_ids.empty())
+ return 1;
+
+ InquisitioQueryTask task(&env);
+ for (std::map<QualifiedPackageName, tr1::shared_ptr<const PackageID> >::const_iterator
+ i(show_ids.begin()), i_end(show_ids.end()) ; i != i_end ; ++i)
+ task.show(PackageDepSpec(make_shared_ptr(new QualifiedPackageName(i->first))), i->second);
+
return 0;
}
diff --git a/src/clients/inquisitio/name_extractor.cc b/src/clients/inquisitio/exact_matcher.cc
index 91d9da1..a930a40 100644
--- a/src/clients/inquisitio/name_extractor.cc
+++ b/src/clients/inquisitio/exact_matcher.cc
@@ -17,22 +17,41 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "name_extractor.hh"
-#include <paludis/util/stringify.hh>
+#include "exact_matcher.hh"
#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/package_id.hh>
-#include <paludis/name.hh>
+#include <string.h>
-using namespace inquisitio;
using namespace paludis;
+using namespace inquisitio;
+
+namespace paludis
+{
+ template<>
+ struct Implementation<ExactMatcher>
+ {
+ std::string pattern;
+
+ Implementation(const std::string & s) :
+ pattern(s)
+ {
+ }
+ };
+}
-NameExtractor::NameExtractor(const paludis::Environment &)
+ExactMatcher::ExactMatcher(const std::string & s) :
+ PrivateImplementationPattern<ExactMatcher>(new Implementation<ExactMatcher>(s))
{
}
-std::string
-NameExtractor::operator() (const PackageID & p) const
+bool
+ExactMatcher::operator() (const std::string & s) const
{
- return stringify(p.name());
+ return 0 == strcasecmp(s.c_str(), _imp->pattern.c_str());
}
+ExactMatcher::~ExactMatcher()
+{
+}
+
+
+
diff --git a/src/clients/inquisitio/description_extractor.hh b/src/clients/inquisitio/exact_matcher.hh
index 816a896..cf33549 100644
--- a/src/clients/inquisitio/description_extractor.hh
+++ b/src/clients/inquisitio/exact_matcher.hh
@@ -17,22 +17,23 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_DESCRIPTION_EXTRACTOR_HH
-#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_DESCRIPTION_EXTRACTOR_HH 1
+#ifndef PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_EXACT_MATCHER_HH
+#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_EXACT_MATCHER_HH 1
-#include <src/clients/inquisitio/extractor.hh>
+#include <src/clients/inquisitio/matcher.hh>
+#include <paludis/util/private_implementation_pattern.hh>
namespace inquisitio
{
- class DescriptionExtractor :
- public Extractor,
- private paludis::PrivateImplementationPattern<DescriptionExtractor>
+ class ExactMatcher :
+ public Matcher,
+ private paludis::PrivateImplementationPattern<ExactMatcher>
{
public:
- DescriptionExtractor(const paludis::Environment &);
- virtual ~DescriptionExtractor();
+ ExactMatcher(const std::string &);
+ virtual ~ExactMatcher();
- std::string operator() (const paludis::PackageID &) const;
+ bool operator() (const std::string &) const;
};
}
diff --git a/src/clients/inquisitio/extractor.cc b/src/clients/inquisitio/extractor.cc
index b7e4ab9..3a05695 100644
--- a/src/clients/inquisitio/extractor.cc
+++ b/src/clients/inquisitio/extractor.cc
@@ -18,42 +18,10 @@
*/
#include "extractor.hh"
-#include "description_extractor.hh"
-#include "name_extractor.hh"
-#include <paludis/util/virtual_constructor-impl.hh>
-#include <paludis/util/private_implementation_pattern-impl.hh>
-#include <paludis/util/instantiation_policy-impl.hh>
using namespace inquisitio;
using namespace paludis;
-template class paludis::VirtualConstructor<std::string,
- tr1::shared_ptr<Extractor> (*) (const paludis::Environment &),
- paludis::virtual_constructor_not_found::ThrowException<NoSuchExtractorError> >;
-
-template class paludis::InstantiationPolicy<ExtractorMaker, paludis::instantiation_method::SingletonTag>;
-
-NoSuchExtractorError::NoSuchExtractorError(const std::string & m) throw () :
- Exception("No such extractor '" + m + "'")
-{
-}
-
-namespace
-{
- template <typename M_>
- tr1::shared_ptr<Extractor>
- make(const Environment & e)
- {
- return tr1::shared_ptr<Extractor>(new M_(e));
- }
-}
-
-ExtractorMaker::ExtractorMaker()
-{
- register_maker("description", &make<DescriptionExtractor>);
- register_maker("name", &make<NameExtractor>);
-}
-
Extractor::Extractor()
{
}
diff --git a/src/clients/inquisitio/extractor.hh b/src/clients/inquisitio/extractor.hh
index 15eeb68..d2546da 100644
--- a/src/clients/inquisitio/extractor.hh
+++ b/src/clients/inquisitio/extractor.hh
@@ -22,12 +22,12 @@
#include <string>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/virtual_constructor.hh>
-#include <paludis/environment-fwd.hh>
#include <paludis/package_id-fwd.hh>
namespace inquisitio
{
+ class Matcher;
+
class Extractor :
private paludis::InstantiationPolicy<Extractor, paludis::instantiation_method::NonCopyableTag>
{
@@ -37,27 +37,7 @@ namespace inquisitio
public:
virtual ~Extractor();
- virtual std::string operator() (const paludis::PackageID &) const = 0;
- };
-
- class NoSuchExtractorError :
- public paludis::Exception
- {
- public:
- NoSuchExtractorError(const std::string &) throw ();
- };
-
- class ExtractorMaker :
- public paludis::InstantiationPolicy<ExtractorMaker, paludis::instantiation_method::SingletonTag>,
- public paludis::VirtualConstructor<
- std::string,
- paludis::tr1::shared_ptr<Extractor> (*) (const paludis::Environment &),
- paludis::virtual_constructor_not_found::ThrowException<NoSuchExtractorError> >
- {
- friend class paludis::InstantiationPolicy<ExtractorMaker, paludis::instantiation_method::SingletonTag>;
-
- private:
- ExtractorMaker();
+ virtual bool operator() (const Matcher &, const paludis::PackageID &) const = 0;
};
}
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
new file mode 100644
index 0000000..3081dac
--- /dev/null
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -0,0 +1,403 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "key_extractor.hh"
+#include "matcher.hh"
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/tr1_functional.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/stringify_formatter.hh>
+#include <paludis/dep_spec.hh>
+#include <paludis/environment.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
+#include <algorithm>
+
+using namespace paludis;
+using namespace inquisitio;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<KeyExtractor>
+ {
+ const std::string key;
+ const bool flatten;
+ const bool visible_only;
+ const Environment & env;
+
+ Implementation(const std::string & k, const bool f, const bool v, const Environment & e) :
+ key(k),
+ flatten(f),
+ visible_only(v),
+ env(e)
+ {
+ }
+ };
+}
+
+KeyExtractor::KeyExtractor(const std::string & k, const bool f, const bool v,
+ const Environment & e) :
+ PrivateImplementationPattern<KeyExtractor>(new Implementation<KeyExtractor>(k, f, v, e))
+{
+}
+
+KeyExtractor::~KeyExtractor()
+{
+}
+
+namespace
+{
+ class TreeVisitor :
+ public ConstVisitor<GenericSpecTree>,
+ public ConstVisitor<GenericSpecTree>::VisitConstSequence<TreeVisitor, AllDepSpec>,
+ public ConstVisitor<GenericSpecTree>::VisitConstSequence<TreeVisitor, AnyDepSpec>
+ {
+ private:
+ const std::string _key;
+ const bool _visible_only;
+ const Environment & _env;
+ const PackageID & _id;
+ const Matcher & _m;
+
+ public:
+ bool result;
+
+ TreeVisitor(const std::string & k, const bool v, const Environment & e,
+ const PackageID & i, const Matcher & m) :
+ _key(k),
+ _visible_only(v),
+ _env(e),
+ _id(i),
+ _m(m),
+ result(false)
+ {
+ }
+
+ using ConstVisitor<GenericSpecTree>::VisitConstSequence<TreeVisitor, AllDepSpec>::visit_sequence;
+ using ConstVisitor<GenericSpecTree>::VisitConstSequence<TreeVisitor, AnyDepSpec>::visit_sequence;
+
+ void visit_sequence(const UseDepSpec & u,
+ GenericSpecTree::ConstSequenceIterator cur,
+ GenericSpecTree::ConstSequenceIterator end)
+ {
+ if (! result)
+ {
+ result |= _m(stringify(u));
+
+ if (! result)
+ {
+ if (! _visible_only)
+ std::for_each(cur, end, accept_visitor(*this));
+ else if (u.inverse() ^ _env.query_use(u.flag(), _id))
+ std::for_each(cur, end, accept_visitor(*this));
+ }
+ }
+ }
+
+ void visit_leaf(const SimpleURIDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
+ void visit_leaf(const PlainTextDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
+ void visit_leaf(const FetchableURIDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
+ void visit_leaf(const PackageDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
+ void visit_leaf(const BlockDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
+ void visit_leaf(const LicenseDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
+ void visit_leaf(const URILabelsDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
+ void visit_leaf(const DependencyLabelsDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+
+ void visit_leaf(const NamedSetDepSpec & s)
+ {
+ if (! result)
+ result |= _m(stringify(s));
+ }
+ };
+
+ class KeyVisitor :
+ public ConstVisitor<MetadataKeyVisitorTypes>
+ {
+ private:
+ const std::string _key;
+ const bool _flatten;
+ const bool _visible_only;
+ const Environment & _env;
+ const PackageID & _id;
+ const Matcher & _m;
+
+ public:
+ bool result;
+
+ KeyVisitor(const std::string & k, const bool f, const bool v, const Environment & e,
+ const PackageID & i, const Matcher & m) :
+ _key(k),
+ _flatten(f),
+ _visible_only(v),
+ _env(e),
+ _id(i),
+ _m(m),
+ result(false)
+ {
+ }
+
+ void visit(const MetadataStringKey & s)
+ {
+ result = _m(s.value());
+ }
+
+ void visit(const MetadataTimeKey & s)
+ {
+ result = _m(stringify(s.value()));
+ }
+
+ void visit(const MetadataContentsKey &)
+ {
+ }
+
+ void visit(const MetadataRepositoryMaskInfoKey &)
+ {
+ }
+
+ void visit(const MetadataFSEntryKey & s)
+ {
+ result = _m(stringify(s.value()));
+ }
+
+ void visit(const MetadataPackageIDKey & s)
+ {
+ result = _m(stringify(*s.value()));
+ }
+
+ void visit(const MetadataSetKey<UseFlagNameSet> & s)
+ {
+ using namespace tr1::placeholders;
+
+ if (_flatten)
+ result = _m(join(s.value()->begin(), s.value()->end(), " "));
+ else
+ result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
+ tr1::bind(&Matcher::operator(), tr1::cref(_m), tr1::bind(&stringify<UseFlagName>, _1)));
+ }
+
+ void visit(const MetadataSetKey<IUseFlagSet> & s)
+ {
+ using namespace tr1::placeholders;
+
+ if (_flatten)
+ result = _m(join(s.value()->begin(), s.value()->end(), " "));
+ else
+ result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
+ tr1::bind(&Matcher::operator(), tr1::cref(_m), tr1::bind(&stringify<IUseFlag>, _1)));
+ }
+
+ void visit(const MetadataSetKey<KeywordNameSet> & s)
+ {
+ using namespace tr1::placeholders;
+
+ if (_flatten)
+ result = _m(join(s.value()->begin(), s.value()->end(), " "));
+ else
+ result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
+ tr1::bind(&Matcher::operator(), tr1::cref(_m), tr1::bind(&stringify<KeywordName>, _1)));
+ }
+
+ void visit(const MetadataSetKey<Set<std::string> > & s)
+ {
+ using namespace tr1::placeholders;
+
+ if (_flatten)
+ result = _m(join(s.value()->begin(), s.value()->end(), " "));
+ else
+ result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
+ tr1::bind(&Matcher::operator(), tr1::cref(_m), _1));
+ }
+
+ void visit(const MetadataSetKey<PackageIDSequence> & s)
+ {
+ using namespace tr1::placeholders;
+
+ if (_flatten)
+ result = _m(join(indirect_iterator(s.value()->begin()), indirect_iterator(s.value()->end()), " "));
+ else
+ result = indirect_iterator(s.value()->end()) != std::find_if(
+ indirect_iterator(s.value()->begin()), indirect_iterator(s.value()->end()),
+ tr1::bind(&Matcher::operator(), tr1::cref(_m), tr1::bind(&stringify<PackageID>, _1)));
+ }
+
+ void visit(const MetadataSpecTreeKey<RestrictSpecTree> & s)
+ {
+ if (_flatten)
+ {
+ StringifyFormatter f;
+ result = _m(s.pretty_print_flat(f));
+ }
+ else
+ {
+ TreeVisitor v(_key, _visible_only, _env, _id, _m);
+ s.value()->accept(v);
+ result = v.result;
+ }
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> & s)
+ {
+ if (_flatten)
+ {
+ StringifyFormatter f;
+ result = _m(s.pretty_print_flat(f));
+ }
+ else
+ {
+ TreeVisitor v(_key, _visible_only, _env, _id, _m);
+ s.value()->accept(v);
+ result = v.result;
+ }
+ }
+
+ void visit(const MetadataSpecTreeKey<SetSpecTree> & s)
+ {
+ if (_flatten)
+ {
+ StringifyFormatter f;
+ result = _m(s.pretty_print_flat(f));
+ }
+ else
+ {
+ TreeVisitor v(_key, _visible_only, _env, _id, _m);
+ s.value()->accept(v);
+ result = v.result;
+ }
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> & s)
+ {
+ if (_flatten)
+ {
+ StringifyFormatter f;
+ result = _m(s.pretty_print_flat(f));
+ }
+ else
+ {
+ TreeVisitor v(_key, _visible_only, _env, _id, _m);
+ s.value()->accept(v);
+ result = v.result;
+ }
+ }
+
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & s)
+ {
+ if (_flatten)
+ {
+ StringifyFormatter f;
+ result = _m(s.pretty_print_flat(f));
+ }
+ else
+ {
+ TreeVisitor v(_key, _visible_only, _env, _id, _m);
+ s.value()->accept(v);
+ result = v.result;
+ }
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & s)
+ {
+ if (_flatten)
+ {
+ StringifyFormatter f;
+ result = _m(s.pretty_print_flat(f));
+ }
+ else
+ {
+ TreeVisitor v(_key, _visible_only, _env, _id, _m);
+ s.value()->accept(v);
+ result = v.result;
+ }
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> & s)
+ {
+ if (_flatten)
+ {
+ StringifyFormatter f;
+ result = _m(s.pretty_print_flat(f));
+ }
+ else
+ {
+ TreeVisitor v(_key, _visible_only, _env, _id, _m);
+ s.value()->accept(v);
+ result = v.result;
+ }
+ }
+ };
+}
+
+bool
+KeyExtractor::operator() (const Matcher & m, const PackageID & id) const
+{
+ PackageID::MetadataConstIterator mi(id.find_metadata(_imp->key));
+ if (id.end_metadata() == mi)
+ return false;
+
+ KeyVisitor v(_imp->key, _imp->flatten, _imp->visible_only, _imp->env, id, m);
+ (*mi)->accept(v);
+ return v.result;
+}
+
diff --git a/src/clients/inquisitio/key_extractor.hh b/src/clients/inquisitio/key_extractor.hh
new file mode 100644
index 0000000..43122a6
--- /dev/null
+++ b/src/clients/inquisitio/key_extractor.hh
@@ -0,0 +1,42 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_KEY_EXTRACTOR_HH
+#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_KEY_EXTRACTOR_HH 1
+
+#include <src/clients/inquisitio/extractor.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/environment-fwd.hh>
+
+namespace inquisitio
+{
+ class KeyExtractor :
+ private paludis::PrivateImplementationPattern<KeyExtractor>,
+ public Extractor
+ {
+ public:
+ KeyExtractor(const std::string &, const bool flatten, const bool visible_only,
+ const paludis::Environment &);
+ ~KeyExtractor();
+
+ bool operator() (const Matcher &, const paludis::PackageID &) const;
+ };
+}
+
+#endif
diff --git a/src/clients/inquisitio/matcher.hh b/src/clients/inquisitio/matcher.hh
index 5995c8b..af3a759 100644
--- a/src/clients/inquisitio/matcher.hh
+++ b/src/clients/inquisitio/matcher.hh
@@ -35,6 +35,8 @@ namespace inquisitio
Matcher();
public:
+ typedef bool result;
+
virtual ~Matcher();
virtual bool operator() (const std::string &) const = 0;
diff --git a/src/clients/inquisitio/description_extractor.cc b/src/clients/inquisitio/name_description_extractor.cc
index 32ac373..88defad 100644
--- a/src/clients/inquisitio/description_extractor.cc
+++ b/src/clients/inquisitio/name_description_extractor.cc
@@ -17,43 +17,38 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "description_extractor.hh"
-#include <paludis/package_database.hh>
+#include "name_description_extractor.hh"
+#include "matcher.hh"
#include <paludis/package_id.hh>
+#include <paludis/name.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/metadata_key.hh>
-#include <paludis/util/private_implementation_pattern-impl.hh>
using namespace paludis;
using namespace inquisitio;
-namespace paludis
+NameDescriptionExtractor::NameDescriptionExtractor()
{
- template <>
- struct Implementation<DescriptionExtractor>
- {
- const Environment * const env;
-
- Implementation(const Environment & e) :
- env(&e)
- {
- }
- };
}
-DescriptionExtractor::DescriptionExtractor(const Environment & e) :
- PrivateImplementationPattern<DescriptionExtractor>(new Implementation<DescriptionExtractor>(e))
+NameDescriptionExtractor::~NameDescriptionExtractor()
{
}
-DescriptionExtractor::~DescriptionExtractor()
+bool
+NameDescriptionExtractor::operator() (const Matcher & m, const PackageID & id) const
{
-}
+ if (m(stringify(id.name())))
+ return true;
-std::string
-DescriptionExtractor::operator() (const PackageID & p) const
-{
- if (p.short_description_key())
- return p.short_description_key()->value();
- return "";
+ if (id.short_description_key())
+ if (m(id.short_description_key()->value()))
+ return true;
+
+ if (id.long_description_key())
+ if (m(id.long_description_key()->value()))
+ return true;
+
+ return false;
}
diff --git a/src/clients/inquisitio/name_extractor.hh b/src/clients/inquisitio/name_description_extractor.hh
index f2f6633..ee005be 100644
--- a/src/clients/inquisitio/name_extractor.hh
+++ b/src/clients/inquisitio/name_description_extractor.hh
@@ -17,20 +17,21 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_NAME_EXTRACTOR_HH
-#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_NAME_EXTRACTOR_HH 1
+#ifndef PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_NAME_DESCRIPTION_EXTRACTOR_HH
+#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_NAME_DESCRIPTION_EXTRACTOR_HH 1
#include <src/clients/inquisitio/extractor.hh>
namespace inquisitio
{
- class NameExtractor :
+ class NameDescriptionExtractor :
public Extractor
{
public:
- NameExtractor(const paludis::Environment &);
+ NameDescriptionExtractor();
+ ~NameDescriptionExtractor();
- std::string operator() (const paludis::PackageID &) const;
+ bool operator() (const Matcher &, const paludis::PackageID &) const;
};
}
diff --git a/src/clients/inquisitio/query_task.cc b/src/clients/inquisitio/query_task.cc
index 29aaf94..345b1f0 100644
--- a/src/clients/inquisitio/query_task.cc
+++ b/src/clients/inquisitio/query_task.cc
@@ -18,6 +18,7 @@
*/
#include "query_task.hh"
+#include "command_line.hh"
using namespace inquisitio;
using namespace paludis;
@@ -27,3 +28,15 @@ InquisitioQueryTask::InquisitioQueryTask(const Environment * const env) :
{
}
+bool
+InquisitioQueryTask::want_deps() const
+{
+ return CommandLine::get_instance()->a_show_dependencies.specified();
+}
+
+bool
+InquisitioQueryTask::want_raw() const
+{
+ return CommandLine::get_instance()->a_show_metadata.specified();
+}
+
diff --git a/src/clients/inquisitio/query_task.hh b/src/clients/inquisitio/query_task.hh
index 52f2aee..1a98e84 100644
--- a/src/clients/inquisitio/query_task.hh
+++ b/src/clients/inquisitio/query_task.hh
@@ -30,15 +30,8 @@ namespace inquisitio
public:
InquisitioQueryTask(const paludis::Environment * const);
- virtual bool want_deps() const
- {
- return false;
- }
-
- virtual bool want_raw() const
- {
- return false;
- }
+ virtual bool want_deps() const;
+ virtual bool want_raw() const;
};
}