diff options
author | 2011-02-06 13:40:38 +0000 | |
---|---|---|
committer | 2011-02-06 13:40:38 +0000 | |
commit | ddcc1913de592ad6c08212fe09efd68328b43dc1 (patch) | |
tree | de28de51eacc21d9f7834a4e7ad0084c74b9ee70 | |
parent | fe657fcda33701ce86fbdf83ed9621e40fc2c11d (diff) | |
download | paludis-ddcc1913de592ad6c08212fe09efd68328b43dc1.tar.gz paludis-ddcc1913de592ad6c08212fe09efd68328b43dc1.tar.xz |
Kill adjutrix
39 files changed, 9 insertions, 3218 deletions
diff --git a/.gitignore b/.gitignore index 0d3447fa3..378c2c39b 100644 --- a/.gitignore +++ b/.gitignore @@ -78,7 +78,6 @@ paludis-*.*.*.tar.bz2 /doc/changelog.html.part /doc/changelog.subst /doc/clients/accerso.html -/doc/clients/adjutrix.html /doc/clients/appareo.html /doc/clients/cave.html /doc/clients/cave-config.html @@ -496,7 +495,6 @@ paludis-*.*.*.tar.bz2 /paludis/version_spec_TEST /pkg-config/paludis.pc /src/clients/accerso/accerso -/src/clients/adjutrix/adjutrix /src/clients/appareo/appareo /src/clients/cave/cave /src/clients/instruo/instruo diff --git a/bash-completion/Makefile.am b/bash-completion/Makefile.am index bbcc02869..05e5ee93d 100644 --- a/bash-completion/Makefile.am +++ b/bash-completion/Makefile.am @@ -1,5 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -noinst_DATA = adjutrix accerso instruo cave +noinst_DATA = accerso instruo cave EXTRA_DIST = $(noinst_DATA) AUTOMAKE_OPTIONS = 1.11 parallel-tests diff --git a/bash-completion/adjutrix b/bash-completion/adjutrix deleted file mode 100644 index 7ed2688fa..000000000 --- a/bash-completion/adjutrix +++ /dev/null @@ -1,118 +0,0 @@ -# Bash completion function for adjutrix -# 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. - -_adjutrix_get_repodir() { - local repodir - [[ -f ./profiles/repo_name ]] && repodir=$(readlink -f $(pwd)) - [[ -z "${repodir}" && -f ../profiles/repo_name ]] \ - && repodir=$(readlink -f $(pwd)/..) - [[ -z "${repodir}" && -f ../../profiles/repo_name ]] \ - && repodir=$(readlink -f $(pwd)/../..) - [[ -z "${repodir}" ]] && return 1 - echo "${repodir}" -} - -_adjutrix() { - local cur prev opts repodir - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - # Figure out what our repository dir is - for i in $(seq 0 ${COMP_CWORD}) ; do - if [[ ${COMP_WORDS[i]} == "-D" \ - || ${COMP_WORDS[i]} == "--repository-dir" ]] - then - repodir=${COMP_WORDS[i+1]} - fi - done - [[ -z "${repodir}" ]] && repodir="$(_adjutrix_get_repodir)" - - opts="--find-stable-candidates -s \ - --find-dropped-keywords -d \ - --find-insecure-packages -i \ - --find-unused-packages -U \ - --keyword-graph -k \ - --reverse-deps -r \ - --what-needs-keywording -w \ - --display-default-system-resolution -S \ - --build-downgrade-check-list \ - --downgrade-check \ - --version -V \ - --help -h \ - --log-level \ - --no-colour \ - --no-color \ - --no-suggestions \ - --repository-dir -D \ - --category -C \ - --package -P \ - --profile \ - --unstable \ - --write-cache-dir \ - --master-repository-name \ - --extra-repository-dir" - - case "${cur}" in - -*) - COMPREPLY=($(compgen -W "${opts}" -- "${cur}")) - return 0 - ;; - *) - case "${prev}" in - ## Enum operators - --log-level) - COMPREPLY=($(compgen -W "debug qa warning silent" -- "${cur}")) - return 0 - ;; - - --category|-C) - [[ -z "${repodir}" ]] && return 0 - COMPREPLY=($(compgen -W "$(< ${repodir}/profiles/categories)" -- "${cur}")) - return 0 - ;; - --package|-P) - [[ -z "${repodir}" ]] && return 0 - # borrowed from the gentoo bashcomp script - local p - COMPREPLY=($(compgen -W "$(\ - builtin cd ${repodir}; \ - for p in *-*/${cur}*; do \ - [[ -d ${p} ]] && \ - echo ${p##*/} ; \ - done)" -- "${cur}")) - return 0 - ;; - - --find-stable-candidates|-s|--find-dropped-keywords|-d) - [[ -z "${repodir}" ]] && return 0 - COMPREPLY=($(compgen -W "$(< ${repodir}/profiles/arch.list)" -- "${cur}")) - return 0 - ;; - --what-needs-keywording|-w) - # still needs some improvement to do package names as the second arg... - COMPREPLY=($(compgen -W "$(< ${repodir}/profiles/arch.list)" -- "${cur}")) - return 0 - ;; - - --repository-dir|-D|--write-cache-dir|--extra-repository-dir) - _filedir -d - return 0 - ;; - - --profile) - COMPREPLY=($(compgen -W "$(sed -n 's,^[^#][^[:space:]]*[[:space:]]*\([^[:space:]]*\).*,\1,p' "${repodir}/profiles/profiles.desc")" -- "${cur}")) - return 0 - ;; - - *) - ;; - esac - ;; - esac -} -complete -o filenames -F _adjutrix adjutrix diff --git a/configure.ac b/configure.ac index cfa723242..ff2f3dbcd 100644 --- a/configure.ac +++ b/configure.ac @@ -1394,7 +1394,7 @@ AC_ARG_WITH([repositories], accounts Account management (requires distribution support) cran The Comprehensive R Archive Network (unusable) e Ebuild, Ebin, Exheres, VDB etc - fake A fake repository for test cases and adjutrix + fake A fake repository for test cases gemcutter Gemcutter for Ruby repository Automatic repository config generation (via 'unavailable') unavailable Unavailable @@ -1459,7 +1459,7 @@ AC_ARG_WITH([environments], all All available environments default Equivalent to no_config,paludis,test - no_config Configurationless environment, for adjutrix etc + no_config Configurationless environment, for accerso etc paludis Standard Paludis environments portage Portage configuration (dodgy) test For test cases], @@ -1513,21 +1513,20 @@ AC_DEFINE_UNQUOTED([DEFAULT_DISTRIBUTION], "$DEFAULT_DISTRIBUTION", [Default dis dnl }}} dnl {{{ clients -ALL_CLIENTS="accerso adjutrix appareo cave instruo" +ALL_CLIENTS="accerso 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" +DEFAULT_CLIENTS="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 + default Equivalent to 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], @@ -1793,7 +1792,6 @@ AC_OUTPUT( src/Makefile src/clients/Makefile src/clients/accerso/Makefile - src/clients/adjutrix/Makefile src/clients/appareo/Makefile src/clients/cave/Makefile src/clients/instruo/Makefile diff --git a/doc/clients/Makefile.am b/doc/clients/Makefile.am index 206e378f9..676611217 100644 --- a/doc/clients/Makefile.am +++ b/doc/clients/Makefile.am @@ -104,16 +104,6 @@ accerso.html : header.html.part footer.html.part fi ; } && \ cat footer.html.part ; } > $@ -adjutrix.html : header.html.part footer.html.part - { cat header.html.part && { \ - if test -x $(top_builddir)/src/clients/adjutrix/man-adjutrix ; then \ - $(top_builddir)/src/clients/adjutrix/man-adjutrix --html ; \ - else \ - echo "<h1>adjutrix</h1>"; \ - echo "<p>Sorry, documentation was generated without support for the adjutrix client.</p>" ; \ - fi ; } && \ - cat footer.html.part ; } > $@ - appareo.html : header.html.part footer.html.part { cat header.html.part && { \ if test -x $(top_builddir)/src/clients/appareo/man-appareo ; then \ diff --git a/doc/clients/index.html.part b/doc/clients/index.html.part index 3e6d0892a..f5ba7281e 100644 --- a/doc/clients/index.html.part +++ b/doc/clients/index.html.part @@ -13,7 +13,6 @@ <ul> <li><a href="accerso.html">accerso</a>, the mirror client.</li> - <li><a href="adjutrix.html">adjutrix</a>, a collection of utilities for ebuild developers and arch teams.</li> <li><a href="instruo.html">instruo</a>, the metadata generation client.</li> <li><a href="appareo.html">appareo</a>, a Manifest generation tool.</li> </ul> diff --git a/doc/clients/toplinks.html.part.in b/doc/clients/toplinks.html.part.in index d5cfb4bfd..018d748a3 100644 --- a/doc/clients/toplinks.html.part.in +++ b/doc/clients/toplinks.html.part.in @@ -32,7 +32,7 @@ </td> <td class="currentpage"> - <a href="###TOPURI###clients/adjutrix.html">adjutrix</a> + <a href="###TOPURI###clients/appareo.html">appareo</a> </td> </tr> @@ -60,7 +60,7 @@ </td> <td class="currentpage"> - <a href="###TOPURI###clients/appareo.html">appareo</a> + </td> </tr> diff --git a/doc/index.html.part.in b/doc/index.html.part.in index 2f50fd5f1..1cda1d025 100644 --- a/doc/index.html.part.in +++ b/doc/index.html.part.in @@ -88,7 +88,6 @@ the exheres repository format.</p> <ul> <li><a href="clients/accerso.html">accerso</a>, the mirror client.</li> - <li><a href="clients/adjutrix.html">adjutrix</a>, a collection of utilities for ebuild developers and arch teams.</li> <li><a href="clients/instruo.html">instruo</a>, the metadata generation client.</li> <li><a href="clients/appareo.html">appareo</a>, a Manifest generation tool.</li> </ul> diff --git a/src/clients/adjutrix/Makefile.am b/src/clients/adjutrix/Makefile.am deleted file mode 100644 index 18abc73f8..000000000 --- a/src/clients/adjutrix/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -include $(top_srcdir)/misc/common-makefile.am - -AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@ -DEFS= \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DLIBDIR=\"$(libdir)\" - -SUBDIRS = . - -bin_PROGRAMS = adjutrix -noinst_PROGRAMS = man-adjutrix - -man_MANS = adjutrix.1 - -adjutrix.1 : man-adjutrix - ./man-adjutrix > $@ - -man_adjutrix_SOURCES = \ - man_adjutrix.cc \ - command_line.hh \ - command_line.cc - -man_adjutrix_LDADD = \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/src/output/liboutput.a \ - $(DYNAMIC_LD_LIBS) - -adjutrix_SOURCES = \ - command_line.hh command_line.cc \ - find_stable_candidates.hh find_stable_candidates.cc \ - find_dropped_keywords.hh find_dropped_keywords.cc \ - find_insecure_packages.hh find_insecure_packages.cc \ - find_reverse_deps.hh find_reverse_deps.cc \ - find_unused_packages.hh find_unused_packages.cc \ - keywords_graph.hh keywords_graph.cc \ - display_default_system_resolution.hh display_default_system_resolution.cc \ - what_needs_keywording.hh what_needs_keywording.cc \ - downgrade_check.hh downgrade_check.cc \ - adjutrix.cc - -adjutrix_LDADD = \ - $(top_builddir)/paludis/legacy/libpaludislegacy_@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)/paludis/selinux/libpaludisselinux_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/src/output/liboutput.a \ - $(DYNAMIC_LD_LIBS) - -TESTS = version_TEST help_TEST find_stable_candidates_TEST args_from_environment_TEST - -EXTRA_DIST = \ - $(man_MANS) \ - $(TESTS) \ - find_stable_candidates_TEST_setup.sh find_stable_candidates_TEST_cleanup.sh - -DISTCLEANFILES = $(man_MANS) $(noinst_DATA) - diff --git a/src/clients/adjutrix/adjutrix.cc b/src/clients/adjutrix/adjutrix.cc deleted file mode 100644 index 1fb7eff7a..000000000 --- a/src/clients/adjutrix/adjutrix.cc +++ /dev/null @@ -1,308 +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 <output/colour.hh> -#include "command_line.hh" -#include "find_stable_candidates.hh" -#include "find_dropped_keywords.hh" -#include "find_insecure_packages.hh" -#include "find_reverse_deps.hh" -#include "find_unused_packages.hh" -#include "keywords_graph.hh" -#include "display_default_system_resolution.hh" -#include "what_needs_keywording.hh" -#include "downgrade_check.hh" - -#include <paludis/about.hh> -#include <paludis/util/join.hh> -#include <paludis/util/log.hh> -#include <paludis/util/fs_stat.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/make_named_values.hh> -#include <paludis/environments/no_config/no_config_environment.hh> -#include <iostream> -#include <cstdlib> -#include <unistd.h> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - FSPath - get_location_and_add_filters() - { - Context context("When determining tree location:"); - - if (CommandLine::get_instance()->a_repository_directory.specified()) - return FSPath(CommandLine::get_instance()->a_repository_directory.argument()); - - if ((FSPath::cwd() / "profiles").stat().is_directory()) - return FSPath::cwd(); - if ((FSPath::cwd().dirname() / "profiles").stat().is_directory()) - { - CommandLine::get_instance()->a_category.add_argument(FSPath::cwd().basename()); - CommandLine::get_instance()->a_category.set_specified(true); - return FSPath::cwd().dirname(); - } - if ((FSPath::cwd().dirname().dirname() / "profiles").stat().is_directory()) - { - CommandLine::get_instance()->a_package.add_argument(FSPath::cwd().basename()); - CommandLine::get_instance()->a_package.set_specified(true); - CommandLine::get_instance()->a_category.add_argument(FSPath::cwd().dirname().basename()); - CommandLine::get_instance()->a_category.set_specified(true); - return FSPath::cwd().dirname().dirname(); - } - - throw ConfigurationError("Cannot find tree location (try specifying --repository-dir)"); - } - - void display_version() - { - cout << "adjutrix, part of " << PALUDIS_PACKAGE << " " << PALUDIS_VERSION_MAJOR << "." - << PALUDIS_VERSION_MINOR << "." << PALUDIS_VERSION_MICRO << PALUDIS_VERSION_SUFFIX; - if (! std::string(PALUDIS_GIT_HEAD).empty()) - cout << " git " << PALUDIS_GIT_HEAD; - cout << endl; - } - - struct DoVersion - { - }; -} - -int -main(int argc, char *argv[]) -{ - Context context("In program " + join(argv, argv + argc, " ") + ":"); - - try - { - CommandLine::get_instance()->run(argc, argv, "adjutrix", "ADJUTRIX_OPTIONS", "ADJUTRIX_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 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); - - if (1 != ( - CommandLine::get_instance()->a_find_stable_candidates.specified() + - CommandLine::get_instance()->a_find_dropped_keywords.specified() + - CommandLine::get_instance()->a_find_insecure_packages.specified() + - CommandLine::get_instance()->a_find_unused_packages.specified() + - CommandLine::get_instance()->a_keywords_graph.specified() + - CommandLine::get_instance()->a_reverse_deps.specified() + - CommandLine::get_instance()->a_display_default_system_resolution.specified() + - CommandLine::get_instance()->a_build_downgrade_check_list.specified() + - CommandLine::get_instance()->a_downgrade_check.specified() + - CommandLine::get_instance()->a_what_needs_keywording.specified() - )) - throw DoHelp("you should specify exactly one action"); - - if (! CommandLine::get_instance()->a_write_cache_dir.specified()) - CommandLine::get_instance()->a_write_cache_dir.set_argument("/var/empty"); - - std::shared_ptr<FSPathSequence> extra_repository_dirs(std::make_shared<FSPathSequence>()); - for (args::StringSequenceArg::ConstIterator d(CommandLine::get_instance()->a_extra_repository_dir.begin_args()), - d_end(CommandLine::get_instance()->a_extra_repository_dir.end_args()) ; - d != d_end ; ++d) - extra_repository_dirs->push_back(FSPath(*d)); - - NoConfigEnvironment env(make_named_values<no_config_environment::Params>( - n::accept_unstable() = CommandLine::get_instance()->a_unstable.specified(), - n::disable_metadata_cache() = false, - n::extra_accept_keywords() = "", - n::extra_params() = std::shared_ptr<Map<std::string, std::string> >(), - n::extra_repository_dirs() = extra_repository_dirs, - n::master_repository_name() = CommandLine::get_instance()->a_master_repository_name.argument(), - n::profiles_if_not_auto() = CommandLine::get_instance()->a_profile.argument(), - n::repository_dir() = get_location_and_add_filters(), - n::repository_type() = (CommandLine::get_instance()->a_reverse_deps.specified()) ? - no_config_environment::ncer_auto : no_config_environment::ncer_ebuild, - n::write_cache() = CommandLine::get_instance()->a_write_cache_dir.argument() - )); - - if (CommandLine::get_instance()->a_find_stable_candidates.specified()) - { - if (1 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw DoHelp("find-stable-candidates action takes exactly one parameter (the target arch)"); - - do_find_stable_candidates(env); - return EXIT_SUCCESS; - } - - if (CommandLine::get_instance()->a_find_dropped_keywords.specified()) - { - if (1 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw DoHelp("find-dropped-keywords action takes exactly one parameter (the target arch)"); - - do_find_dropped_keywords(env); - return EXIT_SUCCESS; - } - - if (CommandLine::get_instance()->a_find_insecure_packages.specified()) - { - if (CommandLine::get_instance()->begin_parameters() != - CommandLine::get_instance()->end_parameters()) - throw DoHelp("find-dropped-keywords action takes no parameters"); - - do_find_insecure_packages(env); - return EXIT_SUCCESS; - } - - if (CommandLine::get_instance()->a_find_unused_packages.specified()) - { - if (CommandLine::get_instance()->begin_parameters() != - CommandLine::get_instance()->end_parameters()) - throw DoHelp("find-unused-packages action takes no parameters"); - - do_find_unused_packages(env); - return EXIT_SUCCESS; - } - - - if (CommandLine::get_instance()->a_keywords_graph.specified()) - { - if (CommandLine::get_instance()->begin_parameters() != - CommandLine::get_instance()->end_parameters()) - throw DoHelp("keywords-graph action takes no parameters"); - - do_keywords_graph(env); - return EXIT_SUCCESS; - } - - if (CommandLine::get_instance()->a_reverse_deps.specified()) - { - if (1 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw DoHelp("reverse-deps action takes exactly one parameter (the target dep)"); - - return do_find_reverse_deps(env); - } - - if (CommandLine::get_instance()->a_display_default_system_resolution.specified()) - { - if (CommandLine::get_instance()->begin_parameters() != - CommandLine::get_instance()->end_parameters()) - throw DoHelp("display-default-system-resolution action takes no parameters"); - - return do_display_default_system_resolution(env); - } - - if (CommandLine::get_instance()->a_what_needs_keywording.specified()) - { - if (2 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw DoHelp("what-needs-keywording action takes exactly two parameters " - "(the target keyword and the target package)"); - - return do_what_needs_keywording(env); - } - - if (CommandLine::get_instance()->a_build_downgrade_check_list.specified()) - { - if (1 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw DoHelp("build-downgrade-check-list takes exactly one parameter (the output directory)"); - - return do_build_downgrade_check_list(env); - } - - if (CommandLine::get_instance()->a_downgrade_check.specified()) - { - if (2 != std::distance(CommandLine::get_instance()->begin_parameters(), - CommandLine::get_instance()->end_parameters())) - throw DoHelp("build-downgrade-check-list takes exactly two parameters " - "(the before and after directories)"); - - return do_downgrade_check(env); - } - - throw InternalError(__PRETTY_FUNCTION__, "no action?"); - } - catch (const DoVersion &) - { - display_version(); - cout << endl; - cout << "Paludis comes with ABSOLUTELY NO WARRANTY. Paludis is free software, and you" << endl; - cout << "are welcome to redistribute it under the terms of the GNU General Public" << endl; - cout << "License, version 2." << endl; - - return EXIT_SUCCESS; - } - catch (const paludis::args::ArgsError & e) - { - cerr << "Usage error: " << e.message() << endl; - cerr << "Try " << argv[0] << " --help" << endl; - return EXIT_FAILURE; - } - catch (const DoHelp & h) - { - if (h.message.empty()) - { - cout << "Usage: " << argv[0] << " [options]" << endl; - cout << endl; - cout << *CommandLine::get_instance(); - return EXIT_SUCCESS; - } - else - { - cerr << "Usage error: " << h.message << endl; - cerr << "Try " << argv[0] << " --help" << endl; - return EXIT_FAILURE; - } - } - catch (const Exception & e) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * " << e.backtrace("\n * ") - << e.message() << " (" << e.what() << ")" << endl; - return EXIT_FAILURE; - } - catch (const std::exception & e) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * " << e.what() << endl; - return EXIT_FAILURE; - } - catch (...) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * Unknown exception type. Ouch..." << endl; - return EXIT_FAILURE; - } -} - diff --git a/src/clients/adjutrix/args_from_environment_TEST b/src/clients/adjutrix/args_from_environment_TEST deleted file mode 100755 index 263392f0f..000000000 --- a/src/clients/adjutrix/args_from_environment_TEST +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -ADJUTRIX_OPTIONS=--help ./adjutrix - diff --git a/src/clients/adjutrix/command_line.cc b/src/clients/adjutrix/command_line.cc deleted file mode 100644 index 4f5e6681e..000000000 --- a/src/clients/adjutrix/command_line.cc +++ /dev/null @@ -1,176 +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/name.hh> -#include <paludis/util/singleton-impl.hh> - -template class paludis::Singleton<CommandLine>; - -CommandLine::CommandLine() : - ArgsHandler(), - - tree_action_args(main_options_section(), "Tree-Oriented Actions", - "Selects which basic tree-oriented action to perform. Exactly one action should " - "be specified."), - - a_find_stable_candidates(&tree_action_args, - "find-stable-candidates", 's', "Search for stable package candidates", false), - a_find_dropped_keywords(&tree_action_args, - "find-dropped-keywords", 'd', "Search for packages where keywords have been dropped", false), - a_find_insecure_packages(&tree_action_args, - "find-insecure-packages", 'i', "Search for packages marked as insecure by a GLSA", false), - a_find_unused_packages(&tree_action_args, - "find-unused-packages", 'U', "Search package versions that can probably safely be removed", false), - a_keywords_graph(&tree_action_args, - "keyword-graph", 'k', "Display keywords graphically", false), - a_reverse_deps(&tree_action_args, - "reverse-deps", 'r', "Find all package that depend on a given dep spec", false), - a_what_needs_keywording(&tree_action_args, - "what-needs-keywording", 'w', "Display what needs to be done to keyword a target", false), - - profile_action_args(main_options_section(), "Profile-Oriented Actions", - "Selects which basic profile-oriented action to perform. Exactly one action should " - "be specified."), - - a_display_default_system_resolution(&profile_action_args, - "display-default-system-resolution", 'S', "Display package names and versions that are included in " - "the default resolution of the system set", false), - - downgrade_check_args(main_options_section(), "Downgrade Check Actions", - "Selects which downgrade check related action to perform. Exactly one action should " - "be specified."), - - a_build_downgrade_check_list(&downgrade_check_args, - "build-downgrade-check-list", '\0', "Build the downgrade check lists", false), - a_downgrade_check(&downgrade_check_args, - "downgrade-check", '\0', "Perform the dowgrade check", false), - - general_action_args(main_options_section(), "General Actions", - "Selects which basic general action to perform. Exactly one action should " - "be specified."), - - a_version(&general_action_args, - "version", 'V', "Display program version", false), - a_help(&general_action_args, - "help", 'h', "Display program help", 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_repository_directory(&general_args, "repository-dir", 'D', - "Where to find the repository (default: detected from ./ or ../ or ../..)"), - - tree_args(main_options_section(), "Tree action options", - "Options which are relevant for tree actions."), - a_category(&tree_args, "category", 'C', - "Matches with this category name only (may be specified multiple times)"), - a_package(&tree_args, "package", 'P', - "Matches with this package name only (may be specified multiple times)"), - - profile_args(main_options_section(), "Profile action options", - "Options which are relevant for profile actions."), - a_profile(&profile_args, "profile", '\0', - "Display results for this profile path, rather than all profiles (may be specified multiple times)"), - a_unstable(&profile_args, "unstable", '\0', - "Accept ~arch as well as arch", true), - - configuration_options(main_options_section(), "Configuration options", - "Options that control general configuration."), - a_write_cache_dir(&configuration_options, "write-cache-dir", '\0', - "Use a subdirectory named for the repository name under the specified directory for repository write cache"), - a_master_repository_name(&general_args, "master-repository-name", '\0', - "Use the specified name for the master repository. Specify the location using --extra-repository-dir. " - "Only for repositories with no metadata/layout.conf."), - a_extra_repository_dir(&general_args, "extra-repository-dir", '\0', - "Also include the repository at this location. May be specified multiple times, in creation order.") -{ - add_usage_line("--find-stable-candidates arch [ --repository-dir /path ] " - "[ --category app-misc --category sys-apps ... ] " - "[ --package foo --package fnord ... ] "); - add_usage_line("--find-dropped-keywords arch [ --repository-dir /path ] " - "[ --category app-misc --category sys-apps ... ] " - "[ --package foo --package fnord ... ] "); - add_usage_line("--find-insecure-packages [ --repository-dir /path ] " - "[ --category app-misc --category sys-apps ... ] " - "[ --package foo --package fnord ... ] "); - add_usage_line("--find-unused-packages [ --repository-dir /path ] " - "[ --category app-misc --category sys-apps ... ] " - "[ --package foo --package fnord ... ] "); - add_usage_line("--keyword-graph [ --repository-dir /path ] " - "[ --category app-misc --category sys-apps ... ] " - "[ --package foo --package fnord ... ]"); - add_usage_line("--reverse-deps [ --repository-dir /path ] " - "[ --category app-misc --category sys-apps ... ] " - "[ --package foo --package fnord ... ]" - "target-spec"); - add_usage_line("--what-needs-keywording [ --repository-dir /path ] " - "[ --category app-misc --category sys-apps ... ] " - "[ --package foo --package fnord ... ]" - "target-keyword target-spec"); - add_usage_line("--display-profiles-use [ --profile default-linux/x86/2006.0 " - "--profile default-linux/x86/2006.1 ... ] [ --repository-dir /path ]"); - add_usage_line("--display-default-system-resolution [ --profile default-linux/x86/2006.0 " - "--profile default-linux/x86/2006.1 ... ] [ --repository-dir /path ]"); - - add_usage_line("--version"); - add_usage_line("--help"); - - add_description_line("adjutrix is configured purely from the command line. It does not use any user " - "configuration files."); - - add_environment_variable("ADJUTRIX_OPTIONS", "Default command-line options."); -} - -std::string -CommandLine::app_name() const -{ - return "adjutrix"; -} - -std::string -CommandLine::app_synopsis() const -{ - return "A tool for arch teams"; -} - -std::string -CommandLine::app_description() const -{ - return - "adjutrix provides a number of utilities that may be useful for arch teams." - "\n\n" - "The --repository-dir switch can be used to tell adjutrix where to find " - "the repository. If this switch is not used, adjutrix will check the current " - "directory, the parent directory and the parent's parent directory for " - "something resembling a profile root. If run inside a package or category " - "directory, filtering in the style of --package and --category is carried " - "out automatically for the current package or category."; -} - -CommandLine::~CommandLine() -{ -} - diff --git a/src/clients/adjutrix/command_line.hh b/src/clients/adjutrix/command_line.hh deleted file mode 100644 index 838b57f3d..000000000 --- a/src/clients/adjutrix/command_line.hh +++ /dev/null @@ -1,145 +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 - */ - -#ifndef PALUDIS_GUARD_SRC_ARCHTOOL_COMMAND_LINE_HH -#define PALUDIS_GUARD_SRC_ARCHTOOL_COMMAND_LINE_HH 1 - -#include <paludis/args/args.hh> -#include <paludis/util/singleton.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 tree_action_args; - paludis::args::SwitchArg a_find_stable_candidates; - paludis::args::SwitchArg a_find_dropped_keywords; - paludis::args::SwitchArg a_find_insecure_packages; - paludis::args::SwitchArg a_find_unused_packages; - paludis::args::SwitchArg a_keywords_graph; - paludis::args::SwitchArg a_reverse_deps; - paludis::args::SwitchArg a_what_needs_keywording; - - paludis::args::ArgsGroup profile_action_args; - paludis::args::SwitchArg a_display_default_system_resolution; - - paludis::args::ArgsGroup downgrade_check_args; - paludis::args::SwitchArg a_build_downgrade_check_list; - paludis::args::SwitchArg a_downgrade_check; - - paludis::args::ArgsGroup general_action_args; - paludis::args::SwitchArg a_version; - paludis::args::SwitchArg a_help; - - /// \name General arguments - ///{ - - /// General arguments. - paludis::args::ArgsGroup general_args; - - paludis::args::LogLevelArg a_log_level; - paludis::args::SwitchArg a_no_colour; - paludis::args::AliasArg a_no_color; - paludis::args::SwitchArg a_force_colour; - paludis::args::AliasArg a_force_color; - paludis::args::SwitchArg a_no_suggestions; - - paludis::args::StringArg a_repository_directory; - - ///} - - - ///\name Tree arguments - ///\{ - - paludis::args::ArgsGroup tree_args; - - paludis::args::StringSetArg a_category; - paludis::args::StringSetArg a_package; - - ///\} - - ///\name Profile arguments - ///\{ - - paludis::args::ArgsGroup profile_args; - - paludis::args::StringArg a_profile; - paludis::args::SwitchArg a_unstable; - - ///\} - - ///\name Configuration options - ///\{ - - paludis::args::ArgsGroup configuration_options; - - paludis::args::StringArg a_write_cache_dir; - paludis::args::StringArg a_master_repository_name; - paludis::args::StringSequenceArg a_extra_repository_dir; - - ///\} -}; - -/** - * Show the help message. - */ -struct DoHelp -{ - const std::string message; - - DoHelp(const std::string & m = "") : - message(m) - { - } -}; - -#endif diff --git a/src/clients/adjutrix/display_default_system_resolution.cc b/src/clients/adjutrix/display_default_system_resolution.cc deleted file mode 100644 index 1086f3a02..000000000 --- a/src/clients/adjutrix/display_default_system_resolution.cc +++ /dev/null @@ -1,115 +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 "display_default_system_resolution.hh" -#include "command_line.hh" -#include <output/colour.hh> -#include <paludis/util/config_file.hh> -#include <paludis/repositories/fake/fake_installed_repository.hh> -#include <paludis/util/log.hh> -#include <paludis/util/tokeniser.hh> -#include <paludis/util/is_file_with_extension.hh> -#include <paludis/util/set.hh> -#include <paludis/util/strip.hh> -#include <paludis/util/wrapped_forward_iterator-impl.hh> -#include <paludis/util/make_named_values.hh> -#include <paludis/legacy/dep_list.hh> -#include <paludis/legacy/dep_list_exceptions.hh> - -#include <iostream> -#include <iomanip> -#include <vector> -#include <cstdlib> -#include <set> -#include <map> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -using namespace paludis; - -namespace -{ - int - display_default_system_resolution(const NoConfigEnvironment & env) - { - int return_code(0); - - Context context("When displaying system resolution:"); - - DepListOptions d_options; - d_options.circular() = dl_circular_discard_silently; - d_options.blocks() = dl_blocks_discard_completely; - DepList d(&env, d_options); - - try - { - d.add(*env.set(SetName("system")), env.default_destinations()); - - for (DepList::ConstIterator e(d.begin()), e_end(d.end()) ; e != e_end ; ++e) - cout << " " << *e->package_id() << endl; - } - catch (const NoSuchPackageError & e) - { - cout << endl; - cerr << "Query error:" << endl; - cerr << " * " << e.backtrace("\n * "); - cerr << "No such package '" << e.name() << "'" << endl; - - return_code |= 1; - } - catch (const DepListError & e) - { - cout << endl; - cerr << "Dependency error:" << endl; - cerr << " * " << e.backtrace("\n * ") << e.message() << " (" - << e.what() << ")" << endl; - cerr << endl; - - return_code |= 1; - } - - cout << endl; - - return return_code; - } -} - -int do_display_default_system_resolution(NoConfigEnvironment & env) -{ - Context context("When performing display-default-system-resolution action:"); - - if (env.default_destinations()->empty()) - { - std::shared_ptr<Repository> fake_destination(std::make_shared<FakeInstalledRepository>( - make_named_values<FakeInstalledRepositoryParams>( - n::environment() = &env, - n::name() = RepositoryName("fake_destination"), - n::suitable_destination() = true, - n::supports_uninstall() = true - ))); - env.package_database()->add_repository(1, fake_destination); - } - - return display_default_system_resolution(env); -} - - diff --git a/src/clients/adjutrix/display_default_system_resolution.hh b/src/clients/adjutrix/display_default_system_resolution.hh deleted file mode 100644 index 0cf53911a..000000000 --- a/src/clients/adjutrix/display_default_system_resolution.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 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_ADJUTRIX_DISPLAY_DEFAULT_SYSTEM_RESOLUTION_HH -#define PALUDIS_GUARD_SRC_ADJUTRIX_DISPLAY_DEFAULT_SYSTEM_RESOLUTION_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -int do_display_default_system_resolution(paludis::NoConfigEnvironment & env); - -#endif diff --git a/src/clients/adjutrix/downgrade_check.cc b/src/clients/adjutrix/downgrade_check.cc deleted file mode 100644 index 676fac7cc..000000000 --- a/src/clients/adjutrix/downgrade_check.cc +++ /dev/null @@ -1,214 +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 "downgrade_check.hh" -#include "command_line.hh" -#include <paludis/package_database.hh> -#include <paludis/util/tokeniser.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/iterator_funcs.hh> -#include <paludis/util/named_value.hh> -#include <paludis/util/make_named_values.hh> -#include <paludis/util/safe_ofstream.hh> -#include <paludis/util/safe_ifstream.hh> -#include <paludis/util/fs_stat.hh> -#include <paludis/util/make_null_shared_ptr.hh> -#include <paludis/package_id.hh> -#include <paludis/user_dep_spec.hh> -#include <paludis/generator.hh> -#include <paludis/filter.hh> -#include <paludis/filtered_generator.hh> -#include <paludis/selection.hh> -#include <paludis/metadata_key.hh> -#include <paludis/partially_made_package_dep_spec.hh> -#include <iostream> -#include <vector> -#include <map> - -using namespace paludis; - -namespace -{ - std::string slot_as_string(const PackageID & id) - { - if (id.slot_key()) - return stringify(id.slot_key()->value()); - else - return "(none)"; - } - - int - build_one_list(NoConfigEnvironment & env, std::ostream & f) - { - std::shared_ptr<const PackageIDSequence> matches(env[selection::AllVersionsGroupedBySlot(generator::All() | filter::NotMasked())]); - - QualifiedPackageName old_package("dummy/dummy"); - std::string old_slot("dummy"); - VersionSpec best_version("0", { }); - for (IndirectIterator<PackageIDSequence::ConstIterator> m(matches->begin()), m_end(matches->end()) ; - m != m_end ; ++m) - { - if (m->name() != old_package || slot_as_string(*m) != old_slot) - { - f << old_package << " " << old_slot << " " << best_version << std::endl; - - old_package = m->name(); - old_slot = slot_as_string(*m); - best_version = m->version(); - } - } - - f << old_package << " " << old_slot << " " << best_version << std::endl; - - return 0; - } - - void - load_list(std::map<std::pair<QualifiedPackageName, std::string>, VersionSpec> & map, std::istream & f) - { - std::string s; - while (std::getline(f, s)) - { - std::vector<std::string> tokens; - tokenise_whitespace(s, std::back_inserter(tokens)); - if (tokens.size() != 3) - throw ConfigurationError("Bad line '" + s + "'"); - - map.insert(std::make_pair(make_pair(QualifiedPackageName(tokens.at(0)), - tokens.at(1)), VersionSpec(tokens.at(2), user_version_spec_options()))); - } - } - - int - check_one_list(NoConfigEnvironment & env, std::istream & f1, - std::istream & f2, std::multimap<std::pair<QualifiedPackageName, std::string>, std::string> & results, - const std::string & desc) - { - int exit_status(0); - - std::map<std::pair<QualifiedPackageName, std::string>, VersionSpec> before, after; - - load_list(before, f1); - load_list(after, f2); - - for (std::map<std::pair<QualifiedPackageName, std::string>, VersionSpec>::const_iterator - b(before.begin()), b_end(before.end()) ; - b != b_end ; ++b) - { - std::map<std::pair<QualifiedPackageName, std::string>, VersionSpec>::const_iterator - a(after.find(b->first)); - if (after.end() == a) - { - PartiallyMadePackageDepSpec part_spec({ }); - part_spec.package(b->first.first); - if ("(none)" != b->first.second) - part_spec.slot_requirement(std::make_shared<UserSlotExactRequirement>(SlotName(b->first.second))); - if (! env[selection::SomeArbitraryVersion(generator::Matches(part_spec, make_null_shared_ptr(), { }))]->empty()) - { - results.insert(std::make_pair(b->first, stringify(b->second) + " -> nothing on " + desc)); - exit_status |= 2; - } - } - else if (b->second > a->second) - { - results.insert(std::make_pair(b->first, stringify(b->second) + " -> " + - stringify(a->second) + " on " + desc)); - exit_status |= 4; - } - } - - return exit_status; - } -} - -int -do_build_downgrade_check_list(NoConfigEnvironment & env) -{ - int exit_status(0); - - FSPath output_dir(*CommandLine::get_instance()->begin_parameters()); - if (! output_dir.mkdir(0755, { fspmkdo_ok_if_exists })) - throw ConfigurationError("Output directory already exists"); - - for (int i = 0 ; i < 2 ; ++i) - { - bool b(i); - env.set_accept_unstable(b); - std::cerr << "Generating " << (b ? "unstable" : "stable") << "..." << std::endl; - SafeOFStream f(output_dir / ((b ? "unstable" : "stable") + std::string(".txt")), -1, true); - exit_status |= build_one_list(env, f); - } - - return exit_status; -} - -int -do_downgrade_check(NoConfigEnvironment & env) -{ - int exit_status(0); - - FSPath before_dir(*CommandLine::get_instance()->begin_parameters()); - if (! before_dir.stat().is_directory()) - throw ConfigurationError("First input directory is not a directory"); - - FSPath after_dir(*next(CommandLine::get_instance()->begin_parameters())); - if (! after_dir.stat().is_directory()) - throw ConfigurationError("Second input directory is not a directory"); - - std::multimap<std::pair<QualifiedPackageName, std::string>, std::string> results; - - for (int i = 0 ; i < 2 ; ++i) - { - bool b(i); - env.set_accept_unstable(b); - std::string f(b ? "unstable" : "stable"); - f.append(".txt"); - - if ((before_dir / f).stat().exists() && (after_dir / f).stat().exists()) - { - std::cerr << "Checking " << (b ? "unstable" : "stable") << "..." << std::endl; - - SafeIFStream f1(before_dir / f); - SafeIFStream f2(after_dir / f); - - exit_status |= check_one_list(env, f1, f2, results, b ? "unstable" : "stable"); - } - else - std::cerr << "Skipping " << (b ? "unstable" : "stable") << "..." << std::endl; - } - - std::pair<QualifiedPackageName, std::string> old_qpns(QualifiedPackageName("dummy/dummmy"), - std::string("dummy")); - for (std::multimap<std::pair<QualifiedPackageName, std::string>, std::string>::const_iterator - r(results.begin()), r_end(results.end()) ; - r != r_end ; ++r) - { - if (old_qpns != r->first) - { - std::cout << r->first.first << " :" << r->first.second << std::endl; - old_qpns = r->first; - } - - std::cout << " " << r->second << std::endl; - } - - return exit_status; -} - diff --git a/src/clients/adjutrix/downgrade_check.hh b/src/clients/adjutrix/downgrade_check.hh deleted file mode 100644 index e71f10f67..000000000 --- a/src/clients/adjutrix/downgrade_check.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_SRC_CLIENTS_ADJUTRIX_DOWNGRADE_CHECK_HH -#define PALUDIS_GUARD_SRC_CLIENTS_ADJUTRIX_DOWNGRADE_CHECK_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -int do_build_downgrade_check_list(paludis::NoConfigEnvironment & env); -int do_downgrade_check(paludis::NoConfigEnvironment & env); - -#endif diff --git a/src/clients/adjutrix/find_dropped_keywords.cc b/src/clients/adjutrix/find_dropped_keywords.cc deleted file mode 100644 index 53322da82..000000000 --- a/src/clients/adjutrix/find_dropped_keywords.cc +++ /dev/null @@ -1,236 +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 "find_dropped_keywords.hh" -#include "command_line.hh" - -#include <paludis/util/tokeniser.hh> -#include <paludis/util/iterator_funcs.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/set.hh> -#include <paludis/util/named_value.hh> -#include <paludis/util/make_named_values.hh> -#include <paludis/version_spec.hh> -#include <paludis/repository.hh> -#include <paludis/package_database.hh> -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> - -#include <set> -#include <map> -#include <iostream> -#include <iomanip> -#include <algorithm> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace paludis -{ - namespace n - { - typedef Name<struct name_best_anywhere> best_anywhere; - typedef Name<struct name_best_keyworded> best_keyworded; - } -} - -namespace -{ - std::string slot_as_string(const std::shared_ptr<const PackageID> & id) - { - if (id->slot_key()) - return stringify(id->slot_key()->value()); - else - return "(none)"; - } - - struct VersionsEntry - { - NamedValue<n::best_anywhere, VersionSpec> best_anywhere; - NamedValue<n::best_keyworded, VersionSpec> best_keyworded; - }; - - static const int col_width_package = 30; - static const int col_width_best_keyworded = 20; - static const int col_width_best_anywhere = 20; - - void - write_repository_header(const KeywordName & keyword, const RepositoryName & repo) - { - std::string s("Dropped keywords for '" + stringify(repo) + "' on '" - + stringify(keyword) + "'"); - cout << std::string(s.length(), '=') << endl; - cout << s << endl; - cout << std::string(s.length(), '=') << endl; - cout << endl; - - cout << std::left - << std::setw(col_width_package) << "category/package (:slot)" - << std::setw(col_width_best_keyworded) << "best keyworded" - << std::setw(col_width_best_anywhere) << "best anywhere" - << endl; - - cout - << std::string(col_width_package - 1, '-') << " " - << std::string(col_width_best_keyworded - 1, '-') << " " - << std::string(col_width_best_anywhere - 1, '-') << " " - << endl; - } - - struct IsStableOrUnstableKeyword - { - bool operator() (const KeywordName & k) const - { - return stringify(k).at(0) != '-'; - } - }; - - void - write_package(const QualifiedPackageName & package, const std::string & slot, - const VersionSpec & best_keyworded, const VersionSpec & best_anywhere) - { - static CategoryNamePart previous_category("not-on-a-boat"); - if (package.category() != previous_category) - { - cout << std::setw(col_width_package) << (stringify(package.category()) + "/") << endl; - previous_category = package.category(); - } - - std::string p(stringify(package.package())); - if ("0" != slot) - p += ":" + stringify(slot); - cout << " " << std::setw(col_width_package - 2) << p; - - if (best_keyworded != VersionSpec("0", { })) - cout << std::setw(col_width_best_keyworded) << best_keyworded; - else - cout << std::setw(col_width_best_keyworded) << " "; - cout << std::setw(col_width_best_anywhere) << best_anywhere; - cout << endl; - } - - void - check_one_package(const Environment &, const KeywordName & keyword, - const Repository & repo, const QualifiedPackageName & package) - { - /* determine whether we have any interesting versions, and pick out - * slots where we do. for slots, we map slot to a pair (best stable - * version for us, best stable version for anyone). */ - - bool is_interesting(false); - VersionSpec worst_keyworded("99999999", { }); - typedef std::map<std::string, VersionsEntry> VersionsInSlots; - VersionsInSlots versions_in_slots; - - std::shared_ptr<const PackageIDSequence> versions(repo.package_ids(package)); - for (PackageIDSequence::ConstIterator v(versions->begin()), v_end(versions->end()) ; - v != v_end ; ++v) - { - if (! (*v)->keywords_key()) - continue; - - /* ensure that there's an entry for this SLOT */ - versions_in_slots.insert(std::make_pair(slot_as_string(*v), VersionsEntry( - make_named_values<VersionsEntry>( - n::best_anywhere() = VersionSpec("0", { }), - n::best_keyworded() = VersionSpec("0", { }) - )))); - - if ((*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(keyword) || - (*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(KeywordName("~" + stringify(keyword)))) - { - is_interesting = true; - versions_in_slots.find(slot_as_string(*v))->second.best_keyworded() = - std::max(versions_in_slots.find(slot_as_string(*v))->second.best_keyworded(), (*v)->version()); - worst_keyworded = std::min(worst_keyworded, (*v)->version()); - } - - if ((*v)->keywords_key()->value()->end() != std::find_if((*v)->keywords_key()->value()->begin(), - (*v)->keywords_key()->value()->end(), IsStableOrUnstableKeyword())) - versions_in_slots.find(slot_as_string(*v))->second.best_anywhere() = - std::max(versions_in_slots.find(slot_as_string(*v))->second.best_anywhere(), (*v)->version()); - } - - if (! is_interesting) - return; - - /* for each slot, if there's a higher version on another arch, flag it */ - for (VersionsInSlots::const_iterator s(versions_in_slots.begin()), - s_end(versions_in_slots.end()) ; s != s_end ; ++s) - { - if (s->second.best_keyworded() >= s->second.best_anywhere()) - continue; - - if (s->second.best_anywhere() < worst_keyworded) - continue; - - write_package(package, s->first, s->second.best_keyworded(), s->second.best_anywhere()); - } - } -} - -void do_find_dropped_keywords(const NoConfigEnvironment & env) -{ - Context context("When performing find-dropped-keywords action:"); - - KeywordName keyword(*CommandLine::get_instance()->begin_parameters()); - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - r(env.package_database()->begin_repositories()), - r_end(env.package_database()->end_repositories()) ; r != r_end ; ++r) - { - if (r->name() == RepositoryName("virtuals")) - continue; - if (env.master_repository() && r->name() == env.master_repository()->name()) - continue; - - write_repository_header(keyword, r->name()); - - 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) - { - 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->package()))) - continue; - - check_one_package(env, keyword, *r, *p); - } - } - } -} - - diff --git a/src/clients/adjutrix/find_dropped_keywords.hh b/src/clients/adjutrix/find_dropped_keywords.hh deleted file mode 100644 index 76e0228b1..000000000 --- a/src/clients/adjutrix/find_dropped_keywords.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 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_ARCHTOOL_FIND_DROPPED_KEYWORDS_HH -#define PALUDIS_GUARD_SRC_ARCHTOOL_FIND_DROPPED_KEYWORDS_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -void do_find_dropped_keywords(const paludis::NoConfigEnvironment & env); - -#endif - diff --git a/src/clients/adjutrix/find_insecure_packages.cc b/src/clients/adjutrix/find_insecure_packages.cc deleted file mode 100644 index 44da9ba56..000000000 --- a/src/clients/adjutrix/find_insecure_packages.cc +++ /dev/null @@ -1,182 +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 "find_insecure_packages.hh" -#include "command_line.hh" - -#include <paludis/util/tokeniser.hh> -#include <paludis/dep_spec.hh> -#include <paludis/dep_tag.hh> -#include <paludis/spec_tree.hh> -#include <paludis/package_id.hh> -#include <paludis/package_database.hh> -#include <paludis/util/iterator_funcs.hh> -#include <paludis/generator.hh> -#include <paludis/filter.hh> -#include <paludis/filtered_generator.hh> -#include <paludis/selection.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/accept_visitor.hh> -#include <paludis/util/make_null_shared_ptr.hh> - -#include <set> -#include <map> -#include <iostream> -#include <iomanip> -#include <algorithm> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - const unsigned col_width_package = 30; - const unsigned col_width_id = 40; - - void - write_repository_header(const RepositoryName & repo) - { - std::string s("Insecure packages from advisories in repository '" + stringify(repo) + "'"); - cout << std::string(s.length(), '=') << endl; - cout << s << endl; - cout << std::string(s.length(), '=') << endl; - cout << endl; - - cout << std::left - << std::setw(col_width_package) << "package" - << std::setw(col_width_id) << "GLSA IDs" - << endl; - - cout - << std::string(col_width_package - 1, '-') << " " - << std::string(col_width_id - 1, '-') << " " - << endl; - } - - class ListInsecureVisitor - { - private: - const Environment & _env; - std::multimap<std::shared_ptr<const PackageID>, std::string, PackageIDSetComparator> _found; - std::set<SetName> recursing_sets; - - public: - ListInsecureVisitor(const Environment & e) : - _env(e) - { - } - - void visit(const SetSpecTree::NodeType<PackageDepSpec>::Type & node) - { - std::shared_ptr<const PackageIDSequence> insecure(_env[selection::AllVersionsSorted( - generator::Matches(*node.spec(), make_null_shared_ptr(), { }))]); - for (PackageIDSequence::ConstIterator i(insecure->begin()), - i_end(insecure->end()) ; i != i_end ; ++i) - if (node.spec()->tag()) - _found.insert(std::make_pair(*i, node.spec()->tag()->short_text())); - else - throw InternalError(PALUDIS_HERE, "didn't get a tag"); - } - - void visit(const SetSpecTree::NodeType<NamedSetDepSpec>::Type & node) - { - Context context("When expanding named set '" + stringify(*node.spec()) + "':"); - - std::shared_ptr<const SetSpecTree> set(_env.set(node.spec()->name())); - - if (! set) - { - Log::get_instance()->message("adjutrix.find_insecure_packages.unknown_set", ll_warning, lc_context) - << "Unknown set '" << node.spec()->name() << "'"; - return; - } - - if (! recursing_sets.insert(node.spec()->name()).second) - { - Log::get_instance()->message("adjutrix.find_insecure_packages.recursive_set", ll_warning, lc_context) - << "Recursively defined set '" << node.spec()->name() << "'"; - return; - } - - set->top()->accept(*this); - - recursing_sets.erase(node.spec()->name()); - } - - void visit(const SetSpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - friend std::ostream & operator<< (std::ostream &, const ListInsecureVisitor &); - }; - - std::ostream & operator<< (std::ostream & s, const ListInsecureVisitor & v) - { - QualifiedPackageName old_name("dormouse/teapot"); - for (std::multimap<std::shared_ptr<const PackageID>, std::string, PackageIDSetComparator>::const_iterator - f(v._found.begin()), f_end(v._found.end()) ; f != f_end ; ++f) - { - if (f->first->name() != old_name) - s << std::setw(col_width_package) << (stringify(f->first->name()) + " ") << endl; - old_name = f->first->name(); - s << std::setw(col_width_package) << (" " + stringify(f->first->canonical_form(idcf_version)) + " ") - << f->second; - while (next(f) != f_end) - { - if (*next(f)->first != *f->first) - break; - cout << " " << f->second; - ++f; - } - cout << endl; - } - - return s; - } -} - -void do_find_insecure_packages(const NoConfigEnvironment & env) -{ - Context context("When performing find-insecure-packages action:"); - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - r(env.package_database()->begin_repositories()), - r_end(env.package_database()->end_repositories()) ; r != r_end ; ++r) - { - if (r->name() == RepositoryName("virtuals")) - continue; - if (env.master_repository() && r->name() == env.master_repository()->name()) - continue; - - std::shared_ptr<const SetSpecTree> all_insecure(env.set(SetName("insecurity::" - + stringify(r->name())))); - if (! all_insecure) - continue; - - write_repository_header(r->name()); - - ListInsecureVisitor v(env); - all_insecure->top()->accept(v); - cout << v << endl; - } -} - diff --git a/src/clients/adjutrix/find_insecure_packages.hh b/src/clients/adjutrix/find_insecure_packages.hh deleted file mode 100644 index 49c96d20e..000000000 --- a/src/clients/adjutrix/find_insecure_packages.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 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_ADJUTRIX_FIND_INSECURE_PACKAGES_HH -#define PALUDIS_GUARD_SRC_ADJUTRIX_FIND_INSECURE_PACKAGES_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -void do_find_insecure_packages(const paludis::NoConfigEnvironment & env); - -#endif diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc deleted file mode 100644 index 2189a7645..000000000 --- a/src/clients/adjutrix/find_reverse_deps.cc +++ /dev/null @@ -1,363 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 Danny van Dyk - * - * 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 "find_reverse_deps.hh" -#include "command_line.hh" -#include <output/colour.hh> - -#include <paludis/util/save.hh> -#include <paludis/util/log.hh> -#include <paludis/util/set.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/options.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/accept_visitor.hh> -#include <paludis/util/make_null_shared_ptr.hh> -#include <paludis/dep_spec.hh> -#include <paludis/user_dep_spec.hh> -#include <paludis/package_id.hh> -#include <paludis/package_database.hh> -#include <paludis/metadata_key.hh> -#include <paludis/fuzzy_finder.hh> -#include <paludis/generator.hh> -#include <paludis/filter.hh> -#include <paludis/filtered_generator.hh> -#include <paludis/selection.hh> - -#include <set> -#include <map> -#include <iostream> -#include <iomanip> -#include <algorithm> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - class ReverseDepChecker - { - private: - const Environment * const _env; - const std::shared_ptr<const PackageID> _from_id; - const PackageIDSequence & _entries; - std::string _depname; - std::string _p; - - bool _in_any; - bool _in_use; - std::string _flags; - - bool _found_matches; - - std::set<SetName> _recursing_sets; - - public: - ReverseDepChecker(const Environment * const e, const std::shared_ptr<const PackageID> & f, - const PackageIDSequence & entries, - const std::string & p) : - _env(e), - _from_id(f), - _entries(entries), - _depname(""), - _p(p), - _in_any(false), - _in_use(false), - _found_matches(false) - { - } - - void check(const std::shared_ptr<const DependencySpecTree> & tree, const std::string & depname) - { - _depname = depname; - tree->top()->accept(*this); - } - - bool found_matches() - { - return _found_matches; - } - - void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node); - void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node); - void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node); - void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node); - - void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &) - { - } - - void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &) - { - } - - void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type & node) - { - Context context("When expanding named set '" + stringify(*node.spec()) + "':"); - - std::shared_ptr<const SetSpecTree> set(_env->set(node.spec()->name())); - - if (! set) - { - Log::get_instance()->message("adjutrix.find_reverse_deps.unknown_set", ll_warning, lc_context) - << "Unknown set '" << node.spec()->name() << "'"; - return; - } - - if (! _recursing_sets.insert(node.spec()->name()).second) - { - Log::get_instance()->message("adjutrix.find_reverse_deps.recursive_set", ll_warning, lc_context) - << "Recursively defined set '" << node.spec()->name() << "'"; - return; - } - - set->top()->accept(*this); - - _recursing_sets.erase(node.spec()->name()); - } - }; - - void - ReverseDepChecker::visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node) - { - Save<bool> in_any_save(&_in_any, true); - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void - ReverseDepChecker::visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void - ReverseDepChecker::visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - Save<bool> in_use_save(&_in_use, true); - Save<std::string> flag_save(&_flags); - - if (! _flags.empty()) - _flags += " "; - _flags += stringify(*node.spec()); - - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void - ReverseDepChecker::visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node) - { - std::shared_ptr<const PackageIDSequence> dep_entries((*_env)[selection::AllVersionsSorted( - generator::Matches(*node.spec(), _from_id, { mpo_ignore_additional_requirements }))]); - std::shared_ptr<PackageIDSequence> matches(std::make_shared<PackageIDSequence>()); - - bool header_written = false; - - for (IndirectIterator<PackageIDSequence::ConstIterator> e(dep_entries->begin()), e_end(dep_entries->end()) ; - e != e_end ; ++e) - { - if (indirect_iterator(_entries.end()) != std::find(indirect_iterator(_entries.begin()), - indirect_iterator(_entries.end()), *e)) - { - _found_matches |= true; - - if (! header_written) - { - std::cout << " " << _p << " " + _depname + " on one of:" << std::endl; - header_written = true; - } - std::cout << " " << stringify(*e); - - if (_in_use || _in_any) - { - std::cout << " ("; - - if (_in_any) - std::cout << "any-of"; - - if (_in_use && _in_any) - std::cout << ", "; - - if (_in_use) - std::cout << "condition USE='" << _flags << "'"; - - std::cout << ")"; - } - std::cout << std::endl; - } - } - } - - void write_repository_header(std::string spec, const std::string &) - { - cout << "Reverse dependencies for '" << spec << "':" << std::endl; - } - - int check_one_package(const Environment & env, - const PackageIDSequence & entries, const QualifiedPackageName & p) - { - Context context("When checking package '" + stringify(p) + "':"); - - std::shared_ptr<const PackageIDSequence> p_entries(env[selection::AllVersionsSorted(generator::Package(p))]); - - bool found_matches(false); - - for (auto e(p_entries->begin()), e_end(p_entries->end()) ; - e != e_end ; ++e) - { - try - { - ReverseDepChecker checker(&env, *e, entries, stringify(p) + "-" + stringify((*e)->canonical_form(idcf_version))); - - if ((*e)->build_dependencies_key()) - checker.check((*e)->build_dependencies_key()->value(), (*e)->build_dependencies_key()->raw_name()); - - if ((*e)->run_dependencies_key()) - checker.check((*e)->run_dependencies_key()->value(), (*e)->run_dependencies_key()->raw_name()); - - if ((*e)->post_dependencies_key()) - checker.check((*e)->post_dependencies_key()->value(), (*e)->post_dependencies_key()->raw_name()); - - if ((*e)->suggested_dependencies_key()) - checker.check((*e)->suggested_dependencies_key()->value(), (*e)->suggested_dependencies_key()->raw_name()); - - found_matches |= checker.found_matches(); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & exception) - { - cerr << "Caught exception:" << endl; - cerr << " * " << exception.backtrace("\n * ") << endl; - cerr << " * " << exception.message() << " (" << exception.what() << ")" << endl; - return (found_matches ? 0 : 1) | 2; - } - } - - return found_matches ? 0 : 1; - } -} - -int do_find_reverse_deps(NoConfigEnvironment & env) -{ - Context context("When performing find-reverse-deps action:"); - - std::shared_ptr<PackageDepSpec> spec; - try - { - spec = std::make_shared<PackageDepSpec>(parse_user_package_dep_spec(*CommandLine::get_instance()->begin_parameters(), - &env, { })); - } - 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; - return 4; - } - catch (const NoSuchPackageError & e) - { - 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::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; - } - - cerr << endl; - return 5; - } - - std::shared_ptr<const PackageIDSequence> entries(env[selection::AllVersionsSorted(generator::Matches( - *spec, make_null_shared_ptr(), { }))]); - int ret(0); - - if (entries->empty()) - { - Log::get_instance()->message("adjutrix.find_reverse_deps.no_matches", ll_warning, lc_context) - << "No matches in package database for '" << *spec << "'"; - return 1; - } - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - r(env.package_database()->begin_repositories()), - r_end(env.package_database()->end_repositories()) ; r != r_end ; ++r) - { - if (r->name() == RepositoryName("virtuals") || r->name() == RepositoryName("installed_virtuals")) - continue; - if (env.master_repository() && r->name() == env.master_repository()->name()) - continue; - - write_repository_header(stringify(*spec), stringify(r->name())); - - 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) - { - cerr << xterm_title("Checking " + stringify(*c) + " - adjutrix"); - - 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) - { - 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->package()))) - continue; - - ret |= check_one_package(env, *entries, *p); - } - } - } - - return ret; -} - - diff --git a/src/clients/adjutrix/find_reverse_deps.hh b/src/clients/adjutrix/find_reverse_deps.hh deleted file mode 100644 index d59a6f794..000000000 --- a/src/clients/adjutrix/find_reverse_deps.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 Danny van Dyk - * - * 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_ARCHTOOL_FIND_REVERSE_DEPS_HH -#define PALUDIS_GUARD_SRC_ARCHTOOL_FIND_REVERSE_DEPS_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -int do_find_reverse_deps(paludis::NoConfigEnvironment & env); - -#endif - diff --git a/src/clients/adjutrix/find_stable_candidates.cc b/src/clients/adjutrix/find_stable_candidates.cc deleted file mode 100644 index 99742ed1e..000000000 --- a/src/clients/adjutrix/find_stable_candidates.cc +++ /dev/null @@ -1,243 +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 "find_stable_candidates.hh" -#include "command_line.hh" - -#include <paludis/util/tokeniser.hh> -#include <paludis/util/iterator_funcs.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/set.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/make_named_values.hh> -#include <paludis/util/named_value.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/wrapped_output_iterator.hh> -#include <paludis/version_spec.hh> -#include <paludis/repository.hh> -#include <paludis/package_database.hh> -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> - -#include <set> -#include <map> -#include <iostream> -#include <iomanip> -#include <algorithm> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace paludis -{ - namespace n - { - typedef Name<struct name_best_version> best_version; - typedef Name<struct name_our_version> our_version; - } -} - -namespace -{ - struct SlotsEntry - { - NamedValue<n::best_version, VersionSpec> best_version; - NamedValue<n::our_version, VersionSpec> our_version; - }; - - static const int col_width_package = 30; - static const int col_width_our_version = 20; - static const int col_width_best_version = 20; - - void - write_repository_header(const KeywordName & keyword, const RepositoryName & repo) - { - std::string s("Stable candidates for '" + stringify(repo) + "' on '" - + stringify(keyword) + "'"); - cout << std::string(s.length(), '=') << endl; - cout << s << endl; - cout << std::string(s.length(), '=') << endl; - cout << endl; - - cout << std::left - << std::setw(col_width_package) << "category/package (:slot)" - << std::setw(col_width_our_version) << "our version" - << std::setw(col_width_best_version) << "best version" - << endl; - - cout - << std::string(col_width_package - 1, '-') << " " - << std::string(col_width_our_version - 1, '-') << " " - << std::string(col_width_best_version - 1, '-') << " " - << endl; - } - - struct IsStableKeyword - { - bool operator() (const KeywordName & k) const - { - return std::string::npos == std::string("-~").find(k.value().at(0)); - } - }; - - void - write_package(const QualifiedPackageName & package, const std::string & slot, - const VersionSpec & our_version, const VersionSpec & best_version) - { - static CategoryNamePart previous_category("not-on-a-boat"); - if (package.category() != previous_category) - { - cout << std::setw(col_width_package) << (stringify(package.category()) + "/") << endl; - previous_category = package.category(); - } - - std::string p(stringify(package.package())); - if ("0" != slot) - p += ":" + stringify(slot); - cout << " " << std::setw(col_width_package - 2) << p; - - if (our_version != VersionSpec("0", { })) - cout << std::setw(col_width_our_version) << our_version; - else - cout << std::setw(col_width_our_version) << " "; - cout << std::setw(col_width_best_version) << best_version; - cout << endl; - } - - std::string slot_as_string(const std::shared_ptr<const PackageID> & id) - { - if (id->slot_key()) - return stringify(id->slot_key()->value()); - else - return "(none)"; - } - - void - check_one_package(const Environment &, const KeywordName & keyword, - const Repository & repo, const QualifiedPackageName & package) - { - /* determine whether we have any interesting versions, and pick out - * slots where we do. for slots, we map slot to a pair (best stable - * version for us, best stable version for anyone). */ - - bool is_interesting(false); - typedef std::map<std::string, SlotsEntry> SlotsToVersions; - SlotsToVersions slots_to_versions; - - std::shared_ptr<const PackageIDSequence> versions(repo.package_ids(package)); - std::shared_ptr<PackageIDSet> versions_sorted(std::make_shared<PackageIDSet>()); - std::copy(versions->begin(), versions->end(), versions_sorted->inserter()); - for (PackageIDSet::ConstIterator v(versions_sorted->begin()), v_end(versions_sorted->end()) ; - v != v_end ; ++v) - { - if (! (*v)->keywords_key()) - continue; - - if ((*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(keyword)) - { - is_interesting = true; - - /* replace the entry */ - slots_to_versions.erase(slot_as_string(*v)); - slots_to_versions.insert(std::make_pair(slot_as_string(*v), - make_named_values<SlotsEntry>( - n::best_version() = VersionSpec("0", { }), - n::our_version() = (*v)->version() - ))); - } - - if ((*v)->keywords_key()->value()->end() != std::find_if((*v)->keywords_key()->value()->begin(), - (*v)->keywords_key()->value()->end(), IsStableKeyword())) - { - /* ensure that an entry exists */ - slots_to_versions.insert(std::make_pair(slot_as_string(*v), - make_named_values<SlotsEntry>( - n::best_version() = (*v)->version(), - n::our_version() = VersionSpec("0", { }) - ))); - - /* update the entry to mark our current version as the best - * version */ - if (slots_to_versions.find(slot_as_string(*v))->second.best_version() <= (*v)->version()) - slots_to_versions.find(slot_as_string(*v))->second.best_version() = (*v)->version(); - } - } - - if (! is_interesting) - return; - - /* for each slot, if there's a higher stable version on another arch, flag it */ - for (SlotsToVersions::const_iterator s(slots_to_versions.begin()), - s_end(slots_to_versions.end()) ; s != s_end ; ++s) - { - if (s->second.our_version() >= s->second.best_version()) - continue; - - write_package(package, s->first, s->second.our_version(), s->second.best_version()); - } - } -} - -void do_find_stable_candidates(const NoConfigEnvironment & env) -{ - Context context("When performing find-stable-candidates action:"); - - KeywordName keyword(*CommandLine::get_instance()->begin_parameters()); - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - r(env.package_database()->begin_repositories()), - r_end(env.package_database()->end_repositories()) ; r != r_end ; ++r) - { - if (r->name() == RepositoryName("virtuals")) - continue; - if (env.master_repository() && r->name() == env.master_repository()->name()) - continue; - - write_repository_header(keyword, r->name()); - - 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) - { - 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->package()))) - continue; - - check_one_package(env, keyword, *r, *p); - } - } - } -} - diff --git a/src/clients/adjutrix/find_stable_candidates.hh b/src/clients/adjutrix/find_stable_candidates.hh deleted file mode 100644 index c79741754..000000000 --- a/src/clients/adjutrix/find_stable_candidates.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 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_ARCHTOOL_FIND_STABLE_CANDIDATES_HH -#define PALUDIS_GUARD_SRC_ARCHTOOL_FIND_STABLE_CANDIDATES_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -void do_find_stable_candidates(const paludis::NoConfigEnvironment & env); - -#endif diff --git a/src/clients/adjutrix/find_stable_candidates_TEST b/src/clients/adjutrix/find_stable_candidates_TEST deleted file mode 100755 index 5532408d2..000000000 --- a/src/clients/adjutrix/find_stable_candidates_TEST +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -./adjutrix --find-stable-candidates -D find_stable_candidates_TEST_dir/ best | \ - tee find_stable_candidates_TEST_dir/out1.txt - -if grep --silent '^ ' find_stable_candidates_TEST_dir/out1.txt ; then - echo "out1 failed" 1>&2 - exit 127 -fi - -./adjutrix --find-stable-candidates -D find_stable_candidates_TEST_dir/ one | \ - tee find_stable_candidates_TEST_dir/out2.txt - -if [[ $(grep --count '^ ' find_stable_candidates_TEST_dir/out2.txt ) != "1" ]] ; then - echo "out2 failed" 1>&2 - exit 127 -fi - diff --git a/src/clients/adjutrix/find_stable_candidates_TEST_cleanup.sh b/src/clients/adjutrix/find_stable_candidates_TEST_cleanup.sh deleted file mode 100755 index 7ef9b03f5..000000000 --- a/src/clients/adjutrix/find_stable_candidates_TEST_cleanup.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d find_stable_candidates_TEST_dir ] ; then - rm -fr find_stable_candidates_TEST_dir -else - true -fi - - - diff --git a/src/clients/adjutrix/find_stable_candidates_TEST_setup.sh b/src/clients/adjutrix/find_stable_candidates_TEST_setup.sh deleted file mode 100755 index 386a25528..000000000 --- a/src/clients/adjutrix/find_stable_candidates_TEST_setup.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir find_stable_candidates_TEST_dir || exit 1 -cd find_stable_candidates_TEST_dir || exit 1 - -mkdir -p {eclass,distfiles,profiles/profile} || exit 1 -echo "test-repo-1" > profiles/repo_name || exit 1 -cat <<END > profiles/categories || exit 1 -cat-one -cat-two -cat-three -END -cat <<END > profiles/profile/make.defaults -ARCH=test -END -cat <<END > profiles/profiles.desc -test profile stable -END - -mkdir cat-one -mkdir cat-one/pkg-one -cat <<"END" > cat-one/pkg-one/pkg-one-1.ebuild -DESCRIPTION="one" -SLOT="0" -KEYWORDS="best one" -END - -cat <<"END" > cat-one/pkg-one/pkg-one-2.ebuild -DESCRIPTION="one" -SLOT="0" -KEYWORDS="best" -END - -mkdir cat-one/pkg-two -cat <<"END" > cat-one/pkg-two/pkg-two-1.ebuild -DESCRIPTION="one" -SLOT="0" -KEYWORDS="foo" -END - -cat <<"END" > cat-one/pkg-one/pkg-two-2.ebuild -DESCRIPTION="one" -SLOT="0" -KEYWORDS="bar" -END - -mkdir cat-one/pkg-three -cat <<"END" > cat-one/pkg-two/pkg-three-1.ebuild -DESCRIPTION="one" -SLOT="0" -KEYWORDS="best one" -END - -cat <<"END" > cat-one/pkg-one/pkg-three-2.ebuild -DESCRIPTION="one" -SLOT="0" -KEYWORDS="best one" -END - -mkdir cat-one/pkg-four -cat <<"END" > cat-one/pkg-two/pkg-four-1.ebuild -DESCRIPTION="one" -SLOT="0" -KEYWORDS="best one" -END - -cat <<"END" > cat-one/pkg-one/pkg-four-2.ebuild -DESCRIPTION="one" -SLOT="0" -KEYWORDS="~best ~one" -END - - diff --git a/src/clients/adjutrix/find_unused_packages.cc b/src/clients/adjutrix/find_unused_packages.cc deleted file mode 100644 index 9d1deb412..000000000 --- a/src/clients/adjutrix/find_unused_packages.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Danny van Dyk - * - * 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 "find_unused_packages.hh" -#include "command_line.hh" - -#include <paludis/legacy/find_unused_packages_task.hh> -#include <paludis/util/tokeniser.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/set.hh> -#include <paludis/util/sequence.hh> -#include <paludis/package_database.hh> - -#include <set> -#include <map> -#include <iostream> -#include <iomanip> -#include <algorithm> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -void do_find_unused_packages(const NoConfigEnvironment & env) -{ - Context context("When performing find-unused-packages action:"); - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - r(env.package_database()->begin_repositories()), - r_end(env.package_database()->end_repositories()) ; r != r_end ; ++r) - { - if (r->name() == RepositoryName("virtuals")) - continue; - if (env.master_repository() && r->name() == env.master_repository()->name()) - continue; - - Context repo_context("When searching for unused packages in repository '" + stringify(r->name()) + "':"); - FindUnusedPackagesTask task(&env, &(*r)); - - cout << "Searching for unused packages in repository " << stringify(r->name()) << endl; - - std::shared_ptr<const CategoryNamePartSet> categories(r->category_names()); - for (CategoryNamePartSet::ConstIterator c(categories->begin()), c_end(categories->end()) ; - c != c_end ; ++c) - { - Context cat_context("When searching for unused packages in category '" + stringify(*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; - - cout << " In category " << stringify(*c) << ":" << endl; - std::shared_ptr<const QualifiedPackageNameSet> packages(r->package_names(*c)); - - for (QualifiedPackageNameSet::ConstIterator p(packages->begin()), p_end(packages->end()) ; - p != p_end ; ++p) - { - Context pkg_context("When searching for unused packages with package name '" + stringify(*p) + "':"); - - 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 PackageIDSequence> unused(task.execute(*p)); - for (IndirectIterator<PackageIDSequence::ConstIterator> u(unused->begin()), u_end(unused->end()) ; - u != u_end ; ++u) - cout << stringify(*u) << endl; - } - - cout << endl; - } - } -} - diff --git a/src/clients/adjutrix/find_unused_packages.hh b/src/clients/adjutrix/find_unused_packages.hh deleted file mode 100644 index 20a7ebbf5..000000000 --- a/src/clients/adjutrix/find_unused_packages.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Danny van Dyk - * - * 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_ADJUTRIX_FIND_UNUSED_PACKAGES_HH -#define PALUDIS_GUARD_SRC_ADJUTRIX_FIND_UNUSED_PACKAGES_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -void do_find_unused_packages(const paludis::NoConfigEnvironment & env); - -#endif diff --git a/src/clients/adjutrix/help_TEST b/src/clients/adjutrix/help_TEST deleted file mode 100755 index 59bb1ddd1..000000000 --- a/src/clients/adjutrix/help_TEST +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -./adjutrix --help - diff --git a/src/clients/adjutrix/keywords_graph.cc b/src/clients/adjutrix/keywords_graph.cc deleted file mode 100644 index 2d0679f72..000000000 --- a/src/clients/adjutrix/keywords_graph.cc +++ /dev/null @@ -1,255 +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 "keywords_graph.hh" -#include "command_line.hh" -#include <output/colour.hh> - -#include <paludis/legacy/find_unused_packages_task.hh> -#include <paludis/util/tokeniser.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/set.hh> -#include <paludis/util/indirect_iterator-impl.hh> -#include <paludis/util/log.hh> -#include <paludis/util/make_null_shared_ptr.hh> -#include <paludis/repository.hh> -#include <paludis/package_database.hh> -#include <paludis/metadata_key.hh> -#include <paludis/package_id.hh> -#include <paludis/generator.hh> -#include <paludis/filter.hh> -#include <paludis/filtered_generator.hh> -#include <paludis/selection.hh> -#include <paludis/choice.hh> -#include <paludis/partially_made_package_dep_spec.hh> - -#include <functional> -#include <set> -#include <map> -#include <iostream> -#include <iomanip> -#include <algorithm> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - template <typename T_> - struct CompareByStringLength : - std::binary_function<const T_ &, const T_ &, bool> - { - bool - operator() (const T_ & l, const T_ & r) const - { - return stringify(l).length() < stringify(r).length(); - } - }; - - std::string slot_as_string(const PackageID & id) - { - if (id.slot_key()) - return stringify(id.slot_key()->value()); - else - return "(none)"; - } - - void - write_keywords_graph(const Environment & e, const Repository & repo, - const QualifiedPackageName & package) - { - using namespace std::placeholders; - - Context context("When writing keyword graph for '" + stringify(package) + "' in '" - + stringify(repo.name()) + "':"); - - cout << "Keywords for " << package << ":" << endl; - cout << endl; - - FindUnusedPackagesTask task(&e, &repo); - std::shared_ptr<const PackageIDSequence> packages(e[selection::AllVersionsGroupedBySlot( - generator::InRepository(repo.name()) & - generator::Matches(make_package_dep_spec({ }).package(package), make_null_shared_ptr(), { }))]); - std::shared_ptr<const PackageIDSequence> unused(task.execute(package)); - - if (packages->empty()) - return; - - std::set<std::string> arch_flags; - for (PackageIDSequence::ConstIterator p(packages->begin()), p_end(packages->end()) ; - p != p_end ; ++p) - { - if (! (*p)->choices_key()) - continue; - - for (Choices::ConstIterator c((*p)->choices_key()->value()->begin()), c_end((*p)->choices_key()->value()->end()) ; - c != c_end ; ++c) - { - if ((*c)->raw_name() != "ARCH") - continue; - - for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ; - i != i_end ; ++i) - arch_flags.insert(stringify((*i)->unprefixed_name())); - } - } - - if (arch_flags.empty()) - { - Log::get_instance()->message("adjutrix.keywords_graph.no_arch_flags", ll_warning, lc_context) << "Couldn't find any arch flags"; - return; - } - - std::set<std::string> slots; - std::transform(indirect_iterator(packages->begin()), indirect_iterator(packages->end()), - std::inserter(slots, slots.begin()), - std::bind(&slot_as_string, std::placeholders::_1)); - - unsigned version_specs_columns_width(std::max_element(indirect_iterator(packages->begin()), - indirect_iterator(packages->end()), - std::bind(CompareByStringLength<std::string>(), - std::bind(std::mem_fn(&PackageID::canonical_form), _1, idcf_version), - std::bind(std::mem_fn(&PackageID::canonical_form), _2, idcf_version)) - )->canonical_form(idcf_version).length() + 1); - - unsigned tallest_arch_name(std::max(stringify(*std::max_element(arch_flags.begin(), - arch_flags.end(), CompareByStringLength<std::string>())).length(), static_cast<std::size_t>(6))); - - unsigned longest_slot_name(stringify(*std::max_element(slots.begin(), - slots.end(), CompareByStringLength<std::string>())).length()); - - for (unsigned h = 0 ; h < tallest_arch_name ; ++h) - { - cout << std::left << std::setw(version_specs_columns_width) << " " << "| "; - for (std::set<std::string>::const_iterator a(arch_flags.begin()), a_end(arch_flags.end()) ; - a != a_end ; ++a) - { - if ((tallest_arch_name - h) > a->length()) - cout << " "; - else - cout << a->at(a->length() - tallest_arch_name + h) << " "; - } - cout << "| "; - if ((tallest_arch_name - h) <= 6) - cout << std::string("unused").at(6 - tallest_arch_name + h); - else - cout << " "; - - cout << " "; - if ((tallest_arch_name - h) <= 4) - cout << std::string("slot").at(4 - tallest_arch_name + h); - - cout << endl; - } - - cout << std::string(version_specs_columns_width, '-') << "+" - << std::string(arch_flags.size() * 2 + 1, '-') << "+" - << std::string(longest_slot_name + 3, '-') << endl; - - std::string old_slot("the first slot"); - for (IndirectIterator<PackageIDSequence::ConstIterator> p(packages->begin()), p_end(packages->end()) ; - p != p_end ; ++p) - { - if (! p->keywords_key()) - continue; - - if (slot_as_string(*p) != old_slot) - if (old_slot != "the first slot") - cout << std::string(version_specs_columns_width, '-') << "+" - << std::string(arch_flags.size() * 2 + 1, '-') << "+" - << std::string(longest_slot_name + 3, '-') << endl; - - cout << std::left << std::setw(version_specs_columns_width) << p->canonical_form(idcf_version) << "| "; - - std::shared_ptr<const KeywordNameSet> keywords(p->keywords_key()->value()); - - for (std::set<std::string>::const_iterator a(arch_flags.begin()), a_end(arch_flags.end()) ; - a != a_end ; ++a) - { - if (keywords->end() != keywords->find(KeywordName(stringify(*a)))) - cout << colour(cl_bold_green, "+ "); - else if (keywords->end() != keywords->find(KeywordName("~" + stringify(*a)))) - cout << colour(cl_bold_yellow, "~ "); - else if (keywords->end() != keywords->find(KeywordName("-" + stringify(*a)))) - cout << colour(cl_red, "- "); - else if (keywords->end() != keywords->find(KeywordName("-*"))) - cout << colour(cl_red, "* "); - else - cout << " "; - } - - cout << "| " << (indirect_iterator(unused->end()) != - std::find(indirect_iterator(unused->begin()), indirect_iterator(unused->end()), *p) ? "* " : " "); - - if (slot_as_string(*p) != old_slot) - { - cout << slot_as_string(*p); - old_slot = slot_as_string(*p); - } - - cout << endl; - } - - cout << endl; - } -} - -void do_keywords_graph(const NoConfigEnvironment & env) -{ - Context context("When performing keywords-graph action:"); - - for (IndirectIterator<PackageDatabase::RepositoryConstIterator, const Repository> - r(env.package_database()->begin_repositories()), - r_end(env.package_database()->end_repositories()) ; r != r_end ; ++r) - { - if (r->name() == RepositoryName("virtuals")) - continue; - if (env.master_repository() && r->name() == env.master_repository()->name()) - 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) - { - 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->package()))) - continue; - - write_keywords_graph(env, *r, *p); - } - } - } -} - diff --git a/src/clients/adjutrix/keywords_graph.hh b/src/clients/adjutrix/keywords_graph.hh deleted file mode 100644 index 8b3c2b75a..000000000 --- a/src/clients/adjutrix/keywords_graph.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 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_ARCHTOOL_KEYWORDS_GRAPH_HH -#define PALUDIS_GUARD_SRC_ARCHTOOL_KEYWORDS_GRAPH_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -void do_keywords_graph(const paludis::NoConfigEnvironment & env); - -#endif diff --git a/src/clients/adjutrix/man_adjutrix.cc b/src/clients/adjutrix/man_adjutrix.cc deleted file mode 100644 index 91c443319..000000000 --- a/src/clients/adjutrix/man_adjutrix.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "command_line.hh" -#include <paludis/args/man.hh> - -#include <iostream> -#include <cstdlib> - -using std::cout; -using std::endl; - -namespace -{ - struct ManCommandLine : - paludis::args::ArgsHandler - { - paludis::args::ArgsGroup group; - paludis::args::SwitchArg a_html; - - ManCommandLine() : - group(main_options_section(), "", ""), - a_html(&group, "html", '\0', "", false) - { - } - - virtual std::string app_name() const - { - return ""; - } - - virtual std::string app_description() const - { - return ""; - } - - virtual std::string app_synopsis() const - { - return ""; - } - }; -} - -int -main(int argc, char * argv[]) -{ - ManCommandLine cmdline; - cmdline.run(argc, argv, "", "", ""); - - if (cmdline.a_html.specified()) - { - paludis::args::HtmlWriter hw(cout); - paludis::args::generate_doc(hw, CommandLine::get_instance()); - } - else - { - paludis::args::ManWriter mw(cout); - paludis::args::generate_doc(mw, CommandLine::get_instance()); - } - - return EXIT_SUCCESS; -} diff --git a/src/clients/adjutrix/version_TEST b/src/clients/adjutrix/version_TEST deleted file mode 100755 index 28b623afe..000000000 --- a/src/clients/adjutrix/version_TEST +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -./adjutrix --version diff --git a/src/clients/adjutrix/what_needs_keywording.cc b/src/clients/adjutrix/what_needs_keywording.cc deleted file mode 100644 index d6329f23a..000000000 --- a/src/clients/adjutrix/what_needs_keywording.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009, 2010 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "what_needs_keywording.hh" -#include "command_line.hh" -#include <output/colour.hh> - -#include <paludis/util/tokeniser.hh> -#include <paludis/util/strip.hh> -#include <paludis/util/set.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/iterator_funcs.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/make_named_values.hh> -#include <paludis/repositories/fake/fake_installed_repository.hh> -#include <paludis/legacy/dep_list_exceptions.hh> -#include <paludis/legacy/dep_list.hh> -#include <paludis/legacy/override_functions.hh> -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> -#include <paludis/mask.hh> -#include <paludis/fuzzy_finder.hh> -#include <paludis/user_dep_spec.hh> -#include <paludis/filter.hh> -#include <functional> -#include <set> -#include <map> -#include <list> -#include <iostream> -#include <iomanip> - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -int do_what_needs_keywording(NoConfigEnvironment & env) -{ - using namespace std::placeholders; - - int return_code(0); - - Context context("When performing what-needs-keywording action:"); - - if (env.default_destinations()->empty()) - { - std::shared_ptr<Repository> fake_destination(std::make_shared<FakeInstalledRepository>( - make_named_values<FakeInstalledRepositoryParams>( - n::environment() = &env, - n::name() = RepositoryName("fake_destination"), - n::suitable_destination() = true, - n::supports_uninstall() = true - ))); - env.package_database()->add_repository(1, fake_destination); - } - - KeywordName target_keyword(*CommandLine::get_instance()->begin_parameters()); - std::string target_arch(strip_leading_string(*CommandLine::get_instance()->begin_parameters(), "~")); - - DepListOptions d_options; - d_options.circular() = dl_circular_discard_silently; - d_options.use() = dl_use_deps_take_all; - d_options.blocks() = dl_blocks_discard_completely; - d_options.override_masks() = std::make_shared<DepListOverrideMasksFunctions>(); - d_options.override_masks()->push_back(std::bind(&override_tilde_keywords, &env, _1, _2)); - d_options.override_masks()->push_back(std::bind(&override_unkeyworded, &env, _1, _2)); - d_options.override_masks()->push_back(std::bind(&override_repository_masks, _2)); - d_options.match_package_options() += mpo_ignore_additional_requirements; - - DepList d(&env, d_options); - - for (CommandLine::ParametersConstIterator p(next(CommandLine::get_instance()->begin_parameters())), - p_end(CommandLine::get_instance()->end_parameters()) ; p != p_end ; ++p) - { - try - { - d.add(parse_user_package_dep_spec(*p, &env, { }), env.default_destinations()); - } - catch (const NoSuchPackageError & e) - { - 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::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; - } - - cerr << endl; - return 5; - } - } - - cout << std::setw(30) << std::left << "Package"; - cout << std::setw(20) << std::left << "Version"; - cout << std::setw(18) << std::left << "Current Keywords"; - cout << std::setw(10) << std::left << "Masks"; - cout << endl; - - cout << std::string(29, '=') << " " << std::string(19, '=') << " " - << std::string(17, '=') << " " << std::string(9, '=') << endl; - - bool none(true); - for (DepList::ConstIterator p(d.begin()), p_end(d.end()) ; p != p_end ; ++p) - if (dlk_masked == p->kind()) - { - none = false; - cout << std::setw(30) << std::left << stringify(p->package_id()->name()); - cout << std::setw(20) << std::left << stringify(p->package_id()->canonical_form(idcf_version)); - - std::string current; - - if (p->package_id()->keywords_key()) - { - std::shared_ptr<const KeywordNameSet> keywords(p->package_id()->keywords_key()->value()); - for (KeywordNameSet::ConstIterator k(keywords->begin()), k_end(keywords->end()) ; - k != k_end ; ++k) - if (*k == KeywordName("-*") - || *k == target_keyword - || k->value().substr(1) == stringify(target_arch)) - current.append(stringify(*k) + " "); - } - - cout << std::setw(18) << std::left << current; - - std::string masks; - - for (PackageID::MasksConstIterator m(p->package_id()->begin_masks()), m_end(p->package_id()->end_masks()) ; - m != m_end ; ++m) - masks.append(stringify((*m)->key())); - - cout << std::setw(10) << std::left << masks; - - cout << endl; - } - - if (none) - { - cerr << "The specified package is already at the target keyword level. Perhaps" << endl; - cerr << "you need to specify a versioned target ('>=cat/pkg-1.23')." << endl; - return 4; - } - - - return return_code; -} - diff --git a/src/clients/adjutrix/what_needs_keywording.hh b/src/clients/adjutrix/what_needs_keywording.hh deleted file mode 100644 index ff6fd91e7..000000000 --- a/src/clients/adjutrix/what_needs_keywording.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_SRC_CLIENTS_ADJUTRIX_WHAT_NEEDS_KEYWORDING_HH -#define PALUDIS_GUARD_SRC_CLIENTS_ADJUTRIX_WHAT_NEEDS_KEYWORDING_HH 1 - -#include <paludis/environments/no_config/no_config_environment.hh> - -int do_what_needs_keywording(paludis::NoConfigEnvironment & env); - -#endif diff --git a/zsh-completion/Makefile.am b/zsh-completion/Makefile.am index ccc8e5c25..f5275c595 100644 --- a/zsh-completion/Makefile.am +++ b/zsh-completion/Makefile.am @@ -1,5 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -noinst_DATA = _adjutrix _paludis_packages _cave +noinst_DATA = _paludis_packages _cave EXTRA_DIST = $(noinst_DATA) AUTOMAKE_OPTIONS = 1.11 parallel-tests diff --git a/zsh-completion/_adjutrix b/zsh-completion/_adjutrix deleted file mode 100644 index b4cbf5db0..000000000 --- a/zsh-completion/_adjutrix +++ /dev/null @@ -1,65 +0,0 @@ -#compdef adjutrix - -# vim: set et sw=4 sts=4 ts=4 ft=zsh : -# ZSH completion for adjutrix -# Written by Baptiste Daroussin <baptux at free.fr> - -_adjutrix() { - local actions tree_options profile_options general_options actions_args arches - actions=( - --what-needs-keywording -w - --find-stable-candidates -s - --find-dropped-keywords -d - --find-insecure-packages -i - --find-unused-packages -U - --keyword-graph -k - --reverse-deps -r - --display-profiles-use -u - --display-default-system-resolution -S - --build-downgrade-check-list - --downgrade-check - --version -V - --help -h - ) - arches=(alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc sparc-fbsd x86 x86-fbsd) - tree_options=( - '(--category -C)'{--category,-C}'[Matches with this category name only (may be specified multiple times)]:Category:' - '(--package -P)'{--package,-P}'[Matches with this package name only (may be specified multiple times)]:Packages:' - ) - profile_options=( - '--profile[Display results for this profile path, rather than all profiles (may be specified multiple times)]:Profile:_files -/' - '--unstable[Accept ~arch as well as arch]' - ) - general_options=( - '--log-level[Specify the log level]:log level:((debug\:"Show debug output (noisy)" qa\:"Show QA messages and warnings only (default)" warning\:"Show warnings only" silent\:"Suppress all log messages (UNSAFE)"))' - '(--no-colour --no-color)'{--no-colour,--no-color}"[Do not use colour]" - '(--repository-dir -D)'{--repository-dir,-D}'[Where to find the repository]:repository:_files -/' - ) - action_args=( - "($actions)"{--what-needs-keywording,-w}"[Display what needs to be done to keyword a target]:arch:($arches)" - "($actions)"{--find-unused-packages,-U}"[Search package versions that can probably safely be removed]" - "($actions)"{--find-stable-candidates,-s}"[Search for stable package candidates]:arch:($arches)" - "($actions)"{--find-dropped-keywords,-d}"[Search for packages where keywords have been dropped]:arch:($arches)" - "($actions)"{--find-insecure-packages,-i}"[Search for packages marked as insecure by a GLSA]" - "($actions)"{--keyword-graph,-k}"[Display keywords graphically]" - "($actions)"{--reverse-deps,-r}"[all package that depend on a given dep spec]:Packages:" - "($actions)"{--display-profiles-use,-u}"[Display USE information for all profiles]" - "($actions)"{--display-default-system-resolution,-S}"[Display package names and versions that are included in the default resolution of the system set]" - "($actions)--build-downgrade-check-list[Build the downgrade check lists]" - "($actions)--downgrade-check[Perform the dowgrade check]" - "(: -)"{--version,-V}"[Display program version]" - "(: -)"{--help,-h}"[Display program help]" - ) - if (( $words[(I)(--(find-stable-candidates|find-dropped-keywords|find-insecure-packages|keyword-graph|reverse-deps)|-[[:alpha:]]#(s|d|i|k|r)[[:alpha:]]#)] ));then - _arguments -s \ - $general_options[@] $tree_options[@] && return 0 - elif (( $words[(I)(--(display-profiles-use|display-default-system-resolution)|-[[:alpha:]]#(u|S)[[:alpha:]]#)] ));then - _arguments -s \ - $general_options[@] $profile_options[@] && return 0 - else - _arguments -s \ - $general_options[@] $profile_options[@] $tree_options[@] $action_args[@] && return 0 - fi -} - -_adjutrix "$@" |