diff options
author | 2009-02-12 16:47:17 +0000 | |
---|---|---|
committer | 2009-02-12 16:47:17 +0000 | |
commit | 23c22d5df8d5d47111d9c8e1e43e787f6a534b65 (patch) | |
tree | 004ed29559fe1a09c528f9050f48262bf9ad4887 /paludis | |
parent | 234d67465e0aae7b1e2e34c8c520609c6bd80789 (diff) | |
download | paludis-23c22d5df8d5d47111d9c8e1e43e787f6a534b65.tar.gz paludis-23c22d5df8d5d47111d9c8e1e43e787f6a534b65.tar.xz |
Send phase messages to the output manager
Diffstat (limited to 'paludis')
-rw-r--r-- | paludis/install_task.cc | 22 | ||||
-rw-r--r-- | paludis/install_task.hh | 10 | ||||
-rw-r--r-- | paludis/output_manager_from_environment.cc | 13 | ||||
-rw-r--r-- | paludis/output_manager_from_environment.hh | 2 |
4 files changed, 34 insertions, 13 deletions
diff --git a/paludis/install_task.cc b/paludis/install_task.cc index 0a52497be..170c5d8b0 100644 --- a/paludis/install_task.cc +++ b/paludis/install_task.cc @@ -69,23 +69,29 @@ template class WrappedForwardIterator<InstallTask::TargetsConstIteratorTag, cons namespace { - WantPhase want_all_phases_function(InstallTask * const task, bool & done_any, const std::string & phase) + WantPhase want_all_phases_function( + InstallTask * const task, + OutputManagerFromEnvironment & output_manager_holder, + bool & done_any, const std::string & phase) { - task->on_phase_proceed_unconditionally(phase); + output_manager_holder.construct_standard_if_unconstructed(); + task->on_phase_proceed_unconditionally(output_manager_holder.output_manager_if_constructed(), phase); done_any = true; return wp_yes; } WantPhase want_phase_function( InstallTask * const task, + OutputManagerFromEnvironment & output_manager_holder, const std::tr1::shared_ptr<const Set<std::string> > & abort_at_phases, const std::tr1::shared_ptr<const Set<std::string> > & skip_phases, const std::tr1::shared_ptr<const Set<std::string> > & skip_until_phases, bool & done_any, const std::string & phase) { + output_manager_holder.construct_standard_if_unconstructed(); if (abort_at_phases->end() != abort_at_phases->find(phase)) { - task->on_phase_abort(phase); + task->on_phase_abort(output_manager_holder.output_manager_if_constructed(), phase); return wp_abort; } @@ -93,7 +99,7 @@ namespace if (! done_any) if (skip_until_phases->end() == skip_until_phases->find(phase)) { - task->on_phase_skip_until(phase); + task->on_phase_skip_until(output_manager_holder.output_manager_if_constructed(), phase); return wp_skip; } @@ -102,11 +108,11 @@ namespace if (skip_phases->end() != skip_phases->find(phase)) { - task->on_phase_skip(phase); + task->on_phase_skip(output_manager_holder.output_manager_if_constructed(), phase); return wp_skip; } - task->on_phase_proceed_conditionally(phase); + task->on_phase_proceed_conditionally(output_manager_holder.output_manager_if_constructed(), phase); return wp_yes; } } @@ -793,11 +799,11 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i apply_phases = true; } if (apply_phases) - install_options.want_phase() = std::tr1::bind(&want_phase_function, this, + install_options.want_phase() = std::tr1::bind(&want_phase_function, this, std::tr1::ref(output_manager_holder), std::tr1::cref(_imp->abort_at_phases), std::tr1::cref(_imp->skip_phases), std::tr1::cref(_imp->skip_until_phases), std::tr1::ref(done_any), std::tr1::placeholders::_1); else - install_options.want_phase() = std::tr1::bind(&want_all_phases_function, this, + install_options.want_phase() = std::tr1::bind(&want_all_phases_function, this, std::tr1::ref(output_manager_holder), std::tr1::ref(done_any), std::tr1::placeholders::_1); InstallAction install_action(install_options); diff --git a/paludis/install_task.hh b/paludis/install_task.hh index 6d87a24e2..449d9b2c7 100644 --- a/paludis/install_task.hh +++ b/paludis/install_task.hh @@ -210,11 +210,11 @@ namespace paludis virtual void on_install_action_error(const InstallActionError &) = 0; virtual void on_fetch_action_error(const FetchActionError &) = 0; - virtual void on_phase_skip(const std::string & phase) = 0; - virtual void on_phase_abort(const std::string & phase) = 0; - virtual void on_phase_skip_until(const std::string & phase) = 0; - virtual void on_phase_proceed_conditionally(const std::string & phase) = 0; - virtual void on_phase_proceed_unconditionally(const std::string & phase) = 0; + virtual void on_phase_skip(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0; + virtual void on_phase_abort(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0; + virtual void on_phase_skip_until(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0; + virtual void on_phase_proceed_conditionally(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0; + virtual void on_phase_proceed_unconditionally(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0; ///\} diff --git a/paludis/output_manager_from_environment.cc b/paludis/output_manager_from_environment.cc index 3c75433e7..0768f3057 100644 --- a/paludis/output_manager_from_environment.cc +++ b/paludis/output_manager_from_environment.cc @@ -19,8 +19,10 @@ #include <paludis/output_manager_from_environment.hh> #include <paludis/util/private_implementation_pattern-impl.hh> +#include <paludis/util/log.hh> #include <paludis/environment.hh> #include <paludis/create_output_manager_info.hh> +#include <paludis/standard_output_manager.hh> using namespace paludis; @@ -71,5 +73,16 @@ OutputManagerFromEnvironment::output_manager_if_constructed() return _imp->result; } +void +OutputManagerFromEnvironment::construct_standard_if_unconstructed() +{ + if (! _imp->result) + { + Log::get_instance()->message("output_manager_from_environment.constructed_standard", ll_warning, lc_context) + << "No output manager available, creating a standard output manager. This is probably a bug."; + _imp->result.reset(new StandardOutputManager); + } +} + template class PrivateImplementationPattern<OutputManagerFromEnvironment>; diff --git a/paludis/output_manager_from_environment.hh b/paludis/output_manager_from_environment.hh index 410c40e45..e4682d817 100644 --- a/paludis/output_manager_from_environment.hh +++ b/paludis/output_manager_from_environment.hh @@ -45,6 +45,8 @@ namespace paludis const std::tr1::shared_ptr<OutputManager> operator() (const Action &); const std::tr1::shared_ptr<OutputManager> output_manager_if_constructed(); + + void construct_standard_if_unconstructed(); }; #ifdef PALUDIS_HAVE_EXTERN_TEMPLATE |