diff options
-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 | ||||
-rw-r--r-- | src/output/console_install_task.cc | 18 | ||||
-rw-r--r-- | src/output/console_install_task.hh | 10 |
6 files changed, 48 insertions, 27 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 diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc index 2e63d4312..ed322584a 100644 --- a/src/output/console_install_task.cc +++ b/src/output/console_install_task.cc @@ -1906,31 +1906,31 @@ ConsoleInstallTask::perform_hook(const Hook & hook) const } void -ConsoleInstallTask::on_phase_skip(const std::string & phase) +ConsoleInstallTask::on_phase_skip(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) { - output_starred_item("Skipping phase '" + phase + "' as instructed"); + output_manager->stdout_stream() << "+++ Skipping phase '" + phase + "' as instructed"; } void -ConsoleInstallTask::on_phase_abort(const std::string & phase) +ConsoleInstallTask::on_phase_abort(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) { - output_starred_item("Aborting at phase '" + phase + "' as instructed"); + output_manager->stdout_stream() << "+++ Aborting at phase '" + phase + "' as instructed"; } void -ConsoleInstallTask::on_phase_skip_until(const std::string & phase) +ConsoleInstallTask::on_phase_skip_until(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) { - output_starred_item("Skipping phase '" + phase + "' as instructed since it is before a start phase"); + output_manager->stdout_stream() << "+++ Skipping phase '" + phase + "' as instructed since it is before a start phase"; } void -ConsoleInstallTask::on_phase_proceed_conditionally(const std::string & phase) +ConsoleInstallTask::on_phase_proceed_conditionally(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) { - output_starred_item("Executing phase '" + phase + "' as instructed"); + output_manager->stdout_stream() << "+++ Executing phase '" + phase + "' as instructed"; } void -ConsoleInstallTask::on_phase_proceed_unconditionally(const std::string &) +ConsoleInstallTask::on_phase_proceed_unconditionally(const std::tr1::shared_ptr<OutputManager> &, const std::string &) { } diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh index 06a99550d..2f58b5dbb 100644 --- a/src/output/console_install_task.hh +++ b/src/output/console_install_task.hh @@ -195,11 +195,11 @@ namespace paludis virtual void on_display_failure_summary_totals(const int, const int, const int, const int, const int); virtual void on_display_failure_summary_post(); - virtual void on_phase_skip(const std::string & phase); - virtual void on_phase_abort(const std::string & phase); - virtual void on_phase_skip_until(const std::string & phase); - virtual void on_phase_proceed_conditionally(const std::string & phase); - virtual void on_phase_proceed_unconditionally(const std::string & phase); + virtual void on_phase_skip(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase); + virtual void on_phase_abort(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase); + virtual void on_phase_skip_until(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase); + virtual void on_phase_proceed_conditionally(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase); + virtual void on_phase_proceed_unconditionally(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase); ///\name More granular display routines ///\{ |