aboutsummaryrefslogtreecommitdiff
path: root/src/clients
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-03 11:37:04 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-03 11:37:04 +0000
commit5b096137be44c5354713cfc02b30767c7b9da0f6 (patch)
treebb5e94c6ddf113628c4b6fba91352a0ed59ebfa4 /src/clients
parentd871dc2994417f4aeee9199d23b7e5d66e03bc63 (diff)
downloadpaludis-5b096137be44c5354713cfc02b30767c7b9da0f6.tar.gz
paludis-5b096137be44c5354713cfc02b30767c7b9da0f6.tar.xz
Parallel sync support
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc7
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh1
-rw-r--r--src/clients/paludis/command_line.cc6
-rw-r--r--src/clients/paludis/command_line.hh3
-rw-r--r--src/clients/paludis/sync.cc22
5 files changed, 33 insertions, 6 deletions
diff --git a/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc b/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc
index f09e091ff..334c25fa0 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.cc
@@ -28,7 +28,7 @@ namespace paludis
}
GuiSyncTask::GuiSyncTask(MainWindow * const m) :
- SyncTask(m->environment()),
+ SyncTask(m->environment(), false),
PrivateImplementationPattern<GuiSyncTask>(new Implementation<GuiSyncTask>(m, this)),
_imp(PrivateImplementationPattern<GuiSyncTask>::_imp)
{
@@ -102,3 +102,8 @@ GuiSyncTask::paludis_thread_execute()
execute();
}
+void
+GuiSyncTask::on_sync_status(const int, const int, const int)
+{
+}
+
diff --git a/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh b/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh
index 9952284aa..c37bc01a5 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/gui_sync_task.hh
@@ -27,6 +27,7 @@ namespace gtkpaludis
virtual void on_sync_fail(const paludis::RepositoryName &, const paludis::SyncFailedError &);
virtual void on_sync_succeed(const paludis::RepositoryName &);
virtual void on_sync_all_post();
+ virtual void on_sync_status(const int x, const int y, const int a);
public:
GuiSyncTask(MainWindow * const);
diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc
index 47f371a95..dd23f9909 100644
--- a/src/clients/paludis/command_line.cc
+++ b/src/clients/paludis/command_line.cc
@@ -73,6 +73,12 @@ CommandLine::CommandLine() :
a_environment(&general_args, "environment", 'E', "Environment specification (class:suffix, both parts optional)"),
a_resume_command_template(&general_args, "resume-command-template", '\0',
"Save the resume command to a file. If the filename contains 'XXXXXX', use mkstemp(3) to generate the filename"),
+#ifdef PALUDIS_ENABLE_THREADS
+ a_parallel(&general_args, "parallel", 'P', "Perform tasks in parallel, where supported (currently --sync only)"),
+#else
+ a_parallel(&general_args, "parallel", 'P', "Does nothing. (For compatibility with Paludis when built with thread "
+ "support, which you shouldn't be using.)"),
+#endif
query_args(this, "Query options",
"Options which are relevant for --query."),
diff --git a/src/clients/paludis/command_line.hh b/src/clients/paludis/command_line.hh
index f9989993a..40918cd37 100644
--- a/src/clients/paludis/command_line.hh
+++ b/src/clients/paludis/command_line.hh
@@ -166,6 +166,9 @@ class CommandLine :
/// --resume-command-template
paludis::args::StringArg a_resume_command_template;
+ /// --parallel
+ paludis::args::SwitchArg a_parallel;
+
///}
/// \name Query arguments
diff --git a/src/clients/paludis/sync.cc b/src/clients/paludis/sync.cc
index 4ae0390de..3a8b4cbf5 100644
--- a/src/clients/paludis/sync.cc
+++ b/src/clients/paludis/sync.cc
@@ -43,8 +43,8 @@ namespace
int _return_code;
public:
- OurSyncTask(tr1::shared_ptr<Environment> env) :
- SyncTask(env.get()),
+ OurSyncTask(tr1::shared_ptr<Environment> env, const bool p) :
+ SyncTask(env.get(), p),
_return_code(0)
{
}
@@ -57,6 +57,8 @@ namespace
virtual void on_sync_succeed(const RepositoryName &);
virtual void on_sync_all_post();
+ virtual void on_sync_status(const int x, const int y, const int a);
+
int return_code() const
{
return _return_code;
@@ -72,7 +74,6 @@ namespace
OurSyncTask::on_sync_pre(const RepositoryName & r)
{
cout << colour(cl_heading, "Sync " + stringify(r)) << endl;
- cerr << xterm_title("Syncing " + stringify(r));
}
void
@@ -108,13 +109,25 @@ namespace
{
cout << endl;
}
+
+ void
+ OurSyncTask::on_sync_status(const int x, const int y, const int a)
+ {
+ cerr << xterm_title("Syncing " + stringify(x) + " of " + stringify(y) + ", "
+ + stringify(a) + " active");
+ }
}
int do_sync(tr1::shared_ptr<Environment> env)
{
Context context("When performing sync action from command line:");
- OurSyncTask task(env);
+ bool parallel(false);
+#ifdef PALUDIS_ENABLE_THREADS
+ parallel = CommandLine::get_instance()->a_parallel.specified();
+#endif
+
+ OurSyncTask task(env, parallel);
for (CommandLine::ParametersConstIterator q(CommandLine::get_instance()->begin_parameters()),
q_end(CommandLine::get_instance()->end_parameters()) ; q != q_end ; ++q)
@@ -126,4 +139,3 @@ int do_sync(tr1::shared_ptr<Environment> env)
return task.return_code();
}
-