00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PALUDIS_GUARD_PALUDIS_INSTALL_TASK_HH
00021 #define PALUDIS_GUARD_PALUDIS_INSTALL_TASK_HH 1
00022
00023 #include <paludis/util/instantiation_policy.hh>
00024 #include <paludis/util/private_implementation_pattern.hh>
00025 #include <paludis/util/wrapped_forward_iterator-fwd.hh>
00026 #include <paludis/dep_list.hh>
00027 #include <paludis/dep_list_exceptions.hh>
00028 #include <paludis/tasks_exceptions.hh>
00029 #include <paludis/repository-fwd.hh>
00030 #include <paludis/action-fwd.hh>
00031 #include <paludis/package_database-fwd.hh>
00032 #include <paludis/output_manager_from_environment-fwd.hh>
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 namespace paludis
00045 {
00046 class Environment;
00047
00048 #include <paludis/install_task-se.hh>
00049
00050
00051
00052
00053
00054
00055
00056 class PALUDIS_VISIBLE InstallTask :
00057 PrivateImplementationPattern<InstallTask>,
00058 InstantiationPolicy<InstallTask, instantiation_method::NonCopyableTag>
00059 {
00060 private:
00061 void _execute();
00062
00063 void _build_dep_list();
00064 void _display_task_list();
00065 bool _pretend();
00066
00067 void _main_actions();
00068 void _main_actions_pre_hooks();
00069 void _main_actions_post_hooks();
00070 void _do_world_updates();
00071 void _main_actions_all(const int y, const DepList::Iterator dep_last_package);
00072
00073 void _one(const DepList::Iterator, const int, const int, const int, const int, const bool is_first, const bool is_last,
00074 std::tr1::shared_ptr<OutputManagerFromEnvironment> &);
00075 void _clean(const DepList::Iterator, const std::tr1::shared_ptr<const PackageID> & id,
00076 const UninstallActionOptions &,
00077 const std::string & cpvr, const int x, const int y, const int s, const int f);
00078 void _display_failure_summary();
00079
00080 void _add_target(const std::string &);
00081 void _add_package_id(const std::tr1::shared_ptr<const PackageID> &);
00082
00083 std::tr1::shared_ptr<const PackageDepSpec> _unsatisfied(const DepListEntry &) const;
00084 std::tr1::shared_ptr<const PackageID> _dependent(const DepListEntry &) const;
00085
00086 protected:
00087
00088
00089
00090 InstallTask(Environment * const env, const DepListOptions & options,
00091 const std::tr1::shared_ptr<const DestinationsSet> & destinations);
00092
00093
00094
00095 bool already_done(const DepListEntry &) const PALUDIS_ATTRIBUTE((warn_unused_result));
00096
00097 FetchActionOptions make_fetch_action_options(const DepListEntry &,
00098 OutputManagerFromEnvironment & o) const PALUDIS_ATTRIBUTE((warn_unused_result));
00099
00100 public:
00101
00102
00103
00104 virtual ~InstallTask();
00105
00106
00107
00108
00109
00110
00111 void set_fetch_only(const bool value);
00112 void set_pretend(const bool value);
00113 void set_preserve_world(const bool value);
00114 void set_add_to_world_spec(const std::string &);
00115 void set_safe_resume(const bool);
00116 void set_continue_on_failure(const InstallTaskContinueOnFailure);
00117 void set_skip_phases(const std::tr1::shared_ptr<const Set<std::string> > &);
00118 void set_skip_until_phases(const std::tr1::shared_ptr<const Set<std::string> > &);
00119 void set_abort_at_phases(const std::tr1::shared_ptr<const Set<std::string> > &);
00120 void set_phase_options_apply_to_first(const bool);
00121 void set_phase_options_apply_to_last(const bool);
00122 void set_phase_options_apply_to_all(const bool);
00123
00124
00125
00126
00127
00128
00129 void set_targets_from_user_specs(const std::tr1::shared_ptr<const Sequence<std::string> > &);
00130 void set_targets_from_exact_packages(const std::tr1::shared_ptr<const PackageIDSequence> &);
00131 void set_targets_from_serialisation(const std::string &, const std::tr1::shared_ptr<const Sequence<std::string> > &);
00132
00133 void clear();
00134 void override_target_type(const DepListTargetType);
00135
00136 struct TargetsConstIteratorTag;
00137 typedef WrappedForwardIterator<TargetsConstIteratorTag, const std::string> TargetsConstIterator;
00138 TargetsConstIterator begin_targets() const PALUDIS_ATTRIBUTE((warn_unused_result));
00139 TargetsConstIterator end_targets() const PALUDIS_ATTRIBUTE((warn_unused_result));
00140
00141
00142
00143
00144
00145
00146 virtual void on_build_deplist_pre() = 0;
00147 virtual void on_build_deplist_post() = 0;
00148
00149 virtual void on_display_merge_list_pre() = 0;
00150 virtual void on_display_merge_list_post() = 0;
00151 virtual void on_display_merge_list_entry(const DepListEntry &) = 0;
00152
00153 virtual void on_display_failure_summary_pre() = 0;
00154 virtual void on_display_failure_summary_success(const DepListEntry &) = 0;
00155 virtual void on_display_failure_summary_failure(const DepListEntry &) = 0;
00156 virtual void on_display_failure_summary_skipped_unsatisfied(const DepListEntry &, const PackageDepSpec &) = 0;
00157 virtual void on_display_failure_summary_skipped_dependent(const DepListEntry &, const std::tr1::shared_ptr<const PackageID> &) = 0;
00158 virtual void on_display_failure_summary_totals(const int, const int, const int, const int, const int) = 0;
00159 virtual void on_display_failure_summary_post() = 0;
00160
00161 virtual void on_not_continuing_due_to_errors() = 0;
00162
00163 virtual void on_pretend_all_pre() = 0;
00164 virtual void on_pretend_pre(const DepListEntry &) = 0;
00165 virtual void on_pretend_post(const DepListEntry &) = 0;
00166 virtual void on_pretend_all_post() = 0;
00167
00168 virtual void on_fetch_all_pre() = 0;
00169 virtual void on_fetch_pre(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
00170 virtual void on_fetch_post(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
00171 virtual void on_fetch_all_post() = 0;
00172
00173 virtual void on_install_all_pre() = 0;
00174 virtual void on_install_pre(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
00175 virtual void on_install_post(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
00176 virtual void on_install_fail(const DepListEntry &, const int x, const int y, const int s, const int f) = 0;
00177 virtual void on_install_all_post() = 0;
00178
00179 virtual void on_skip_unsatisfied(const DepListEntry &, const PackageDepSpec &,
00180 const int x, const int y, const int s, const int f) = 0;
00181 virtual void on_skip_dependent(const DepListEntry &, const std::tr1::shared_ptr<const PackageID> &,
00182 const int x, const int y, const int s, const int f) = 0;
00183 virtual void on_skip_already_done(const DepListEntry &, const int, const int, const int, const int) = 0;
00184
00185 virtual void on_clean_pre(const DepListEntry &,
00186 const PackageID &,
00187 const int x, const int y, const int s, const int f) = 0;
00188 virtual void on_clean_post(const DepListEntry &,
00189 const PackageID &,
00190 const int x, const int y, const int s, const int f) = 0;
00191 virtual void on_clean_fail(const DepListEntry &,
00192 const PackageID &,
00193 const int x, const int y, const int s, const int f) = 0;
00194
00195 virtual void on_update_world_pre() = 0;
00196 virtual void on_update_world(const PackageDepSpec &) = 0;
00197 virtual void on_update_world(const SetName &) = 0;
00198 virtual void on_update_world_skip(const PackageDepSpec &, const std::string &) = 0;
00199 virtual void on_update_world_skip(const SetName &, const std::string &) = 0;
00200 virtual void on_update_world_post() = 0;
00201 virtual void on_preserve_world() = 0;
00202
00203 virtual void on_installed_paludis();
00204
00205 virtual void on_ambiguous_package_name_error(const AmbiguousPackageNameError &) = 0;
00206 virtual void on_no_such_package_error(const NoSuchPackageError &) = 0;
00207 virtual void on_all_masked_error(const AllMaskedError &) = 0;
00208 virtual void on_additional_requirements_not_met_error(const AdditionalRequirementsNotMetError &) = 0;
00209 virtual void on_dep_list_error(const DepListError &) = 0;
00210 virtual void on_had_both_package_and_set_targets_error(const HadBothPackageAndSetTargets &) = 0;
00211 virtual void on_multiple_set_targets_specified(const MultipleSetTargetsSpecified &) = 0;
00212
00213 virtual void on_install_action_error(const std::tr1::shared_ptr<OutputManager> &, const ActionError &) = 0;
00214 virtual void on_fetch_action_error(const std::tr1::shared_ptr<OutputManager> &, const FetchActionError &) = 0;
00215
00216 virtual void on_phase_skip(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
00217 virtual void on_phase_abort(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
00218 virtual void on_phase_skip_until(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
00219 virtual void on_phase_proceed_conditionally(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
00220 virtual void on_phase_proceed_unconditionally(const std::tr1::shared_ptr<OutputManager> & output_manager, const std::string & phase) = 0;
00221
00222
00223
00224
00225
00226
00227 virtual void world_update_set(const SetName &);
00228 virtual void world_update_packages(const std::tr1::shared_ptr<const SetSpecTree> &);
00229
00230
00231
00232
00233
00234
00235 virtual void execute();
00236
00237
00238
00239
00240 const DepList & dep_list() const PALUDIS_ATTRIBUTE((warn_unused_result));
00241
00242
00243
00244
00245 Environment * environment() PALUDIS_ATTRIBUTE((warn_unused_result));
00246
00247
00248
00249
00250 const Environment * environment() const PALUDIS_ATTRIBUTE((warn_unused_result));
00251
00252
00253
00254
00255 virtual HookResult perform_hook(const Hook &) const
00256 PALUDIS_ATTRIBUTE((warn_unused_result));
00257
00258
00259
00260
00261 virtual bool had_resolution_failures() const PALUDIS_ATTRIBUTE((warn_unused_result));
00262
00263
00264
00265
00266 virtual bool had_action_failures() const PALUDIS_ATTRIBUTE((warn_unused_result));
00267
00268
00269
00270
00271 std::string serialise(const bool undo_failures) const PALUDIS_ATTRIBUTE((warn_unused_result));
00272
00273
00274
00275
00276 std::string serialised_format() const PALUDIS_ATTRIBUTE((warn_unused_result));
00277 };
00278 }
00279
00280 #endif