diff options
author | 2011-02-05 22:38:55 +0000 | |
---|---|---|
committer | 2011-02-05 22:38:55 +0000 | |
commit | 95941e66453feb65895b597e305403776da96b42 (patch) | |
tree | f9eb428c3152495ae8d4daa7a3f93761f728b878 | |
parent | e91a83397adaad38a7ac9b60d315db481cc3fff2 (diff) | |
download | paludis-95941e66453feb65895b597e305403776da96b42.tar.gz paludis-95941e66453feb65895b597e305403776da96b42.tar.xz |
Kill paludis
56 files changed, 6 insertions, 5963 deletions
diff --git a/.gitignore b/.gitignore index 602114296..0d3447fa3 100644 --- a/.gitignore +++ b/.gitignore @@ -134,12 +134,10 @@ paludis-*.*.*.tar.bz2 /doc/clients/cave-uninstall.html /doc/clients/cave-update-world.html /doc/clients/cave-verify.html -/doc/clients/contrarius.html /doc/clients/footer.html.part /doc/clients/header.html.part /doc/clients/index.html /doc/clients/instruo.html -/doc/clients/paludis.html /doc/clients/toplinks.html.part /doc/configuration/bashrc.html /doc/configuration/bashrc.html.part @@ -502,7 +500,6 @@ paludis-*.*.*.tar.bz2 /src/clients/appareo/appareo /src/clients/cave/cave /src/clients/instruo/instruo -/src/clients/paludis/paludis /stamp-h1 /test/test_fail_TEST /test/test_pass_TEST diff --git a/bash-completion/Makefile.am b/bash-completion/Makefile.am index 2e1b30d61..bbcc02869 100644 --- a/bash-completion/Makefile.am +++ b/bash-completion/Makefile.am @@ -1,7 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -noinst_DATA = paludis adjutrix \ - accerso instruo \ - cave +noinst_DATA = adjutrix accerso instruo cave EXTRA_DIST = $(noinst_DATA) AUTOMAKE_OPTIONS = 1.11 parallel-tests diff --git a/bash-completion/paludis b/bash-completion/paludis deleted file mode 100644 index 832bac71c..000000000 --- a/bash-completion/paludis +++ /dev/null @@ -1,374 +0,0 @@ -# Bash completion function for paludis -# 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. - -_paludis_packagenames() { - for names_cache in $(paludis --list-repositories --log-level silent |sed -n 's,^[[:space:]]*names_cache:[[:space:]]*\(.*\)$,\1,p') - do - pushd "${names_cache}" 1>/dev/null - for d in * ; do - [[ -d "${d}" ]] || continue - pushd "${d}" 1>/dev/null - for x in "${1}"* ; do - [[ -f "${x}" ]] && echo $x - done - popd 1>/dev/null - done - popd 1>/dev/null - done -} - -_paludis_dolist() { - paludis --list-${1} --log-level silent |sed -n 's,^\* \(.*\),\1,p' -} - -_paludis() { - local cur prev opts action - - local action_opts general_opts deplist_opts - local query_opts install_opts uninstall_opts sync_opts report_opts - local contents_opts owner_opts info_opts version_query_opts - local env_variable_query_opts conf_variable_query_opts - local list_opts regen_opts all_opts - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - action_opts="--query -q \ - --install -i \ - --uninstall -u \ - --uninstall-unused \ - --sync -s \ - --report -r \ - --contents -k \ - --executables \ - --owner -o \ - --config \ - --version -V \ - --info -I \ - --help -h \ - --has-version \ - --best-version \ - --match \ - --environment-variable \ - --configuration-variable \ - --list-repositories \ - --list-categories \ - --list-packages \ - --list-sets \ - --list-sync-protocols \ - --list-repository-formats \ - --list-dep-tag-categories \ - --regenerate-installed-cache \ - --regenerate-installable-cache" - general_opts="--log-level \ - --no-colour \ - --no-color \ - --no-suggestions \ - --environment -E \ - --resume-command-template \ - --multitask" - - deplist_opts="--dl-reinstall \ - --dl-reinstall-scm \ - --dl-reinstall-targets \ - --dl-upgrade \ - --dl-new-slots \ - --dl-downgrade \ - --dl-deps-default \ - --dl-installed-deps-pre \ - --dl-installed-deps-runtime \ - --dl-installed-deps-post \ - --dl-uninstalled-deps-pre \ - --dl-uninstalled-deps-runtime \ - --dl-uninstalled-deps-post \ - --dl-uninstalled-deps-suggested \ - --dl-suggested \ - --dl-circular \ - --dl-blocks \ - --dl-override-masks \ - --dl-fall-back" - - query_opts="--show-deps -D \ - --show-metadata -M \ - --compact \ - --no-compact" - install_opts="--pretend -p \ - --destinations -d \ - --preserve-world -1 \ - --add-to-world-spec \ - --fetch -f \ - --no-safe-resume \ - --show-reasons \ - --show-use-descriptions \ - --show-package-descriptions \ - --continue-on-failure \ - --skip-phase \ - --abort-at-phase \ - --skip-until-phase \ - --change-phases-for \ - --compact \ - ${deplist_opts}" - uninstall_opts="--pretend -p \ - --destinations -d \ - --preserve-world -1 \ - --show-reasons \ - --show-use-descriptions \ - --show-package-descriptions \ - --with-unused-dependencies \ - --permit-unsafe-uninstalls \ - --with-dependencies \ - --all-versions \ - ${deplist_opts}" - sync_opts="" - report_opts="" - contents_opts="" - owner_opts="--full-match" - info_opts="" - version_query_opts="" - env_variable_query_opts="" - conf_variable_query_opts="" - list_opts="--repository \ - --repository-format \ - --category \ - --package \ - --set" - regen_repos_opts="" - - all_opts="${action_opts} ${general_opts} ${query_opts} ${install_opts} ${uninstall_opts} ${sync_opts} ${report_opts} ${contents_opts} ${owner_opts} ${version_query_opts} ${variable_query_opts} ${list_opts} ${regen_repos_opts}" - - local x - for x in "${COMP_WORDS[@]}" ; do - case "${x}" in - -q|--query) - action="query" - break - ;; - -i|--install) - action="install" - break - ;; - -u|--uninstall|--uninstall-unused) - action="uninstall" - break - ;; - -s|--sync) - action="sync" - break - ;; - -r|--report) - action="report" - break - ;; - -k|--contents) - action="contents" - break - ;; - -o|--owner) - action="owner" - break - ;; - --config) - action="config" - break - ;; - -V|--version|-I|--info|-h|--help) - action="info" - break - ;; - --has-version|--best-version|--match) - action="version_query" - break - ;; - --environment-variable) - action="env_variable_query" - break - ;; - --configuration-variable) - action="conf_variable_query" - break - ;; - --list-repositories|--list-categories|--list-packages|--list-sets|--list-sync-protocols|--list-repository-formats|--list-dep-tag-categories) - action="list" - break - ;; - --regenerate-installed-cache|--regenerate-installable-cache) - action="regen_repos" - break - ;; - esac - done - - case "${cur}" in - -*) - local opts= - [[ -z "${action}" ]] && action="all" - opts="${action}_opts" - - COMPREPLY=($(compgen -W "${general_opts} ${!opts}" -- "${cur}")) - return 0 - ;; - *) - case "${prev}" in - ## Enum operators - --log-level) - COMPREPLY=($(compgen -W "debug qa warning silent" -- "${cur}")) - return 0 - ;; - --show-reasons) - COMPREPLY=($(compgen -W "none summary full" -- "${cur}")) - return 0 - ;; - --show-use-descriptions) - COMPREPLY=($(compgen -W "none new changed all" -- "${cur}")) - return 0 - ;; - --show-package-descriptions) - COMPREPLY=($(compgen -W "none new all" -- "${cur}")) - return 0 - ;; - --continue-on-failure) - COMPREPLY=($(compgen -W "if-fetch-only never if-satisfied if-independent always" -- "${cur}")) - return 0 - ;; - --change-phases-for) - COMPREPLY=($(compgen -W "all first last" -- "${cur}")) - return 0 - ;; - --dl-reinstall) - COMPREPLY=($(compgen -W "never always if-use-changed" -- "${cur}")) - return 0 - ;; - --dl-reinstall-scm) - COMPREPLY=($(compgen -W "never always daily weekly" -- "${cur}")) - return 0 - ;; - --dl-reinstall-targets) - COMPREPLY=($(compgen -W "auto never always" -- "${cur}")) - return 0 - ;; - --dl-upgrade|--dl-new-slots) - COMPREPLY=($(compgen -W "always as-needed" -- "${cur}")) - return 0 - ;; - --dl-downgrade) - COMPREPLY=($(compgen -W "as-needed warning error" -- "${cur}")) - return 0 - ;; - - --dl-deps-default|--dl-installed-deps-pre|--dl-installed-deps-runtime|--dl-installed-deps-post|--dl-uninstalled-deps-pre|--dl-uninstalled-deps-runtime|--dl-uninstalled-deps-post|--dl-uninstalled-deps-suggested) - COMPREPLY=($(compgen -W "pre pre-or-post post try-post discard" -- "${cur}")) - return 0 - ;; - - --dl-suggested) - COMPREPLY=($(compgen -W "show install discard" -- "${cur}")) - return 0 - ;; - --dl-blocks) - COMPREPLY=($(compgen -W "accumulate error discard" -- "${cur}")) - return 0 - ;; - --dl-override-masks) - COMPREPLY=($(compgen -W "none tilde-keyword unkeyworded repository license" -- "${cur}")) - return 0 - ;; - - --dl-circular) - COMPREPLY=($(compgen -W "error discard" -- "${cur}")) - return 0 - ;; - --dl-fall-back) - COMPREPLY=($(compgen -W "as-needed-except-targets as-needed never" -- "${cur}")) - return 0 - ;; - ## list specifiers - --repository) - COMPREPLY=($(compgen -W "$(_paludis_dolist repositories)" -- "${cur}")) - return 0 - ;; - --repository-format) - COMPREPLY=($(compgen -W "$(_paludis_dolist repository-formats)" -- "${cur}")) - return 0 - ;; - --category) - COMPREPLY=($(compgen -W "$(_paludis_dolist categories)" -- "${cur}")) - return 0 - ;; - --package) - COMPREPLY=($(compgen -W "$(_paludis_packagenames "${cur}")" -- "${cur}")) - return 0 - ;; - --set) - COMPREPLY=($(compgen -W "$(_paludis_dolist sets)" -- "${cur}")) - return 0 - ;; - --owner|-o|--resume-command-template) - _filedir - return 0 - ;; - #=*|>*|>*|~*) - # : - # ;; - *) - case "${action}" in - sync|regen_repos) - COMPREPLY=($(compgen -W "$(_paludis_dolist repositories)" -- "${cur}")) - return 0 - ;; - report|info|list) - return 0 - ;; - owner) - _filedir - return 0 - ;; - conf_variable_query) - case "${prev}" in - -*) - COMPREPLY=($(compgen -W "$(_paludis_dolist repositories)" -- "${cur}")) - ;; - *) - COMPREPLY=($(compgen -W "$(paludis --log-level silent --list-repositories --repository ${prev} |sed -n 's,^ \([^:]*\).*,\1,p')" -- "${cur}")) - ;; - esac - return 0 - - ;; - query|install|uninstall|contents|version_query|env_variable_query|config) - if [[ "${action}" == "env_variable_query" \ - && "${prev}" != -* ]] - then - COMPREPLY=($(compgen -W "$(paludis --log-level silent --info |sed -n 's,^ \([A-Z][^:]*\):.*,\1,p')" -- "${cur}")) - return 0 - fi - # default - match on package names - case "${cur}" in - */*) - local catname=${cur%/*} - COMPREPLY=($(compgen -W "$(paludis --list-packages --log-level silent --category ${catname} |sed -n 's,^\* \(.*\),\1,p')" -- "${cur}")) - return 0 - ;; - *) - # Do set name, package name, and category name completion - COMPREPLY=( - $(compgen -W "$(_paludis_dolist sets)" -- "${cur}") - $(compgen -W "$(_paludis_dolist categories)" -- "${cur}") - $(compgen -W "$(_paludis_packagenames "${cur}")" -- "${cur}") - ) - _filedir - return 0 - ;; - esac - ;; - esac - ;; - esac - ;; - esac -} -complete -o filenames -F _paludis paludis diff --git a/configure.ac b/configure.ac index 16aa8e0d3..f10a59afc 100644 --- a/configure.ac +++ b/configure.ac @@ -1513,25 +1513,24 @@ AC_DEFINE_UNQUOTED([DEFAULT_DISTRIBUTION], "$DEFAULT_DISTRIBUTION", [Default dis dnl }}} dnl {{{ clients -ALL_CLIENTS="accerso adjutrix appareo cave instruo paludis" +ALL_CLIENTS="accerso adjutrix appareo cave instruo" ALL_CLIENTS_HTML="" for a in $ALL_CLIENTS ; do ALL_CLIENTS_HTML="$ALL_CLIENTS_HTML $a.html" done -DEFAULT_CLIENTS="adjutrix cave paludis" +DEFAULT_CLIENTS="adjutrix cave" AC_MSG_CHECKING([which clients to build...]) AC_ARG_WITH([clients], [ --with-clients=foo,bar,... Build the specified clients: all All available clients - default Equivalent to adjutrix,cave,paludis + default Equivalent to adjutrix,cave accerso A fetch / mirror client adjutrix A tool for tree querying appareo A tool for generating manifests cave The modular Paludis client - instruo A metadata generation client - paludis The Paludis console client], + instruo A metadata generation client], [clients="`echo $with_clients | tr ',' ' '`"], [clients="$DEFAULT_CLIENTS"]) clients=`echo $clients | tr ' ' '\n' \ @@ -1799,7 +1798,6 @@ AC_OUTPUT( src/clients/appareo/Makefile src/clients/cave/Makefile src/clients/instruo/Makefile - src/clients/paludis/Makefile src/output/Makefile test/Makefile vim/Makefile diff --git a/doc/clients/Makefile.am b/doc/clients/Makefile.am index 025753317..206e378f9 100644 --- a/doc/clients/Makefile.am +++ b/doc/clients/Makefile.am @@ -94,16 +94,6 @@ HTML_LOG_COMPILER = $(LOG_COMPILER) index.html : header.html.part $(srcdir)/index.html.part footer.html.part cat header.html.part $(srcdir)/index.html.part footer.html.part > $@ -paludis.html : header.html.part footer.html.part - { cat header.html.part && { \ - if test -x $(top_builddir)/src/clients/paludis/man-paludis ; then \ - $(top_builddir)/src/clients/paludis/man-paludis --html ; \ - else \ - echo "<h1>paludis</h1>"; \ - echo "<p>Sorry, documentation was generated without support for the paludis client.</p>" ; \ - fi ; } && \ - cat footer.html.part ; } > $@ - accerso.html : header.html.part footer.html.part { cat header.html.part && { \ if test -x $(top_builddir)/src/clients/accerso/man-accerso ; then \ diff --git a/doc/clients/index.html.part b/doc/clients/index.html.part index 56677df6f..3e6d0892a 100644 --- a/doc/clients/index.html.part +++ b/doc/clients/index.html.part @@ -9,12 +9,6 @@ client.</li> </ul> -<p>And the old clients, which are being phased out:</p> - -<ul> - <li><a href="paludis.html">paludis</a>, the original console package management client.</li> -</ul> - <p>For ebuild developers and distribution maintainers:</p> <ul> diff --git a/doc/clients/toplinks.html.part.in b/doc/clients/toplinks.html.part.in index 1ff046ab1..d5cfb4bfd 100644 --- a/doc/clients/toplinks.html.part.in +++ b/doc/clients/toplinks.html.part.in @@ -18,10 +18,6 @@ </td> <td class="currentpage"> - <a href="###TOPURI###clients/paludis.html">paludis</a> - </td> - - <td class="currentpage"> <a href="###TOPURI###clients/accerso.html">accerso</a> </td> </tr> @@ -36,10 +32,6 @@ </td> <td class="currentpage"> - - </td> - - <td class="currentpage"> <a href="###TOPURI###clients/adjutrix.html">adjutrix</a> </td> </tr> @@ -54,10 +46,6 @@ </td> <td class="currentpage"> - - </td> - - <td class="currentpage"> <a href="###TOPURI###clients/instruo.html">instruo</a> </td> </tr> @@ -72,10 +60,6 @@ </td> <td class="currentpage"> - - </td> - - <td class="currentpage"> <a href="###TOPURI###clients/appareo.html">appareo</a> </td> </tr> @@ -92,10 +76,6 @@ <td class="currentpage"> </td> - - <td class="currentpage"> - - </td> </tr> <tr> @@ -110,10 +90,6 @@ <td class="currentpage"> </td> - - <td class="currentpage"> - - </td> </tr> <tr> @@ -128,10 +104,6 @@ <td class="currentpage"> </td> - - <td class="currentpage"> - - </td> </tr> </table> </div> diff --git a/doc/index.html.part.in b/doc/index.html.part.in index 884e18d06..2f50fd5f1 100644 --- a/doc/index.html.part.in +++ b/doc/index.html.part.in @@ -84,12 +84,6 @@ the exheres repository format.</p> management client.</li> </ul> -<p>And the old clients, which are being phased out:</p> - -<ul> - <li><a href="clients/paludis.html">paludis</a>, the original console package management client.</li> -</ul> - <p>For ebuild developers and distribution maintainers:</p> <ul> diff --git a/src/clients/paludis/Makefile.am b/src/clients/paludis/Makefile.am deleted file mode 100644 index c0246da42..000000000 --- a/src/clients/paludis/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -include $(top_srcdir)/misc/common-makefile.am - -AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src \ - @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_NO_WOLD_STYLE_CAST@ @PALUDIS_CXXFLAGS_VISIBILITY@ -DEFS= \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DLIBDIR=\"$(libdir)\" \ - -DPYTHONINSTALLDIR=\"$(PYTHON_INSTALL_DIR)\" \ - -DRUBYINSTALLDIR=\"$(RUBY_INSTALL_DIR)\" - -SUBDIRS = . - -bin_PROGRAMS = paludis -noinst_PROGRAMS = man-paludis -man_MANS = paludis.1 - -paludis.1 : man-paludis - ./man-paludis > $@ - -man_paludis_SOURCES = \ - man_paludis.cc \ - command_line.hh \ - command_line.cc - -man_paludis_LDADD = \ - $(top_builddir)/paludis/args/legacy/libpaludisargslegacy_@PALUDIS_PC_SLOT@.la \ - $(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) - -paludis_SOURCES = \ - applets.hh applets.cc \ - command_line.hh command_line.cc \ - info.hh info.cc \ - install.hh install.cc \ - uninstall.hh uninstall.cc \ - list.hh list.cc \ - query.hh query.cc \ - sync.hh sync.cc \ - do_contents.hh do_contents.cc \ - do_executables.hh do_executables.cc \ - do_config.hh do_config.cc \ - owner.hh owner.cc \ - report.hh report.cc \ - paludis.cc - -paludis_LDADD = \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/legacy/libpaludislegacy_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/args/legacy/libpaludisargslegacy_@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) - -TESTS = \ - upgrade_TEST \ - install_TEST \ - continue_on_failure_TEST \ - version_TEST help_TEST \ - list_repository_formats_TEST \ - exception_TEST \ - pretend_TEST \ - args_from_environment_TEST - -EXTRA_DIST = \ - $(man_MANS) \ - $(TESTS) \ - install_TEST_setup.sh install_TEST_cleanup.sh \ - pretend_TEST_setup.sh pretend_TEST_cleanup.sh \ - upgrade_TEST_setup.sh upgrade_TEST_cleanup.sh \ - continue_on_failure_TEST_setup.sh continue_on_failure_TEST_cleanup.sh - -DISTCLEANFILES = $(man_MANS) $(noinst_DATA) - diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc deleted file mode 100644 index 92a191278..000000000 --- a/src/clients/paludis/applets.cc +++ /dev/null @@ -1,442 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 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 "applets.hh" -#include <src/output/colour.hh> -#include <functional> -#include <iomanip> -#include <iostream> -#include <paludis/paludis.hh> -#include <paludis/util/log.hh> -#include <paludis/util/system.hh> -#include <paludis/util/tokeniser.hh> -#include <paludis/util/timestamp.hh> -#include <paludis/util/process.hh> -#include <paludis/repository_factory.hh> -#include <string> -#include <set> -#include <map> - -/** \file - * Handle the --has-version, --best-version and various --list actions for the - * main paludis program. - */ - -using namespace paludis; - -namespace -{ - struct ValuePrinter - { - int return_code; - - ValuePrinter() : - return_code(0) - { - } - - void visit(const MetadataValueKey<std::string> & k) - { - std::cout << k.value() << std::endl; - } - - void visit(const MetadataValueKey<SlotName> & k) - { - std::cout << k.value() << std::endl; - } - - void visit(const MetadataValueKey<long> & k) - { - std::cout << k.value() << std::endl; - } - - void visit(const MetadataValueKey<bool> & k) - { - std::cout << k.value() << std::endl; - } - - void visit(const MetadataValueKey<FSPath> & k) - { - std::cout << k.value() << std::endl; - } - - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > &) - { - std::cout << "(unprintable)" << std::endl; - return_code |= 1; - } - - void visit(const MetadataSectionKey &) - { - std::cout << "(unprintable)" << std::endl; - return_code |= 1; - } - - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > &) - { - std::cout << "(unprintable)" << std::endl; - return_code |= 1; - } - - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > &) - { - std::cout << "(unprintable)" << std::endl; - return_code |= 1; - } - - void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataSpecTreeKey<DependencySpecTree> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataCollectionKey<FSPathSequence> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataCollectionKey<PackageIDSequence> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataCollectionKey<KeywordNameSet> & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataCollectionKey<Set<std::string> > & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataCollectionKey<Sequence<std::string> > & k) - { - std::cout << k.pretty_print_value(UnformattedPrettyPrinter(), { }) << std::endl; - } - - void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) - { - std::cout << *k.value() << std::endl; - } - - void visit(const MetadataTimeKey & k) - { - std::cout << k.value().seconds() << std::endl; - } - }; -} - -int do_has_version(const std::shared_ptr<Environment> & env) -{ - int return_code(0); - - Context context("When performing has-version action from command line:"); - - std::string query(*CommandLine::get_instance()->begin_parameters()); - std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( - parse_user_package_dep_spec(query, env.get(), { }))); - std::shared_ptr<const PackageIDSequence> entries((*env)[selection::SomeArbitraryVersion( - generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); - - if (entries->empty()) - return_code = 1; - - return return_code; -} - -int do_best_version(const std::shared_ptr<Environment> & env) -{ - int return_code(0); - - Context context("When performing best-version action from command line:"); - - std::string query(*CommandLine::get_instance()->begin_parameters()); - std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( - parse_user_package_dep_spec(query, env.get(), { }))); - std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); - - /* make built_with_use work for virtuals... icky... */ - while (! entries->empty()) - { - if (! (*entries->last())->virtual_for_key()) - break; - - Log::get_instance()->message("paludis.best_version.is_virtual", ll_qa, lc_context) << "best-version of '" << query << - "' resolves to '" << **entries->last() << "', which is a virtual for '" - << *(*entries->last())->virtual_for_key()->value() << "'. This will break with " - "new style virtuals."; - std::shared_ptr<PackageIDSequence> new_entries(std::make_shared<PackageIDSequence>()); - new_entries->push_back((*entries->last())->virtual_for_key()->value()); - entries = new_entries; - } - - if (entries->empty()) - return_code = 1; - else - { - // don't include repo, it breaks built_with_use and the like. - std::string entry( - stringify((*entries->last())->name()) + "-" + - stringify((*entries->last())->version())); - std::cout << entry << std::endl; - } - - return return_code; -} - -int do_match(const std::shared_ptr<Environment> & env) -{ - int return_code(0); - - Context context("When performing match action from command line:"); - - std::string query(*CommandLine::get_instance()->begin_parameters()); - std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( - parse_user_package_dep_spec(query, env.get(), { }))); - std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); - - while (! entries->empty()) - { - if (! (*entries->last())->virtual_for_key()) - break; - - Log::get_instance()->message("paludis.match.is_virtual", ll_qa, lc_context) << "match of '" << query << - "' resolves to '" << **entries->last() << "', which is a virtual for '" - << *(*entries->last())->virtual_for_key()->value() << "'. This will break with " - "new style virtuals."; - std::shared_ptr<PackageIDSequence> new_entries(std::make_shared<PackageIDSequence>()); - new_entries->push_back((*entries->last())->virtual_for_key()->value()); - entries = new_entries; - } - - if (entries->empty()) - return_code = 1; - else - { - for (PackageIDSequence::ConstIterator i(entries->begin()), i_end(entries->end()) ; i != i_end ; ++i) - { - // don't include repo, it breaks built_with_use and the like. - std::string entry( - stringify((*i)->name()) + "-" + - stringify((*i)->version())); - std::cout << entry << std::endl; - } - } - - return return_code; -} - -int do_environment_variable(const std::shared_ptr<Environment> & env) -{ - int return_code(0); - - Context context("When performing environment-variable action from command line:"); - - std::string spec_str(*CommandLine::get_instance()->begin_parameters()); - std::string var_str(* next(CommandLine::get_instance()->begin_parameters())); - std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( - parse_user_package_dep_spec(spec_str, env.get(), { }))); - - std::shared_ptr<const PackageIDSequence> entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); - - if (entries->empty()) - entries = (*env)[selection::AllVersionsSorted(generator::Matches(*spec, make_null_shared_ptr(), { }))]; - - if (entries->empty()) - throw NoSuchPackageError(spec_str); - - auto repo(env->package_database()->fetch_repository((*entries->last())->repository_name())); - RepositoryEnvironmentVariableInterface * env_if(repo->environment_variable_interface()); - - if (! env_if) - { - std::cerr << "Repository '" << (*entries->last())->repository_name() << - "' cannot be queried for environment variables" << std::endl; - return_code |= 1; - } - else - std::cout << env_if->get_environment_variable(*entries->last(), var_str) << std::endl; - - return return_code; -} - -int do_configuration_variable(const std::shared_ptr<Environment> & env) -{ - Context context("When performing configuration-variable action from command line:"); - - std::string repo_str(*CommandLine::get_instance()->begin_parameters()); - std::string var_str(* next(CommandLine::get_instance()->begin_parameters())); - - const std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(RepositoryName(repo_str))); - Repository::MetadataConstIterator i(repo->find_metadata(var_str)); - if (i == repo->end_metadata()) - return 1; - else - { - ValuePrinter v; - (*i)->accept(v); - return v.return_code; - } -} - -int do_list_repository_formats() -{ - int return_code(1); - - std::set<std::string> keys(RepositoryFactory::get_instance()->begin_keys(), RepositoryFactory::get_instance()->end_keys()); - - if (! keys.empty()) - { - return_code = 0; - for (std::set<std::string>::const_iterator k(keys.begin()), k_end(keys.end()) ; - k != k_end ; ++k) - std::cout << "* " << colour(cl_key_name, *k) << std::endl; - } - - return return_code; -} - -int do_list_sync_protocols(const std::shared_ptr<Environment> & env) -{ - std::map<std::string, std::string> syncers; - - std::shared_ptr<const FSPathSequence> sd(env->syncers_dirs()); - for (FSPathSequence::ConstIterator d(sd->begin()), - d_end(sd->end()) ; d != d_end ; ++d) - { - FSPath dir(*d); - if (! dir.stat().is_directory()) - continue; - - for (FSIterator f(dir, { }), f_end; f != f_end; ++f) - { - std::string name(f->basename()); - if ((0 != (f->stat().permissions() & S_IXUSR)) && - 0 == name.compare(0, 2, "do", 0, 2)) - { - name.erase(0, 2); - if (syncers.find(name) == syncers.end()) - syncers[name] = stringify(*f); - } - } - } - - int return_code(1); - - if (! syncers.empty()) - { - return_code = 0; - for (std::map<std::string, std::string>::const_iterator s(syncers.begin()), s_end(syncers.end()) ; - s != s_end ; ++s) - { - std::cout << "* " << colour(cl_key_name, s->first) << std::endl; - Process process((ProcessCommand(s->second + " --help"))); - process - .setenv("PALUDIS_FETCHERS_DIRS", join(sd->begin(), sd->end(), " ")) - .setenv("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")); - if (0 != process.run().wait()) - Log::get_instance()->message("paludis.syncer_help.failure", ll_warning, lc_context) - << "Syncer help command '" << s->second << " --help' failed"; - std::cout << std::endl; - } - } - - return return_code; -} - -int do_regenerate_cache(const std::shared_ptr<Environment> & env, bool installed) -{ - Context context("When performing cache regeneration action from command line:"); - - if (! CommandLine::get_instance()->empty()) - { - CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()); - for ( ; q != q_end ; ++q) - { - if (! env->package_database()->has_repository_named(RepositoryName(*q))) - throw NoSuchRepositoryError(RepositoryName(*q)); - - std::cout << "Regenerating cache for " << (*q) << "..." << std::endl; - env->package_database()->fetch_repository(RepositoryName(*q))->regenerate_cache(); - } - } - else - { - for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()), - r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r) - { - if (installed) - { - if (! (*r)->installed_root_key()) - continue; - } - else - { - SupportsActionTest<InstallAction> action_test; - if (! (*r)->some_ids_might_support_action(action_test)) - continue; - } - - std::cout << "Regenerating cache for " << (*r)->name() << "..." << std::endl; - (*r)->regenerate_cache(); - } - } - - return 0; -} - diff --git a/src/clients/paludis/applets.hh b/src/clients/paludis/applets.hh deleted file mode 100644 index 42b7db4c2..000000000 --- a/src/clients/paludis/applets.hh +++ /dev/null @@ -1,59 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_APPLETS_HH -#define PALUDIS_GUARD_SRC_APPLETS_HH 1 - -#include "command_line.hh" - -/** \file - * Declaration for small do_* functions. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --has-version. -int do_has_version(const std::shared_ptr<paludis::Environment> &); - -/// Handle --best-version. -int do_best_version(const std::shared_ptr<paludis::Environment> &); - -/// Handle --match. -int do_match(const std::shared_ptr<paludis::Environment> &); - -/// Handle --environment-variable. -int do_environment_variable(const std::shared_ptr<paludis::Environment> &); - -/// Handle --configuration-variable. -int do_configuration_variable(const std::shared_ptr<paludis::Environment> &); - -/// Handle --list-repository-formats -int do_list_repository_formats(); - -/// Handle --list-sync-protocols -int do_list_sync_protocols(const std::shared_ptr<paludis::Environment> &); - -/// Handle cache regeneration -int do_regenerate_cache(const std::shared_ptr<paludis::Environment> &, bool installed); - -#endif - diff --git a/src/clients/paludis/args_from_environment_TEST b/src/clients/paludis/args_from_environment_TEST deleted file mode 100755 index 5ec6fecf7..000000000 --- a/src/clients/paludis/args_from_environment_TEST +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -PALUDIS_SKIP_CONFIG=yes PALUDIS_OPTIONS=--version ./paludis diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc deleted file mode 100644 index cd04d7cd7..000000000 --- a/src/clients/paludis/command_line.cc +++ /dev/null @@ -1,230 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 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/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_query(&action_args, "query", 'q', "Query for package information", false), - a_install(&action_args, "install", 'i', "Install one or more packages", false), - a_uninstall(&action_args, "uninstall", 'u', "Uninstall one or more packages", false), - a_uninstall_unused(&action_args, "uninstall-unused", '\0', "Uninstall unused packages", false), - a_sync(&action_args, "sync", 's', "Sync all or specified repositories", false), - a_report(&action_args, "report", 'r', "Report the current state of the system", false), - a_contents(&action_args, "contents", 'k', "Display contents of a package", false), - a_executables(&action_args,"executables", '\0', "Display executable contents of a package", false), - a_owner(&action_args, "owner", 'o', "Display the owner of a file", false), - a_config(&action_args, "config", '\0', "Run post-install configuration for a package", false), - a_version(&action_args, "version", 'V', "Display program version", false), - a_info(&action_args, "info", 'I', "Display program version and system information", false), - a_help(&action_args, "help", 'h', "Display program help", false), - - action_args_internal(main_options_section(), "More actions", - "Additional actions, mostly for script and internal use."), - a_has_version(&action_args_internal, "has-version", '\0', "Check whether the specified spec is installed", false), - a_best_version(&action_args_internal, "best-version", '\0', "Display the best version of the specified spec", false), - a_match(&action_args_internal, "match", '\0', "Display all installed packages matching the supplied argument", false), - a_environment_variable(&action_args_internal, "environment-variable", '\0', "Display the value of an environment " - "variable for a particular package", false), - a_configuration_variable(&action_args_internal, "configuration-variable", '\0', "Display the value of a " - "configuration variable for a particular repository", false), - a_list_repositories(&action_args_internal, "list-repositories", '\0', "List available repositories", false), - a_list_categories(&action_args_internal, "list-categories", '\0', "List available categories", false), - a_list_packages(&action_args_internal, "list-packages", '\0', "List available packages", false), - a_list_sets(&action_args_internal, "list-sets", '\0', "List available package sets", false), - a_list_sync_protocols(&action_args_internal, "list-sync-protocols", '\0', "List available sync protocols", false), - a_list_repository_formats(&action_args_internal, "list-repository-formats", '\0', - "List available repository formats", false), - a_regenerate_installed_cache(&action_args_internal, "regenerate-installed-cache", '\0', - "Regenerate (non-metadata) cache for installed repositories", false), - a_regenerate_installable_cache(&action_args_internal, "regenerate-installable-cache", '\0', - "Regenerate (non-metadata) cache for installable repositories", false), - - general_args(main_options_section(), "General options", - "Options which 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_no_suggestions(&general_args, "no-suggestions", '\0', "Do not give suggestions if an unknown name is specified", false), - a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"), - a_resume_command_template(&general_args, "resume-command-template", '\0', - "Save the resume command to a file. If the filename contains 'XXXXXX', use mkstemp(3) to generate the filename"), - a_multitask(&general_args, "multitask", '\0', "Perform tasks in parallel, where supported (currently --sync only)", true), - a_compact(&general_args, "compact", '\0', "Display output using one line per entry (--install, --query)", true), - - query_args(main_options_section(), "Query options", - "Options which are relevant for --query."), - a_show_deps(&query_args, "show-deps", 'D', "Show dependencies", true), - a_show_authors(&query_args, "show-authors", 'A', "Show author information", true), - a_show_metadata(&query_args, "show-metadata", 'M', "Show raw metadata", true), - - install_args(main_options_section(), "Install, Uninstall options", - "Options which are relevant for --install, --uninstall or --uninstall-unused."), - - a_serialised(&install_args, "serialised", '\0', - "Rather than being a collection of atoms, treat the positional parameters as a serialised dependency " - "list. The parameter to this option specifies the format version. Used by resume commands and Paludis " - "exec()ing itself upon an upgrade; not to be used manually"), - - uninstall_args(main_options_section(), "Uninstall options", - "Options which are relevant for --uninstall."), - a_with_unused_dependencies(&uninstall_args, "with-unused-dependencies", '\0', - "Also uninstall any dependencies of the target that are no longer used", true), - a_with_dependencies(&uninstall_args, "with-dependencies", '\0', - "Also uninstall packages that depend upon the target", true), - a_all_versions(&uninstall_args, "all-versions", '\0', - "Uninstall all versions of a package", true), - a_permit_unsafe_uninstalls(&uninstall_args, "permit-unsafe-uninstalls", '\0', - "Allow depended-upon packages to uninstalled", true), - - dl_args(main_options_section()), - - list_args(main_options_section(), "List options", - "Options relevant for one or more of the --list actions."), - a_repository(&list_args, "repository", '\0', "Matches with this repository name only"), - a_repository_format(&list_args, "repository-format", '\0', "Matches with this repository format only"), - a_category(&list_args, "category", '\0', "Matches with this category name only"), - a_package(&list_args, "package", '\0', "Matches with this package name only"), - a_set(&list_args, "set", '\0', "Matches with this package set name only"), - - owner_args(main_options_section(), "Owner options", - "Options relevant for the --owner actions."), - a_full_match(&owner_args, "full-match", '\0', "Match whole filename", true) -{ - add_usage_line("--query [query options] target ..."); - add_usage_line("--install [install options] target ..."); - add_usage_line("--uninstall [uninstall options] target ..."); - add_usage_line("--uninstall-unused"); - add_usage_line("--sync [target (leave blank for all)]"); - add_usage_line("--report"); - add_usage_line("--contents target ..."); - add_usage_line("--executables target ..."); - add_usage_line("--owner [owner options] files ..."); - add_usage_line("--config target ..."); - add_usage_line("--version"); - add_usage_line("--info [target ...]"); - add_usage_line("--help"); - - add_usage_line("--has-version spec"); - add_usage_line("--best-version spec"); - add_usage_line("--environment-variable spec variable"); - add_usage_line("--configuration-variable repository variable"); - add_usage_line("--list-repositories [--repository repo1 --repository repo2 ...]"); - add_usage_line("--list-categories [--repository repo1 ... --category cat1 --category cat2 ...]"); - add_usage_line("--list-packages [--repository repo1 ... --category cat1 ... --package pkg1 --package pkg2 ...]"); - add_usage_line("--list-sets [--repository repo1 ... --set set1 ...]"); - add_usage_line("--list-sync-protocols"); - add_usage_line("--list-repository-formats"); - add_usage_line("--list-dep-tag-categories"); - add_usage_line("--regenerate-installed-cache [target (leave blank for all)]"); - add_usage_line("--regenerate-installable-cache [target (leave blank for all)]"); - - add_environment_variable("PALUDIS_OPTIONS", "Default command-line options."); - - add_example( - "paludis --sync", - "Sync all syncable repositories, and perform any necessary cache updates."); - add_example( - "paludis --install --pretend world", - "Show available updates for packages in the 'world' set (which contains all packages that " - "have been explicitly installed as targets, along with the 'system' set), along with runtime " - "dependencies of packages therein recursively."); - add_example( - "paludis --install world", - "...and, having checked the output above, perform the install."); - add_example( - "paludis --install --continue-on-failure if-satisfied world", - "...and continue as far as possible even after errors are encountered."); - add_example( - "paludis --install --pretend --dl-reinstall if-use-changed world", - "...also reinstall packages whose use settings have changed."); - add_example( - "paludis --install --pretend --dl-reinstall-scm weekly world", - "...also reinstall any scm (cvs, svn, ...) package that was installed over a week ago."); - add_example( - "paludis --install --pretend x11-wm/fluxbox", - "Show what would be done to install a single package, along with all its dependencies, " - "whilst recursively updating runtime dependencies."); - add_example( - "paludis --install --pretend fluxbox", - "...as above, if the package name is unambiguous."); - add_example( - "paludis --install fluxbox", - "...and perform the install, and add the package to the 'world' set when done."); - add_example( - "paludis --install --preserve-world fluxbox", - "...or don't add the package to the 'world' set."); - add_example( - "paludis --install --pretend --dl-upgrade as-needed fluxbox", - "...only update dependencies where required."); - add_example( - "paludis --install --pretend =x11-wm/fluxbox-1.0.0", - "...specifying an exact version (which also prevents the package from being added to 'world')."); - add_example( - "paludis --uninstall app-editors/emacs", - "Uninstall a package."); - add_example( - "paludis --uninstall --pretend --with-dependencies app-editors/emacs", - "Uninstall a package, along with any packages depending upon it."); - add_example( - "paludis --uninstall --pretend --with-dependencies --with-unused-dependencies app-editors/emacs", - "...and also any packages that are only installed to satisfy that package's dependencies."); - add_example( - "paludis --uninstall --pretend --permit-unsafe-uninstalls app-editors/emacs", - "...uninstall, even if the package is required by another installed package."); - add_example( - "paludis --uninstall-unused --pretend", - "Uninstall all unused packages."); - - add_note("paludis is deprecated. Use 'cave' instead."); -} - -std::string -CommandLine::app_name() const -{ - return "paludis"; -} - -std::string -CommandLine::app_synopsis() const -{ - return "The deprecated other package mangler client"; -} - -std::string -CommandLine::app_description() const -{ - return "paludis is deprecated; use 'cave' instead."; -} - -CommandLine::~CommandLine() -{ -} - diff --git a/src/clients/paludis/command_line.hh b/src/clients/paludis/command_line.hh deleted file mode 100644 index 76f4393f2..000000000 --- a/src/clients/paludis/command_line.hh +++ /dev/null @@ -1,265 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 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_COMMAND_LINE_HH -#define PALUDIS_GUARD_SRC_COMMAND_LINE_HH 1 - -#include <paludis/args/args.hh> -#include <paludis/util/singleton.hh> -#include <paludis/args/legacy/dep_list_args_group.hh> -#include <paludis/args/legacy/install_args_group.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::Singleton<CommandLine> -{ - friend class paludis::Singleton<CommandLine>; - - private: - /// Constructor. - CommandLine(); - - /// Destructor. - ~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 - ///{ - - /// Action arguments. - paludis::args::ArgsGroup action_args; - - /// --query - paludis::args::SwitchArg a_query; - - /// --install - paludis::args::SwitchArg a_install; - - /// --uninstall - paludis::args::SwitchArg a_uninstall; - - /// --uninstall-unused - paludis::args::SwitchArg a_uninstall_unused; - - /// --sync - paludis::args::SwitchArg a_sync; - - /// --report - paludis::args::SwitchArg a_report; - - /// --contents - paludis::args::SwitchArg a_contents; - - /// --executables - paludis::args::SwitchArg a_executables; - - /// --owner - paludis::args::SwitchArg a_owner; - - /// --config - paludis::args::SwitchArg a_config; - - /// --version - paludis::args::SwitchArg a_version; - - /// --info - paludis::args::SwitchArg a_info; - - /// --help - paludis::args::SwitchArg a_help; - - /// Action arguments (internal). - paludis::args::ArgsGroup action_args_internal; - - /// --has-version - paludis::args::SwitchArg a_has_version; - - /// --best-version - paludis::args::SwitchArg a_best_version; - - /// --match - paludis::args::SwitchArg a_match; - - /// --environment-variable - paludis::args::SwitchArg a_environment_variable; - - /// --configuration-variable - paludis::args::SwitchArg a_configuration_variable; - - /// --list-repositories - paludis::args::SwitchArg a_list_repositories; - - /// --list-categories - paludis::args::SwitchArg a_list_categories; - - /// --list-packages - paludis::args::SwitchArg a_list_packages; - - /// --list-sets - paludis::args::SwitchArg a_list_sets; - - /// --list-sync-protocols - paludis::args::SwitchArg a_list_sync_protocols; - - /// --list-repository-formats - paludis::args::SwitchArg a_list_repository_formats; - - /// --regenerate-installed-cache - paludis::args::SwitchArg a_regenerate_installed_cache; - - /// --regenerate-installable-cache - paludis::args::SwitchArg a_regenerate_installable_cache; - - ///} - - /// \name General arguments - ///{ - - /// General arguments. - paludis::args::ArgsGroup general_args; - - /// --log-level - paludis::args::LogLevelArg a_log_level; - - /// --no-colour - paludis::args::SwitchArg a_no_colour; - - /// --no-color - paludis::args::AliasArg a_no_color; - - /// --force-colour - paludis::args::SwitchArg a_force_colour; - - /// --force-color - paludis::args::AliasArg a_force_color; - - /// --no-suggestions - paludis::args::SwitchArg a_no_suggestions; - - /// --environment - paludis::args::StringArg a_environment; - - /// --resume-command-template - paludis::args::StringArg a_resume_command_template; - - /// --multitask - paludis::args::SwitchArg a_multitask; - - /// --compact - paludis::args::SwitchArg a_compact; - - ///} - - /// \name Query arguments - ///{ - - /// Query arguments. - paludis::args::ArgsGroup query_args; - - /// --show-deps - paludis::args::SwitchArg a_show_deps; - - /// --show-authors - paludis::args::SwitchArg a_show_authors; - - /// --show-metadata - paludis::args::SwitchArg a_show_metadata; - - /// } - - /// \name (Un)Install arguments - paludis::args::InstallArgsGroup install_args; - - paludis::args::StringArg a_serialised; - - /// \name Uninstall arguments - ///\{ - - paludis::args::ArgsGroup uninstall_args; - - /// --with-unused-dependencies - paludis::args::SwitchArg a_with_unused_dependencies; - - /// --with-dependencies - paludis::args::SwitchArg a_with_dependencies; - - /// --all-versions - paludis::args::SwitchArg a_all_versions; - - /// --permit-unsafe-uninstalls - paludis::args::SwitchArg a_permit_unsafe_uninstalls; - - ///\} - - /// DepList behaviour arguments. - paludis::args::DepListArgsGroup dl_args; - - /// \name List arguments - /// { - - /// List arguments. - paludis::args::ArgsGroup list_args; - - /// --repository - paludis::args::StringSetArg a_repository; - - /// --repository-format - paludis::args::StringSetArg a_repository_format; - - /// --category - paludis::args::StringSetArg a_category; - - /// --package - paludis::args::StringSetArg a_package; - - /// --set - paludis::args::StringSetArg a_set; - - /// } - - /// \name Owner arguments - /// { - - /// Owner arguments. - paludis::args::ArgsGroup owner_args; - - /// --full-match - paludis::args::SwitchArg a_full_match; - - /// } -}; - -#endif diff --git a/src/clients/paludis/continue_on_failure_TEST b/src/clients/paludis/continue_on_failure_TEST deleted file mode 100755 index 5f95d13d6..000000000 --- a/src/clients/paludis/continue_on_failure_TEST +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -export PALUDIS_HOME=`pwd`/continue_on_failure_TEST_dir/config/ - -./paludis --environment :continue-on-failure-test \ - --install --continue-on-failure if-satisfied a b c - -if [[ -f continue_on_failure_TEST_dir/root/a ]] ; then - exit 1 -fi - -if [[ -f continue_on_failure_TEST_dir/root/b ]] ; then - exit 2 -fi - -if ! [[ -f continue_on_failure_TEST_dir/root/c ]] ; then - exit 3 -fi - -if [[ -f continue_on_failure_TEST_dir/root/d ]] ; then - exit 4 -fi - -if ! [[ -f continue_on_failure_TEST_dir/root/e ]] ; then - exit 5 -fi - -./paludis --environment :continue-on-failure-test \ - --install =cat/w-1 cat/u || exit 6 - -./paludis --environment :continue-on-failure-test \ - --install --continue-on-failure if-independent x y z - -if [[ -f continue_on_failure_TEST_dir/root/z ]] ; then - exit 7 -fi - -if [[ -f continue_on_failure_TEST_dir/root/y ]] ; then - exit 8 -fi - -if ! [[ -f continue_on_failure_TEST_dir/root/x ]] ; then - exit 9 -fi - -if [[ -f continue_on_failure_TEST_dir/root/w ]] ; then - exit 10 -fi - -if ! [[ -f continue_on_failure_TEST_dir/root/v ]] ; then - exit 11 -fi - -exit 0 - diff --git a/src/clients/paludis/continue_on_failure_TEST_cleanup.sh b/src/clients/paludis/continue_on_failure_TEST_cleanup.sh deleted file mode 100755 index 530454138..000000000 --- a/src/clients/paludis/continue_on_failure_TEST_cleanup.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d continue_on_failure_TEST_dir ] ; then - rm -fr continue_on_failure_TEST_dir -else - true -fi - diff --git a/src/clients/paludis/continue_on_failure_TEST_setup.sh b/src/clients/paludis/continue_on_failure_TEST_setup.sh deleted file mode 100755 index e7ba6181d..000000000 --- a/src/clients/paludis/continue_on_failure_TEST_setup.sh +++ /dev/null @@ -1,249 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir continue_on_failure_TEST_dir || exit 1 -cd continue_on_failure_TEST_dir || exit 1 -mkdir -p build - -mkdir -p config/.paludis-continue-on-failure-test -cat <<END > config/.paludis-continue-on-failure-test/specpath.conf -root = `pwd`/root -config-suffix = -END - -mkdir -p root/${SYSCONFDIR}/paludis/repositories -cat <<END > root/${SYSCONFDIR}/paludis/use.conf -*/* foo -END - -cat <<END > root/${SYSCONFDIR}/paludis/licenses.conf -*/* * -END - -cat <<END > root/${SYSCONFDIR}/paludis/keywords.conf -*/* test -END - -cat <<END > root/${SYSCONFDIR}/paludis/general.conf -world = `pwd`/root/world -END - -cat <<END > root/${SYSCONFDIR}/paludis/bashrc -export CHOST="my-chost" -END - -cat <<END > root/${SYSCONFDIR}/paludis/repositories/repo1.conf -location = `pwd`/repo1 -cache = /var/empty -format = e -names_cache = /var/empty -profiles = \${location}/profiles/testprofile -builddir = `pwd`/build -END - -cat <<END > root/${SYSCONFDIR}/paludis/repositories/installed.conf -location = `pwd`/root/var/db/pkg -format = vdb -names_cache = /var/empty -provides_cache = /var/empty -builddir = `pwd`/build -END - -mkdir -p root/tmp -mkdir -p root/var/db/pkg -touch root/${SYSCONFDIR}/ld.so.conf - -mkdir -p repo1/{eclass,distfiles,profiles/testprofile,cat/{a,b,c,d,e,u,v,w,x,y,z}/files} || exit 1 - -cd repo1 || exit 1 -echo "test-repo-1" > profiles/repo_name || exit 1 -cat <<END > profiles/categories || exit 1 -cat -END -cat <<END > profiles/testprofile/make.defaults -ARCH=test -USERLAND=test -KERNEL=test -TESTPROFILE_WAS_SOURCED=yes -PROFILE_ORDERING=1 -USE_EXPAND="USERLAND KERNEL" -END - -cat <<"END" > cat/a/a-1.ebuild || exit 1 -DESCRIPTION="Test a" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="cat/d" - -src_install() { - touch ${D}/a -} -END - -cat <<"END" > cat/b/b-1.ebuild || exit 1 -DESCRIPTION="Test b" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="cat/a" - -src_install() { - touch ${D}/b -} -END - -cat <<"END" > cat/c/c-1.ebuild || exit 1 -DESCRIPTION="Test c" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="cat/e" - -src_install() { - touch ${D}/c -} -END - -cat <<"END" > cat/d/d-1.ebuild || exit 1 -DESCRIPTION="Test d" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="" - -pkg_setup() { - die "supposed to fail" -} -END - -cat <<"END" > cat/e/e-1.ebuild || exit 1 -DESCRIPTION="Test e" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="" - -src_install() { - touch ${D}/e -} -END - -cat <<"END" > cat/z/z-1.ebuild || exit 1 -DESCRIPTION="Test z" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="cat/w" - -src_install() { - touch ${D}/z -} -END - -cat <<"END" > cat/y/y-1.ebuild || exit 1 -DESCRIPTION="Test y" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="cat/u" - -src_install() { - touch ${D}/y -} -END - -cat <<"END" > cat/x/x-1.ebuild || exit 1 -DESCRIPTION="Test x" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="cat/v" - -src_install() { - touch ${D}/x -} -END - -cat <<"END" > cat/w/w-1.ebuild || exit 1 -DESCRIPTION="Test w" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="" -END - -cat <<"END" > cat/w/w-2.ebuild || exit 1 -DESCRIPTION="Test w" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="" - -pkg_setup() { - die "supposed to fail" -} -END - -cat <<"END" > cat/v/v-1.ebuild || exit 1 -DESCRIPTION="Test v" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="" - -src_install() { - touch ${D}/v -} -END - -cat <<"END" > cat/u/u-1.ebuild || exit 1 -DESCRIPTION="Test u" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -RDEPEND="cat/w" - -src_install() { - touch ${D}/u -} -END - -cd .. - diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc deleted file mode 100644 index d78a31c66..000000000 --- a/src/clients/paludis/do_config.cc +++ /dev/null @@ -1,139 +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 "do_config.hh" -#include "command_line.hh" -#include <src/output/colour.hh> -#include <paludis/paludis.hh> -#include <iostream> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - struct AmbiguousConfigTarget : - public Exception - { - std::shared_ptr<const PackageIDSequence> matches; - - AmbiguousConfigTarget(std::shared_ptr<const PackageIDSequence> & m) throw () : - Exception("Ambiguous config target"), - matches(m) - { - } - - ~AmbiguousConfigTarget() throw () - { - } - }; - - int - do_one_config_entry(const Environment * const env, const std::shared_ptr<const PackageID> & p) - { - int return_code(0); - - OutputManagerFromEnvironment output_manager_holder(env, p, oe_exclusive, ClientOutputFeatures()); - ConfigActionOptions options(make_named_values<ConfigActionOptions>( - n::make_output_manager() = std::ref(output_manager_holder) - )); - ConfigAction a(options); - try - { - p->perform_action(a); - if (output_manager_holder.output_manager_if_constructed()) - output_manager_holder.output_manager_if_constructed()->succeeded(); - } - catch (const ActionFailedError &) - { - std::cerr << "Package '" << *p << "' failed post-install configuration" << std::endl; - return_code |= 1; - } - - return return_code; - } - - int - do_one_config(std::shared_ptr<Environment> env, const std::string & target) - { - Context local_context("When handling query '" + target + "':"); - - std::shared_ptr<PackageDepSpec> spec( - std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(target, env.get(), { }, - filter::InstalledAtRoot(env->preferred_root_key()->value())))); - - std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsUnsorted(generator::Matches(*spec, make_null_shared_ptr(), { }) - | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); - - if (entries->empty()) - throw NoSuchPackageError(target); - - if (next(entries->begin()) != entries->end()) - throw AmbiguousConfigTarget(entries); - - return do_one_config_entry(env.get(), *entries->begin()); - } -} - -int -do_config(const std::shared_ptr<Environment> & env) -{ - int ret_code(0); - - Context context("When performing config action from command line:"); - - CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()); - for ( ; q != q_end ; ++q) - { - try - { - ret_code |= do_one_config(env, *q); - } - catch (const AmbiguousPackageNameError & e) - { - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl; - for (AmbiguousPackageNameError::OptionsConstIterator o(e.begin_options()), - o_end(e.end_options()) ; o != o_end ; ++o) - cerr << " * " << colour(cl_package_name, *o) << endl; - cerr << endl; - } - catch (const AmbiguousConfigTarget & e) - { - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Ambiguous config target '" << *q << "'. Did you mean:" << endl; - for (PackageIDSequence::ConstIterator o(e.matches->begin()), - o_end(e.matches->end()) ; o != o_end ; ++o) - cerr << " * =" << colour(cl_package_name, **o) << endl; - cerr << endl; - } - } - - return ret_code; -} - - diff --git a/src/clients/paludis/do_config.hh b/src/clients/paludis/do_config.hh deleted file mode 100644 index 97b1877d4..000000000 --- a/src/clients/paludis/do_config.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 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_CONFIG_HH -#define PALUDIS_GUARD_SRC_CONFIG_HH 1 - -#include <memory> - -/** \file - * Declaration for the do_config function. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --config. -int do_config(const std::shared_ptr<paludis::Environment> &); - -#endif - diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc deleted file mode 100644 index 3e7c726f2..000000000 --- a/src/clients/paludis/do_contents.cc +++ /dev/null @@ -1,173 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 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 "do_contents.hh" -#include <src/output/colour.hh> -#include "command_line.hh" -#include <paludis/paludis.hh> -#include <paludis/fuzzy_finder.hh> -#include <iostream> -#include <algorithm> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - struct ContentsDisplayer - { - void visit(const ContentsFileEntry & e) - { - cout << " " << colour(cl_file, stringify(e.location_key()->value())) << endl; - } - - void visit(const ContentsDirEntry & e) - { - cout << " " << colour(cl_dir, stringify(e.location_key()->value()) )<< endl; - } - - void visit(const ContentsSymEntry & e) - { - cout << " " << colour(cl_sym, stringify(e.location_key()->value())) << " -> " << e.target_key()->value() << endl; - } - - void visit(const ContentsOtherEntry & e) - { - cout << " " << colour(cl_other, stringify(e.location_key()->value())) << endl; - } - }; -} - -void -do_one_contents_entry( - const std::shared_ptr<Environment>, - const PackageID & e) -{ - cout << "* " << colour(cl_package_name, e) << endl; - - if (e.contents_key()) - { - std::shared_ptr<const Contents> contents(e.contents_key()->value()); - ContentsDisplayer d; - std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(d)); - } - else - cout << " " << colour(cl_error, "(unknown)") << endl; - - cout << endl; -} - -void -do_one_contents( - const std::shared_ptr<Environment> env, - const std::string & q) -{ - Context local_context("When handling query '" + q + "':"); - - std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( - parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions() + updso_allow_wildcards, - filter::InstalledAtRoot(env->preferred_root_key()->value())))); - - std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(*spec, make_null_shared_ptr(), { }) - | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); - - if (entries->empty()) - throw NoSuchPackageError(q); - - for (PackageIDSequence::ConstIterator i(entries->begin()), - i_end(entries->end()) ; i != i_end ; ++i) - do_one_contents_entry(env, **i); -} - -int -do_contents(const std::shared_ptr<Environment> & env) -{ - int return_code(0); - - Context context("When performing contents action from command line:"); - - CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()); - for ( ; q != q_end ; ++q) - { - try - { - do_one_contents(env, *q); - } - catch (const AmbiguousPackageNameError & e) - { - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl; - for (AmbiguousPackageNameError::OptionsConstIterator o(e.begin_options()), - o_end(e.end_options()) ; o != o_end ; ++o) - cerr << " * " << colour(cl_package_name, *o) << endl; - cerr << endl; - } - catch (const NameError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * ") << e.message() << endl; - cerr << endl; - } - catch (const NoSuchPackageError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Could not find '" << e.name() << "'."; - - if (! CommandLine::get_instance()->a_no_suggestions.specified()) - { - cerr << " Looking for suggestions:" << endl; - - FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->preferred_root_key()->value())); - - if (f.begin() == f.end()) - cerr << "No suggestions found." << endl; - else - cerr << "Suggestions:" << endl; - - for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), - c_end(f.end()) ; c != c_end ; ++c) - cerr << " * " << colour(cl_package_name, *c) << endl; - } - - cerr << endl; - } - catch (const PackageDatabaseLookupError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * ") << e.message() << endl; - cerr << endl; - } - } - - return return_code; -} - diff --git a/src/clients/paludis/do_contents.hh b/src/clients/paludis/do_contents.hh deleted file mode 100644 index 8a5bf6be4..000000000 --- a/src/clients/paludis/do_contents.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_CONTENTS_HH -#define PALUDIS_GUARD_SRC_CONTENTS_HH 1 - -/** \file - * Declaration for the do_contents function. - */ - -#include <memory> -#include <paludis/environment-fwd.hh> - -/// Handle --contents. -int do_contents(const std::shared_ptr<paludis::Environment> &); - -#endif diff --git a/src/clients/paludis/do_executables.cc b/src/clients/paludis/do_executables.cc deleted file mode 100644 index 143f1d481..000000000 --- a/src/clients/paludis/do_executables.cc +++ /dev/null @@ -1,225 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2008 Richard Brown - * - * 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_executables.hh" -#include "paludis/util/log.hh" -#include "paludis/util/tokeniser.hh" -#include <src/output/colour.hh> -#include "command_line.hh" -#include <paludis/paludis.hh> -#include <paludis/fuzzy_finder.hh> -#include <iostream> -#include <algorithm> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - struct ExecutablesDisplayer - { - private: - const std::list<std::string> _paths; - - bool is_file_in_path(FSPath file) - { - try - { - FSStat file_stat(file); - if (file_stat.exists()) - { - if (0 != (file_stat.permissions() & S_IXOTH)) - { - FSPath dirname(file.dirname()); - for (std::list<std::string>::const_iterator it(_paths.begin()), - it_end(_paths.end()); it_end != it; ++it) - { - if (stringify(dirname) == *it) - return true; - } - } - } - else - { - Context context("When checking permissions on '" + stringify(file) + "'"); - Log::get_instance()->message("do_executables.file_does_not_exist", ll_warning, lc_context) - << "'" << stringify(file) << "' is listed as installed but does not exist"; - } - return false; - } - catch (const FSError & e) - { - Context context("When checking if '" + stringify(file) + "' exists:"); - Log::get_instance()->message("do_executables.stat_failed", ll_warning, lc_context) - << "Cannot stat '" << stringify(file) << "': '" << e.message() << "' (" << e.what() << ")"; - return false; - } - } - - public: - ExecutablesDisplayer(std::list<std::string> p) : - _paths(p) - { - } - - void visit(const ContentsFileEntry & e) - { - if (is_file_in_path(e.location_key()->value())) - cout << " " << colour(cl_file, e.location_key()->value()) << endl; - } - - void visit(const ContentsDirEntry &) - { - } - - void visit(const ContentsSymEntry & e) - { - FSPath sym(e.location_key()->value()); - FSPath real(sym.realpath_if_exists()); - if (sym != real) - if (is_file_in_path(sym)) - cout << " " << colour(cl_sym, e.location_key()->value()) << endl; - } - - void visit(const ContentsOtherEntry &) - { - } - }; -} - -void -do_one_executables_entry( - const std::shared_ptr<Environment>, - const PackageID & e) -{ - cout << "* " << colour(cl_package_name, e) << endl; - - if (e.contents_key()) - { - std::shared_ptr<const Contents> contents(e.contents_key()->value()); - std::string path(getenv("PATH")); - std::list<std::string> paths; - tokenise<delim_kind::AnyOfTag, delim_mode::DelimiterTag>(path, ":", "", std::back_inserter(paths)); - ExecutablesDisplayer d(paths); - std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(d)); - } - else - cout << " " << colour(cl_error, "(unknown)") << endl; - - cout << endl; -} - -void -do_one_executables( - const std::shared_ptr<Environment> env, - const std::string & q) -{ - Context local_context("When handling query '" + q + "':"); - - std::shared_ptr<PackageDepSpec> spec(std::make_shared<PackageDepSpec>( - parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions() + updso_allow_wildcards, - filter::InstalledAtRoot(env->preferred_root_key()->value())))); - - std::shared_ptr<const PackageIDSequence> entries( - (*env)[selection::AllVersionsSorted(generator::Matches(*spec, make_null_shared_ptr(), { }) - | filter::InstalledAtRoot(env->preferred_root_key()->value()))]); - - if (entries->empty()) - throw NoSuchPackageError(q); - - for (PackageIDSequence::ConstIterator i(entries->begin()), - i_end(entries->end()) ; i != i_end ; ++i) - do_one_executables_entry(env, **i); -} - -int -do_executables(const std::shared_ptr<Environment> & env) -{ - int return_code(0); - - Context context("When performing executables action from command line:"); - - CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()); - for ( ; q != q_end ; ++q) - { - try - { - do_one_executables(env, *q); - } - catch (const AmbiguousPackageNameError & e) - { - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl; - for (AmbiguousPackageNameError::OptionsConstIterator o(e.begin_options()), - o_end(e.end_options()) ; o != o_end ; ++o) - cerr << " * " << colour(cl_package_name, *o) << endl; - cerr << endl; - } - catch (const NameError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * ") << e.message() << endl; - cerr << endl; - } - catch (const NoSuchPackageError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Could not find '" << e.name() << "'."; - - if (! CommandLine::get_instance()->a_no_suggestions.specified()) - { - cerr << " Looking for suggestions:" << endl; - - FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->preferred_root_key()->value())); - - if (f.begin() == f.end()) - cerr << "No suggestions found." << endl; - else - cerr << "Suggestions:" << endl; - - for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), - c_end(f.end()) ; c != c_end ; ++c) - cerr << " * " << colour(cl_package_name, *c) << endl; - } - - cerr << endl; - } - catch (const PackageDatabaseLookupError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * ") << e.message() << endl; - cerr << endl; - } - } - - return return_code; -} - diff --git a/src/clients/paludis/do_executables.hh b/src/clients/paludis/do_executables.hh deleted file mode 100644 index 62e89225f..000000000 --- a/src/clients/paludis/do_executables.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2008 Richard Brown - * - * 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_EXECUTABLES_HH -#define PALUDIS_GUARD_SRC_EXECUTABLES_HH 1 - -/** \file - * Declaration for the do_contents function. - */ - -#include <paludis/environment-fwd.hh> -#include <memory> - -/// Handle --executables. -int do_executables(const std::shared_ptr<paludis::Environment> &); - -#endif diff --git a/src/clients/paludis/exception_TEST b/src/clients/paludis/exception_TEST deleted file mode 100755 index 06703e586..000000000 --- a/src/clients/paludis/exception_TEST +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -PALUDIS_HOME=./ \ - ./paludis --environment :paludis-build-test -pi asdf 2>&1 \ - | grep 'configuration error' >/dev/null - diff --git a/src/clients/paludis/help_TEST b/src/clients/paludis/help_TEST deleted file mode 100755 index ece503f3f..000000000 --- a/src/clients/paludis/help_TEST +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -PALUDIS_SKIP_CONFIG=yes ./paludis --help diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc deleted file mode 100644 index fd8e02566..000000000 --- a/src/clients/paludis/info.cc +++ /dev/null @@ -1,422 +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 "info.hh" -#include "command_line.hh" -#include "src/output/colour.hh" -#include "src/output/colour_pretty_printer.hh" -#include <paludis/about.hh> -#include <paludis/user_dep_spec.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/simple_visitor_cast.hh> -#include <paludis/util/make_named_values.hh> -#include <paludis/util/system.hh> -#include <paludis/util/pretty_print.hh> -#include <paludis/util/wrapped_output_iterator.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/timestamp.hh> -#include <paludis/util/accept_visitor.hh> -#include <paludis/util/process.hh> -#include <paludis/util/make_null_shared_ptr.hh> -#include <paludis/package_database.hh> -#include <paludis/environment.hh> -#include <paludis/package_id.hh> -#include <paludis/action.hh> -#include <paludis/metadata_key.hh> -#include <paludis/generator.hh> -#include <paludis/filter.hh> -#include <paludis/filtered_generator.hh> -#include <paludis/selection.hh> -#include <paludis/create_output_manager_info.hh> -#include <paludis/output_manager_from_environment.hh> -#include <paludis/output_manager.hh> -#include <iostream> -#include <iomanip> -#include <set> -#include <sys/types.h> -#include <pwd.h> -#include <grp.h> - -using namespace paludis; -using std::endl; -using std::flush; -using std::cout; - -namespace -{ - struct MetadataKeyComparator - { - bool operator() (const std::shared_ptr<const MetadataKey> & a, const std::shared_ptr<const MetadataKey> & b) const - { - bool a_is_section(simple_visitor_cast<const MetadataSectionKey>(*a)); - bool b_is_section(simple_visitor_cast<const MetadataSectionKey>(*b)); - if (a_is_section != b_is_section) - return b_is_section; - if (a->type() != b->type()) - return a->type() < b->type(); - return a->human_name() < b->human_name(); - } - }; - - struct InfoDisplayer - { - const Environment * const env; - std::string indent; - - InfoDisplayer(const Environment * const e, const std::string & i) : - env(e), - indent(i) - { - } - - void visit(const MetadataSectionKey & k) - { - cout << endl; - cout << indent << colour(cl_heading, k.human_name() + ":") << endl; - std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator > keys( - k.begin_metadata(), k.end_metadata()); - InfoDisplayer i(env, indent + " "); - for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator - e(keys.begin()), e_end(keys.end()) ; e != e_end ; ++e) - if ((*e)->type() != mkt_internal) - accept_visitor(i)(**e); - } - - void visit(const MetadataValueKey<std::string> & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl; - } - - void visit(const MetadataValueKey<SlotName> & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl; - } - - void visit(const MetadataValueKey<long> & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl; - } - - void visit(const MetadataValueKey<bool> & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl; - } - - void visit(const MetadataValueKey<FSPath> & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl; - } - - void visit(const MetadataValueKey<std::shared_ptr<const PackageID> > & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << *k.value() << endl; - } - - void visit(const MetadataValueKey<std::shared_ptr<const RepositoryMaskInfo> > & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << endl; - } - - void visit(const MetadataValueKey<std::shared_ptr<const Contents> > & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << endl; - } - - void visit(const MetadataTimeKey & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " - << pretty_print_time(k.value().seconds()) << endl; - } - - void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataSpecTreeKey<RequiredUseSpecTree> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataSpecTreeKey<DependencySpecTree> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataCollectionKey<FSPathSequence> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataCollectionKey<PackageIDSequence> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataCollectionKey<KeywordNameSet> & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataCollectionKey<Set<std::string> > & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataCollectionKey<Map<std::string, std::string> > & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataCollectionKey<Sequence<std::string> > & k) - { - ColourPrettyPrinter printer(env, make_null_shared_ptr()); - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_value(printer, { }) << endl; - } - - void visit(const MetadataValueKey<std::shared_ptr<const Choices> > & k) - { - cout << std::setw(30) << (indent + k.human_name() + ":") << " " << endl; - } - }; -} - -int do_one_info( - const std::shared_ptr<const Environment> & env, - const std::string & q) -{ - Context local_context("When handling query '" + q + "':"); - - std::shared_ptr<PackageDepSpec> spec( - std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(q, env.get(), { }))); - - std::shared_ptr<const PackageIDSequence> - entries((*env)[selection::AllVersionsSorted(generator::Matches(*spec, make_null_shared_ptr(), { }))]), - installed_entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::InstalledAtRoot(env->preferred_root_key()->value()))]), - installable_entries((*env)[selection::AllVersionsSorted( - generator::Matches(*spec, make_null_shared_ptr(), { }) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]); - - std::shared_ptr<PackageIDSequence> to_show_entries(std::make_shared<PackageIDSequence>()); - - if (entries->empty()) - throw NoSuchPackageError(q); - - if (! installed_entries->empty()) - std::copy(installed_entries->begin(), installed_entries->end(), to_show_entries->back_inserter()); - - if (! installable_entries->empty()) - to_show_entries->push_back(*installable_entries->last()); - - if (to_show_entries->empty()) - to_show_entries->push_back(*entries->last()); - - for (PackageIDSequence::ConstIterator p(to_show_entries->begin()), p_end(to_show_entries->end()) ; - p != p_end ; ++p) - { - OutputManagerFromEnvironment output_manager_holder(env.get(), *p, oe_exclusive, ClientOutputFeatures()); - InfoActionOptions options(make_named_values<InfoActionOptions>( - n::make_output_manager() = std::ref(output_manager_holder) - )); - InfoAction a(options); - - try - { - cout << "Package " << colour(cl_package_name, **p) << ":" << endl; - cout << endl; - (*p)->perform_action(a); - cout << endl; - - if (output_manager_holder.output_manager_if_constructed()) - output_manager_holder.output_manager_if_constructed()->succeeded(); - } - catch (const ActionFailedError &) - { - cout << " No extra information available for '" << **p << "'" << endl; - cout << endl; - } - } - - return 0; -} - -int -do_info(const std::shared_ptr<const Environment> & env) -{ - int return_code(0); - - cout << "Paludis build information:" << endl; - - cout << " " << colour(cl_heading, "Compiler:") << endl; - cout << " " << std::setw(22) << std::left << ("CXX:") << std::setw(0) << " " << PALUDIS_BUILD_CXX -#if defined(__ICC) - << " " << __ICC -#elif defined(__VERSION__) - << " " << __VERSION__ -#endif - << endl; - - cout << " " << std::setw(22) << std::left << ("CXXFLAGS:") << std::setw(0) << " " << PALUDIS_BUILD_CXXFLAGS << endl; - cout << " " << std::setw(22) << std::left << ("LDFLAGS:") << std::setw(0) << " " << PALUDIS_BUILD_LDFLAGS << endl; - cout << " " << std::setw(22) << std::left << ("DATE:") << std::setw(0) << " " << PALUDIS_BUILD_DATE << endl; - - cout << endl; - - cout << " " << colour(cl_heading, "Libraries:") << endl; - cout << " " << std::setw(22) << std::left << ("C++ Library:") << std::setw(0) << " " -#if defined(__GLIBCXX__) -# define XSTRINGIFY(x) #x -# define STRINGIFY(x) XSTRINGIFY(x) - << "GNU libstdc++ " << STRINGIFY(__GLIBCXX__) -#endif - << endl; - cout << endl; - - cout << " " << colour(cl_heading, "Paths:") << endl; - - cout << " " << std::setw(22) << std::left << ("DATADIR:") << std::setw(0) << " " << DATADIR << endl; - cout << " " << std::setw(22) << std::left << ("LIBDIR:") << std::setw(0) << " " << LIBDIR << endl; - cout << " " << std::setw(22) << std::left << ("LIBEXECDIR:") << std::setw(0) << " " << LIBEXECDIR << endl; - cout << " " << std::setw(22) << std::left << ("SYSCONFDIR:") << std::setw(0) << " " << SYSCONFDIR << endl; - cout << " " << std::setw(22) << std::left << ("PYTHONINSTALLDIR:") << std::setw(0) << " " << PYTHONINSTALLDIR << endl; - cout << " " << std::setw(22) << std::left << ("RUBYINSTALLDIR:") << std::setw(0) << " " << RUBYINSTALLDIR << endl; - - cout << endl; - - cout << colour(cl_heading, "System:") << endl; - cout << " " << flush; - int status(Process((ProcessCommand("uname -a"))).run().wait()); - if (0 != status) - Log::get_instance()->message("info.uname.failure", ll_warning, lc_context) - << "uname -a failed with status " << status; - - cout << endl; - - cout << colour(cl_heading, "Reduced Privs:") << endl; - cout << " " << std::setw(26) << std::left << "reduced_uid:" << std::setw(0) << " " - << env->reduced_uid() << endl; - const struct passwd * const p(getpwuid(env->reduced_uid())); - cout << " " << std::setw(26) << std::left << "reduced_uid->name:" << std::setw(0) << " " - << (p ? p->pw_name : "???") << endl; - cout << " " << std::setw(26) << std::left << "reduced_uid->dir:" << std::setw(0) << " " - << (p ? p->pw_dir : "???") << endl; - cout << " " << std::setw(26) << std::left << "reduced_gid:" << std::setw(0) << " " - << env->reduced_gid() << endl; - const struct group * const g(getgrgid(env->reduced_gid())); - cout << " " << std::setw(26) << std::left << "reduced_gid->name:" << std::setw(0) << " " - << (g ? g->gr_name : "???") << endl; - - cout << endl; - - { - cout << colour(cl_heading, "Environment:") << endl; - std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys( - env->begin_metadata(), env->end_metadata()); - InfoDisplayer i(env.get(), " "); - for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator - k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k) - if ((*k)->type() != mkt_internal) - accept_visitor(i)(**k); - cout << endl; - } - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - r(env->package_database()->begin_repositories()), r_end(env->package_database()->end_repositories()) ; - r != r_end ; ++r) - { - cout << "Repository " << colour(cl_repository_name, r->name()) << ":" << endl; - std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(r->begin_metadata(), r->end_metadata()); - InfoDisplayer i(env.get(), " "); - for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator - k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k) - if ((*k)->type() != mkt_internal) - accept_visitor(i)(**k); - cout << endl; - } - - if (CommandLine::get_instance()->empty()) - { - cout << "No packages were specified on the command line, so detailed information is not" << endl; - cout << "available (Paludis can display detailed information for both installed and" << endl; - cout << "installable packages)." << endl; - cout << endl; - cout << colour(cl_bold_pink, "So if you're reporting a bug in cat/pkg, use '") << - "paludis --info cat/pkg" << colour(cl_bold_pink, "' instead.") << endl; - cout << endl; - } - else - { - for (CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()) ; - q != q_end ; ++q) - { - try - { - return_code |= do_one_info(env, *q); - } - catch (const AmbiguousPackageNameError & e) - { - cout << endl; - cout << "Query error:" << endl; - cout << " * " << e.backtrace("\n * "); - cout << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl; - for (AmbiguousPackageNameError::OptionsConstIterator o(e.begin_options()), - o_end(e.end_options()) ; o != o_end ; ++o) - cout << " * " << colour(cl_package_name, *o) << endl; - cout << endl; - return_code |= 1; - } - } - } - - return return_code; -} - diff --git a/src/clients/paludis/info.hh b/src/clients/paludis/info.hh deleted file mode 100644 index b66a22317..000000000 --- a/src/clients/paludis/info.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 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_PALUDIS_INFO_HH -#define PALUDIS_GUARD_SRC_CLIENTS_PALUDIS_INFO_HH 1 - -#include <paludis/environment-fwd.hh> -#include <memory> - -/// Handle --info. -int do_info(const std::shared_ptr<const paludis::Environment> &); - -#endif diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc deleted file mode 100644 index 6b4259287..000000000 --- a/src/clients/paludis/install.cc +++ /dev/null @@ -1,188 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2005, 2006, 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 "install.hh" -#include <src/output/console_install_task.hh> -#include <paludis/args/do_help.hh> - -#include <iostream> -#include <cstdlib> -#include <cstring> - -#include <paludis/legacy/install_task.hh> -#include <paludis/legacy/tasks_exceptions.hh> - -#include <paludis/util/log.hh> -#include <paludis/util/tokeniser.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/set.hh> -#include <paludis/util/wrapped_output_iterator.hh> - -#include <paludis/hook.hh> -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> -#include <paludis/mask.hh> -#include <paludis/action.hh> -#include <paludis/name.hh> -#include <paludis/choice.hh> - -/** \file - * Handle the --install action for the main paludis program. - */ - -using namespace paludis; - -using std::cerr; -using std::cout; -using std::endl; - -namespace -{ - class OurInstallTask : - public ConsoleInstallTask - { - private: - std::shared_ptr<Environment> _env; - - public: - OurInstallTask(std::shared_ptr<Environment> env, const DepListOptions & options, - std::shared_ptr<const DestinationsSet> destinations) : - ConsoleInstallTask(env.get(), options, destinations), - _env(env) - { - } - - virtual bool want_full_install_reasons() const - { - return CommandLine::get_instance()->install_args.want_full_install_reasons(); - } - - virtual bool want_tags_summary() const - { - return CommandLine::get_instance()->install_args.want_tags_summary(); - } - - virtual bool want_install_reasons() const - { - return CommandLine::get_instance()->install_args.want_install_reasons(); - } - - virtual bool want_unchanged_use_flags() const - { - return CommandLine::get_instance()->install_args.want_unchanged_use_flags(); - } - - virtual bool want_changed_use_flags() const - { - return CommandLine::get_instance()->install_args.want_changed_use_flags(); - } - - virtual bool want_new_use_flags() const - { - return CommandLine::get_instance()->install_args.want_new_use_flags(); - } - - virtual bool want_use_summary() const - { - return CommandLine::get_instance()->install_args.want_use_summary(); - } - - virtual bool want_compact() const - { - return CommandLine::get_instance()->a_compact.specified(); - } - - virtual bool want_suggestions() const - { - return ! CommandLine::get_instance()->a_no_suggestions.specified(); - } - - virtual bool want_new_descriptions() const - { - return CommandLine::get_instance()->install_args.want_new_descriptions(); - } - - virtual bool want_existing_descriptions() const - { - return CommandLine::get_instance()->install_args.want_existing_descriptions(); - } - - virtual std::string make_resume_command(const bool undo_failures) const - { - std::string serialisation(serialise(undo_failures)); - if (serialisation.empty()) - return ""; - - std::string resume_command = environment()->paludis_command() - + " --" + CommandLine::get_instance()->a_install.long_name(); - - resume_command.append(CommandLine::get_instance()->install_args.resume_command_fragment(*this)); - resume_command.append(CommandLine::get_instance()->dl_args.resume_command_fragment(*this)); - resume_command.append(" --" + CommandLine::get_instance()->a_serialised.long_name() + " " + serialised_format()); - resume_command.append(" "); - resume_command.append(serialisation); - - return resume_command; - } - - void show_resume_command() const - { - if (CommandLine::get_instance()->install_args.a_fetch.specified() || - CommandLine::get_instance()->install_args.a_pretend.specified()) - return; - - ConsoleInstallTask::show_resume_command(CommandLine::get_instance()->a_resume_command_template.argument()); - } - }; -} - -int -do_install(const std::shared_ptr<Environment> & env) -{ - Context context("When performing install action from command line:"); - - DepListOptions options; - CommandLine::get_instance()->dl_args.populate_dep_list_options(env.get(), options); - CommandLine::get_instance()->install_args.populate_dep_list_options(env.get(), options); - - OurInstallTask task(env, options, CommandLine::get_instance()->install_args.destinations(env.get())); - CommandLine::get_instance()->install_args.populate_install_task(env.get(), task); - CommandLine::get_instance()->dl_args.populate_install_task(env.get(), task); - - cout << "Building target list... " << std::flush; - std::shared_ptr<Sequence<std::string> > specs(std::make_shared<Sequence<std::string>>()); - std::copy(CommandLine::get_instance()->begin_parameters(), CommandLine::get_instance()->end_parameters(), - specs->back_inserter()); - if (CommandLine::get_instance()->a_serialised.specified()) - task.set_targets_from_serialisation(CommandLine::get_instance()->a_serialised.argument(), specs); - else - { - if (! task.try_to_set_targets_from_user_specs(specs)) - return task.exit_status(); - } - - cout << endl; - - task.execute(); - - cout << endl; - - return task.exit_status(); -} - diff --git a/src/clients/paludis/install.hh b/src/clients/paludis/install.hh deleted file mode 100644 index 2961435ca..000000000 --- a/src/clients/paludis/install.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_DEPGRAPH_HH -#define PALUDIS_GUARD_SRC_DEPGRAPH_HH 1 - -#include "command_line.hh" - -/** \file - * Declaration for the do_install function. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --install. -int do_install(const std::shared_ptr<paludis::Environment> &); - -#endif diff --git a/src/clients/paludis/install_TEST b/src/clients/paludis/install_TEST deleted file mode 100755 index f59742c07..000000000 --- a/src/clients/paludis/install_TEST +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -for c in vdb_config exndbam_config ; do - - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - --list-packages || exit 12 - - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - --query test-category/target || exit 13 - - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - --has-version test-category/target && exit 1 - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - --install target --resume-command-template `pwd`/install_TEST_dir/resume \ - && exit 2 - ( echo -n './paludis ' ; cut -d ' ' -f2- < install_TEST_dir/resume ) > install_TEST_dir/fixedresume - cat install_TEST_dir/fixedresume - PALUDIS_HOME=./install_TEST_dir/config-checks-none/ bash `pwd`/install_TEST_dir/fixedresume || exit 3 - ./install_TEST_dir/root/usr/bin/testbin | grep success >/dev/null || exit 4 - grep target install_TEST_dir/root/world-${c%_config} || exit 5 - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - --has-version test-category/target || exit 6 - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - --contents test-category/target || exit 12 - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - --uninstall target || exit 7 - [[ -f ./install_TEST_dir/root/usr/bin/testbin ]] && exit 8 - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - --has-version test-category/target && exit 9 - grep target install_TEST_dir/root/world-${c%_config} >/dev/null && exit 10 - - PALUDIS_HOME=./install_TEST_dir/config-checks-always/ ./paludis --environment :install-test-$c \ - -qMD test-category/target || exit 11 - - rm -fr install_TEST_dir/root/usr/{share/doc,bin} -done - -true - diff --git a/src/clients/paludis/install_TEST_cleanup.sh b/src/clients/paludis/install_TEST_cleanup.sh deleted file mode 100755 index 6440b503a..000000000 --- a/src/clients/paludis/install_TEST_cleanup.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d install_TEST_dir ] ; then - rm -fr install_TEST_dir -else - true -fi - - - diff --git a/src/clients/paludis/install_TEST_setup.sh b/src/clients/paludis/install_TEST_setup.sh deleted file mode 100755 index abc9ddf67..000000000 --- a/src/clients/paludis/install_TEST_setup.sh +++ /dev/null @@ -1,183 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir install_TEST_dir || exit 1 -cd install_TEST_dir || exit 1 -mkdir -p build - -mkdir -p config-checks-always/.paludis-install-test-vdb_config -cat <<END > config-checks-always/.paludis-install-test-vdb_config/specpath.conf -root = `pwd`/root -config-suffix = vdb-checks-always -END - -mkdir -p config-checks-always/.paludis-install-test-exndbam_config -cat <<END > config-checks-always/.paludis-install-test-exndbam_config/specpath.conf -root = `pwd`/root -config-suffix = exndbam-checks-always -END - -mkdir -p config-checks-none/.paludis-install-test-vdb_config -cat <<END > config-checks-none/.paludis-install-test-vdb_config/specpath.conf -root = `pwd`/root -config-suffix = vdb-checks-none -END - -mkdir -p config-checks-none/.paludis-install-test-exndbam_config -cat <<END > config-checks-none/.paludis-install-test-exndbam_config/specpath.conf -root = `pwd`/root -config-suffix = exndbam-checks-none -END - -for c in vdb exndbam ; do - mkdir -p root/${SYSCONFDIR}/paludis-${c}-checks-{always,none}/repositories - cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-always/use.conf -*/* foo build_options: optional_tests recommended_tests -END - - cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-none/use.conf -*/* foo build_options: -optional_tests -recommended_tests -END - - for d in always none ; do - - cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/general.conf -world = `pwd`/root/world-${c} -END - - cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/licenses.conf -*/* * -END - - cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/keywords.conf -*/* test -END - - cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/bashrc -export CHOST="my-chost" -export USER_BASHRC_WAS_USED=yes -END - - cat <<END > root/${SYSCONFDIR}/paludis-${c}-checks-${d}/repositories/repo1.conf -location = `pwd`/repo1 -cache = /var/empty -format = e -names_cache = /var/empty -profiles = \${location}/profiles/testprofile \${location}/profiles/anothertestprofile -builddir = `pwd`/build -END - - done - -done - -for d in always none ; do - cat <<END > root/${SYSCONFDIR}/paludis-vdb-checks-${d}/repositories/installed.conf -location = `pwd`/root/var/db/pkg -format = vdb -names_cache = /var/empty -provides_cache = /var/empty -builddir = `pwd`/build -END - - cat <<END > root/${SYSCONFDIR}/paludis-exndbam-checks-${d}/repositories/installed.conf -location = `pwd`/root/var/db/exndbam -format = exndbam -builddir = `pwd`/build -END - -done - -mkdir -p root/tmp -mkdir -p root/var/db/pkg -mkdir -p root/var/db/exndbam -touch root/${SYSCONFDIR}/ld.so.conf - -mkdir -p repo1/{eclass,distfiles,profiles/{testprofile,anothertestprofile},test-category/target/files} || exit 1 - -mkdir -p src/target-2 -cat <<"END" > src/target-2/testbin -#!/usr/bin/env bash -echo "Test was a success" -END -chmod +x src/target-2/testbin -cd src -tar zcf target-2.tar.gz target-2/ -mv target-2.tar.gz ../repo1/distfiles/ -cd .. -rm -fr src - -cd repo1 || exit 1 -echo "test-repo-1" > profiles/repo_name || exit 1 -cat <<END > profiles/categories || exit 1 -test-category -END -cat <<END > profiles/testprofile/make.defaults -ARCH=test -USERLAND=test -KERNEL=test -TESTPROFILE_WAS_SOURCED=yes -PROFILE_ORDERING=1 -USE_EXPAND="USERLAND KERNEL" -END -cat <<END > profiles/anothertestprofile/make.defaults -ARCH=test -USERLAND=test -KERNEL=test -ANOTHERTESTPROFILE_WAS_SOURCED=yes -PROFILE_ORDERING=2 -END - -cat <<"END" > eclass/foo.eclass -inherit_was_ok() { - true -} -END - -cat <<"END" > test-category/target/target-2.ebuild || exit 1 -inherit foo - -DESCRIPTION="Test target" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="http://invalid.domain/${P}.tar.gz oink? ( http://example.com/foo.tar.gz )" -SLOT="0" -IUSE="oink" -LICENSE="GPL-2" -KEYWORDS="test" - -pkg_setup() { - [[ -z "${USER_BASHRC_WAS_USED}" ]] && die "bad env" - [[ -z "${TESTPROFILE_WAS_SOURCED}" ]] && die "testprofile not sourced" - [[ -z "${ANOTHERTESTPROFILE_WAS_SOURCED}" ]] && die "anothertestprofile not sourced" - [[ ${PROFILE_ORDERING:-0} != 2 ]] && die "bad profile source ordering" - - [[ $USERLAND == test ]] || die "bad userland" - [[ $KERNEL == test ]] || die "bad kernel" - use userland_test || die "bad use for userland" - use kernel_test || die "bad use for kernel" - use test || die "bad use for arch" -} - -src_unpack() { - hasq "${P}.tar.gz" ${A} || die - hasq "${P}.tar.gz" ${AA} || die - hasq "foo.tar.gz" ${A} && die - hasq "foo.tar.gz" ${AA} || die - unpack ${A} -} - -src_compile() { - inherit_was_ok || die "inherit didn't work" - ./testbin | grep success || die "failure" -} - -src_test() { - die "giant monkey detected" -} - -src_install() { - dobin testbin -} -END -cd .. - diff --git a/src/clients/paludis/list.cc b/src/clients/paludis/list.cc deleted file mode 100644 index 32026efcd..000000000 --- a/src/clients/paludis/list.cc +++ /dev/null @@ -1,215 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 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 "list.hh" - -#include <paludis/environment.hh> -#include <paludis/package_database.hh> -#include <paludis/util/log.hh> -#include <paludis/util/set.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/metadata_key.hh> -#include <src/output/colour.hh> - -#include <memory> -#include <iomanip> -#include <iostream> -#include <list> -#include <map> -#include <algorithm> - -using namespace paludis; - -int -do_list_repositories(const std::shared_ptr<Environment> & env) -{ - int ret_code(1); - - Context context("When performing list-repositories action from command line:"); - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - 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(), - CommandLine::get_instance()->a_repository.end_args(), - 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(), - CommandLine::get_instance()->a_repository_format.end_args(), - r->format_key() ? r->format_key()->value() : "?")) - continue; - - ret_code = 0; - - std::cout << "* " << colour(cl_repository_name, r->name()) << std::endl; - } - - return ret_code; -} - -int -do_list_categories(const std::shared_ptr<Environment> & env) -{ - int ret_code(1); - - Context context("When performing list-categories action from command line:"); - - std::map<CategoryNamePart, std::list<RepositoryName> > cats; - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - 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(), - CommandLine::get_instance()->a_repository.end_args(), - 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(), - CommandLine::get_instance()->a_repository_format.end_args(), - r->format_key() ? r->format_key()->value() : "?")) - continue; - - std::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) - cats[*c].push_back(r->name()); - } - - for (std::map<CategoryNamePart, std::list<RepositoryName > >::const_iterator - c(cats.begin()), c_end(cats.end()) ; c != c_end ; ++c) - { - 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->first))) - continue; - - ret_code = 0; - - std::cout << "* " << colour(cl_package_name, c->first) << std::endl; - std::cout << " " << std::setw(22) << std::left << "found in:" << - std::setw(0) << " " << join(c->second.begin(), c->second.end(), ", ") << std::endl; - std::cout << std::endl; - } - - return ret_code; -} - -int -do_list_packages(const std::shared_ptr<Environment> & env) -{ - int ret_code(1); - - Context context("When performing list-packages action from command line:"); - - std::map<QualifiedPackageName, std::list<RepositoryName> > pkgs; - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - 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(), - CommandLine::get_instance()->a_repository.end_args(), - 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(), - CommandLine::get_instance()->a_repository_format.end_args(), - r->format_key() ? r->format_key()->value() : "?")) - continue; - - std::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_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; - - std::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[*p].push_back(r->name()); - } - } - - for (std::map<QualifiedPackageName, std::list<RepositoryName > >::const_iterator - p(pkgs.begin()), p_end(pkgs.end()) ; p != p_end ; ++p) - { - if (CommandLine::get_instance()->a_package.specified()) - if (CommandLine::get_instance()->a_package.end_args() == std::find( - CommandLine::get_instance()->a_package.begin_args(), - CommandLine::get_instance()->a_package.end_args(), - stringify(p->first.package()))) - continue; - - ret_code = 0; - - std::cout << "* " << colour(cl_package_name, p->first) << std::endl; - std::cout << " " << std::setw(22) << std::left << "found in:" << - std::setw(0) << " " << join(p->second.begin(), p->second.end(), ", ") << std::endl; - std::cout << std::endl; - } - - return ret_code; -} - -int -do_list_sets(const std::shared_ptr<Environment> & env) -{ - int ret_code(1); - - Context context("While performing list-sets action from command line:"); - - for (SetNameSet::ConstIterator s(env->set_names()->begin()), s_end(env->set_names()->end()) ; - s != s_end ; ++s) - { - if (CommandLine::get_instance()->a_set.specified()) - if (CommandLine::get_instance()->a_set.end_args() == std::find( - CommandLine::get_instance()->a_set.begin_args(), - CommandLine::get_instance()->a_set.end_args(), - stringify(*s))) - continue; - - ret_code = 0; - - std::cout << "* " << colour(cl_package_name, *s) << std::endl; - } - - return ret_code; -} - - diff --git a/src/clients/paludis/list.hh b/src/clients/paludis/list.hh deleted file mode 100644 index 2dd468084..000000000 --- a/src/clients/paludis/list.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_LIST_REPOSITORIES_HH -#define PALUDIS_GUARD_SRC_LIST_REPOSITORIES_HH 1 - -/** \file - * Declaration for the do_list_repositories and do_list_categories functions. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --list-repositories. -int do_list_repositories(const std::shared_ptr<paludis::Environment> &); - -/// Handle --list-categories. -int do_list_categories(const std::shared_ptr<paludis::Environment> &); - -/// Handle --list-packages. -int do_list_packages(const std::shared_ptr<paludis::Environment> &); - -/// Handle --list-sets. -int do_list_sets(const std::shared_ptr<paludis::Environment> &); - -#endif diff --git a/src/clients/paludis/list_repository_formats_TEST b/src/clients/paludis/list_repository_formats_TEST deleted file mode 100755 index 9a0e9adeb..000000000 --- a/src/clients/paludis/list_repository_formats_TEST +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -PALUDIS_SKIP_CONFIG=yes ./paludis --list-repository-formats diff --git a/src/clients/paludis/man_paludis.cc b/src/clients/paludis/man_paludis.cc deleted file mode 100644 index 2917ce694..000000000 --- a/src/clients/paludis/man_paludis.cc +++ /dev/null @@ -1,79 +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/paludis/owner.cc b/src/clients/paludis/owner.cc deleted file mode 100644 index 5359b40c3..000000000 --- a/src/clients/paludis/owner.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 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 "owner.hh" -#include <paludis/util/set.hh> -#include <src/output/colour.hh> -#include "command_line.hh" -#include <paludis/paludis.hh> -#include <iostream> -#include <algorithm> -#include <set> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - struct ContentsFinder - { - std::set<std::string> matches; - const std::string query; - const bool full; - - ContentsFinder(const std::string & q, bool f) : - query(q), - full(f) - { - } - - void handle(const std::string & e) - { - if (full) - { - if (e == query) - matches.insert(e); - } - else - { - if (std::string::npos != e.find(query)) - matches.insert(e); - } - } - - void visit(const ContentsFileEntry & e) - { - handle(stringify(e.location_key()->value())); - } - - void visit(const ContentsDirEntry & e) - { - handle(stringify(e.location_key()->value())); - } - - void visit(const ContentsSymEntry & e) - { - handle(stringify(e.location_key()->value())); - } - - void visit(const ContentsOtherEntry & e) - { - handle(stringify(e.location_key()->value())); - } - }; -} - -int -do_one_owner( - const std::shared_ptr<Environment> env, - const std::string & query) -{ - bool found_owner=false; - cout << "* " << colour(cl_package_name, query) << endl; - - for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()), - r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r) - { - if (! (*r)->installed_root_key()) - continue; - - std::shared_ptr<const CategoryNamePartSet> cats((*r)->category_names()); - for (CategoryNamePartSet::ConstIterator c(cats->begin()), - c_end(cats->end()) ; c != c_end ; ++c) - { - std::shared_ptr<const QualifiedPackageNameSet> pkgs((*r)->package_names(*c)); - for (QualifiedPackageNameSet::ConstIterator p(pkgs->begin()), - p_end(pkgs->end()) ; p != p_end ; ++p) - { - std::shared_ptr<const PackageIDSequence> ids((*r)->package_ids(*p)); - for (PackageIDSequence::ConstIterator v(ids->begin()), v_end(ids->end()) ; v != v_end ; ++v) - { - if (! (*v)->contents_key()) - continue; - - std::shared_ptr<const Contents> contents((*v)->contents_key()->value()); - ContentsFinder d(query, CommandLine::get_instance()->a_full_match.specified()); - std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(d)); - if (! d.matches.empty()) - { - cout << " " << **v << endl; - if (! CommandLine::get_instance()->a_full_match.specified()) - { - for (std::set<std::string>::const_iterator f(d.matches.begin()), f_end(d.matches.end()) ; - f != f_end ; ++f) - cout << " " << *f << endl; - } - - found_owner=true; - } - - (*v)->can_drop_in_memory_cache(); - } - } - } - } - - cout << endl; - return found_owner ? 0 : 1; -} - -int -do_owner(const std::shared_ptr<Environment> & env) -{ - int return_code(0); - Context context("When performing owner action from command line:"); - - CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()); - for ( ; q != q_end ; ++q) - return_code |= do_one_owner(env, *q); - - return return_code; -} - diff --git a/src/clients/paludis/owner.hh b/src/clients/paludis/owner.hh deleted file mode 100644 index 2f758690d..000000000 --- a/src/clients/paludis/owner.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_OWNER_HH -#define PALUDIS_GUARD_SRC_OWNER_HH 1 - -#include <memory> - -/** \file - * Declaration for the do_owner function. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --owner. -int do_owner(const std::shared_ptr<paludis::Environment> &); - -#endif diff --git a/src/clients/paludis/paludis.cc b/src/clients/paludis/paludis.cc deleted file mode 100644 index 4bfca4e2f..000000000 --- a/src/clients/paludis/paludis.cc +++ /dev/null @@ -1,453 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2005, 2006, 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 "applets.hh" -#include "command_line.hh" -#include "config.h" -#include "do_contents.hh" -#include "do_executables.hh" -#include "do_config.hh" -#include "install.hh" -#include "list.hh" -#include "info.hh" -#include "owner.hh" -#include "query.hh" -#include "report.hh" -#include "sync.hh" -#include "uninstall.hh" - -#include <paludis/args/do_help.hh> -#include <src/output/colour.hh> - -#include <paludis/paludis.hh> -#include <paludis/environment_factory.hh> -#include <paludis/util/system.hh> -#include <paludis/util/util.hh> -#include <paludis/util/log.hh> -#include <paludis/fuzzy_finder.hh> - -#include <iostream> -#include <iomanip> -#include <string> -#include <cstdlib> -#include <algorithm> -#include <iterator> - -#include <time.h> -#include <unistd.h> - -/** \file - * Main paludis program. - */ - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - struct DoVersion - { - }; -} - -namespace -{ - void display_version() - { - cout << 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("PALUDIS_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("paludis.deprecated", ll_warning, lc_context) - << "paludis is deprecated. Use 'cave' instead."; - - try - { - CommandLine::get_instance()->run(argc, argv, "paludis", "PALUDIS_OPTIONS", "PALUDIS_CMDLINE"); - set_use_colour(! CommandLine::get_instance()->a_no_colour.specified()); - set_force_colour(CommandLine::get_instance()->a_force_colour.specified()); - if (1 != isatty(1)) - CommandLine::get_instance()->a_no_suggestions.set_specified(true); - - 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_query.specified() + - CommandLine::get_instance()->a_version.specified() + - CommandLine::get_instance()->a_install.specified() + - CommandLine::get_instance()->a_uninstall.specified() + - CommandLine::get_instance()->a_uninstall_unused.specified() + - CommandLine::get_instance()->a_sync.specified() + - CommandLine::get_instance()->a_report.specified() + - CommandLine::get_instance()->a_list_repositories.specified() + - CommandLine::get_instance()->a_list_categories.specified() + - CommandLine::get_instance()->a_list_packages.specified() + - CommandLine::get_instance()->a_list_sets.specified() + - CommandLine::get_instance()->a_list_sync_protocols.specified() + - CommandLine::get_instance()->a_list_repository_formats.specified() + - CommandLine::get_instance()->a_contents.specified() + - CommandLine::get_instance()->a_executables.specified() + - CommandLine::get_instance()->a_owner.specified() + - CommandLine::get_instance()->a_config.specified() + - CommandLine::get_instance()->a_has_version.specified() + - CommandLine::get_instance()->a_regenerate_installed_cache.specified() + - CommandLine::get_instance()->a_regenerate_installable_cache.specified() + - CommandLine::get_instance()->a_environment_variable.specified() + - CommandLine::get_instance()->a_configuration_variable.specified() + - CommandLine::get_instance()->a_info.specified() + - CommandLine::get_instance()->a_best_version.specified() + - CommandLine::get_instance()->a_match.specified() - )) - throw args::DoHelp("you should specify exactly one action"); - - /* these actions don't need Environment or paludis_command. */ - - if (CommandLine::get_instance()->a_list_repository_formats.specified()) - { - if (! CommandLine::get_instance()->empty()) - throw args::DoHelp("list-repository-formats action takes no parameters"); - - return do_list_repository_formats(); - } - - /* these actions do need Environment or paludis_command */ - - std::string paludis_command(argv[0]), env_spec; - - if (CommandLine::get_instance()->a_environment.specified()) - { - env_spec = CommandLine::get_instance()->a_environment.argument(); - paludis_command.append(" --" + CommandLine::get_instance()->a_environment.long_name() + " " + - 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_resume_command_template.specified()) - paludis_command.append(" --" + CommandLine::get_instance()->a_resume_command_template.long_name() + " " - + CommandLine::get_instance()->a_resume_command_template.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()); - - paludis_command.append(CommandLine::get_instance()->install_args.paludis_command_fragment()); - paludis_command.append(CommandLine::get_instance()->dl_args.paludis_command_fragment()); - - std::shared_ptr<Environment> env(EnvironmentFactory::get_instance()->create(env_spec)); - env->set_paludis_command(paludis_command); - - try - { - if (CommandLine::get_instance()->a_list_sync_protocols.specified()) - { - if (! CommandLine::get_instance()->empty()) - throw args::DoHelp("list-sync-protocols action takes no parameters"); - - return do_list_sync_protocols(env); - } - - if (CommandLine::get_instance()->a_info.specified()) - { - display_version(); - return do_info(env); - } - - if (CommandLine::get_instance()->a_query.specified()) - { - if (CommandLine::get_instance()->empty()) - throw args::DoHelp("query action requires at least one parameter"); - - return do_query(env); - } - - if (CommandLine::get_instance()->a_install.specified()) - { - if (CommandLine::get_instance()->empty()) - throw args::DoHelp("install action requires at least one parameter"); - - return do_install(env); - } - - if (CommandLine::get_instance()->a_uninstall.specified()) - { - if (CommandLine::get_instance()->empty()) - throw args::DoHelp("uninstall action requires at least one parameter"); - - return do_uninstall(env); - } - - if (CommandLine::get_instance()->a_config.specified()) - { - if (CommandLine::get_instance()->empty()) - throw args::DoHelp("config action requires at least one parameter"); - - return do_config(env); - } - - if (CommandLine::get_instance()->a_uninstall_unused.specified()) - { - if (! CommandLine::get_instance()->empty()) - throw args::DoHelp("uninstall-unused action takes no parameters"); - - return do_uninstall_unused(env); - } - - if (CommandLine::get_instance()->a_sync.specified()) - { - return do_sync(env); - } - - if (CommandLine::get_instance()->a_report.specified()) - { - if (! CommandLine::get_instance()->empty()) - throw args::DoHelp("report action takes no parameters"); - return do_report(env); - } - - if (CommandLine::get_instance()->a_list_repositories.specified()) - { - if (! CommandLine::get_instance()->empty()) - throw args::DoHelp("list-repositories action takes no parameters"); - - return do_list_repositories(env); - } - - if (CommandLine::get_instance()->a_list_categories.specified()) - { - if (! CommandLine::get_instance()->empty()) - throw args::DoHelp("list-categories action takes no parameters"); - - return do_list_categories(env); - } - - if (CommandLine::get_instance()->a_list_packages.specified()) - { - if (! CommandLine::get_instance()->empty()) - throw args::DoHelp("list-packages action takes no parameters"); - - return do_list_packages(env); - } - - if (CommandLine::get_instance()->a_list_sets.specified()) - { - if (! CommandLine::get_instance()->empty()) - throw args::DoHelp("list-sets action takes no parameters"); - - return do_list_sets(env); - } - - if (CommandLine::get_instance()->a_contents.specified()) - { - if (CommandLine::get_instance()->empty()) - throw args::DoHelp("contents action requires at least one parameter"); - - return do_contents(env); - } - - if (CommandLine::get_instance()->a_executables.specified()) - { - if (CommandLine::get_instance()->empty()) - throw args::DoHelp("executables action requires at least one parameter"); - - return do_executables(env); - } - - if (CommandLine::get_instance()->a_owner.specified()) - { - if (CommandLine::get_instance()->empty()) - throw args::DoHelp("owner action requires at least one parameter"); - - return do_owner(env); - } - - if (CommandLine::get_instance()->a_has_version.specified()) - { - if (1 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw args::DoHelp("has-version action takes exactly one parameter"); - - return do_has_version(env); - } - - if (CommandLine::get_instance()->a_best_version.specified()) - { - if (1 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw args::DoHelp("best-version action takes exactly one parameter"); - - return do_best_version(env); - } - - if (CommandLine::get_instance()->a_match.specified()) - { - if (1 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw args::DoHelp("match action takes exactly one parameter"); - - return do_match(env); - } - - if (CommandLine::get_instance()->a_environment_variable.specified()) - { - if (2 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw args::DoHelp("environment-variable action takes exactly two parameters (depspec var)"); - - return do_environment_variable(env); - } - - if (CommandLine::get_instance()->a_configuration_variable.specified()) - { - if (2 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw args::DoHelp("configuration-variable action takes exactly two parameters (repository var)"); - - return do_configuration_variable(env); - } - - if (CommandLine::get_instance()->a_regenerate_installed_cache.specified() || - CommandLine::get_instance()->a_regenerate_installable_cache.specified()) - { - return do_regenerate_cache(env, CommandLine::get_instance()->a_regenerate_installed_cache.specified()); - } - - throw InternalError(__PRETTY_FUNCTION__, "no action?"); - } - catch (const NoSuchRepositoryError & e) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * " << e.backtrace("\n * ") - << e.message() << " (" << e.what() << ")" << endl; - - if (! CommandLine::get_instance()->a_no_suggestions.specified()) - { - cerr << " * Looking for suggestions:" << endl; - - FuzzyRepositoriesFinder f(*env, stringify(e.name())); - - if (f.begin() == f.end()) - cerr << "No suggestions found." << endl; - else - cerr << "Suggestions:" << endl; - - for (FuzzyRepositoriesFinder::RepositoriesConstIterator r(f.begin()), r_end(f.end()) ; - r != r_end ; ++r) - cerr << " * " << colour(cl_repository_name, *r) << endl; - cerr << endl; - } - - return EXIT_FAILURE; - } - } - 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 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 ActionAbortedError & e) - { - cout << endl; - cerr << "Action aborted:" << endl - << " * " << e.backtrace("\n * ") - << e.message() << " (" << e.what() << ")" << endl; - return 42; - } - 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/paludis/pretend_TEST b/src/clients/paludis/pretend_TEST deleted file mode 100755 index ab8efd9c5..000000000 --- a/src/clients/paludis/pretend_TEST +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -PALUDIS_HOME=./pretend_TEST_dir/config/ ./paludis --environment :pretend-test \ - --list-packages || exit 12 - -PALUDIS_HOME=./pretend_TEST_dir/config/ ./paludis --environment :pretend-test \ - --query test-category/target || exit 13 - -PALUDIS_HOME=./pretend_TEST_dir/config/ ./paludis --environment :pretend-test \ - --has-version test-category/target && exit 1 - -export PRETEND_SHOULD_FAIL=yes - -PALUDIS_HOME=./pretend_TEST_dir/config/ ./paludis --environment :pretend-test \ - --pretend --install test-category/target && exit 2 - -PALUDIS_HOME=./pretend_TEST_dir/config/ ./paludis --environment :pretend-test \ - --install test-category/target && exit 3 - -export PRETEND_SHOULD_FAIL= - -PALUDIS_HOME=./pretend_TEST_dir/config/ ./paludis --environment :pretend-test \ - --pretend --install test-category/target || exit 4 - -PALUDIS_HOME=./pretend_TEST_dir/config/ ./paludis --environment :pretend-test \ - --install test-category/target || exit 5 - - diff --git a/src/clients/paludis/pretend_TEST_cleanup.sh b/src/clients/paludis/pretend_TEST_cleanup.sh deleted file mode 100755 index 56f3bfa8c..000000000 --- a/src/clients/paludis/pretend_TEST_cleanup.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d pretend_TEST_dir ] ; then - rm -fr pretend_TEST_dir -else - true -fi - diff --git a/src/clients/paludis/pretend_TEST_setup.sh b/src/clients/paludis/pretend_TEST_setup.sh deleted file mode 100755 index c71653b38..000000000 --- a/src/clients/paludis/pretend_TEST_setup.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir pretend_TEST_dir || exit 1 -cd pretend_TEST_dir || exit 1 -mkdir -p build - -mkdir -p config/.paludis-pretend-test -cat <<END > config/.paludis-pretend-test/specpath.conf -root = `pwd`/root -END - -mkdir -p root/${SYSCONFDIR}/paludis/repositories -cat <<END > root/${SYSCONFDIR}/paludis/use.conf -*/* foo -END - -cat <<END > root/${SYSCONFDIR}/paludis/general.conf -world = `pwd`/root/world -END - -cat <<END > root/${SYSCONFDIR}/paludis/licenses.conf -*/* * -END - -cat <<END > root/${SYSCONFDIR}/paludis/keywords.conf -*/* test -END - -cat <<END > root/${SYSCONFDIR}/paludis/bashrc -export CHOST="my-chost" -export USER_BASHRC_WAS_USED=yes -END - -cat <<END > root/${SYSCONFDIR}/paludis/repositories/repo1.conf -location = `pwd`/repo1 -cache = /var/empty -format = e -names_cache = /var/empty -profiles = \${location}/profiles/profile -builddir = `pwd`/build -END - -cat <<END > root/${SYSCONFDIR}/paludis/repositories/installed.conf -location = `pwd`/root/var/db/pkg -format = vdb -names_cache = /var/empty -provides_cache = /var/empty -builddir = `pwd`/build -END -mkdir -p root/tmp -mkdir -p root/var/db/pkg -mkdir -p root/var/db/exndbam -touch root/${SYSCONFDIR}/ld.so.conf - -mkdir -p repo1/{eclass,distfiles,profiles/profile,test-category/target/files} || exit 1 - -cd repo1 || exit 1 -echo "test-repo-1" > profiles/repo_name || exit 1 -cat <<END > profiles/categories || exit 1 -test-category -END -cat <<END > profiles/profile/make.defaults -ARCH=test -USERLAND=test -KERNEL=test -USE_EXPAND="USERLAND KERNEL" -END - -cat <<"END" > test-category/target/target-1.exheres-0 || exit 1 -DESCRIPTION="Test target" -HOMEPAGE="http://paludis.pioto.org/" -DOWNLOADS="" -SLOT="0" -MYOPTIONS="" -LICENCES="GPL-2" -PLATFORMS="test" - -pkg_pretend() { - [[ ${PRETEND_SHOULD_FAIL} == yes ]] && die "pretend failure" -} - -END -cd .. - diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc deleted file mode 100644 index 3e4ee61b8..000000000 --- a/src/clients/paludis/query.cc +++ /dev/null @@ -1,230 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 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 <src/output/colour.hh> -#include "query.hh" -#include <src/output/console_query_task.hh> -#include <paludis/paludis.hh> -#include <paludis/fuzzy_finder.hh> -#include <paludis/filter.hh> -#include <string> -#include <functional> -#include <iomanip> -#include <iostream> -#include <algorithm> - -/** \file - * Handle the --query action for the main paludis program. - */ - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - class QueryTask : - public ConsoleQueryTask - { - public: - QueryTask(const std::shared_ptr<Environment> e) : - ConsoleQueryTask(e.get()) - { - } - - bool want_deps() const - { - return CommandLine::get_instance()->a_show_deps.specified() || want_raw(); - } - - bool want_raw() const - { - return CommandLine::get_instance()->a_show_metadata.specified(); - } - - bool want_authors() const - { - return CommandLine::get_instance()->a_show_authors.specified(); - } - - bool want_compact() const - { - return CommandLine::get_instance()->a_compact.specified(); - } - }; -} - -void do_one_package_query( - const std::shared_ptr<Environment> & env, - const std::shared_ptr<Map<char, std::string> > & masks_to_explain, - std::shared_ptr<PackageDepSpec> spec) -{ - QueryTask query(env); - query.show(*spec); - std::copy(query.masks_to_explain()->begin(), query.masks_to_explain()->end(), - masks_to_explain->inserter()); -} - -namespace -{ - struct SetPrettyPrinter - { - std::ostringstream stream; - - void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node) - { - stream << " " << *node.spec() << std::endl; - } - - void visit(const SetSpecTree::NodeType<NamedSetDepSpec>::Type & node) - { - stream << " " << *node.spec() << std::endl; - } - - void visit(const SetSpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - }; -} - -void do_one_set_query( - const std::shared_ptr<Environment> &, - const std::string & q, - const std::shared_ptr<Map<char, std::string> > &, - std::shared_ptr<const SetSpecTree> set) -{ - cout << "* " << colour(cl_package_name, q) << endl; - SetPrettyPrinter packages; - set->top()->accept(packages); - cout << " " << std::setw(22) << std::left << "Packages:" << std::setw(0) - << endl << packages.stream.str() << endl; -} - -void do_one_query( - const std::shared_ptr<Environment> & env, - const std::string & q, - const std::shared_ptr<Map<char, std::string> > & masks_to_explain) -{ - Context local_context("When handling query '" + q + "':"); - - try - { - do_one_package_query(env, masks_to_explain, std::make_shared<PackageDepSpec>( - parse_user_package_dep_spec(q, env.get(), UserPackageDepSpecOptions() + updso_throw_if_set + updso_allow_wildcards))); - } - catch (const GotASetNotAPackageDepSpec &) - { - do_one_set_query(env, q, masks_to_explain, env->set(SetName(q))); - } -} - -int do_query(const std::shared_ptr<Environment> & env) -{ - int return_code(0); - - Context context("When performing query action from command line:"); - - std::shared_ptr<Map<char, std::string> > masks_to_explain(std::make_shared<Map<char, std::string>>()); - - CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()); - for ( ; q != q_end ; ++q) - { - try - { - do_one_query(env, *q, masks_to_explain); - } - catch (const AmbiguousPackageNameError & e) - { - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Ambiguous package name '" << e.name() << "'. Did you mean:" << endl; - for (AmbiguousPackageNameError::OptionsConstIterator o(e.begin_options()), - o_end(e.end_options()) ; o != o_end ; ++o) - cerr << " * " << colour(cl_package_name, *o) << endl; - cerr << endl; - } - catch (const NameError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * ") << e.message() << endl; - cerr << endl; - } - catch (const NoSuchPackageError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Could not find '" << e.name() << "'."; - - if (! CommandLine::get_instance()->a_no_suggestions.specified()) - { - cerr << " Looking for suggestions:" << endl; - - try - { - FuzzyCandidatesFinder f(*env, e.name(), filter::All()); - - if (f.begin() == f.end()) - cerr << "No suggestions found." << endl; - else - cerr << "Suggestions:" << endl; - - for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), - c_end(f.end()) ; c != c_end ; ++c) - cerr << " * " << colour(cl_package_name, *c) << endl; - } - catch (const PackageDepSpecError &) - { - cerr << "Query too complicated or confusing to make suggestions." << endl; - } - } - - cerr << endl; - } - catch (const PackageDatabaseLookupError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * ") << e.message() << endl; - cerr << endl; - } - } - - if (! masks_to_explain->empty()) - { - cout << colour(cl_heading, "Key to mask reasons:") << endl << endl; - - for (Map<char, std::string>::ConstIterator m(masks_to_explain->begin()), m_end(masks_to_explain->end()) ; - m != m_end ; ++m) - cout << "* " << colour(cl_masked, m->first) << ": " << m->second << endl; - - cout << endl; - } - - return return_code; -} - diff --git a/src/clients/paludis/query.hh b/src/clients/paludis/query.hh deleted file mode 100644 index 065d1335d..000000000 --- a/src/clients/paludis/query.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_QUERY_HH -#define PALUDIS_GUARD_SRC_QUERY_HH 1 - -#include "command_line.hh" - -/** \file - * Declaration for the do_query function. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --query. -int do_query(const std::shared_ptr<paludis::Environment> &); - -#endif diff --git a/src/clients/paludis/report.cc b/src/clients/paludis/report.cc deleted file mode 100644 index 490e5942b..000000000 --- a/src/clients/paludis/report.cc +++ /dev/null @@ -1,197 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 Fernando J. Pereda - * - * 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 "report.hh" -#include <src/output/colour.hh> -#include <src/output/mask_displayer.hh> -#include <paludis/legacy/report_task.hh> -#include <paludis/mask.hh> -#include <paludis/dep_tag.hh> -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/join.hh> -#include <iostream> - -/** \file - * Handle the --report action for the main paludis program. - */ - -using namespace paludis; -using std::cout; -using std::endl; - -namespace -{ - class OurReportTask : - public ReportTask - { - private: - int _n_packages; - int _n_errors; - const Environment * const env; - - public: - OurReportTask(std::shared_ptr<Environment> e) : - ReportTask(e.get()), - _n_packages(0), - _n_errors(0), - env(e.get()) - { - } - - virtual void on_report_all_pre(); - virtual void on_report_check_package_pre(const QualifiedPackageName & p); - virtual void on_report_package_success(const std::shared_ptr<const PackageID> & id); - virtual void on_report_package_failure_pre(const std::shared_ptr<const PackageID> & id); - virtual void on_report_package_is_masked(const std::shared_ptr<const PackageID> & id, const std::shared_ptr<const PackageIDSequence> & origin); - virtual void on_report_package_is_vulnerable_pre(const std::shared_ptr<const PackageID> & id); - virtual void on_report_package_is_vulnerable(const std::shared_ptr<const PackageID> & id, const GLSADepTag & glsa_tag); - virtual void on_report_package_is_vulnerable_post(const std::shared_ptr<const PackageID> & id); - virtual void on_report_package_is_missing(const std::shared_ptr<const PackageID> & id); - virtual void on_report_package_is_unused(const std::shared_ptr<const PackageID> & id); - virtual void on_report_package_failure_post(const std::shared_ptr<const PackageID> & id); - virtual void on_report_check_package_post(const QualifiedPackageName & p); - virtual void on_report_all_post(); - - int return_code() const - { - return _n_errors ? 1 : 0; - } - }; - - void - OurReportTask::on_report_all_pre() - { - cout << colour(cl_heading, "Current state of the system") << endl << endl; - } - - void - OurReportTask::on_report_check_package_pre(const QualifiedPackageName &) - { - } - - void - OurReportTask::on_report_package_success(const std::shared_ptr<const PackageID> &) - { - } - - void - OurReportTask::on_report_package_failure_pre(const std::shared_ptr<const PackageID> & pde) - { - cout << "* " << colour(cl_package_name, *pde) << " NOT OK"; - } - - void - OurReportTask::on_report_package_is_masked(const std::shared_ptr<const PackageID> & id, - const std::shared_ptr<const PackageIDSequence> & origins) - { - cout << endl << " Masked by: "; - - bool outer_comma(false); - for (PackageIDSequence::ConstIterator o(origins->begin()), o_end(origins->end()) ; - o != o_end ; ++o) - { - if (outer_comma) - cout << "; "; - - bool comma(false); - for (PackageID::MasksConstIterator m((*o)->begin_masks()), m_end((*o)->end_masks()) ; - m != m_end ; ++m) - { - if (comma) - cout << ", "; - - MaskDisplayer d(env, id, true); - (*m)->accept(d); - cout << d.result(); - - comma = true; - } - cout << " in '" << (*o)->repository_name() << "'"; - outer_comma = true; - } - ++_n_errors; - } - - void - OurReportTask::on_report_package_is_vulnerable_pre(const std::shared_ptr<const PackageID> &) - { - cout << endl << " This package has following security issues:"; - } - - void - OurReportTask::on_report_package_is_vulnerable(const std::shared_ptr<const PackageID> &, const GLSADepTag & glsa_tag) - { - cout << endl << " " << colour(cl_error, glsa_tag.short_text() + ": \"" + glsa_tag.glsa_title() +"\"") - << endl << colour(cl_error, " -> " + stringify(glsa_tag.glsa_file())); - ++_n_errors; - } - - void - OurReportTask::on_report_package_is_vulnerable_post(const std::shared_ptr<const PackageID> &) - { - } - - void - OurReportTask::on_report_package_is_missing(const std::shared_ptr<const PackageID> & id) - { - cout << endl << " No longer exists in original repositories '" << - join(id->from_repositories_key()->value()->begin(), id->from_repositories_key()->value()->end(), - "', '") << "'"; - ++_n_errors; - } - - void - OurReportTask::on_report_package_is_unused(const std::shared_ptr<const PackageID> &) - { - cout << endl << " Not used by any package in world"; - ++_n_errors; - } - - void - OurReportTask::on_report_package_failure_post(const std::shared_ptr<const PackageID> &) - { - cout << endl << endl; - } - - void - OurReportTask::on_report_check_package_post(const QualifiedPackageName &) - { - ++_n_packages; - } - - void - OurReportTask::on_report_all_post() - { - cout << "Finished processing " << - _n_packages << " " << (_n_packages != 1 ? "packages" : "package") << ". " << - _n_errors << " " << (_n_errors != 1 ? "errors" : "error") << "." << endl; - } -} - -int do_report(const std::shared_ptr<Environment> & env) -{ - Context context("When performing report action from command line:"); - - OurReportTask task(env); - task.execute(); - - return task.return_code(); -} - diff --git a/src/clients/paludis/report.hh b/src/clients/paludis/report.hh deleted file mode 100644 index f7260acf0..000000000 --- a/src/clients/paludis/report.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 Fernando J. Pereda - * - * 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_REPORT_HH -#define PALUDIS_GUARD_SRC_REPORT_HH 1 - -#include "command_line.hh" - -/** \file - * Declaration for the do_report function. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --report. -int do_report(const std::shared_ptr<paludis::Environment> &); - -#endif - diff --git a/src/clients/paludis/sync.cc b/src/clients/paludis/sync.cc deleted file mode 100644 index b3715a489..000000000 --- a/src/clients/paludis/sync.cc +++ /dev/null @@ -1,139 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 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 <src/output/colour.hh> -#include "sync.hh" -#include <paludis/legacy/sync_task.hh> -#include <paludis/syncer.hh> -#include <iomanip> -#include <iostream> -#include <string> - -/** \file - * Handle the --sync action for the main paludis program. - */ - -using namespace paludis; -using std::cerr; -using std::cout; -using std::endl; - -namespace -{ - class OurSyncTask : - public SyncTask - { - private: - int _return_code; - - public: - OurSyncTask(std::shared_ptr<Environment> env, const bool p) : - SyncTask(env.get(), p), - _return_code(0) - { - } - - virtual void on_sync_all_pre(); - virtual void on_sync_pre(const RepositoryName &); - virtual void on_sync_post(const RepositoryName &); - virtual void on_sync_skip(const RepositoryName &); - virtual void on_sync_fail(const RepositoryName &, const SyncFailedError &); - virtual void on_sync_succeed(const RepositoryName &); - virtual void on_sync_all_post(); - - virtual void on_sync_status(const int x, const int y, const int a); - - int return_code() const - { - return _return_code; - } - }; - - void - OurSyncTask::on_sync_all_pre() - { - } - - void - OurSyncTask::on_sync_pre(const RepositoryName & r) - { - cout << colour(cl_heading, "Sync " + stringify(r)) << endl; - } - - void - OurSyncTask::on_sync_post(const RepositoryName &) - { - } - - void - OurSyncTask::on_sync_skip(const RepositoryName & r) - { - cout << "Sync " << r << " skipped" << endl; - } - - void - OurSyncTask::on_sync_succeed(const RepositoryName & r) - { - cout << "Sync " << r << " completed" << endl; - } - - void - OurSyncTask::on_sync_fail(const RepositoryName & r, const SyncFailedError & e) - { - _return_code |= 1; - cout << endl; - cerr << "Sync error:" << endl; - cerr << " * " << e.backtrace("\n * ") << e.message() << endl; - cerr << endl; - cout << "Sync " << r << " failed" << endl; - } - - void - OurSyncTask::on_sync_all_post() - { - cout << endl; - } - - void - OurSyncTask::on_sync_status(const int x, const int y, const int a) - { - cerr << xterm_title("Syncing " + stringify(x) + " of " + stringify(y) + ", " - + stringify(a) + " active"); - } -} - -int do_sync(const std::shared_ptr<Environment> & env) -{ - Context context("When performing sync action from command line:"); - - bool parallel(false); - parallel = CommandLine::get_instance()->a_multitask.specified(); - - OurSyncTask task(env, parallel); - - for (CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()) ; q != q_end ; ++q) - task.add_target(*q); - - task.execute(); - cout << endl; - - return task.return_code(); -} - diff --git a/src/clients/paludis/sync.hh b/src/clients/paludis/sync.hh deleted file mode 100644 index 8a6a9a6ec..000000000 --- a/src/clients/paludis/sync.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_SYNC_HH -#define PALUDIS_GUARD_SRC_SYNC_HH 1 - -#include "command_line.hh" - -/** \file - * Declaration for the do_sync function. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --sync. -int do_sync(const std::shared_ptr<paludis::Environment> &); - -#endif - diff --git a/src/clients/paludis/uninstall.cc b/src/clients/paludis/uninstall.cc deleted file mode 100644 index cbade320a..000000000 --- a/src/clients/paludis/uninstall.cc +++ /dev/null @@ -1,345 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2005, 2006, 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 <src/output/colour.hh> -#include "uninstall.hh" - -#include <paludis/legacy/uninstall_task.hh> -#include <paludis/legacy/tasks_exceptions.hh> -#include <paludis/legacy/uninstall_list.hh> -#include <paludis/util/set.hh> -#include <paludis/package_database.hh> -#include <paludis/action.hh> -#include <paludis/fuzzy_finder.hh> -#include <paludis/generator.hh> -#include <paludis/selection.hh> -#include <paludis/filter.hh> -#include <paludis/metadata_key.hh> - -#include <iostream> -#include <limits> - -/** \file - * Handle the --uninstall action for the main paludis program. - */ - -using namespace paludis; - -using std::cerr; -using std::cout; -using std::endl; - -namespace -{ - class OurUninstallTask : - public UninstallTask - { - private: - int _count, _current_count, _error_count; - - public: - OurUninstallTask(std::shared_ptr<Environment> e) : - UninstallTask(e.get()), - _count(0), - _current_count(0), - _error_count(0) - { - } - - virtual void on_build_unmergelist_pre() - { - cout << "Building unmerge list... " << std::flush; - } - - virtual void on_build_unmergelist_post() - { - cout << "done" << endl; - } - - virtual void on_display_unmerge_list_pre() - { - cout << endl << colour(cl_heading, "These packages will be uninstalled:") - << endl << endl; - } - - virtual void on_display_unmerge_list_post() - { - cout << endl << endl; - - cout << "Total: " << _count << (_count == 1 ? " package" : " packages"); - - if (_error_count) - { - cout << " and " << colour(cl_error, stringify(_error_count) + " errors") << endl; - cout << "Use either --" << CommandLine::get_instance()->a_with_dependencies.long_name() - << " or --" << CommandLine::get_instance()->a_permit_unsafe_uninstalls.long_name() << endl; - } - else - cout << endl; - } - - virtual void on_display_unmerge_list_entry(const UninstallListEntry & d) - { - if (d.kind() == ulk_virtual) - if (CommandLine::get_instance()->install_args.a_show_reasons.argument() != "full") - return; - - switch (d.kind()) - { - case ulk_package: - cout << "* " << colour(cl_package_name, stringify(*d.package_id())); - ++_count; - break; - - case ulk_virtual: - cout << "* " << colour(cl_unimportant, stringify(*d.package_id())); - break; - - case ulk_requires: - case ulk_required_by: - cout << "* " << colour(cl_error, stringify(*d.package_id())); - ++_error_count; - break; - - case last_ulk: - break; - } - - if ((CommandLine::get_instance()->install_args.a_show_reasons.argument() == "summary") || - (CommandLine::get_instance()->install_args.a_show_reasons.argument() == "full") || - ulk_requires == d.kind() || ulk_required_by == d.kind()) - { - std::string deps; - unsigned count(0), max_count; - if (CommandLine::get_instance()->install_args.a_show_reasons.argument() == "summary") - max_count = 3; - else - max_count = std::numeric_limits<long>::max(); - - for (Set<std::shared_ptr<DepTag> >::ConstIterator - tag(d.tags()->begin()), - tag_end(d.tags()->end()) ; - tag != tag_end ; ++tag) - { - if ((*tag)->category() != "dependency" && (*tag)->category() != "general") - continue; - - if (++count < max_count) - { - deps.append((*tag)->short_text()); - deps.append(", "); - } - } - if (! deps.empty()) - { - if (count >= max_count) - deps.append(stringify(count - max_count + 1) + " more, "); - - deps.erase(deps.length() - 2); - if (d.kind() == ulk_requires) - cout << " requires"; - else if (d.kind() == ulk_required_by) - cout << " required by"; - cout << " " << colour(d.kind() == ulk_virtual ? cl_unimportant : cl_tag, - "<" + deps + ">"); - } - } - - cout << endl; - } - - virtual void on_uninstall_all_pre() - { - } - - virtual void on_uninstall_pre(const UninstallListEntry & d) - { - std::string msg("(" + stringify(++_current_count) + " of " + - stringify(_count) + ") Uninstalling " + stringify(*d.package_id())); - - cout << endl << colour(cl_heading, msg) << endl << endl; - - cerr << xterm_title(msg); - } - - virtual void on_uninstall_post(const UninstallListEntry &) - { - } - - virtual void on_uninstall_all_post() - { - } - - virtual void on_not_continuing_due_to_errors() - { - cout << endl << colour(cl_error, "Cannot continue with uninstall due to the errors indicated above") << endl << endl; - } - - virtual void on_update_world_pre() - { - cout << endl << colour(cl_heading, "Updating world file") << endl << endl; - } - - virtual void on_update_world(const PackageDepSpec & a) - { - if (a.package_ptr()) - cout << "* removing " << colour(cl_package_name, *a.package_ptr()) << endl; - } - - virtual void on_update_world(const SetName & a) - { - cout << "* removing " << colour(cl_package_name, a) << endl; - } - - virtual void on_update_world_post() - { - cout << endl; - } - - virtual void on_preserve_world() - { - cout << endl << colour(cl_heading, "Updating world file") << endl << endl; - cout << "* --preserve-world was specified, skipping world changes" << endl; - cout << endl; - } - }; - - int real_uninstall(std::shared_ptr<Environment> env, bool unused) - { - int return_code(0); - - Context context(unused ? - "When performing uninstall-unused action from command line:" : - "When performing uninstall action from command line:"); - - OurUninstallTask task(env); - - task.set_pretend(CommandLine::get_instance()->install_args.a_pretend.specified()); - task.set_preserve_world(CommandLine::get_instance()->install_args.a_preserve_world.specified()); - task.set_with_unused_dependencies(CommandLine::get_instance()->a_with_unused_dependencies.specified()); - task.set_with_dependencies(CommandLine::get_instance()->a_with_dependencies.specified()); - task.set_check_safety(! CommandLine::get_instance()->a_permit_unsafe_uninstalls.specified()); - task.set_all_versions(CommandLine::get_instance()->a_all_versions.specified()); - - try - { - if (unused) - task.add_unused(); - else - for (CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()), - q_end(CommandLine::get_instance()->end_parameters()) ; q != q_end ; ++q) - task.add_target(*q); - - task.execute(); - - cout << endl; - } - catch (const AmbiguousUnmergeTargetError & e) - { - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Ambiguous unmerge target '" << e.target() << "'. Did you mean:" << endl; - for (AmbiguousUnmergeTargetError::ConstIterator o(e.begin()), - o_end(e.end()) ; o != o_end ; ++o) - cerr << " * =" << colour(cl_package_name, **o) << endl; - cerr << endl; - cerr << "Consider using --all-versions if appropriate." << endl; - cerr << endl; - return 1; - } - catch (const ActionFailedError & e) - { - cout << endl; - cerr << "Action failed error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << e.message() << endl; - - return_code |= 1; - } - catch (const HadBothPackageAndSetTargets &) - { - cout << endl; - cerr << "Error: both package sets and packages were specified." << endl; - cerr << endl; - cerr << "Package sets (like 'system' and 'world') cannot be uninstalled at the same time" << endl; - cerr << "as ordinary packages." << endl; - - return_code |= 1; - } - catch (const MultipleSetTargetsSpecified &) - { - cout << endl; - cerr << "Error: multiple package sets were specified." << endl; - cerr << endl; - cerr << "Package sets (like 'system' and 'world') must be uninstalled individually," << endl; - cerr << "without any other sets or packages." << endl; - - return_code |= 1; - } - catch (const NoSuchPackageError & e) - { - return_code |= 1; - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "Could not find '" << e.name() << "'."; - - if (! CommandLine::get_instance()->a_no_suggestions.specified()) - { - cerr << " Looking for suggestions:" << endl; - - try - { - FuzzyCandidatesFinder f(*env, e.name(), filter::InstalledAtRoot(env->preferred_root_key()->value())); - - if (f.begin() == f.end()) - cerr << "No suggestions found." << endl; - else - cerr << "Suggestions:" << endl; - - for (FuzzyCandidatesFinder::CandidatesConstIterator c(f.begin()), - c_end(f.end()) ; c != c_end ; ++c) - cerr << " * " << colour(cl_package_name, *c) << endl; - } - catch (const PackageDepSpecError &) - { - cerr << "Query too complicated or confusing to make suggestions." << endl; - } - } - - cerr << endl; - } - - return return_code; - } -} - -int -do_uninstall(const std::shared_ptr<Environment> & env) -{ - return real_uninstall(env, false); -} - -int -do_uninstall_unused(const std::shared_ptr<Environment> & env) -{ - return real_uninstall(env, true); -} - diff --git a/src/clients/paludis/uninstall.hh b/src/clients/paludis/uninstall.hh deleted file mode 100644 index 338f76a24..000000000 --- a/src/clients/paludis/uninstall.hh +++ /dev/null @@ -1,41 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 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_UNINSTALL_HH -#define PALUDIS_GUARD_SRC_UNINSTALL_HH 1 - -#include "command_line.hh" - -/** \file - * Declaration for the do_uninstall function. - */ - -namespace paludis -{ - class Environment; -} - -/// Handle --uninstall. -int do_uninstall(const std::shared_ptr<paludis::Environment> &); - -/// Handle --uninstall-unused. -int do_uninstall_unused(const std::shared_ptr<paludis::Environment> &); - -#endif - diff --git a/src/clients/paludis/upgrade_TEST b/src/clients/paludis/upgrade_TEST deleted file mode 100755 index e0d962bdd..000000000 --- a/src/clients/paludis/upgrade_TEST +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -for c in vdb_config exndbam_config ; do - - PALUDIS_HOME=./upgrade_TEST_dir/$c/ REPEAT= \ - ./paludis -E :upgrade-test --query -M =test-category/target-1 || exit 13 - - PALUDIS_HOME=./upgrade_TEST_dir/$c/ REPEAT= \ - ./paludis -E :upgrade-test --install =test-category/target-1 || exit 1 - - PALUDIS_HOME=./upgrade_TEST_dir/$c/ REPEAT= \ - ./paludis -E :upgrade-test --query -M =test-category/target-1 || exit 14 - - ./upgrade_TEST_dir/root/usr/bin/testbin | grep testbin-1 >/dev/null || exit 2 - ./upgrade_TEST_dir/root/usr/bin/testbin1 | grep testbin1 >/dev/null || exit 3 - ./upgrade_TEST_dir/root/usr/bin/testbin2 && exit 4 - - for a in 1 2 ; do - PALUDIS_HOME=./upgrade_TEST_dir/$c/ REPEAT=yes \ - ./paludis -E :upgrade-test --install =test-category/target-1 || exit 5 - - PALUDIS_HOME=./upgrade_TEST_dir/$c/ REPEAT= \ - ./paludis -E :upgrade-test --query -M =test-category/target-1 || exit 15 - - ./upgrade_TEST_dir/root/usr/bin/testbin | grep testbin-1 >/dev/null || exit 6 - ./upgrade_TEST_dir/root/usr/bin/testbin1 | grep repeatbin1 >/dev/null || exit 7 - ./upgrade_TEST_dir/root/usr/bin/testbin2 && exit 8 - done - - PALUDIS_HOME=./upgrade_TEST_dir/$c/ \ - ./paludis -E :upgrade-test --install target || exit 9 - - - PALUDIS_HOME=./upgrade_TEST_dir/$c/ REPEAT= \ - ./paludis -E :upgrade-test --query -M target || exit 16 - - ./upgrade_TEST_dir/root/usr/bin/testbin | grep testbin-2 >/dev/null || exit 10 - ./upgrade_TEST_dir/root/usr/bin/testbin1 2>/dev/null && exit 11 - ./upgrade_TEST_dir/root/usr/bin/testbin2 | grep testbin2 >/dev/null || exit 12 - - rm -fr upgrade_TEST_dir/root/usr/{share/doc,bin} - -done - diff --git a/src/clients/paludis/upgrade_TEST_cleanup.sh b/src/clients/paludis/upgrade_TEST_cleanup.sh deleted file mode 100755 index 10ff0abbf..000000000 --- a/src/clients/paludis/upgrade_TEST_cleanup.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d upgrade_TEST_dir ] ; then - rm -fr upgrade_TEST_dir -else - true -fi - - - diff --git a/src/clients/paludis/upgrade_TEST_setup.sh b/src/clients/paludis/upgrade_TEST_setup.sh deleted file mode 100755 index 674f88e1d..000000000 --- a/src/clients/paludis/upgrade_TEST_setup.sh +++ /dev/null @@ -1,202 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir upgrade_TEST_dir || exit 1 -cd upgrade_TEST_dir || exit 1 -mkdir -p build - -mkdir -p vdb_config/.paludis-upgrade-test -cat <<END > vdb_config/.paludis-upgrade-test/specpath.conf -root = `pwd`/root -config-suffix = vdb -END - -mkdir -p exndbam_config/.paludis-upgrade-test -cat <<END > exndbam_config/.paludis-upgrade-test/specpath.conf -root = `pwd`/root -config-suffix = exndbam -END - -for a in vdb exndbam ; do - - mkdir -p root/${SYSCONFDIR}/paludis-${a}/repositories - cat <<END > root/${SYSCONFDIR}/paludis-${a}/use.conf -*/* foo -END - - cat <<END > root/${SYSCONFDIR}/paludis-${a}/licenses.conf -*/* * -END - - cat <<END > root/${SYSCONFDIR}/paludis-${a}/keywords.conf -*/* test -END - - cat <<END > root/${SYSCONFDIR}/paludis-${a}/bashrc -export CHOST="my-chost" -export USER_BASHRC_WAS_USED=yes -END - - cat <<END > root/${SYSCONFDIR}/paludis-${a}/repositories/repo1.conf -location = `pwd`/repo1 -cache = /var/empty -format = e -names_cache = /var/empty -profiles = \${location}/profiles/testprofile -builddir = `pwd`/build -END - -done - -cat <<END > root/${SYSCONFDIR}/paludis-vdb/repositories/installed.conf -location = \${ROOT}/var/db/pkg -format = vdb -names_cache = /var/empty -provides_cache = /var/empty -builddir = `pwd`/build -END - -cat <<END > root/${SYSCONFDIR}/paludis-exndbam/repositories/installed.conf -location = \${ROOT}/var/db/exndbam -format = exndbam -builddir = `pwd`/build -END - -mkdir -p root/tmp -touch root/${SYSCONFDIR}/ld.so.conf -mkdir -p root/var/db/pkg - -mkdir -p root/var/db/exndbam - -mkdir -p repo1/{eclass,distfiles,profiles/testprofile,test-category/target/files} || exit 1 - -mkdir -p src/target-1 -cat <<"END" > src/target-1/testbin -#!/usr/bin/env bash -echo "This is testbin-1" -END -chmod +x src/target-1/testbin -cat <<"END" > src/target-1/testbin1 -#!/usr/bin/env bash -echo "This is testbin1" -END -chmod +x src/target-1/testbin1 -cd src -tar zcf target-1.tar.gz target-1/ -mv target-1.tar.gz ../repo1/distfiles/ -cd .. -rm -fr src - -mkdir -p src/target-2 -cat <<"END" > src/target-2/testbin -#!/usr/bin/env bash -echo "This is testbin-2" -END -chmod +x src/target-2/testbin -cat <<"END" > src/target-2/testbin2 -#!/usr/bin/env bash -echo "This is testbin2" -END -chmod +x src/target-2/testbin2 -cd src -tar zcf target-2.tar.gz target-2/ -mv target-2.tar.gz ../repo1/distfiles/ -cd .. -rm -fr src - -cd repo1 || exit 1 -echo "test-repo-1" > profiles/repo_name || exit 1 -cat <<END > profiles/categories || exit 1 -test-category -END -cat <<END > profiles/testprofile/make.defaults -ARCH=test -USERLAND=test -KERNEL=test -END - -cat <<"END" > eclass/myeclass.eclass || exit 1 -the_eclass_works() -{ - true -} -END - -cat <<"END" > test-category/target/target-1.ebuild || exit 1 -EAPI="3" - -inherit myeclass - -DESCRIPTION="Test target" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="http://invalid.domain/${P}.tar.gz" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" - -pkg_setup() { - export VAR1=yes - VAR2=yes - local VAR3=yes -} - -src_compile() { - if [[ ${REPEAT} == yes ]] ; then - sed -i -e 's,testbin1,repeatbin1,' testbin1 || die - fi -} - -src_install() { - [[ "${VAR1}" == yes ]] || die - [[ "${VAR2}" == yes ]] || die - [[ "${VAR3}" == yes ]] && die - [[ $(printenv VAR1 ) == yes ]] || die - - dobin testbin - dobin testbin${PV} - - touch -d "1 April 2000" -m ${D}/usr/bin/testbin -} - -pkg_preinst() { - [[ "${VAR1}" == yes ]] || die - [[ "${VAR2}" == yes ]] || die - [[ "${VAR3}" == yes ]] && die - [[ $(printenv VAR1 ) == yes ]] || die - [[ -z "$(printenv D )" ]] && die - - the_eclass_works || die -} - -pkg_prerm() { - [[ "${VAR1}" == yes ]] || die - [[ "${VAR2}" == yes ]] || die - [[ "${VAR3}" == yes ]] && die - [[ $(printenv VAR1 ) == yes ]] || die - [[ -z "$(printenv D )" ]] && die - - the_eclass_works || die -} -END - -cat <<"END" > test-category/target/target-2.ebuild || exit 1 -EAPI="3" - -DESCRIPTION="Test target" -HOMEPAGE="http://paludis.pioto.org/" -SRC_URI="http://invalid.domain/${P}.tar.gz" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" - -src_install() { - dobin testbin - dobin testbin${PV} - - touch -d "1 April 2000" -m ${D}/usr/bin/testbin -} -END -cd .. - diff --git a/src/clients/paludis/version_TEST b/src/clients/paludis/version_TEST deleted file mode 100755 index f792c994c..000000000 --- a/src/clients/paludis/version_TEST +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -PALUDIS_SKIP_CONFIG=yes ./paludis --version diff --git a/zsh-completion/Makefile.am b/zsh-completion/Makefile.am index 8648b3c00..ccc8e5c25 100644 --- a/zsh-completion/Makefile.am +++ b/zsh-completion/Makefile.am @@ -1,5 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -noinst_DATA = _paludis _adjutrix _paludis_packages _cave +noinst_DATA = _adjutrix _paludis_packages _cave EXTRA_DIST = $(noinst_DATA) AUTOMAKE_OPTIONS = 1.11 parallel-tests diff --git a/zsh-completion/_paludis b/zsh-completion/_paludis deleted file mode 100644 index f3fb939be..000000000 --- a/zsh-completion/_paludis +++ /dev/null @@ -1,147 +0,0 @@ -#compdef paludis - -# vim: set et sw=4 sts=4 ts=4 ft=zsh : -# ZSH completion for adjutrix -# Written by Baptiste Daroussin <baptux at free.fr> - -_paludis() { - local actions action_args query_args general_args deplist_descriptions deplist_args install_uninstall_args list_args lists owner_args - actions=( - --query --install -i --uninstall -u --uninstall-unused --sync -s --report --contents -k --executables --owner -o --config - --version -V --info -I --help -h -has-version --best-version --environment-variable --list-repositories --list-categories --list-packages --list-sets - --list-sync-protocols --list-repository-formats --list-dep-tag-categories --regenerate-installed-cache --regenerate-installable-cache - ) - - query_args=( - "(--show-deps -D)"{--show-deps,-D}"[Show dependencies]" - "(--show-metadata -M)"{--show-metadata,-M}"[Show raw metadata]" - ) - - install_uninstall_args=( - "(--pretend -p)"{--pretend,-p}"[Pretend only]" - "(--destinations -d)"{--destinations,-d}"[Use specified destinations instead of defaults]:Destinations:_paludis_packages repositories" - "(--preserve-world -1)"{--preserve-world,-1}"[Don't modify the world file]" - "--add-to-world-spec[Use this atom, rather than all targets, for updating world (for resume commands)]" - "(--fetch -f)"{--fetch,-f}"[Only fetch sources; don't install anything]" - "--no-safe-resume[Do not allow interrupted downloads to be resumed]" - "--show-reasons[Show why packages are being (un)installed]:Verbosity:((none\:Don\'t\ show\ any\ information summary\:Show\ a\ summary full\:Show\ full\ output))" - "--show-use-descriptions[Show descriptions of USE flags]:Which:((none\:Don\'t\ show\ any\ descriptions new\:Show\ for\ new\ use\ flags changed\:Show\ for\ new\ and\ changed\ flags all\:Show for all flags))" - "--show-package-descriptions[Show package descriptions]:When:((none\:Don\'t\ show\ any\ descriptions new\:Show\ descriptions\ for\ new\ packages all\:Show\ descriptions\ for\ all\ packages))" - "--continue-on-failure[Whether to continue after a fetch or install error]:When:((if-fetch-only\:If\ fetching\ only never\:Never if-satisfied\:If\ remaining\ packages\ dependencies\ are\ satisfied if-independent\:If\ independent\ of\ failed\ and\ skipped\ packages always\:Always))" - "--skip-phase[Skip phases with a given name]:Phase: " - "--abort-at-phase[Abort when a phase with a given name is encountered]:Phase: " - "--skip-until-phase[Skip all phases until a phase with a given name is encountered]:Phase: " - "--change-phases-for[Control which packages to change phases for]:Target:((all\:'All packages' first\:'Only the first package on the list' last\:'Only the last package on the list'))" - ) - list_args=( - "--repository-format[Matches with this repository format only]:format:_paludis_packages repository-formats" - "--repository[Matches with this repository name only]:repository:_paludis_packages repositories" - "--category[Matches with this category name only]:category:_paludis_packages categories" - "--package[Matches with this package name only]:package:_paludis_packages available" - "--set[Matches with this package set name only]:set:_paludis_packages sets" - ) - uninstall_args=( - "--with-unused-dependencies[Also uninstall any dependencies of the target that are no longer used]" - "--permit-unsafe-uninstalls[Permit depended-upon packages to be uninstalled]" - "--with-dependencies[Also uninstall packages that depend upon the target]" - "--all-versions[Uninstall all versions of a package]" - ) - lists=( - "(: -)--list-repositories[List available repositories]" - "(: -)--list-categories[List available categories]" - "(: -)--list-packages[List available packages]" - "(: -)--list-sets[List available package sets]" - "(: -)--list-sync-protocols[List available sync protocols]" - "(: -)--list-repository-formats[List available repository formats]" - "(: -)--list-dep-tag-categories[List known dep tag categories]" - ) - general_args=( - '--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)--force-colour[Force the use of colour]" - "(--force-colour)--no-colour[Do not use colour]" - "--no-suggestions[Do not give suggestions if an unknown name is specified]" - "(--environment -E)"{-E,--environment}"[Environment specification]" - "--resume-command-template[Save the resume command to a file made using mkstemp(3)]:file:_files" - "--compact[Display output using one line per entry]" - ) - - action_args=( - "($actions)"{-q,--query}"[Query for package information]" - "($actions)"{-i,--install}"[Install one or more packages]" - "($actions)"{-u,--uninstall}"[Uninstall one or more packages]" - "(: -)"{--sync,-s}"[Sync all or specified repositories]:repository:_paludis_packages repositories" - "($actions)--uninstall-unused[Uninstall unused packages]" - "(: -)"{--report,-r}"[Report the current state of the system]" - "(: -)"{--contents,-k}"[Display contents of a package]:package:_paludis_packages installed" - "(: -)"--executables"[Display executable contents of a package]:package:_paludis_packages installed" - "(: -)"{--owner,-o}"[Display the owner of a file]" - "(: -)"{--version,-V}"[Display program version]" - "(: -)"{--info,-I}"[Display program version and system information]" - "(: -)"{--help,-h}"[Display program help]" - "(: -)--has-version[Check whether the specified spec is installed]:package:_paludis_packages available" - "(: -)--best-version[Display the best version of the specified spec]:package:_paludis_packages available" - "(: -)--environment-variable[Display the value of an environment variable for a particular package]:package:_paludis_packages available" - "(: -)--configuration-variable[Display the value of a configuration variable for a particular repository]:repository:_paludis_packages repositories" - "(: -)--update-news[Regenerate news.unread files]" - "(: -)--regenerate-installed-cache[Regenerate (non-metadata) cache for installed repositories]:repository:_paludis_packages repositories" - "(: -)--regenerate-installable-cache[Regenerate (non-metadata) cache for installable repositories]:repository:_paludis_packages repositories" - "(: -)--config[Run post-install configuration for a package]:package:_paludis_packages installed" - ) - owner_args=( - "--full-match[Match whole filename]" - ) - deplist_descriptions=' - pre\:"As pre dependencies" - pre-or-post\:"As pre dependencies, or post dependencies where needed" - post\:"As post dependencies" - try-post\:"As post dependencies, with no error for failures" - discard\:"Discard (default)"' - deplist_args=( - "--dl-blocks[How to handle blocks]:How:(accumulate error discard)" - "--dl-override-masks[Zero or more mask kinds that can be overridden as necessary]:What:((none tilde-keyword unkeyworded profile repository license))" - "--dl-suggested[How to handle suggested dependencies]:How:((show install discard))" - "--dl-downgrade[When to downgrade packages]:When:((as-needed warning error))" - "--dl-reinstall[When to reinstall packages]:When:((never always if-use-changed))" - "--dl-reinstall-scm[When to reinstall scm packages]:When:((never always daily weekly))" - "--dl-reinstall-targets[When to reinstall targets]:When:((auto never always))" - "--dl-upgrade[When to upgrade packages]:When:((always as-needed))" - "--dl-deps-default[Override default behaviour for all dependency classes]:How:(($deplist_descriptions))" - "--dl-installed-deps-pre[How to handle pre dependencies for installed packages]:How:(($deplist_descriptions))" - "--dl-installed-deps-runtime[How to handle runtime dependencies for installed packages]:How:(($deplist_descriptions))" - "--dl-installed-deps-post[How to handle post dependencies for installed packages]:How:(($deplist_descriptions))" - "--dl-uninstalled-deps-pre[How to handle pre dependencies for uninstalled packages]:How:(($deplist_descriptions))" - "--dl-uninstalled-deps-post[How to handle post dependencies for uninstalled packages]:How:(($deplist_descriptions))" - "--dl-uninstalled-deps-runtime[How to handle runtime dependencies for uninstalled packages]:How:(($deplist_descriptions))" - "--dl-uninstalled-deps-suggested[How to handle suggested dependencies for uninstalled packages]:How:(($deplist_descriptions))" - "--dl-circular[How to handle circular dependencies]:How:((error discard))" - "--dl-fall-back[When to fall back to installed packages]:When:((as-needed-except-targets as-needed never))" - "--dl-new-slots[When to pull in new slots (works with --dl-upgrade)]:When:((always as-needed))" - ) - #dispatch - if (( $words[(I)(--(uninstall|config)|-[[:alpha:]]#u[[:alpha:]]#)] )) ; then - _arguments -s \ - $general_args[@] $deplist_args[@] $install_uninstall_args[@] $uninstall_args[@] \ - "*:installed package:_paludis_packages installed" && return 0 - elif (( $words[(I)--uninstall-unused] )) ; then - _arguments -s \ - $deplist_args[@] $install_uninstall_args[@] && return 0 - elif (( $words[(I)(--owner|-[[:alpha:]]#o[[:alpha:]]#)] )) ; then - _arguments -s \ - $general_args[@] $owner_args[@] \ - "*:Files:_files" && return 0 - elif (( $words[(I)(--install|-[[:alpha:]]#i[[:alpha:]]#)] )) ; then - _arguments -s \ - $general_args[@] $deplist_args[@] $install_uninstall_args[@] \ - "*:available packages:_paludis_packages available" && return 0 - elif (( $words[(I)(--query|-[[:alpha:]]#q[[:alpha:]]#)] )) ; then - _arguments -s \ - $general_args[@] $query_args[@]\ - "*:available packages:_paludis_packages available" && return 0 - else - _arguments -s \ - $general_args[@] $deplist_args[@] $list_args[@] $lists[@] $install_uninstall_args[@] $uninstall_args[@] $owner_args[@] $query_args[@] "$action_args[@]" \ - "*:available packages:_paludis_packages available" && return 0 - fi -} - -_paludis "$@" |