diff options
author | 2011-02-05 23:24:22 +0000 | |
---|---|---|
committer | 2011-02-05 23:24:22 +0000 | |
commit | fe657fcda33701ce86fbdf83ed9621e40fc2c11d (patch) | |
tree | 40ef481ede75e9befa526bf53494893838c0986a | |
parent | 95941e66453feb65895b597e305403776da96b42 (diff) | |
download | paludis-fe657fcda33701ce86fbdf83ed9621e40fc2c11d.tar.gz paludis-fe657fcda33701ce86fbdf83ed9621e40fc2c11d.tar.xz |
Remove legacy args
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | paludis/args/Makefile.am | 2 | ||||
-rw-r--r-- | paludis/args/legacy/Makefile.am | 39 | ||||
-rw-r--r-- | paludis/args/legacy/dep_list_args_group.cc | 330 | ||||
-rw-r--r-- | paludis/args/legacy/dep_list_args_group.hh | 105 | ||||
-rw-r--r-- | paludis/args/legacy/deps_option_arg.cc | 89 | ||||
-rw-r--r-- | paludis/args/legacy/deps_option_arg.hh | 69 | ||||
-rw-r--r-- | paludis/args/legacy/install_args_group.cc | 268 | ||||
-rw-r--r-- | paludis/args/legacy/install_args_group.hh | 154 |
9 files changed, 1 insertions, 1056 deletions
diff --git a/configure.ac b/configure.ac index f10a59afc..cfa723242 100644 --- a/configure.ac +++ b/configure.ac @@ -1745,7 +1745,6 @@ AC_OUTPUT( paludis/Makefile paludis/about.hh paludis/args/Makefile - paludis/args/legacy/Makefile paludis/distributions/Makefile paludis/distributions/exherbo/Makefile paludis/distributions/gentoo/Makefile diff --git a/paludis/args/Makefile.am b/paludis/args/Makefile.am index f90aae564..a79faf6ce 100644 --- a/paludis/args/Makefile.am +++ b/paludis/args/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/misc/common-makefile.am -SUBDIRS = . legacy +SUBDIRS = . DISTCLEANFILES = args_handler-se.hh args_handler-se.cc AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@ diff --git a/paludis/args/legacy/Makefile.am b/paludis/args/legacy/Makefile.am deleted file mode 100644 index 7f9262845..000000000 --- a/paludis/args/legacy/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -include $(top_srcdir)/misc/common-makefile.am - -DISTCLEANFILES = -AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@ -EXTRA_DIST = -BUILT_SOURCES = - -TESTS = - -paludis_args_legacy_includedir = $(includedir)/paludis-$(PALUDIS_PC_SLOT)/paludis/args/legacy - -paludis_args_legacy_include_HEADERS = \ - deps_option_arg.hh \ - dep_list_args_group.hh \ - install_args_group.hh - -libpaludisargslegacy_@PALUDIS_PC_SLOT@_la_SOURCES = \ - deps_option_arg.cc \ - dep_list_args_group.cc \ - install_args_group.cc - -libpaludisargslegacy_@PALUDIS_PC_SLOT@_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0 - -libpaludisargslegacy_@PALUDIS_PC_SLOT@_la_LIBADD = \ - $(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 - -lib_LTLIBRARIES = libpaludisargslegacy_@PALUDIS_PC_SLOT@.la - -check_PROGRAMS = $(TESTS) - -test_ldadd = \ - $(top_builddir)/paludis/util/test_extras.o \ - libpaludisargslegacy_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la - diff --git a/paludis/args/legacy/dep_list_args_group.cc b/paludis/args/legacy/dep_list_args_group.cc deleted file mode 100644 index 29fd0af93..000000000 --- a/paludis/args/legacy/dep_list_args_group.cc +++ /dev/null @@ -1,330 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Ciaran McCreesh - * Copyright (c) 2007 David Leverton - * - * 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 "dep_list_args_group.hh" - -#include <paludis/util/log.hh> -#include <paludis/util/sequence.hh> - -#include <paludis/args/do_help.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/legacy/override_functions.hh> - -using namespace paludis; -using namespace paludis::args; - -namespace -{ - DepListDepsOption - enum_arg_to_dep_list_deps_option(const args::EnumArg & arg) - { - if (arg.argument() == "pre") - return dl_deps_pre; - else if (arg.argument() == "pre-or-post") - return dl_deps_pre_or_post; - else if (arg.argument() == "post") - return dl_deps_post; - else if (arg.argument() == "try-post") - return dl_deps_try_post; - else if (arg.argument() == "discard") - return dl_deps_discard; - else - throw args::DoHelp("bad value for --" + arg.long_name()); - } -} - -DepListArgsGroup::DepListArgsGroup(ArgsSection * h) : - ArgsGroup(h, "DepList behaviour", - "Modify dependency list generation behaviour. Use with caution."), - - dl_reinstall(this, "dl-reinstall", '\0', "When to reinstall packages", - args::EnumArg::EnumArgOptions - ("never", "Never") - ("always", "Always") - ("if-use-changed", "If USE flags have changed"), - "never"), - dl_reinstall_scm(this, "dl-reinstall-scm", '\0', "When to reinstall scm packages", - args::EnumArg::EnumArgOptions - ("never", "Never") - ("always", "Always") - ("daily", "If they are over a day old") - ("weekly", "If they are over a week old"), - "never"), - dl_reinstall_targets(this, "dl-reinstall-targets", '\0', "Whether to reinstall targets", - args::EnumArg::EnumArgOptions - ("auto", "If the target is a set, never, otherwise always") - ("never", "Never") - ("always", "Always"), - "auto"), - - dl_upgrade(this, "dl-upgrade", '\0', "When to upgrade packages", - args::EnumArg::EnumArgOptions - ("always", "Always") - ("as-needed", "As needed"), - "always"), - dl_new_slots(this, "dl-new-slots", '\0', "When to pull in new slots (works with --dl-upgrade)", - args::EnumArg::EnumArgOptions - ("always", "Always") - ("as-needed", "As needed"), - "always"), - dl_downgrade(this, "dl-downgrade", '\0', "When to downgrade packages", - args::EnumArg::EnumArgOptions - ("as-needed", "As needed") - ("warning", "As needed, but warn when doing so") - ("error", "Downgrades should be treated as errors"), - "warning"), - - dl_deps_default(this, "dl-deps-default", '\0', - "Override default behaviour for all dependency classes", - static_cast<DepListDepsOption>(-1)), - - dl_installed_deps_pre(this, "dl-installed-deps-pre", '\0', - "How to handle pre dependencies for installed packages", - dl_deps_discard), - dl_installed_deps_runtime(this, "dl-installed-deps-runtime", '\0', - "How to handle runtime dependencies for installed packages", - dl_deps_try_post), - dl_installed_deps_post(this, "dl-installed-deps-post", '\0', - "How to handle post dependencies for installed packages", - dl_deps_try_post), - - dl_uninstalled_deps_pre(this, "dl-uninstalled-deps-pre", '\0', - "How to handle pre dependencies for uninstalled packages", - dl_deps_pre), - dl_uninstalled_deps_runtime(this, "dl-uninstalled-deps-runtime", '\0', - "How to handle runtime dependencies for uninstalled packages", - dl_deps_pre_or_post), - dl_uninstalled_deps_post(this, "dl-uninstalled-deps-post", '\0', - "How to handle post dependencies for uninstalled packages", - dl_deps_post), - dl_uninstalled_deps_suggested(this, "dl-uninstalled-deps-suggested", '\0', - "How to handle suggested dependencies for uninstalled packages (only with --dl-suggested install)", - dl_deps_post), - - dl_suggested(this, "dl-suggested", '\0', "How to handle suggested dependencies", - args::EnumArg::EnumArgOptions - ("show", "Display, but do not install") - ("install", "Install") - ("discard", "Discard"), - "show"), - dl_circular(this, "dl-circular", '\0', "How to handle circular dependencies", - args::EnumArg::EnumArgOptions - ("error", "Raise an error") - ("discard", "Discard"), - "error"), - dl_blocks(this, "dl-blocks", '\0', "How to handle blocks", - args::EnumArg::EnumArgOptions - ("accumulate", "Accumulate and show in the dependency list") - ("error", "Error straight away") - ("discard", "Discard (dangerous)"), - "accumulate"), - dl_override_masks(this, "dl-override-masks", '\0', - "Zero or more mask kinds that can be overridden as necessary (default: tilde-keyword and license)", - args::StringSetArg::StringSetArgOptions - ("none", "None (overrides defaults, not user selections)") - ("tilde-keyword", "Keyword masks where accepting ~ would work") - ("unkeyworded", "Keyword masks where a package is unkeyworded") - ("repository", "Repository masks") - ("license", "License masks")), - - dl_fall_back(this, "dl-fall-back", '\0', "When to fall back to installed packages", - args::EnumArg::EnumArgOptions - ("as-needed-except-targets", "Where necessary, but not for target packages") - ("as-needed", "Where necessary, including for target packages") - ("never", "Never"), - "as-needed-except-targets") -{ -} - -DepListArgsGroup::~DepListArgsGroup() -{ -} - -void -DepListArgsGroup::populate_dep_list_options(const Environment * env, DepListOptions & options) const -{ - using namespace std::placeholders; - - if (dl_reinstall.argument() == "never") - options.reinstall() = dl_reinstall_never; - else if (dl_reinstall.argument() == "always") - options.reinstall() = dl_reinstall_always; - else if (dl_reinstall.argument() == "if-use-changed") - options.reinstall() = dl_reinstall_if_use_changed; - else - throw args::DoHelp("bad value for --dl-reinstall"); - - if (dl_reinstall_scm.argument() == "never") - options.reinstall_scm() = dl_reinstall_scm_never; - else if (dl_reinstall_scm.argument() == "always") - options.reinstall_scm() = dl_reinstall_scm_always; - else if (dl_reinstall_scm.argument() == "daily") - options.reinstall_scm() = dl_reinstall_scm_daily; - else if (dl_reinstall_scm.argument() == "weekly") - options.reinstall_scm() = dl_reinstall_scm_weekly; - else - throw args::DoHelp("bad value for --dl-reinstall-scm"); - - if (dl_upgrade.argument() == "as-needed") - options.upgrade() = dl_upgrade_as_needed; - else if (dl_upgrade.argument() == "always") - options.upgrade() = dl_upgrade_always; - else - throw args::DoHelp("bad value for --dl-upgrade"); - - if (dl_new_slots.argument() == "as-needed") - options.new_slots() = dl_new_slots_as_needed; - else if (dl_new_slots.argument() == "always") - options.new_slots() = dl_new_slots_always; - else - throw args::DoHelp("bad value for --dl-new-slots"); - - if (dl_downgrade.argument() == "as-needed") - options.downgrade() = dl_downgrade_as_needed; - else if (dl_downgrade.argument() == "warning") - options.downgrade() = dl_downgrade_warning; - else if (dl_downgrade.argument() == "error") - options.downgrade() = dl_downgrade_error; - else - throw args::DoHelp("bad value for --dl-downgrade"); - - if (dl_circular.argument() == "discard") - options.circular() = dl_circular_discard; - else if (dl_circular.argument() == "error") - options.circular() = dl_circular_error; - else - throw args::DoHelp("bad value for --dl-circular"); - - if (dl_suggested.argument() == "show") - options.suggested() = dl_suggested_show; - else if (dl_suggested.argument() == "discard") - options.suggested() = dl_suggested_discard; - else if (dl_suggested.argument() == "install") - options.suggested() = dl_suggested_install; - else - throw args::DoHelp("bad value for --dl-suggested"); - - if (dl_blocks.argument() == "discard") - options.blocks() = dl_blocks_discard; - else if (dl_blocks.argument() == "error") - options.blocks() = dl_blocks_error; - else if (dl_blocks.argument() == "accumulate") - options.blocks() = dl_blocks_accumulate; - else - throw args::DoHelp("bad value for --dl-blocks"); - - if (! options.override_masks()) - options.override_masks() = std::make_shared<DepListOverrideMasksFunctions>(); - options.override_masks()->push_back(std::bind(&override_tilde_keywords, env, _1, _2)); - options.override_masks()->push_back(std::bind(&override_license, _1, _2)); - - if (dl_override_masks.specified()) - { - for (args::StringSetArg::ConstIterator a(dl_override_masks.begin_args()), - a_end(dl_override_masks.end_args()) ; a != a_end ; ++a) - if (*a == "none") - options.override_masks() = std::make_shared<DepListOverrideMasksFunctions>(); - - for (args::StringSetArg::ConstIterator a(dl_override_masks.begin_args()), - a_end(dl_override_masks.end_args()) ; a != a_end ; ++a) - { - if (*a == "tilde-keyword") - options.override_masks()->push_back(std::bind(&override_tilde_keywords, env, _1, _2)); - else if (*a == "unkeyworded") - options.override_masks()->push_back(std::bind(&override_unkeyworded, env, _1, _2)); - else if (*a == "repository") - options.override_masks()->push_back(std::bind(&override_repository_masks, _2)); - else if (*a == "license") - options.override_masks()->push_back(std::bind(&override_license, _1, _2)); - else if (*a == "none") - { - } - else - throw args::DoHelp("bad value for --dl-override-masks"); - } - } - - if (dl_fall_back.argument() == "as-needed-except-targets") - options.fall_back() = dl_fall_back_as_needed_except_targets; - else if (dl_fall_back.argument() == "as-needed") - options.fall_back() = dl_fall_back_as_needed; - else if (dl_fall_back.argument() == "never") - options.fall_back() = dl_fall_back_never; - else - throw args::DoHelp("bad value for --dl-fall-back"); - - if (dl_deps_default.specified()) - { - DepListDepsOption x(dl_deps_default.option()); - options.installed_deps_pre() = x; - options.installed_deps_post() = x; - options.installed_deps_runtime() = x; - options.uninstalled_deps_pre() = x; - options.uninstalled_deps_post() = x; - options.uninstalled_deps_runtime() = x; - options.uninstalled_deps_suggested() = x; - } - - if (dl_installed_deps_pre.specified() || ! dl_deps_default.specified()) - options.installed_deps_pre() = enum_arg_to_dep_list_deps_option(dl_installed_deps_pre); - if (dl_installed_deps_runtime.specified() || ! dl_deps_default.specified()) - options.installed_deps_runtime() = enum_arg_to_dep_list_deps_option(dl_installed_deps_runtime); - if (dl_installed_deps_post.specified() || ! dl_deps_default.specified()) - options.installed_deps_post() = enum_arg_to_dep_list_deps_option(dl_installed_deps_post); - - if (dl_uninstalled_deps_pre.specified() || ! dl_deps_default.specified()) - options.uninstalled_deps_pre() = enum_arg_to_dep_list_deps_option(dl_uninstalled_deps_pre); - if (dl_uninstalled_deps_runtime.specified() || ! dl_deps_default.specified()) - options.uninstalled_deps_runtime() = enum_arg_to_dep_list_deps_option(dl_uninstalled_deps_runtime); - if (dl_uninstalled_deps_post.specified() || ! dl_deps_default.specified()) - options.uninstalled_deps_post() = enum_arg_to_dep_list_deps_option(dl_uninstalled_deps_post); - if (dl_uninstalled_deps_suggested.specified() || ! dl_deps_default.specified()) - options.uninstalled_deps_suggested() = enum_arg_to_dep_list_deps_option(dl_uninstalled_deps_suggested); -} - -void -DepListArgsGroup::populate_install_task(const Environment *, InstallTask & task) const -{ - if (dl_reinstall_targets.specified()) - { - if (dl_reinstall_targets.argument() == "auto") - { - } - else if (dl_reinstall_targets.argument() == "always") - task.override_target_type(dl_target_package); - else if (dl_reinstall_targets.argument() == "never") - task.override_target_type(dl_target_set); - else - throw args::DoHelp("bad value for --dl-reinstall-targets"); - } -} - -std::string -DepListArgsGroup::paludis_command_fragment() const -{ - return ""; -} - -std::string -DepListArgsGroup::resume_command_fragment(const InstallTask &) const -{ - return ""; -} - diff --git a/paludis/args/legacy/dep_list_args_group.hh b/paludis/args/legacy/dep_list_args_group.hh deleted file mode 100644 index 1a50a529a..000000000 --- a/paludis/args/legacy/dep_list_args_group.hh +++ /dev/null @@ -1,105 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2009, 2010 Ciaran McCreesh - * Copyright (c) 2007 David Leverton - * - * 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_COMMON_ARGS_DEP_LIST_ARGS_HH -#define PALUDIS_GUARD_SRC_COMMON_ARGS_DEP_LIST_ARGS_HH 1 - -#include <paludis/args/args_option.hh> -#include <paludis/args/legacy/deps_option_arg.hh> -#include <paludis/args/args_group.hh> -#include <paludis/legacy/dep_list.hh> -#include <paludis/legacy/install_task.hh> - -namespace paludis -{ - namespace args - { - /** - * The standard dep command line arguments. - * - * \since 0.26 - * \ingroup g_args - * \nosubgrouping - */ - class PALUDIS_VISIBLE DepListArgsGroup : public ArgsGroup - { - public: - /// Constructor. - DepListArgsGroup(ArgsSection *); - - /// Destructor - ~DepListArgsGroup(); - - /// \name DepList behaviour arguments - /// { - - paludis::args::EnumArg dl_reinstall; - paludis::args::EnumArg dl_reinstall_scm; - paludis::args::EnumArg dl_reinstall_targets; - paludis::args::EnumArg dl_upgrade; - paludis::args::EnumArg dl_new_slots; - paludis::args::EnumArg dl_downgrade; - - paludis::args::DepsOptionArg dl_deps_default; - - paludis::args::DepsOptionArg dl_installed_deps_pre; - paludis::args::DepsOptionArg dl_installed_deps_runtime; - paludis::args::DepsOptionArg dl_installed_deps_post; - - paludis::args::DepsOptionArg dl_uninstalled_deps_pre; - paludis::args::DepsOptionArg dl_uninstalled_deps_runtime; - paludis::args::DepsOptionArg dl_uninstalled_deps_post; - paludis::args::DepsOptionArg dl_uninstalled_deps_suggested; - - paludis::args::EnumArg dl_suggested; - paludis::args::EnumArg dl_circular; - paludis::args::EnumArg dl_blocks; - paludis::args::StringSetArg dl_override_masks; - - paludis::args::EnumArg dl_fall_back; - - /// } - - /** - * Populate a DepListOptions from our values. - */ - void populate_dep_list_options(const paludis::Environment *, DepListOptions &) const; - - /** - * Populate an InstallTask from our values. - */ - void populate_install_task(const paludis::Environment *, InstallTask &) const; - - /** - * Fetch a fragment for Environment::paludis_command for our - * values. - */ - std::string paludis_command_fragment() const; - - /** - * Fetch a fragment for a resume command for our values. - */ - std::string resume_command_fragment(const InstallTask &) const; - }; - } -} - -#endif - diff --git a/paludis/args/legacy/deps_option_arg.cc b/paludis/args/legacy/deps_option_arg.cc deleted file mode 100644 index 3df4d04c7..000000000 --- a/paludis/args/legacy/deps_option_arg.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2010 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "deps_option_arg.hh" -#include <paludis/args/do_help.hh> -#include <paludis/util/stringify.hh> - -using namespace paludis; -using namespace paludis::args; - -namespace -{ - std::string def_to_string(const DepListDepsOption d) - { - if (-1 == d) - return "none"; - - switch (d) - { - case dl_deps_discard: - return "discard"; - case dl_deps_pre: - return "pre"; - case dl_deps_pre_or_post: - return "pre-or-post"; - case dl_deps_post: - return "post"; - case dl_deps_try_post: - return "try-post"; - case last_dl_deps: - ; - }; - - throw InternalError(PALUDIS_HERE, "Unexpected DepListDepsOption value"); - } -} - -DepsOptionArg::DepsOptionArg(ArgsGroup * const grp, const std::string & ln, - char sh, const std::string & desc, const DepListDepsOption def) : - EnumArg(grp, ln, sh, desc, - EnumArgOptions - ("pre", "As pre dependencies") - ("pre-or-post", "As pre dependencies, or post dependencies where needed") - ("post", "As post dependencies") - ("try-post", "As post dependencies, with no error for failures") - ("discard", "Discard"), - def_to_string(def)) -{ -} - -DepsOptionArg::~DepsOptionArg() -{ -} - -DepListDepsOption -DepsOptionArg::option() const -{ - if ("pre" == argument()) - return dl_deps_pre; - if ("pre-or-post" == argument()) - return dl_deps_pre_or_post; - if ("post" == argument()) - return dl_deps_post; - if ("try-post" == argument()) - return dl_deps_try_post; - if ("discard" == argument()) - return dl_deps_discard; - - throw DoHelp("Bad value for --" + long_name()); -} - - - diff --git a/paludis/args/legacy/deps_option_arg.hh b/paludis/args/legacy/deps_option_arg.hh deleted file mode 100644 index 9595ad79c..000000000 --- a/paludis/args/legacy/deps_option_arg.hh +++ /dev/null @@ -1,69 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2010 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_SRC_COMMON_ARGS_DEPS_OPTION_ARG_HH -#define PALUDIS_GUARD_SRC_COMMON_ARGS_DEPS_OPTION_ARG_HH 1 - -#include <paludis/args/args_option.hh> -#include <paludis/legacy/dep_list.hh> - -/** \file - * Declarations for the DepsOptionArg class. - * - * \ingroup g_args - * - * \section Examples - * - * - None at this time. - */ - -namespace paludis -{ - namespace args - { - /** - * A '--dl-deps-' standard command line argument. - * - * \since 0.26 - * \ingroup g_args - * \nosubgrouping - */ - class PALUDIS_VISIBLE DepsOptionArg : - public EnumArg - { - public: - ///\name Basic operations - ///\{ - - DepsOptionArg(ArgsGroup * const, const std::string &, char, - const std::string &, const DepListDepsOption); - ~DepsOptionArg(); - - ///\} - - /** - * Our selected value, as a DepListDepsOption. - */ - DepListDepsOption option() const; - }; - - } -} - -#endif diff --git a/paludis/args/legacy/install_args_group.cc b/paludis/args/legacy/install_args_group.cc deleted file mode 100644 index efbb9486d..000000000 --- a/paludis/args/legacy/install_args_group.cc +++ /dev/null @@ -1,268 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2005, 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh - * Copyright (c) 2007 David Leverton - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "install_args_group.hh" - -#include <paludis/environment-fwd.hh> -#include <paludis/args/do_help.hh> -#include <paludis/util/iterator_funcs.hh> -#include <paludis/util/set-impl.hh> - -using namespace paludis; -using namespace paludis::args; - -InstallArgsGroup::InstallArgsGroup(ArgsSection * h, const std::string & our_name, - const std::string & our_description) : - ArgsGroup(h, our_name, our_description), - - a_pretend(this, "pretend", 'p', "Pretend only", false), - a_destinations(this, "destinations", 'd', "Use specified destinations instead of defaults"), - a_preserve_world(this, "preserve-world", '1', "Don't modify the world file", true), - a_add_to_world_spec(this, "add-to-world-spec", '\0', - "Use this spec, rather than all targets, for updating world (for resume commands)"), - a_fetch(this, "fetch", 'f', "Only fetch sources; don't install anything", false), - a_no_safe_resume(this, "no-safe-resume", '\0', "Do not allow interrupted downloads to be resumed", false), - a_show_reasons(this, "show-reasons", '\0', "Show why packages are being (un)installed", - args::EnumArg::EnumArgOptions - ("none", "Don't show any information") - ("summary", "Show a summary") - ("full", "Show full output (can be very verbose)"), - "summary"), - a_show_use_descriptions(this, "show-use-descriptions", '\0', "Show descriptions of USE flags", - args::EnumArg::EnumArgOptions - ("none", "Don't show any descriptions") - ("new", "Show for new use flags") - ("changed", "Show for new and changed flags") - ("all", "Show for all flags"), - "changed"), - a_show_package_descriptions(this, "show-package-descriptions", '\0', "Show package descriptions", - args::EnumArg::EnumArgOptions - ("none", "Don't show any descriptions") - ("new", "Show descriptions for new packages") - ("all", "Show descriptions for all packages"), - "new"), - a_continue_on_failure(this, "continue-on-failure", '\0', "Whether to continue after a fetch or install error", - args::EnumArg::EnumArgOptions - ("if-fetch-only", "If fetching only") - ("never", "Never") - ("if-satisfied", "If remaining packages' dependencies are satisfied") - ("if-independent", "If independent of failed and skipped packages") - ("always", "Always (UNSAFE)"), - "if-fetch-only"), - a_continue_on_eroyf(&a_continue_on_failure, "continue-on-eroyf", true), - a_skip_phase(this, "skip-phase", '\0', "Skip phases with a given name (e.g. init, preinst, unpack, merge, strip). Dangerous."), - a_abort_at_phase(this, "abort-at-phase", '\0', "Abort when a phase with a given name is encountered."), - a_skip_until_phase(this, "skip-until-phase", '\0', "Skip all phases until a phase with a given name is encountered. Dangerous."), - a_change_phases_for(this, "change-phases-for", '\0', "Control to which package or packages options --" + a_skip_phase.long_name() + ", --" - + a_abort_at_phase.long_name() + " and --" + a_skip_until_phase.long_name() + " apply.", - args::EnumArg::EnumArgOptions - ("all", "All packages") - ("first", "Only the first package on the list") - ("last", "Only the last package on the list"), - "all") -{ -} - -InstallArgsGroup::~InstallArgsGroup() -{ -} - -void -InstallArgsGroup::populate_dep_list_options(const Environment *, DepListOptions & options) const -{ - options.dependency_tags() = a_show_reasons.argument() == "summary" || a_show_reasons.argument() == "full"; -} - -std::shared_ptr<const DestinationsSet> -InstallArgsGroup::destinations(Environment * env) const -{ - if (a_destinations.specified()) - { - Context local_context("When building destinations collection:"); - - std::shared_ptr<DestinationsSet> d(std::make_shared<DestinationsSet>()); - for (args::StringSetArg::ConstIterator i(a_destinations.begin_args()), - i_end(a_destinations.end_args()) ; - i != i_end ; ++i) - { - std::shared_ptr<Repository> repo(env->package_database()->fetch_repository( - RepositoryName(*i))); - if ((*repo).destination_interface()) - d->insert(repo); - else - throw args::DoHelp("--destinations argument '" + *i + "' does not provide a destinations interface"); - } - - return d; - } - else - return env->default_destinations(); -} - -void -InstallArgsGroup::populate_install_task(const Environment *, InstallTask & task) const -{ - task.set_fetch_only(a_fetch.specified()); - task.set_pretend(a_pretend.specified()); - task.set_preserve_world(a_preserve_world.specified()); - task.set_safe_resume(! a_no_safe_resume.specified()); - - if (a_add_to_world_spec.specified()) - task.set_add_to_world_spec(a_add_to_world_spec.argument()); - - if (a_continue_on_failure.argument() == "if-fetch-only") - task.set_continue_on_failure(itcof_if_fetch_only); - else if (a_continue_on_failure.argument() == "never") - task.set_continue_on_failure(itcof_never); - else if (a_continue_on_failure.argument() == "if-satisfied") - task.set_continue_on_failure(itcof_if_satisfied); - else if (a_continue_on_failure.argument() == "if-independent") - task.set_continue_on_failure(itcof_if_independent); - else if (a_continue_on_failure.argument() == "always") - task.set_continue_on_failure(itcof_always); - else - throw args::DoHelp("bad value for --continue-on-failure"); - - if (a_change_phases_for.argument() == "all") - task.set_phase_options_apply_to_all(true); - else if (a_change_phases_for.argument() == "first") - task.set_phase_options_apply_to_first(true); - else if (a_change_phases_for.argument() == "last") - task.set_phase_options_apply_to_last(true); - else - throw args::DoHelp("bad value for --change-phases-for"); - - std::shared_ptr<Set<std::string> > skip_phases(std::make_shared<Set<std::string>>()); - std::copy(a_skip_phase.begin_args(), a_skip_phase.end_args(), skip_phases->inserter()); - task.set_skip_phases(skip_phases); - - std::shared_ptr<Set<std::string> > abort_at_phases(std::make_shared<Set<std::string>>()); - std::copy(a_abort_at_phase.begin_args(), a_abort_at_phase.end_args(), abort_at_phases->inserter()); - task.set_abort_at_phases(abort_at_phases); - - std::shared_ptr<Set<std::string> > skip_until_phases(std::make_shared<Set<std::string>>()); - std::copy(a_skip_until_phase.begin_args(), a_skip_until_phase.end_args(), skip_until_phases->inserter()); - task.set_skip_until_phases(skip_until_phases); -} - -bool -InstallArgsGroup::want_full_install_reasons() const -{ - return "full" == a_show_reasons.argument(); -} - -bool -InstallArgsGroup::want_tags_summary() const -{ - return a_pretend.specified(); -} - -bool -InstallArgsGroup::want_install_reasons() const -{ - if (! a_pretend.specified()) - return false; - - return "full" == a_show_reasons.argument() || "summary" == a_show_reasons.argument(); -} - -bool -InstallArgsGroup::want_unchanged_use_flags() const -{ - return "none" != a_show_use_descriptions.argument() && - "new" != a_show_use_descriptions.argument() && - "changed" != a_show_use_descriptions.argument(); -} - -bool -InstallArgsGroup::want_changed_use_flags() const -{ - return "none" != a_show_use_descriptions.argument() && "new" != a_show_use_descriptions.argument(); -} - -bool -InstallArgsGroup::want_new_use_flags() const -{ - return "none" != a_show_use_descriptions.argument(); -} - -bool -InstallArgsGroup::want_use_summary() const -{ - return "none" != a_show_use_descriptions.argument(); -} - -bool -InstallArgsGroup::want_new_descriptions() const -{ - return "none" != a_show_package_descriptions.argument(); -} - -bool -InstallArgsGroup::want_existing_descriptions() const -{ - return "all" == a_show_package_descriptions.argument(); -} - -std::string -InstallArgsGroup::paludis_command_fragment() const -{ - std::string paludis_command; - - if (a_preserve_world.specified()) - paludis_command.append(" --" + a_preserve_world.long_name()); - - if (a_no_safe_resume.specified()) - paludis_command.append(" --" + a_no_safe_resume.long_name()); - - return paludis_command; -} - -std::string -InstallArgsGroup::resume_command_fragment(const InstallTask & task) const -{ - std::string resume_command; - - if (a_add_to_world_spec.specified()) - resume_command = resume_command + " --" + a_add_to_world_spec.long_name() - + " '" + a_add_to_world_spec.argument() + "'"; - else if (! a_preserve_world.specified()) - { - if (capped_distance(task.begin_targets(), task.end_targets(), 2) == 1) - { - resume_command = resume_command + " --" + a_add_to_world_spec.long_name() - + " '" + *task.begin_targets() + "'"; - } - else - resume_command = resume_command + " --" + a_add_to_world_spec.long_name() - + " '( " + join(task.begin_targets(), task.end_targets(), " ") + " )'"; - } - - if (a_continue_on_failure.specified()) - resume_command.append(" --" + a_continue_on_failure.long_name() + " " + a_continue_on_failure.argument()); - - if (a_destinations.specified()) - for (args::StringSetArg::ConstIterator i(a_destinations.begin_args()), - i_end(a_destinations.end_args()) ; i != i_end ; ++i) - resume_command = resume_command + " --" + a_destinations.long_name() + " '" + *i + "'"; - - return resume_command; -} - diff --git a/paludis/args/legacy/install_args_group.hh b/paludis/args/legacy/install_args_group.hh deleted file mode 100644 index acada1e10..000000000 --- a/paludis/args/legacy/install_args_group.hh +++ /dev/null @@ -1,154 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009, 2010 Ciaran McCreesh - * Copyright (c) 2007 David Leverton - * - * 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_COMMON_ARGS_INSTALL_ARGS_HH -#define PALUDIS_GUARD_SRC_COMMON_ARGS_INSTALL_ARGS_HH 1 - -#include <paludis/util/set.hh> - -#include <paludis/args/args_option.hh> -#include <paludis/args/args_group.hh> -#include <paludis/legacy/dep_list-fwd.hh> -#include <paludis/legacy/install_task.hh> - -/** \file - * Declarations for the InstallArgsGroup class. - * - * \ingroup g_args - * - * \section Examples - * - * - None at this time. - */ - -namespace paludis -{ - namespace args - { - /** - * Standard install arguments. - * - * \ingroup g_args - * \since 0.26 - * \nosubgrouping - */ - class PALUDIS_VISIBLE InstallArgsGroup : public ArgsGroup - { - public: - /// Constructor. - InstallArgsGroup(ArgsSection *, const std::string &, const std::string &); - - /// Destructor - ~InstallArgsGroup(); - - /// \name (Un)Install arguments - /// { - - /// --pretend - paludis::args::SwitchArg a_pretend; - - /// --destinations - paludis::args::StringSetArg a_destinations; - - /// --preserve-world - paludis::args::SwitchArg a_preserve_world; - - /// --add-to-world-spec - paludis::args::StringArg a_add_to_world_spec; - - /// --fetch - paludis::args::SwitchArg a_fetch; - - /// --no-safe-resume - paludis::args::SwitchArg a_no_safe_resume; - - /// --show-reasons - paludis::args::EnumArg a_show_reasons; - - /// --show-use-descriptions - paludis::args::EnumArg a_show_use_descriptions; - - /// --show-package-descriptions - paludis::args::EnumArg a_show_package_descriptions; - - /// --continue-on-failure - paludis::args::EnumArg a_continue_on_failure; - paludis::args::AliasArg a_continue_on_eroyf; - - /// --skip-phase - paludis::args::StringSetArg a_skip_phase; - - /// --abort-at-phase - paludis::args::StringSetArg a_abort_at_phase; - - /// --skip-until-phase - paludis::args::StringSetArg a_skip_until_phase; - - /// --change-phases-for - paludis::args::EnumArg a_change_phases_for; - - /// } - - /** - * Populate a DepListOptions from our values. - */ - void populate_dep_list_options(const Environment *, DepListOptions &) const; - - /** - * Fetch our specified destinations set. - */ - std::shared_ptr<const DestinationsSet> destinations(Environment *) const; - - /** - * Populate an InstallTask from our values. - */ - void populate_install_task(const Environment *, InstallTask &) const; - - ///\name Assorted options - ///\{ - - bool want_full_install_reasons() const; - bool want_install_reasons() const; - bool want_tags_summary() const; - - bool want_use_summary() const; - bool want_unchanged_use_flags() const; - bool want_changed_use_flags() const; - bool want_new_use_flags() const; - - bool want_new_descriptions() const; - bool want_existing_descriptions() const; - - ///\} - - /** - * Create a fragment for Environment::paludis_command. - */ - std::string paludis_command_fragment() const; - - /** - * Create a fragment for a resume command. - */ - std::string resume_command_fragment(const InstallTask &) const; - }; - } -} - -#endif |