aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2009-10-12 00:27:23 -0400
committerAvatar Mike Kelly <pioto@pioto.org> 2009-10-12 00:27:23 -0400
commit5355d539ddad92f2289f4f78508ca0cd32db14a2 (patch)
tree012466517aaf71b810352501df6210a9374e0569
parent15792dbb2affa34cb6a9790a53f20ca9a024e72e (diff)
downloadpaludis-5355d539ddad92f2289f4f78508ca0cd32db14a2.tar.gz
paludis-5355d539ddad92f2289f4f78508ca0cd32db14a2.tar.xz
Initial --suggestions / --recommendations support.
Coarse ability to toggle taking/skipping of suggestions and recommendations. No difference between display and ignore right now.
-rw-r--r--src/clients/cave/cmd_resolve.cc16
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc30
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.hh6
3 files changed, 33 insertions, 19 deletions
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index 0e79249..b168b1d 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -711,13 +711,27 @@ namespace
bool
take_dependency_fn(const Environment * const,
- const ResolveCommandLine &,
+ const ResolveCommandLine & cmdline,
const Resolvent &,
const SanitisedDependency & dep,
const std::tr1::shared_ptr<const Reason> &)
{
if (is_suggestion(dep))
+ {
+ if (cmdline.resolution_options.a_suggestions.argument() == "take")
+ {
+ return true;
+ }
+ return false;
+ }
+ if (is_recommendation(dep))
+ {
+ if (cmdline.resolution_options.a_recommendations.argument() == "take")
+ {
+ return true;
+ }
return false;
+ }
return true;
}
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index a6855fd..612cf5b 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -122,21 +122,21 @@ ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::A
"Ignore dependencies (except compiled-against dependencies, which are already taken) "
"for installed packages. (default if --lazy)", true),
-//
-// g_suggestion_options(this, "Suggestion Options", "Control whether suggestions are taken. Suggestions that are "
-// "already installed are instead treated as hard dependencies."),
-// a_suggestions(&g_suggestion_options, "suggestions", '\0', "How to treat suggestions and recommendations",
-// args::EnumArg::EnumArgOptions
-// ("ignore", "Ignore suggestions")
-// ("display", "Display suggestions, but do not take them unless explicitly told to do so")
-// ("take", "Take all suggestions"),
-// "display"),
-// a_recommendations(&g_suggestion_options, "recommendations", '\0', "How to treat recommendations",
-// args::EnumArg::EnumArgOptions
-// ("ignore", "Ignore recommendations")
-// ("display", "Display recommendations, but do not take them unless explicitly told to do so")
-// ("take", "Take all recommendations"),
-// "take"),
+
+ g_suggestion_options(this, "Suggestion Options", "Control whether suggestions are taken. Suggestions that are "
+ "already installed are instead treated as hard dependencies."),
+ a_suggestions(&g_suggestion_options, "suggestions", '\0', "How to treat suggestions and recommendations",
+ args::EnumArg::EnumArgOptions
+ ("ignore", "Ignore suggestions")
+ ("display", "Display suggestions, but do not take them unless explicitly told to do so")
+ ("take", "Take all suggestions"),
+ "display"),
+ a_recommendations(&g_suggestion_options, "recommendations", '\0', "How to treat recommendations",
+ args::EnumArg::EnumArgOptions
+ ("ignore", "Ignore recommendations")
+ ("display", "Display recommendations, but do not take them unless explicitly told to do so")
+ ("take", "Take all recommendations"),
+ "take"),
// a_take(&g_suggestion_options, "take", '\0', "Take any suggestion matching the supplied package specification"
// " (e.g. --take 'app-vim/securemodelines' or --take 'app-vim/*')"),
// a_take_from(&g_suggestion_options, "take-from", '\0', "Take all suggestions made by any package matching the "
diff --git a/src/clients/cave/cmd_resolve_cmdline.hh b/src/clients/cave/cmd_resolve_cmdline.hh
index 2a1e733..d89675e 100644
--- a/src/clients/cave/cmd_resolve_cmdline.hh
+++ b/src/clients/cave/cmd_resolve_cmdline.hh
@@ -63,9 +63,9 @@ namespace paludis
args::SwitchArg a_follow_installed_build_dependencies;
args::SwitchArg a_ignore_installed_dependencies;
- // args::ArgsGroup g_suggestion_options;
- // args::EnumArg a_suggestions;
- // args::EnumArg a_recommendations;
+ args::ArgsGroup g_suggestion_options;
+ args::EnumArg a_suggestions;
+ args::EnumArg a_recommendations;
// args::StringSetArg a_take;
// args::StringSetArg a_take_from;
// args::StringSetArg a_discard;