diff options
author | 2011-02-04 20:00:32 +0000 | |
---|---|---|
committer | 2011-02-04 20:00:32 +0000 | |
commit | 8e76744365a37d8cf9816764377cbdd26592e568 (patch) | |
tree | 4b9a1490d65f0062152ce1d9ddfb6211c97920d2 | |
parent | c054c6d7c9be6df0f99a3876f4fbe7608deb023f (diff) | |
download | paludis-8e76744365a37d8cf9816764377cbdd26592e568.tar.gz paludis-8e76744365a37d8cf9816764377cbdd26592e568.tar.xz |
Ding dong, inquisitio is dead
36 files changed, 6 insertions, 2428 deletions
diff --git a/.gitignore b/.gitignore index fd5a3ae72..233a340ef 100644 --- a/.gitignore +++ b/.gitignore @@ -139,7 +139,6 @@ paludis-*.*.*.tar.bz2 /doc/clients/header.html.part /doc/clients/importare.html /doc/clients/index.html -/doc/clients/inquisitio.html /doc/clients/instruo.html /doc/clients/paludis.html /doc/clients/reconcilio.html @@ -505,7 +504,6 @@ paludis-*.*.*.tar.bz2 /src/clients/appareo/appareo /src/clients/cave/cave /src/clients/importare/importare -/src/clients/inquisitio/inquisitio /src/clients/instruo/instruo /src/clients/paludis/paludis /src/clients/reconcilio/reconcilio diff --git a/Makefile.am b/Makefile.am index fb5b48a99..24b533c48 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,7 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-ruby --enable-ruby-doc --enable-vim \ --with-hacked-log-dir='$${DESTDIR}$${prefix}/log_dir' \ --with-repositories=default,accounts,gemcutter \ --with-environments=default,portage \ - --with-clients=default,accerso,appareo,cave,inquisitio,instruo \ + --with-clients=default,accerso,appareo,cave,instruo \ --with-default-distribution=giant-space-monkey \ --enable-htmltidy --enable-search-index diff --git a/bash-completion/Makefile.am b/bash-completion/Makefile.am index 378560c7c..58ef29c99 100644 --- a/bash-completion/Makefile.am +++ b/bash-completion/Makefile.am @@ -1,6 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in noinst_DATA = paludis adjutrix \ - inquisitio \ accerso instruo reconcilio \ importare cave EXTRA_DIST = $(noinst_DATA) diff --git a/bash-completion/inquisitio b/bash-completion/inquisitio deleted file mode 100644 index 953c95db9..000000000 --- a/bash-completion/inquisitio +++ /dev/null @@ -1,77 +0,0 @@ -# Bash completion function for inquisitio -# Written by Mike Kelly -# vim: set et sw=4 sts=4 ts=4 ft=sh : - -# NOTE: This is still a work in progress, don't expect it to work well or -# properly right now. - -_inquisitio() { - local cur prev opts - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - opts="--search -s \ - --version -V \ - --help -h \ - --log-level \ - --no-colour \ - --no-color \ - --environment -E \ - --keys -k \ - --matcher -m \ - --flatten -f \ - --enabled-only -e \ - --not -n \ - --repository -r \ - --repository-format \ - --category \ - --package \ - --visible-only -v \ - --all-versions -a \ - --kind -K \ - --compact \ - --no-compact \ - --show-dependencies -D \ - --show-metadata -M" - - case "${cur}" in - -*) - COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) - return 0 - ;; - *) - case "${prev}" in - ## Enum operators - --log-level) - COMPREPLY=($(compgen -W "debug qa warning silent" -- "${cur}")) - return 0 - ;; - - --matcher|-m) - COMPREPLY=($(compgen -W "text pcre exact" -- "${cur}")) - return 0 - ;; - - --repository|-r) - COMPREPLY=($(compgen -W "$(paludis --log-level silent --list-repositories |sed -n 's,^\* \(.*\),\1,p')" -- "${cur}")) - return 0 - ;; - --repository-format) - COMPREPLY=($(compgen -W "$(paludis --log-level silent --list-repository-formats |sed -n 's,^\* \(.*\),\1,p')" -- "${cur}")) - return 0 - ;; - --category) - COMPREPLY=($(compgen -W "$(paludis --log-level silent --list-categories |sed -n 's,^\* \(.*\),\1,p')" -- "${cur}")) - return 0 - ;; - --kind|-K) - COMPREPLY=($(compgen -W "installable installed all" -- "${cur}")) - return 0 - ;; - - esac - ;; - esac -} -complete -F _inquisitio inquisitio diff --git a/configure.ac b/configure.ac index 4d7f7c5bc..0559a35f2 100644 --- a/configure.ac +++ b/configure.ac @@ -1513,7 +1513,7 @@ AC_DEFINE_UNQUOTED([DEFAULT_DISTRIBUTION], "$DEFAULT_DISTRIBUTION", [Default dis dnl }}} dnl {{{ clients -ALL_CLIENTS="accerso adjutrix appareo cave importare inquisitio instruo paludis reconcilio" +ALL_CLIENTS="accerso adjutrix appareo cave importare instruo paludis reconcilio" ALL_CLIENTS_HTML="" for a in $ALL_CLIENTS ; do ALL_CLIENTS_HTML="$ALL_CLIENTS_HTML $a.html" @@ -1531,7 +1531,6 @@ AC_ARG_WITH([clients], appareo A tool for generating manifests cave The modular Paludis client importare On-the-fly unpackaged installer - inquisitio A search client instruo A metadata generation client paludis The Paludis console client reconcilio A linkage repair tool], @@ -1547,10 +1546,6 @@ AC_SUBST([ALL_CLIENTS]) AC_SUBST([ALL_CLIENTS_HTML]) AC_SUBST([BUILD_CLIENTS]) -if echo $clients | tr ' ' '\n' | grep '^inquisitio$' >/dev/null ; then - need_pcrecpp_check=yes -fi - if echo $clients | tr ' ' '\n' | grep '^cave$' >/dev/null ; then need_resolver=yes need_pcrecpp_check=yes @@ -1599,7 +1594,7 @@ dnl }}} dnl {{{ pcrecpp check if test "x$need_pcrecpp_check" = "xyes" ; then PKG_CHECK_MODULES(PCRECPPDEPS, [libpcrecpp >= 7.8], [], - [AC_MSG_ERROR([pcrecpp (http://www.pcre.org/) is required if --with-clients=inquisitio or --with-clients=cave is used])]) + [AC_MSG_ERROR([pcrecpp (http://www.pcre.org/) is required if --with-clients=cave is used])]) AC_SUBST(PCRECPPDEPS_CFLAGS) AC_SUBST(PCRECPPDEPS_LIBS) fi @@ -1806,7 +1801,6 @@ AC_OUTPUT( src/clients/appareo/Makefile src/clients/cave/Makefile src/clients/importare/Makefile - src/clients/inquisitio/Makefile src/clients/instruo/Makefile src/clients/paludis/Makefile src/clients/reconcilio/Makefile diff --git a/doc/clients/Makefile.am b/doc/clients/Makefile.am index 3b59b05b5..e33ab0439 100644 --- a/doc/clients/Makefile.am +++ b/doc/clients/Makefile.am @@ -156,16 +156,6 @@ $(CAVE_COMMANDS_HTML) : header.html.part footer.html.part fi ; } && \ cat footer.html.part ; } > $@ -inquisitio.html : header.html.part footer.html.part - { cat header.html.part && { \ - if test -x $(top_builddir)/src/clients/inquisitio/man-inquisitio ; then \ - $(top_builddir)/src/clients/inquisitio/man-inquisitio --html ; \ - else \ - echo "<h1>inquisitio</h1>"; \ - echo "<p>Sorry, documentation was generated without support for the inquisitio client.</p>" ; \ - fi ; } && \ - cat footer.html.part ; } > $@ - importare.html : header.html.part footer.html.part { cat header.html.part && { \ if test -x $(top_builddir)/src/clients/importare/man-importare ; then \ diff --git a/doc/clients/index.html.part b/doc/clients/index.html.part index 32c0252ae..8b4e80824 100644 --- a/doc/clients/index.html.part +++ b/doc/clients/index.html.part @@ -14,7 +14,6 @@ <ul> <li><a href="paludis.html">paludis</a>, the original console package management client.</li> <li><a href="importare.html">importare</a>, the unpackaged package installer.</li> - <li><a href="inquisitio.html">inquisitio</a>, the search client.</li> <li><a href="reconcilio.html">reconcilio</a>, a tool for rebuilding packages with broken linkage.</li> </ul> diff --git a/doc/clients/toplinks.html.part.in b/doc/clients/toplinks.html.part.in index 0aa7c4848..6b20c19f0 100644 --- a/doc/clients/toplinks.html.part.in +++ b/doc/clients/toplinks.html.part.in @@ -54,7 +54,7 @@ </td> <td class="currentpage"> - <a href="###TOPURI###clients/inquisitio.html">inquisitio</a> + <a href="###TOPURI###clients/reconcilio.html">reconcilio</a> </td> <td class="currentpage"> @@ -72,7 +72,7 @@ </td> <td class="currentpage"> - <a href="###TOPURI###clients/reconcilio.html">reconcilio</a> + </td> <td class="currentpage"> diff --git a/doc/index.html.part.in b/doc/index.html.part.in index 7f19a9661..0751dc667 100644 --- a/doc/index.html.part.in +++ b/doc/index.html.part.in @@ -89,7 +89,6 @@ the exheres repository format.</p> <ul> <li><a href="clients/paludis.html">paludis</a>, the original console package management client.</li> <li><a href="clients/importare.html">importare</a>, the unpackaged package installer.</li> - <li><a href="clients/inquisitio.html">inquisitio</a>, the search client.</li> <li><a href="clients/reconcilio.html">reconcilio</a>, a tool for rebuilding packages with broken linkage.</li> </ul> diff --git a/src/clients/inquisitio/Makefile.am b/src/clients/inquisitio/Makefile.am deleted file mode 100644 index db96dd355..000000000 --- a/src/clients/inquisitio/Makefile.am +++ /dev/null @@ -1,61 +0,0 @@ -include $(top_srcdir)/misc/common-makefile.am - -AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@ -DEFS= \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DLIBDIR=\"$(libdir)\" - -SUBDIRS = . - -bin_PROGRAMS = inquisitio -noinst_PROGRAMS = man-inquisitio -man_MANS = inquisitio.1 - -inquisitio.1 : man-inquisitio - ./man-inquisitio > $@ - -man_inquisitio_SOURCES = \ - man_inquisitio.cc \ - command_line.hh command_line.cc - -man_inquisitio_LDADD = \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/src/output/liboutput.a \ - $(DYNAMIC_LD_LIBS) \ - $(PCRECPPDEPS_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 \ - 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 = \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/src/output/liboutput.a \ - $(DYNAMIC_LD_LIBS) \ - $(PCRECPPDEPS_LIBS) - -inquisitio_CXXFLAGS = $(AM_CXXFLAGS) $(PCRECPPDEPS_CFLAGS) - -TESTS = version_TEST help_TEST - -EXTRA_DIST = \ - $(man_MANS) \ - $(TESTS) - -DISTCLEANFILES = $(man_MANS) $(noinst_DATA) - diff --git a/src/clients/inquisitio/command_line.cc b/src/clients/inquisitio/command_line.cc deleted file mode 100644 index 06002e9d0..000000000 --- a/src/clients/inquisitio/command_line.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009, 2010 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 "command_line.hh" -#include <paludis/name.hh> -#include <paludis/util/singleton-impl.hh> - -using namespace paludis; - -template class paludis::Singleton<CommandLine>; - -CommandLine::CommandLine() : - ArgsHandler(), - - action_args(main_options_section(), "Actions", - "Selects which basic action to perform. Exactly one action should " - "be specified."), - a_search(&action_args, "search", 's', "Search for a package", false), - a_version(&action_args, "version", 'V', "Display program version", false), - a_help(&action_args, "help", 'h', "Display program help", false), - - general_args(main_options_section(), "General options", - "Options that are relevant for most or all actions."), - a_log_level(&general_args, "log-level", '\0'), - a_no_colour(&general_args, "no-colour", '\0', "Do not use colour", false), - a_no_color(&a_no_colour, "no-color"), - a_force_colour(&general_args, "force-colour", '\0', "Force the use of colour", false), - a_force_color(&a_force_colour, "force-color"), - a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"), - - match_args(main_options_section(), "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") - ("exact", "Exact text match"), - "text"), - a_flatten(&match_args, "flatten", 'f', "Flatten spec trees, rather than matching against individual items", true), - a_enabled_only(&match_args, "enabled-only", 'e', "When searching spec trees, only look in enabled subtrees", true), - a_not(&match_args, "not", 'n', "Select packages that do not match", true), - - filter_args(main_options_section(), "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"), - 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"), - a_package(&filter_args, "package", '\0', "Matches with this package name only"), - a_visible_only(&filter_args, "visible-only", 'v', "Only consider visible packages", true), - a_all_versions(&filter_args, "all-versions", 'a', "Check all versions, rather than only one (slower)", true), - a_kind(&filter_args, "kind", 'K', "Packages of this kind only", - paludis::args::EnumArg::EnumArgOptions - ("installable", "Installable packages") - ("installed", "Installed packages") - ("all", "All packages (default if --repository specified)"), - "installable"), - - output_args(main_options_section(), "Output options", - "Options that control how output is generated."), - - a_compact(&output_args, "compact", '\0', "Display output using one line per entry", true), - a_show_dependencies(&output_args, "show-dependencies", 'D', "Show dependencies", true), - a_show_authors(&output_args, "show-authors", 'A', "Show author information", true), - a_show_metadata(&output_args, "show-metadata", 'M', "Show raw metadata", true) -{ - add_usage_line("[ --search ] [search options] pattern ..."); - add_usage_line("--help"); - - add_environment_variable("INQUISITIO_OPTIONS", "Default command-line options."); - - add_note("Inquisitio is deprecated. Use 'cave search' instead."); -} - -std::string -CommandLine::app_name() const -{ - return "inquisitio"; -} - -std::string -CommandLine::app_synopsis() const -{ - return "A deprecated search client for Paludis, the other package mangler"; -} - -std::string -CommandLine::app_description() const -{ - return - "inquisitio is a deprecated search client for Paludis. 'cave search' should be " - "used instead."; -} - -CommandLine::~CommandLine() -{ -} - - diff --git a/src/clients/inquisitio/command_line.hh b/src/clients/inquisitio/command_line.hh deleted file mode 100644 index 3c444afda..000000000 --- a/src/clients/inquisitio/command_line.hh +++ /dev/null @@ -1,110 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2010 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_COMMAND_LINE_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_COMMAND_LINE_HH 1 - -#include <paludis/args/args.hh> -#include <paludis/util/singleton.hh> -#include <paludis/args/log_level_arg.hh> - -class CommandLine : - public paludis::args::ArgsHandler, - public paludis::Singleton<CommandLine> -{ - friend class paludis::Singleton<CommandLine>; - - private: - CommandLine(); - ~CommandLine(); - - public: - ///\name Program information - ///\{ - - virtual std::string app_name() const; - virtual std::string app_synopsis() const; - virtual std::string app_description() const; - - ///\} - - /// \name Action arguments - ////{ - - paludis::args::ArgsGroup action_args; - - paludis::args::SwitchArg a_search; - paludis::args::SwitchArg a_version; - paludis::args::SwitchArg a_help; - - ///\} - - /// \name General arguments - ///{ - - paludis::args::ArgsGroup general_args; - paludis::args::LogLevelArg a_log_level; - paludis::args::SwitchArg a_no_colour; - paludis::args::AliasArg a_no_color; - paludis::args::SwitchArg a_force_colour; - paludis::args::AliasArg a_force_color; - paludis::args::StringArg a_environment; - - ///} - - ///\name Matching arguments - ///\{ - - paludis::args::ArgsGroup match_args; - paludis::args::StringSetArg a_keys; - paludis::args::EnumArg a_matcher; - paludis::args::SwitchArg a_flatten; - paludis::args::SwitchArg a_enabled_only; - paludis::args::SwitchArg a_not; - - ///\} - - ///\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::SwitchArg a_all_versions; - paludis::args::EnumArg a_kind; - - ///\} - - ///\name Output arguments - ///\{ - - paludis::args::ArgsGroup output_args; - paludis::args::SwitchArg a_compact; - paludis::args::SwitchArg a_show_dependencies; - paludis::args::SwitchArg a_show_authors; - paludis::args::SwitchArg a_show_metadata; - - ///\} -}; - - -#endif diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc deleted file mode 100644 index f140ddb15..000000000 --- a/src/clients/inquisitio/do_search.cc +++ /dev/null @@ -1,458 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009, 2010 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 "do_search.hh" -#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/package_database.hh> -#include <paludis/action.hh> -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> -#include <paludis/notifier_callback.hh> -#include <paludis/partially_made_package_dep_spec.hh> -#include <paludis/util/set.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/create_iterator-impl.hh> -#include <paludis/util/forward_parallel_for_each.hh> -#include <paludis/util/system.hh> -#include <paludis/util/destringify.hh> -#include <functional> -#include <list> -#include <set> -#include <map> -#include <iostream> -#include <algorithm> - -using namespace paludis; -using namespace inquisitio; - -namespace -{ - struct Searched - { - }; - - struct DisplayCallback - { - mutable Mutex mutex; - mutable unsigned width; - mutable std::map<std::string, int> metadata, steps; - - DisplayCallback() : - width(0) - { - } - - void operator() (const NotifierCallbackEvent & event) const - { - event.accept(*this); - } - - void visit(const NotifierCallbackGeneratingMetadataEvent & e) const - { - Lock lock(mutex); - ++metadata.insert(std::make_pair(stringify(e.repository()), 0)).first->second; - update(); - } - - void visit(const NotifierCallbackResolverStageEvent &) const - { - } - - void visit(const NotifierCallbackLinkageStepEvent &) const - { - } - - void visit(const NotifierCallbackResolverStepEvent &) const - { - Lock lock(mutex); - ++steps.insert(std::make_pair("steps", 0)).first->second; - update(); - } - - void visit(const Searched &) const - { - Lock lock(mutex); - ++steps.insert(std::make_pair("searched", 0)).first->second; - update(); - } - - void update() const - { - std::string s; - if (! steps.empty()) - { - for (std::map<std::string, int>::const_iterator i(steps.begin()), i_end(steps.end()) ; - i != i_end ; ++i) - { - if (! s.empty()) - s.append(", "); - - s.append(stringify(i->second) + " " + i->first); - } - } - - if (! metadata.empty()) - { - std::multimap<int, std::string> biggest; - for (std::map<std::string, int>::const_iterator i(metadata.begin()), i_end(metadata.end()) ; - i != i_end ; ++i) - biggest.insert(std::make_pair(i->second, i->first)); - - int t(0), n(0); - std::string ss; - for (std::multimap<int, std::string>::const_reverse_iterator i(biggest.rbegin()), i_end(biggest.rend()) ; - i != i_end ; ++i) - { - ++n; - - if (n == 4) - { - ss.append(", ..."); - break; - } - - if (n < 4) - { - if (! ss.empty()) - ss.append(", "); - - ss.append(stringify(i->first) + " " + i->second); - } - - t += i->first; - } - - if (! s.empty()) - s.append(", "); - s.append(stringify(t) + " metadata (" + ss + ")"); - } - - std::cout << std::string(width, '\010') << s; - - if (width > s.length()) - std::cout - << std::string(width - s.length(), ' ') - << std::string(width - s.length(), '\010'); - - width = s.length(); - std::cout << std::flush; - } - }; - - struct Eligible - { - typedef bool result; - - const Environment * const env; - const bool visible_only; - bool installed, installable; - - Eligible(const Environment * const e, const bool v, const std::string & k) : - env(e), - visible_only(v), - installed(true), - installable(true) - { - if (k == "all") - { - } - else if (k == "installable") - installed = false; - else if (k == "installed") - installable = false; - else - throw InternalError(PALUDIS_HERE, "Bad --kind '" + k + "'"); - } - - bool operator() (const std::shared_ptr<const PackageID> & id) const - { - auto repo(env->package_database()->fetch_repository(id->repository_name())); - if ((! installed) && repo->installed_root_key()) - return false; - - if ((! installable) && id->supports_action(SupportsActionTest<InstallAction>())) - return false; - - if (visible_only) - return ! id->masked(); - else - return true; - } - }; - - struct Matches - { - typedef bool result; - - const std::list<std::shared_ptr<Matcher> > & matchers; - const std::list<std::shared_ptr<Extractor> > & extractors; - - Matches( - const std::list<std::shared_ptr<Matcher> > & m, - const std::list<std::shared_ptr<Extractor> > & e) : - matchers(m), - extractors(e) - { - } - - bool operator() (const std::shared_ptr<const PackageID> & id) const - { - for (std::list<std::shared_ptr<Extractor> >::const_iterator e(extractors.begin()), e_end(extractors.end()) ; - e != e_end ; ++e) - for (std::list<std::shared_ptr<Matcher> >::const_iterator m(matchers.begin()), m_end(matchers.end()) ; - m != m_end ; ++m) - if ((**e)(**m, id)) - return true; - - return false; - } - }; - - std::shared_ptr<const PackageID> fetch_id( - const Environment & env, - const std::shared_ptr<const Repository> & r, - const QualifiedPackageName & q, - const std::function<bool (const std::shared_ptr<const PackageID> &)> & e, - const std::function<bool (const std::shared_ptr<const PackageID> &)> & m, - const bool all_versions, - const bool invert_match, - const DisplayCallback & display_callback) - { - std::shared_ptr<const PackageIDSequence> ids(r->package_ids(q)); - if (ids->empty()) - return std::shared_ptr<const PackageID>(); - else - { - std::list<std::shared_ptr<const PackageID> > sids(ids->begin(), ids->end()); - PackageIDComparator c(env.package_database().get()); - sids.sort(c); - - for (std::list<std::shared_ptr<const PackageID> >::const_reverse_iterator i(sids.rbegin()), i_end(sids.rend()) ; - i != i_end ; ++i) - { - try - { - display_callback.visit(Searched()); - if (e(*i)) - { - if (invert_match ^ m(*i)) - return *i; - else - { - (*i)->can_drop_in_memory_cache(); - if (! all_versions) - return std::shared_ptr<const PackageID>(); - } - } - else - (*i)->can_drop_in_memory_cache(); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & ex) - { - Log::get_instance()->message("inquisitio.failure", ll_warning, lc_context) - << "Caught exception while handling '" << **i << "': '" << ex.message() << "' (" << ex.what() << ")"; - } - } - - return std::shared_ptr<const PackageID>(); - } - } - - void set_id( - const Environment & env, - const std::list<std::shared_ptr<const Repository> > & repos, - std::pair<const QualifiedPackageName, std::shared_ptr<const PackageID> > & q, - const std::function<bool (const std::shared_ptr<const PackageID> &)> & e, - const std::function<bool (const std::shared_ptr<const PackageID> &)> & m, - const bool all_versions, - const bool invert_match, - const DisplayCallback & display_callback) - { - std::shared_ptr<const PackageID> best_id; - for (std::list<std::shared_ptr<const Repository> >::const_iterator r(repos.begin()), r_end(repos.end()) ; - r != r_end ; ++r) - { - std::shared_ptr<const PackageID> id(fetch_id(env, *r, q.first, e, m, all_versions, invert_match, - display_callback)); - if (id) - { - if (best_id) - { - PackageIDComparator c(env.package_database().get()); - if (c(best_id, id)) - best_id = id; - } - else - best_id = id; - } - } - - q.second = best_id; - } -} - -int -do_search(Environment & env) -{ - using namespace std::placeholders; - - std::cout << "Searching: " << std::flush; - DisplayCallback display_callback; - ScopedNotifierCallback display_callback_holder(&env, NotifierCallbackFunction(std::cref(display_callback))); - - if (CommandLine::get_instance()->a_repository.specified() && - ! CommandLine::get_instance()->a_kind.specified()) - CommandLine::get_instance()->a_kind.set_argument("all"); - - std::list<std::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(MatcherFactory::get_instance()->create( - CommandLine::get_instance()->a_matcher.argument(), *p)); - - std::list<std::shared_ptr<Extractor> > extractors; - if (CommandLine::get_instance()->a_keys.begin_args() == CommandLine::get_instance()->a_keys.end_args()) - extractors.push_back(std::make_shared<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(std::make_shared<KeyExtractor>(*i, - CommandLine::get_instance()->a_flatten.specified(), - CommandLine::get_instance()->a_enabled_only.specified(), - env)); - - std::list<std::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.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(), - std::bind(std::equal_to<std::string>(), _1, stringify((*r)->name())))) - continue; - - 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(), - std::bind(std::equal_to<std::string>(), _1, (*r)->format_key() ? (*r)->format_key()->value() : "?"))) - continue; - - if (CommandLine::get_instance()->a_kind.argument() == "installable") - { - if (! (*r)->some_ids_might_support_action(SupportsActionTest<InstallAction>())) - continue; - } - else if (CommandLine::get_instance()->a_kind.argument() == "installed") - { - if (! (*r)->installed_root_key()) - 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); - } - - 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 - { - for (std::list<std::shared_ptr<const Repository> >::const_iterator r(repos.begin()), r_end(repos.end()) ; - r != r_end ; ++r) - { - std::shared_ptr<const CategoryNamePartSet> c((*r)->category_names()); - std::copy(c->begin(), c->end(), std::inserter(cats, cats.begin())); - } - } - - std::map<QualifiedPackageName, std::shared_ptr<const PackageID> > ids; - 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) - ids.insert(std::make_pair(*c + PackageNamePart(*i), std::shared_ptr<const PackageID>())); - } - else - { - for (std::list<std::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) - { - std::shared_ptr<const QualifiedPackageNameSet> q((*r)->package_names(*c)); - for (QualifiedPackageNameSet::ConstIterator i(q->begin()), i_end(q->end()) ; - i != i_end ; ++i) - ids.insert(std::make_pair(*i, std::shared_ptr<const PackageID>())); - } - } - - Eligible eligible( - &env, - CommandLine::get_instance()->a_visible_only.specified(), - CommandLine::get_instance()->a_kind.argument()); - - Matches matches( - matchers, - extractors - ); - - const unsigned n_threads(destringify<int>(getenv_with_default("INQUISITIO_THREADS", "5"))); - forward_parallel_for_each(ids.begin(), ids.end(), - std::bind(&set_id, std::cref(env), std::cref(repos), _1, eligible, matches, - CommandLine::get_instance()->a_all_versions.specified(), - CommandLine::get_instance()->a_not.specified(), - std::cref(display_callback)), - n_threads, 10); - - display_callback_holder.remove_now(); - std::cout << std::endl; - - bool any(false); - InquisitioQueryTask task(&env); - for (std::map<QualifiedPackageName, std::shared_ptr<const PackageID> >::const_iterator - i(ids.begin()), i_end(ids.end()) ; i != i_end ; ++i) - if (i->second) - { - task.show(make_package_dep_spec({ }).package(i->first), i->second); - any = true; - } - - return any ? 0 : 1; -} - diff --git a/src/clients/inquisitio/do_search.hh b/src/clients/inquisitio/do_search.hh deleted file mode 100644 index f2c6631ee..000000000 --- a/src/clients/inquisitio/do_search.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2009 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_DO_SEARCH_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_DO_SEARCH_HH 1 - -namespace paludis -{ - class Environment; -} - -int do_search(paludis::Environment & env); - -#endif diff --git a/src/clients/inquisitio/exact_matcher.cc b/src/clients/inquisitio/exact_matcher.cc deleted file mode 100644 index 210456009..000000000 --- a/src/clients/inquisitio/exact_matcher.cc +++ /dev/null @@ -1,57 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2010, 2011 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 "exact_matcher.hh" -#include <paludis/util/pimp-impl.hh> -#include <string.h> - -using namespace paludis; -using namespace inquisitio; - -namespace paludis -{ - template<> - struct Imp<ExactMatcher> - { - std::string pattern; - - Imp(const std::string & s) : - pattern(s) - { - } - }; -} - -ExactMatcher::ExactMatcher(const std::string & s) : - _imp(s) -{ -} - -bool -ExactMatcher::operator() (const std::string & s) const -{ - return 0 == strcasecmp(s.c_str(), _imp->pattern.c_str()); -} - -ExactMatcher::~ExactMatcher() -{ -} - - - diff --git a/src/clients/inquisitio/exact_matcher.hh b/src/clients/inquisitio/exact_matcher.hh deleted file mode 100644 index 7cc7d3988..000000000 --- a/src/clients/inquisitio/exact_matcher.hh +++ /dev/null @@ -1,42 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2011 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_EXACT_MATCHER_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_EXACT_MATCHER_HH 1 - -#include <src/clients/inquisitio/matcher.hh> -#include <paludis/util/pimp.hh> - -namespace inquisitio -{ - class ExactMatcher : - public Matcher - { - private: - paludis::Pimp<ExactMatcher> _imp; - - public: - ExactMatcher(const std::string &); - virtual ~ExactMatcher(); - - bool operator() (const std::string &) const; - }; -} - -#endif diff --git a/src/clients/inquisitio/extractor.cc b/src/clients/inquisitio/extractor.cc deleted file mode 100644 index 3a05695fc..000000000 --- a/src/clients/inquisitio/extractor.cc +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 "extractor.hh" - -using namespace inquisitio; -using namespace paludis; - -Extractor::Extractor() -{ -} - -Extractor::~Extractor() -{ -} - diff --git a/src/clients/inquisitio/extractor.hh b/src/clients/inquisitio/extractor.hh deleted file mode 100644 index 6b139c5d4..000000000 --- a/src/clients/inquisitio/extractor.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2010 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_EXTRACTOR_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_EXTRACTOR_HH 1 - -#include <string> -#include <memory> -#include <paludis/package_id-fwd.hh> - -namespace inquisitio -{ - class Matcher; - - class Extractor - { - protected: - Extractor(); - - public: - virtual ~Extractor(); - - virtual bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const = 0; - }; -} - -#endif diff --git a/src/clients/inquisitio/help_TEST b/src/clients/inquisitio/help_TEST deleted file mode 100755 index 576dbb443..000000000 --- a/src/clients/inquisitio/help_TEST +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -PALUDIS_SKIP_CONFIG=yes ./inquisitio --help - diff --git a/src/clients/inquisitio/inquisitio.cc b/src/clients/inquisitio/inquisitio.cc deleted file mode 100644 index 5ae7983bb..000000000 --- a/src/clients/inquisitio/inquisitio.cc +++ /dev/null @@ -1,174 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2010 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 "command_line.hh" -#include "do_search.hh" - -#include <iostream> -#include <iomanip> -#include <cstdlib> - -#include <paludis/about.hh> -#include <paludis/util/system.hh> -#include <paludis/util/join.hh> -#include <paludis/environment_factory.hh> -#include <paludis/environment.hh> - -#include <src/output/colour.hh> -#include <paludis/args/do_help.hh> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - struct DoVersion - { - }; - - void display_version() - { - cout << "inquisitio, part of " << PALUDIS_PACKAGE << " " << PALUDIS_VERSION_MAJOR << "." - << PALUDIS_VERSION_MINOR << "." << PALUDIS_VERSION_MICRO << PALUDIS_VERSION_SUFFIX; - if (! std::string(PALUDIS_GIT_HEAD).empty()) - cout << " git " << PALUDIS_GIT_HEAD; - cout << endl; - } -} - -int -main(int argc, char *argv[]) -{ - std::string options(paludis::getenv_with_default("INQUISITIO_OPTIONS", "")); - if (! options.empty()) - options = "(" + options + ") "; - options += join(argv + 1, argv + argc, " "); - - Context context(std::string("In program ") + argv[0] + " " + options + ":"); - - Log::get_instance()->message("inquisitio.deprecated", ll_warning, lc_context) - << "inquisitio is deprecated. Use 'cave search' instead."; - - try - { - CommandLine::get_instance()->run(argc, argv, "inquisitio", "INQUISITIO_OPTIONS", "INQUISITIO_CMDLINE"); - set_use_colour(! CommandLine::get_instance()->a_no_colour.specified()); - set_force_colour(CommandLine::get_instance()->a_force_colour.specified()); - - if (CommandLine::get_instance()->a_help.specified()) - throw args::DoHelp(); - - if (CommandLine::get_instance()->a_version.specified()) - throw DoVersion(); - - if (CommandLine::get_instance()->a_log_level.specified()) - Log::get_instance()->set_log_level(CommandLine::get_instance()->a_log_level.option()); - else - Log::get_instance()->set_log_level(ll_qa); - - Log::get_instance()->set_program_name(argv[0]); - - /* need an action */ - if (1 < (CommandLine::get_instance()->a_search.specified() + - CommandLine::get_instance()->a_version.specified())) - throw args::DoHelp("you should specify exactly one action"); - - std::string paludis_command(argv[0]), env_spec; - if (CommandLine::get_instance()->a_environment.specified()) - { - paludis_command.append(" --" + CommandLine::get_instance()->a_environment.long_name() + " " + - CommandLine::get_instance()->a_environment.argument()); - env_spec = CommandLine::get_instance()->a_environment.argument(); - } - - paludis_command.append(" --" + CommandLine::get_instance()->a_log_level.long_name() + " " + - CommandLine::get_instance()->a_log_level.argument()); - - if (CommandLine::get_instance()->a_no_color.specified()) - paludis_command.append(" --" + CommandLine::get_instance()->a_no_color.long_name()); - - if (CommandLine::get_instance()->a_force_color.specified()) - paludis_command.append(" --" + CommandLine::get_instance()->a_force_color.long_name()); - - std::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(env_spec)); - env->set_paludis_command(paludis_command); - - if (CommandLine::get_instance()->begin_parameters() == CommandLine::get_instance()->end_parameters()) - throw args::DoHelp("search action takes at least one parameter"); - - return do_search(*env); - } - catch (const DoVersion &) - { - display_version(); - cout << endl; - cout << "Paludis comes with ABSOLUTELY NO WARRANTY. Paludis is free software, and you" << endl; - cout << "are welcome to redistribute it under the terms of the GNU General Public" << endl; - cout << "License, version 2." << endl; - - return EXIT_SUCCESS; - } - catch (const paludis::args::ArgsError & e) - { - cerr << "Usage error: " << e.message() << endl; - cerr << "Try " << argv[0] << " --help" << endl; - return EXIT_FAILURE; - } - catch (const args::DoHelp & h) - { - if (h.message.empty()) - { - cout << "Usage: " << argv[0] << " [options]" << endl; - cout << endl; - cout << *CommandLine::get_instance(); - return EXIT_SUCCESS; - } - else - { - cerr << "Usage error: " << h.message << endl; - cerr << "Try " << argv[0] << " --help" << endl; - return EXIT_FAILURE; - } - } - catch (const Exception & e) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * " << e.backtrace("\n * ") - << e.message() << " (" << e.what() << ")" << endl; - return EXIT_FAILURE; - } - catch (const std::exception & e) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * " << e.what() << endl; - return EXIT_FAILURE; - } - catch (...) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * Unknown exception type. Ouch..." << endl; - return EXIT_FAILURE; - } -} - diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc deleted file mode 100644 index 3895cdeac..000000000 --- a/src/clients/inquisitio/key_extractor.cc +++ /dev/null @@ -1,490 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009, 2010, 2011 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/pimp-impl.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/set.hh> -#include <paludis/util/join.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/timestamp.hh> -#include <paludis/util/accept_visitor.hh> -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> -#include <paludis/dep_spec.hh> -#include <paludis/environment.hh> -#include <paludis/choice.hh> -#include <paludis/unformatted_pretty_printer.hh> -#include <functional> -#include <algorithm> - -using namespace paludis; -using namespace inquisitio; - -namespace paludis -{ - template <> - struct Imp<KeyExtractor> - { - const std::string key; - const bool flatten; - const bool visible_only; - const Environment & env; - - Imp(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) : - _imp(k, f, v, e) -{ -} - -KeyExtractor::~KeyExtractor() -{ -} - -namespace -{ - class TreeVisitor - { - private: - const std::string _key; - const bool _visible_only; - const Environment & _env; - const std::shared_ptr<const PackageID> _id; - const Matcher & _m; - - public: - bool result; - - TreeVisitor(const std::string & k, const bool v, const Environment & e, - const std::shared_ptr<const PackageID> & i, const Matcher & m) : - _key(k), - _visible_only(v), - _env(e), - _id(i), - _m(m), - result(false) - { - } - - void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<ExactlyOneDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - if (! result) - { - result |= _m(stringify(*node.spec())); - - if (! result) - { - if (! _visible_only) - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - else if (node.spec()->condition_met(&_env, _id)) - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - } - } - - void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - - void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type & node) - { - if (! result) - result |= _m(stringify(*node.spec())); - } - }; - - std::string stringify_string_pair(const std::pair<const std::string, std::string> & s) - { - if (s.first.empty()) - return s.second; - else - return s.first + "=" + s.second; - } - - class KeyVisitor - { - private: - const std::string _key; - const bool _flatten; - const bool _visible_only; - const Environment & _env; - const std::shared_ptr<const PackageID> _id; - const Matcher & _m; - - public: - bool result; - - KeyVisitor(const std::string & k, const bool f, const bool v, const Environment & e, - const std::shared_ptr<const PackageID> & i, const Matcher & m) : - _key(k), - _flatten(f), - _visible_only(v), - _env(e), - _id(i), - _m(m), - result(false) - { - } - - void visit(const MetadataValueKey<std::string> & s) - { - result = _m(s.value()); - } - - void visit(const MetadataValueKey<SlotName> & s) - { - result = _m(stringify(s.value())); - } - - void visit(const MetadataValueKey<long> & s) - { - result = _m(stringify(s.value())); - } - - void visit(const MetadataValueKey<bool> & s) - { - result = _m(stringify(s.value())); - } - - void visit(const MetadataTimeKey & s) - { - result = _m(stringify(s.value().seconds())); - } - - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) - { - } - - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > &) - { - } - - void visit(const MetadataValueKey<FSPath> & s) - { - result = _m(stringify(s.value())); - } - - void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & s) - { - result = _m(stringify(*s.value())); - } - - void visit(const MetadataCollectionKey<KeywordNameSet> & s) - { - using namespace std::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(), - std::bind(&Matcher::operator(), std::cref(_m), std::bind(&stringify<KeywordName>, _1))); - } - - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > & s) - { - if (_flatten) - { - std::string r; - for (Choices::ConstIterator c(s.value()->begin()), c_end(s.value()->end()) ; - c != c_end ; ++c) - for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ; - i != i_end ; ++i) - { - if (! r.empty()) - r.append(" "); - r.append(stringify((*i)->name_with_prefix())); - } - - result = _m(r); - } - else - { - for (Choices::ConstIterator c(s.value()->begin()), c_end(s.value()->end()) ; - c != c_end && ! result ; ++c) - for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ; - i != i_end && ! result ; ++i) - result = _m(stringify((*i)->name_with_prefix())); - } - } - - void visit(const MetadataCollectionKey<Set<std::string> > & s) - { - using namespace std::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(), - std::bind(&Matcher::operator(), std::cref(_m), _1)); - } - - void visit(const MetadataCollectionKey<Map<std::string, std::string> > & s) - { - using namespace std::placeholders; - - if (_flatten) - result = _m(join(s.value()->begin(), s.value()->end(), " ", stringify_string_pair)); - else - result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(), - std::bind(&Matcher::operator(), std::cref(_m), std::bind(&stringify_string_pair, _1))); - } - - void visit(const MetadataCollectionKey<Sequence<std::string> > & s) - { - using namespace std::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(), - std::bind(&Matcher::operator(), std::cref(_m), _1)); - } - - void visit(const MetadataCollectionKey<FSPathSequence> & s) - { - using namespace std::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(), - std::bind(&Matcher::operator(), std::cref(_m), std::bind(&stringify<FSPath>, _1))); - } - - void visit(const MetadataCollectionKey<PackageIDSequence> & s) - { - using namespace std::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()), - std::bind(&Matcher::operator(), std::cref(_m), std::bind(&stringify<PackageID>, _1))); - } - - void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & s) - { - if (_flatten) - { - result = _m(s.pretty_print_value(UnformattedPrettyPrinter(), { })); - } - else - { - TreeVisitor v(_key, _visible_only, _env, _id, _m); - s.value()->top()->accept(v); - result = v.result; - } - } - - void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & s) - { - if (_flatten) - { - result = _m(s.pretty_print_value(UnformattedPrettyPrinter(), { })); - } - else - { - TreeVisitor v(_key, _visible_only, _env, _id, _m); - s.value()->top()->accept(v); - result = v.result; - } - } - - void visit(const MetadataSpecTreeKey<DependencySpecTree> & s) - { - if (_flatten) - { - result = _m(s.pretty_print_value(UnformattedPrettyPrinter(), { })); - } - else - { - TreeVisitor v(_key, _visible_only, _env, _id, _m); - s.value()->top()->accept(v); - result = v.result; - } - } - - void visit(const MetadataSpecTreeKey<SetSpecTree> & s) - { - if (_flatten) - { - result = _m(s.pretty_print_value(UnformattedPrettyPrinter(), { })); - } - else - { - TreeVisitor v(_key, _visible_only, _env, _id, _m); - s.value()->top()->accept(v); - result = v.result; - } - } - - void visit(const MetadataSpecTreeKey<LicenseSpecTree> & s) - { - if (_flatten) - { - result = _m(s.pretty_print_value(UnformattedPrettyPrinter(), { })); - } - else - { - TreeVisitor v(_key, _visible_only, _env, _id, _m); - s.value()->top()->accept(v); - result = v.result; - } - } - - void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & s) - { - if (_flatten) - { - result = _m(s.pretty_print_value(UnformattedPrettyPrinter(), { })); - } - else - { - TreeVisitor v(_key, _visible_only, _env, _id, _m); - s.value()->top()->accept(v); - result = v.result; - } - } - - void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & s) - { - if (_flatten) - { - result = _m(s.pretty_print_value(UnformattedPrettyPrinter(), { })); - } - else - { - TreeVisitor v(_key, _visible_only, _env, _id, _m); - s.value()->top()->accept(v); - result = v.result; - } - } - - void visit(const MetadataSpecTreeKey<ProvideSpecTree> & s) - { - if (_flatten) - { - result = _m(s.pretty_print_value(UnformattedPrettyPrinter(), { })); - } - else - { - TreeVisitor v(_key, _visible_only, _env, _id, _m); - s.value()->top()->accept(v); - result = v.result; - } - } - - void visit(const MetadataSectionKey & k) - { - std::for_each(indirect_iterator(k.begin_metadata()), - indirect_iterator(k.end_metadata()), accept_visitor(*this)); - } - }; -} - -bool -KeyExtractor::operator() (const Matcher & m, const std::shared_ptr<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 deleted file mode 100644 index 1205a697a..000000000 --- a/src/clients/inquisitio/key_extractor.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2010, 2011 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/pimp.hh> -#include <paludis/environment-fwd.hh> - -namespace inquisitio -{ - class KeyExtractor : - public Extractor - { - private: - paludis::Pimp<KeyExtractor> _imp; - - public: - KeyExtractor(const std::string &, const bool flatten, const bool visible_only, - const paludis::Environment &); - ~KeyExtractor(); - - bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const; - }; -} - -#endif diff --git a/src/clients/inquisitio/man_inquisitio.cc b/src/clients/inquisitio/man_inquisitio.cc deleted file mode 100644 index 91c443319..000000000 --- a/src/clients/inquisitio/man_inquisitio.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2009 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 "command_line.hh" -#include <paludis/args/man.hh> - -#include <iostream> -#include <cstdlib> - -using std::cout; -using std::endl; - -namespace -{ - struct ManCommandLine : - paludis::args::ArgsHandler - { - paludis::args::ArgsGroup group; - paludis::args::SwitchArg a_html; - - ManCommandLine() : - group(main_options_section(), "", ""), - a_html(&group, "html", '\0', "", false) - { - } - - virtual std::string app_name() const - { - return ""; - } - - virtual std::string app_description() const - { - return ""; - } - - virtual std::string app_synopsis() const - { - return ""; - } - }; -} - -int -main(int argc, char * argv[]) -{ - ManCommandLine cmdline; - cmdline.run(argc, argv, "", "", ""); - - if (cmdline.a_html.specified()) - { - paludis::args::HtmlWriter hw(cout); - paludis::args::generate_doc(hw, CommandLine::get_instance()); - } - else - { - paludis::args::ManWriter mw(cout); - paludis::args::generate_doc(mw, CommandLine::get_instance()); - } - - return EXIT_SUCCESS; -} diff --git a/src/clients/inquisitio/matcher.cc b/src/clients/inquisitio/matcher.cc deleted file mode 100644 index 96368ee01..000000000 --- a/src/clients/inquisitio/matcher.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2010 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 "matcher.hh" -#include "exact_matcher.hh" -#include "pcre_matcher.hh" -#include "text_matcher.hh" -#include <paludis/util/pimp-impl.hh> -#include <paludis/util/singleton-impl.hh> - -using namespace inquisitio; -using namespace paludis; - -template class paludis::Singleton<MatcherFactory>; - -Matcher::Matcher() -{ -} - -Matcher::~Matcher() -{ -} - -NoSuchMatcherError::NoSuchMatcherError(const std::string & msg) throw () : - Exception("No such matcher '" + msg + "'") -{ -} - -namespace -{ - template <typename M_> - static std::shared_ptr<Matcher> - make(const std::string & s) - { - return std::make_shared<M_>(s); - } -} - -MatcherFactory::MatcherFactory() -{ -} - -const std::shared_ptr<Matcher> -MatcherFactory::create(const std::string & s, const std::string & t) const -{ - if (s == "exact") - return make<ExactMatcher>(t); - if (s == "pcre") - return make<PCREMatcher>(t); - if (s == "text") - return make<TextMatcher>(t); - throw NoSuchMatcherError(t); -} - diff --git a/src/clients/inquisitio/matcher.hh b/src/clients/inquisitio/matcher.hh deleted file mode 100644 index 5ded845cd..000000000 --- a/src/clients/inquisitio/matcher.hh +++ /dev/null @@ -1,64 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2010 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_MATCHER_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_MATCHER_HH 1 - -#include <paludis/util/singleton.hh> -#include <paludis/util/exception.hh> -#include <string> -#include <memory> - -namespace inquisitio -{ - class Matcher - { - protected: - Matcher(); - - public: - typedef bool result; - - virtual ~Matcher(); - - virtual bool operator() (const std::string &) const = 0; - }; - - class NoSuchMatcherError : - public paludis::Exception - { - public: - NoSuchMatcherError(const std::string &) throw (); - }; - - class MatcherFactory : - public paludis::Singleton<MatcherFactory> - { - friend class paludis::Singleton<MatcherFactory>; - - private: - MatcherFactory(); - - public: - const std::shared_ptr<Matcher> create(const std::string &, const std::string &) const - PALUDIS_ATTRIBUTE((warn_unused_result)); - }; -} - -#endif diff --git a/src/clients/inquisitio/name_description_extractor.cc b/src/clients/inquisitio/name_description_extractor.cc deleted file mode 100644 index 3772ccbdc..000000000 --- a/src/clients/inquisitio/name_description_extractor.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2010 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 "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> - -using namespace paludis; -using namespace inquisitio; - -NameDescriptionExtractor::NameDescriptionExtractor() -{ -} - -NameDescriptionExtractor::~NameDescriptionExtractor() -{ -} - -bool -NameDescriptionExtractor::operator() (const Matcher & m, const std::shared_ptr<const PackageID> & id) const -{ - if (m(stringify(id->name()))) - return true; - - 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_description_extractor.hh b/src/clients/inquisitio/name_description_extractor.hh deleted file mode 100644 index b6f8c8a3b..000000000 --- a/src/clients/inquisitio/name_description_extractor.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2010 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_NAME_DESCRIPTION_EXTRACTOR_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_NAME_DESCRIPTION_EXTRACTOR_HH 1 - -#include <src/clients/inquisitio/extractor.hh> - -namespace inquisitio -{ - class NameDescriptionExtractor : - public Extractor - { - public: - NameDescriptionExtractor(); - ~NameDescriptionExtractor(); - - bool operator() (const Matcher &, const std::shared_ptr<const paludis::PackageID> &) const; - }; -} - -#endif diff --git a/src/clients/inquisitio/pcre_matcher.cc b/src/clients/inquisitio/pcre_matcher.cc deleted file mode 100644 index 03ff84491..000000000 --- a/src/clients/inquisitio/pcre_matcher.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2009, 2010, 2011 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 "pcre_matcher.hh" -#include <pcrecpp.h> -#include <paludis/util/pimp-impl.hh> - -using namespace paludis; -using namespace inquisitio; - -namespace paludis -{ - template<> - struct Imp<PCREMatcher> - { - const pcrecpp::RE pattern; - - Imp(const std::string & s) : - pattern(s, pcrecpp::RE_Options().set_caseless(true)) - { - if (! pattern.error().empty()) - throw BadPCREPatternError(s, pattern.error()); - } - }; -} - -PCREMatcher::PCREMatcher(const std::string & s) : - _imp(s) -{ -} - -bool -PCREMatcher::operator() (const std::string & s) const -{ - return _imp->pattern.PartialMatch(s); -} - -PCREMatcher::~PCREMatcher() -{ -} - -BadPCREPatternError::BadPCREPatternError(const std::string & p, const std::string & m) throw () : - Exception("Bad PCRE pattern '" + p + "': " + m) -{ -} - diff --git a/src/clients/inquisitio/pcre_matcher.hh b/src/clients/inquisitio/pcre_matcher.hh deleted file mode 100644 index 3120ecd22..000000000 --- a/src/clients/inquisitio/pcre_matcher.hh +++ /dev/null @@ -1,49 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2009, 2011 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_PCRE_MATCHER_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_PCRE_MATCHER_HH 1 - -#include <src/clients/inquisitio/matcher.hh> -#include <paludis/util/pimp.hh> - -namespace inquisitio -{ - class PCREMatcher : - public Matcher - { - private: - paludis::Pimp<PCREMatcher> _imp; - - public: - PCREMatcher(const std::string &); - virtual ~PCREMatcher(); - - bool operator() (const std::string &) const; - }; - - class PALUDIS_VISIBLE BadPCREPatternError : - public paludis::Exception - { - public: - BadPCREPatternError(const std::string &, const std::string &) throw (); - }; -} - -#endif diff --git a/src/clients/inquisitio/query_task.cc b/src/clients/inquisitio/query_task.cc deleted file mode 100644 index dcb349eac..000000000 --- a/src/clients/inquisitio/query_task.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* 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 "query_task.hh" -#include "command_line.hh" - -using namespace inquisitio; -using namespace paludis; - -InquisitioQueryTask::InquisitioQueryTask(const Environment * const env) : - ConsoleQueryTask(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(); -} - -bool -InquisitioQueryTask::want_compact() const -{ - return CommandLine::get_instance()->a_compact.specified(); -} - -bool -InquisitioQueryTask::want_authors() const -{ - return CommandLine::get_instance()->a_show_authors.specified(); -} - diff --git a/src/clients/inquisitio/query_task.hh b/src/clients/inquisitio/query_task.hh deleted file mode 100644 index e72568e4e..000000000 --- a/src/clients/inquisitio/query_task.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* 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_QUERY_TASK_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_QUERY_TASK_HH 1 - -#include <src/output/console_query_task.hh> - -namespace inquisitio -{ - class InquisitioQueryTask : - public paludis::ConsoleQueryTask - { - public: - InquisitioQueryTask(const paludis::Environment * const); - - virtual bool want_compact() const; - virtual bool want_deps() const; - virtual bool want_raw() const; - virtual bool want_authors() const; - }; -} - -#endif diff --git a/src/clients/inquisitio/text_matcher.cc b/src/clients/inquisitio/text_matcher.cc deleted file mode 100644 index 131db2b5e..000000000 --- a/src/clients/inquisitio/text_matcher.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2010, 2011 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 "text_matcher.hh" -#include <paludis/util/pimp-impl.hh> -#include <string.h> - -using namespace paludis; -using namespace inquisitio; - -namespace paludis -{ - template<> - struct Imp<TextMatcher> - { - std::string pattern; - - Imp(const std::string & s) : - pattern(s) - { - } - }; -} - -TextMatcher::TextMatcher(const std::string & s) : - _imp(s) -{ -} - -bool -TextMatcher::operator() (const std::string & s) const -{ - return 0 != strcasestr(s.c_str(), _imp->pattern.c_str()); -} - -TextMatcher::~TextMatcher() -{ -} - - diff --git a/src/clients/inquisitio/text_matcher.hh b/src/clients/inquisitio/text_matcher.hh deleted file mode 100644 index e7b5635c8..000000000 --- a/src/clients/inquisitio/text_matcher.hh +++ /dev/null @@ -1,42 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2011 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_TEXT_MATCHER_HH -#define PALUDIS_GUARD_SRC_CLIENTS_INQUISITIO_TEXT_MATCHER_HH 1 - -#include <src/clients/inquisitio/matcher.hh> -#include <paludis/util/pimp.hh> - -namespace inquisitio -{ - class TextMatcher : - public Matcher - { - private: - paludis::Pimp<TextMatcher> _imp; - - public: - TextMatcher(const std::string &); - virtual ~TextMatcher(); - - bool operator() (const std::string &) const; - }; -} - -#endif diff --git a/src/clients/inquisitio/version_TEST b/src/clients/inquisitio/version_TEST deleted file mode 100755 index e869872e2..000000000 --- a/src/clients/inquisitio/version_TEST +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -PALUDIS_SKIP_CONFIG=yes ./inquisitio --version - diff --git a/zsh-completion/Makefile.am b/zsh-completion/Makefile.am index f9fc6d070..87a2b046c 100644 --- a/zsh-completion/Makefile.am +++ b/zsh-completion/Makefile.am @@ -1,5 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -noinst_DATA = _paludis _adjutrix _paludis_packages _inquisitio _importare _reconcilio _cave +noinst_DATA = _paludis _adjutrix _paludis_packages _importare _reconcilio _cave EXTRA_DIST = $(noinst_DATA) AUTOMAKE_OPTIONS = 1.11 parallel-tests diff --git a/zsh-completion/_inquisitio b/zsh-completion/_inquisitio deleted file mode 100644 index 937d3edc7..000000000 --- a/zsh-completion/_inquisitio +++ /dev/null @@ -1,52 +0,0 @@ -#compdef inquisitio -# -# vim: set et sw=4 sts=4 ts=4 ft=zsh : -# ZSH completion for adjutrix -# Written by Baptiste Daroussin <baptux at free.fr> - -_inquisitio() { - local actions actions_options general_options matching_options filter_options output_options - actions=( - --search -s - --version -V - --help -h - ) - matching_options=( - "(--keys -k)"{-k,--keys}"[Match using listed metadata keys]:Key: " - "(--matcher -m)"{-m,--matcher}"[Which match algorithm to use]:algorithm:((text\:Simple\ text\ match pcre\:Regular\ expression exact\:Exact\ text\ match))" - "(--flatten -f)"{-f,--flatten}"[Flatten spec trees, rather than matching against individual items]" - "(--enabled-only -e)"{-e,--enabled-only}"[When searching spec trees, only look in enabled subtrees]" - "(--not -n)"{-n,--not}"[Select packages that do not match]" - ) - - filter_options=( - "(--repository -r)"{-r,--repository}"[Matches with this repository name only]:repository:_paludis_packages repositories" - "--repository-format[Matches with this repository format only]:format:_paludis_packages repository-formats" - "--category[Matches with this category name only]:category:_paludis_packages categories" - "--package[Matches with this package name only]:package:_paludis_packages available" - "(--visible-only -v)"{-v,--visible-only}"[Only consider visible packages]" - "(--all-versions -a)"{-a,--all-versions}"[Check all versions, rather than only one]" - "(--kind -k)"{-k,--kind}"[Packages of this kind only]:((installable\:Installable\ packages installed\:Installed\ packages all\:All\ packages))" - ) - - general_options=( - '--log-level[Specify the log level]:log level:((debug\:"Show debug output (noisy)" qa\:"Show QA messages and warnings only (default)" warning\:"Show warnings only" silent\:"Suppress all log messages (UNSAFE)"))' - "(--no-colour --no-color)"{--no-colour,--no-color}"[Do not use colour]" - "(--environment -E)"{-E,--environment}"[Environment specification]:Environment: " - ) - output_options=( - "--compact[Display output using one line per entry]" - "(--show-dependencies -D)"{-D,--show-dependencies}"[Show dependencies]" - "(--show-metadata -M)"{-M,--show-metadata}"[Show raw metadata]" - ) - action_options=( - "($actions)"{--search,-s}"[Search for a package]" - "(: -)"{--version,-V}"[Display program version]" - "(: -)"{--help,-h}"[Display program help]" - ) - - _arguments -s \ - $general_options[@] $output_options[@] $filter_options[@] $matching_options[@] $action_options[@] && return 0 -} - -_inquisitio "$@" |