aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-16 14:01:10 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-16 14:01:10 +0100
commitf2fcaeea1fe8ce2a0ddcfcb5219f4338e2900500 (patch)
tree48a67e28b1989a99cedeede6da9dede0af2c21c6
parentbb9036fecacfd94cce5dc556ccb30e40db52b616 (diff)
downloadpaludis-f2fcaeea1fe8ce2a0ddcfcb5219f4338e2900500.tar.gz
paludis-f2fcaeea1fe8ce2a0ddcfcb5219f4338e2900500.tar.xz
cave resolve --fetch-jobs
-rw-r--r--src/clients/cave/cmd_execute_resolution.cc32
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.cc6
-rw-r--r--src/clients/cave/cmd_resolve_cmdline.hh3
3 files changed, 31 insertions, 10 deletions
diff --git a/src/clients/cave/cmd_execute_resolution.cc b/src/clients/cave/cmd_execute_resolution.cc
index d368960..e5c4afb 100644
--- a/src/clients/cave/cmd_execute_resolution.cc
+++ b/src/clients/cave/cmd_execute_resolution.cc
@@ -259,7 +259,9 @@ namespace
if (command.empty())
command = "$CAVE perform";
- command.append(" fetch --hooks --if-supported --managed-output --output-exclusivity with-others ");
+ command.append(" fetch --hooks --if-supported --managed-output ");
+ if (cmdline.execution_options.a_fetch_jobs.argument() != 0)
+ command.append("--output-exclusivity with-others ");
command.append(stringify(id->uniquely_identifying_spec()));
command.append(" --x-of-y '" + stringify(x) + " of " + stringify(y) + "'");
@@ -333,7 +335,9 @@ namespace
if (command.empty())
command = "$CAVE perform";
- command.append(" install --hooks --managed-output --output-exclusivity with-others ");
+ command.append(" install --hooks --managed-output ");
+ if (cmdline.execution_options.a_fetch_jobs.argument() != 0)
+ command.append("--output-exclusivity with-others ");
command.append(stringify(id->uniquely_identifying_spec()));
command.append(" --destination " + stringify(destination_repository_name));
for (Sequence<PackageDepSpec>::ConstIterator i(replacing_specs->begin()),
@@ -407,7 +411,9 @@ namespace
if (command.empty())
command = "$CAVE perform";
- command.append(" uninstall --hooks --managed-output --output-exclusivity with-others ");
+ command.append(" uninstall --hooks --managed-output ");
+ if (cmdline.execution_options.a_fetch_jobs.argument() != 0)
+ command.append("--output-exclusivity with-others ");
command.append(stringify(id->uniquely_identifying_spec()));
command.append(" --x-of-y '" + stringify(x) + " of " + stringify(y) + "'");
@@ -979,18 +985,18 @@ namespace
std::string visit(const UninstallJob & j) const
{
- return "Uninstall " + join(j.ids_to_remove_specs()->begin(), j.ids_to_remove_specs()->end(), ",",
+ return "uninstalling " + join(j.ids_to_remove_specs()->begin(), j.ids_to_remove_specs()->end(), ", ",
std::tr1::bind(stringify_id_or_spec, env, std::tr1::placeholders::_1));
}
std::string visit(const InstallJob & j) const
{
- return "Install " + stringify_id_or_spec(env, j.origin_id_spec()) + " to " + stringify(j.destination_repository_name());
+ return "installing " + stringify_id_or_spec(env, j.origin_id_spec()) + " to " + stringify(j.destination_repository_name());
}
std::string visit(const FetchJob & j) const
{
- return "Fetch " + stringify_id_or_spec(env, j.origin_id_spec());
+ return "fetch " + stringify_id_or_spec(env, j.origin_id_spec());
}
};
@@ -1097,7 +1103,10 @@ namespace
std::string queue_name() const
{
- return simple_visitor_cast<const FetchJob>(*job) ? "fetch" : "execute";
+ if (cmdline.execution_options.a_fetch_jobs.argument() != 0)
+ return simple_visitor_cast<const FetchJob>(*job) ? "fetch" : "execute";
+ else
+ return "execute";
}
std::string unique_id() const
@@ -1200,19 +1209,22 @@ namespace
void display_active()
{
+ if (cmdline.execution_options.a_fetch_jobs.argument() == 0)
+ return;
+
Lock lock(job_mutex);
const std::tr1::shared_ptr<OutputManager> output_manager(
job->state()->accept_returning<std::tr1::shared_ptr<OutputManager> >(GetOutputManager()));
if (output_manager)
{
- std::string heading("[" + queue_name() + "] " + unique_id());
+ std::string heading("Output from " + unique_id() + ":");
if (output_manager->want_to_flush())
{
if (heading != old_heading)
{
- cout << endl << c::bold_blue() << heading << c::normal() << endl << endl;
+ cout << endl << c::bold_normal() << heading << c::normal() << endl << endl;
old_heading = heading;
}
@@ -1221,7 +1233,7 @@ namespace
}
else
{
- cout << endl << c::bold_blue() << heading << c::normal() << endl << endl;
+ cout << endl << c::bold_normal() << heading << c::normal() << endl << endl;
old_heading = "";
cout << "-> (no output for " << (Timestamp::now().seconds() - last_output.seconds()) << " seconds)" << endl;
}
diff --git a/src/clients/cave/cmd_resolve_cmdline.cc b/src/clients/cave/cmd_resolve_cmdline.cc
index 7cbc992..751bdef 100644
--- a/src/clients/cave/cmd_resolve_cmdline.cc
+++ b/src/clients/cave/cmd_resolve_cmdline.cc
@@ -307,6 +307,11 @@ ResolveCommandLineExecutionOptions::ResolveCommandLineExecutionOptions(args::Arg
"Write resume information to the specified file. If a build fails, or if '--execute' is not "
"specified, then 'cave resume' can resume execution from this file."),
+ g_jobs_options(this, "Jobs Options", "Options controlling jobs and parallelism."),
+ a_fetch_jobs(&g_jobs_options, "fetch-jobs", 'J', "The number of parallel fetch jobs to launch. If set to 0, fetches "
+ "will be carried out sequentially with other jobs. Values higher than 1 are currently treated "
+ "as being 1. Defaults to 1."),
+
g_phase_options(this, "Phase Options", "Options controlling which phases to execute. No sanity checking "
"is done, allowing you to shoot as many feet off as you desire. Phase names do not have the "
"src_, pkg_ or builtin_ prefix, so 'init', 'preinst', 'unpack', 'merge', 'strip' etc."),
@@ -321,6 +326,7 @@ ResolveCommandLineExecutionOptions::ResolveCommandLineExecutionOptions(args::Arg
("last", "Only the last package on the list"),
"all")
{
+ a_fetch_jobs.set_argument(1);
}
ResolveCommandLineProgramOptions::ResolveCommandLineProgramOptions(args::ArgsHandler * const h) :
diff --git a/src/clients/cave/cmd_resolve_cmdline.hh b/src/clients/cave/cmd_resolve_cmdline.hh
index ccb3a0c..178cfc9 100644
--- a/src/clients/cave/cmd_resolve_cmdline.hh
+++ b/src/clients/cave/cmd_resolve_cmdline.hh
@@ -125,6 +125,9 @@ namespace paludis
args::EnumArg a_continue_on_failure;
args::StringArg a_resume_file;
+ args::ArgsGroup g_jobs_options;
+ args::IntegerArg a_fetch_jobs;
+
args::ArgsGroup g_phase_options;
args::StringSetArg a_skip_phase;
args::StringSetArg a_abort_at_phase;