aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-05 00:20:33 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-09-05 00:27:14 +0100
commit28f932a48885d0c480255d6d12c37ddb713aefcc (patch)
tree6ce80ddcd20b8e7f92fb298f628e3c2e21c6f259
parent1a300a6eec57dca2807f98071d2c5b1023eaf71a (diff)
downloadpaludis-28f932a48885d0c480255d6d12c37ddb713aefcc.tar.gz
paludis-28f932a48885d0c480255d6d12c37ddb713aefcc.tar.xz
perform
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc4
-rw-r--r--src/clients/cave/cmd_resolve.cc49
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc7
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.hh4
4 files changed, 56 insertions, 8 deletions
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index 0f19684..08e844b 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -66,11 +66,11 @@ namespace
struct ExecuteResolutionCommandLine :
CaveCommandCommandLine
{
- ResolveCommandLineExecutionOptions display_options;
+ ResolveCommandLineExecutionOptions execution_options;
ResolveCommandLineProgramOptions program_options;
ExecuteResolutionCommandLine() :
- display_options(this),
+ execution_options(this),
program_options(this)
{
add_environment_variable("PALUDIS_SERIALISED_RESOLUTION_FD",
diff --git a/src/clients/cave/cmd_resolve.cc b/src/clients/cave/cmd_resolve.cc
index f362951..a88696d 100644
--- a/src/clients/cave/cmd_resolve.cc
+++ b/src/clients/cave/cmd_resolve.cc
@@ -541,6 +541,53 @@ namespace
return run_command(cmd);
}
+
+ void perform_resolution(
+ const std::tr1::shared_ptr<Environment> &,
+ const ResolutionLists & resolution_lists,
+ const ResolveCommandLine & cmdline) PALUDIS_ATTRIBUTE((noreturn));
+
+ void perform_resolution(
+ const std::tr1::shared_ptr<Environment> &,
+ const ResolutionLists & resolution_lists,
+ const ResolveCommandLine & cmdline)
+ {
+ Context context("When performing chosen resolution:");
+
+ std::stringstream ser_stream;
+ Serialiser ser(ser_stream);
+ resolution_lists.serialise(ser);
+
+ std::string command(cmdline.program_options.a_execute_resolution_program.argument());
+ if (command.empty())
+ command = "$CAVE execute-resolution";
+
+ for (args::ArgsSection::GroupsConstIterator g(cmdline.execution_options.begin()),
+ g_end(cmdline.execution_options.end()) ;
+ g != g_end ; ++g)
+ {
+ for (args::ArgsGroup::ConstIterator o(g->begin()), o_end(g->end()) ;
+ o != o_end ; ++o)
+ if ((*o)->specified())
+ command = command + " " + (*o)->forwardable_string();
+ }
+
+ for (args::ArgsSection::GroupsConstIterator g(cmdline.program_options.begin()),
+ g_end(cmdline.program_options.end()) ;
+ g != g_end ; ++g)
+ {
+ for (args::ArgsGroup::ConstIterator o(g->begin()), o_end(g->end()) ;
+ o != o_end ; ++o)
+ if ((*o)->specified())
+ command = command + " " + (*o)->forwardable_string();
+ }
+
+ paludis::Command cmd(command);
+ cmd
+ .with_input_stream(&ser_stream, -1, "PALUDIS_SERIALISED_RESOLUTION_FD");
+
+ become_command(cmd);
+ }
}
@@ -651,6 +698,8 @@ ResolveCommand::run(
}
retcode |= display_resolution(env, *resolver->resolution_lists(), cmdline);
+ if (0 == retcode && cmdline.resolution_options.a_execute.specified())
+ perform_resolution(env, *resolver->resolution_lists(), cmdline);
}
catch (...)
{
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index 467dc59..ce51f16 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -24,10 +24,9 @@ using namespace cave;
ResolveCommandLineResolutionOptions::ResolveCommandLineResolutionOptions(args::ArgsHandler * const h) :
ArgsSection(h, "Resolution Options"),
-// g_execution_options(this, "Execution Options", "Control execution."),
-// a_execute(&g_execution_options, "execute", 'x', "Execute the suggested actions", true),
-// a_preserve_world(&g_execution_options, "preserve-world", '1', "Do not modify the 'world' set", true),
-//
+ g_execution_options(this, "Execution Options", "Control execution."),
+ a_execute(&g_execution_options, "execute", 'x', "Execute the suggested actions", true),
+
g_convenience_options(this, "Convenience Options", "Broad behaviour options."),
a_lazy(&g_convenience_options, "lazy", 'z', "Do as little work as possible.", true),
a_complete(&g_convenience_options, "complete", 'c', "Do all optional work.", true),
diff --git a/src/clients/cave/cmd_resolve_cmdline.hh b/src/clients/cave/cmd_resolve_cmdline.hh
index 5c4725c..70897cc 100644
--- a/src/clients/cave/cmd_resolve_cmdline.hh
+++ b/src/clients/cave/cmd_resolve_cmdline.hh
@@ -31,8 +31,8 @@ namespace paludis
{
ResolveCommandLineResolutionOptions(args::ArgsHandler * const);
- // args::ArgsGroup g_execution_options;
- // args::SwitchArg a_execute;
+ args::ArgsGroup g_execution_options;
+ args::SwitchArg a_execute;
args::ArgsGroup g_convenience_options;
args::SwitchArg a_lazy;