aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-09 14:39:23 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-09 14:39:23 +0000
commit768e6a2a4f80d4589e262f3241cdbc2273e029a5 (patch)
tree990c1856d2d1af619e103f16ac1361ad90a0dd4f
parentf8468b0fa0eb873acbfe9ddf6024bfbb6968eb08 (diff)
downloadpaludis-768e6a2a4f80d4589e262f3241cdbc2273e029a5.tar.gz
paludis-768e6a2a4f80d4589e262f3241cdbc2273e029a5.tar.xz
Get the output manager from the environment.
-rw-r--r--paludis/action.hh20
-rw-r--r--paludis/environment-fwd.hh6
-rw-r--r--paludis/environment.cc75
-rw-r--r--paludis/environment.hh84
-rw-r--r--paludis/environments/no_config/no_config_environment.cc7
-rw-r--r--paludis/environments/no_config/no_config_environment.hh3
-rw-r--r--paludis/environments/paludis/paludis_environment.cc7
-rw-r--r--paludis/environments/paludis/paludis_environment.hh3
-rw-r--r--paludis/environments/portage/portage_environment.cc7
-rw-r--r--paludis/environments/portage/portage_environment.hh3
-rw-r--r--paludis/environments/test/test_environment.cc7
-rw-r--r--paludis/environments/test/test_environment.hh2
-rw-r--r--paludis/install_task.cc45
-rw-r--r--paludis/install_task.hh3
-rw-r--r--paludis/repositories/accounts/accounts_id.cc5
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc5
-rw-r--r--paludis/repositories/e/e_repository_entries.hh7
-rw-r--r--paludis/repositories/e/ebuild_entries.cc48
-rw-r--r--paludis/repositories/e/ebuild_entries.hh8
-rw-r--r--paludis/repositories/unpackaged/installed_id.cc3
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc6
-rw-r--r--paludis/uninstall_task.cc13
-rw-r--r--python/action.cc11
-rw-r--r--python/environment.cc7
-rw-r--r--ruby/action.cc11
-rw-r--r--src/clients/accerso/accerso.cc12
-rw-r--r--src/output/console_install_task.cc2
27 files changed, 343 insertions, 67 deletions
diff --git a/paludis/action.hh b/paludis/action.hh
index 28eff0e..f79acca 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -54,7 +54,7 @@ namespace paludis
struct failed_automatic_fetching;
struct failed_integrity_checks;
struct fetch_unneeded;
- struct output_manager;
+ struct make_output_manager;
struct requires_manual_fetching;
struct safe_resume;
struct target_file;
@@ -79,9 +79,13 @@ namespace paludis
NamedValue<n::fetch_unneeded, bool> fetch_unneeded;
/**
+ * This is a function to avoid chicken / egg problems when using
+ * Environment::create_output_manager.
+ *
* \since 0.36
*/
- NamedValue<n::output_manager, std::tr1::shared_ptr<OutputManager> > output_manager;
+ NamedValue<n::make_output_manager, std::tr1::function<std::tr1::shared_ptr<OutputManager> (
+ const FetchAction &)> > make_output_manager;
NamedValue<n::safe_resume, bool> safe_resume;
};
@@ -98,9 +102,13 @@ namespace paludis
NamedValue<n::destination, std::tr1::shared_ptr<Repository> > destination;
/**
+ * This is a function to avoid chicken / egg problems when using
+ * Environment::create_output_manager.
+ *
* \since 0.36
*/
- NamedValue<n::output_manager, std::tr1::shared_ptr<OutputManager> > output_manager;
+ NamedValue<n::make_output_manager, std::tr1::function<std::tr1::shared_ptr<OutputManager> (
+ const InstallAction &)> > make_output_manager;
NamedValue<n::used_this_for_config_protect, std::tr1::function<void (const std::string &)> > used_this_for_config_protect;
NamedValue<n::want_phase, std::tr1::function<WantPhase (const std::string &)> > want_phase;
@@ -118,9 +126,13 @@ namespace paludis
NamedValue<n::config_protect, std::string> config_protect;
/**
+ * This is a function to avoid chicken / egg problems when using
+ * Environment::create_output_manager.
+ *
* \since 0.36
*/
- NamedValue<n::output_manager, std::tr1::shared_ptr<OutputManager> > output_manager;
+ NamedValue<n::make_output_manager, std::tr1::function<std::tr1::shared_ptr<OutputManager> (
+ const UninstallAction &)> > make_output_manager;
};
/**
diff --git a/paludis/environment-fwd.hh b/paludis/environment-fwd.hh
index c0a4284..2b98d06 100644
--- a/paludis/environment-fwd.hh
+++ b/paludis/environment-fwd.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -41,6 +41,10 @@ namespace paludis
typedef Sequence<std::string> MirrorsSequence;
class Environment;
+
+ struct CreateOutputManagerInfo;
+ struct CreateOutputManagerForPackageIDActionInfo;
+ struct CreateOutputManagerForRepositorySyncInfo;
}
#endif
diff --git a/paludis/environment.cc b/paludis/environment.cc
index aad5bf4..a59b2c7 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -23,6 +23,7 @@
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/wrapped_output_iterator-impl.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
using namespace paludis;
@@ -33,3 +34,75 @@ Environment::~Environment()
{
}
+namespace paludis
+{
+ template <>
+ struct Implementation<CreateOutputManagerForPackageIDActionInfo>
+ {
+ const std::tr1::shared_ptr<const PackageID> id;
+ const Action & action;
+
+ Implementation(const std::tr1::shared_ptr<const PackageID> & i,
+ const Action & a) :
+ id(i),
+ action(a)
+ {
+ }
+ };
+
+ template <>
+ struct Implementation<CreateOutputManagerForRepositorySyncInfo>
+ {
+ const Repository & repo;
+
+ Implementation(const Repository & r) :
+ repo(r)
+ {
+ }
+ };
+}
+
+CreateOutputManagerForPackageIDActionInfo::CreateOutputManagerForPackageIDActionInfo(
+ const std::tr1::shared_ptr<const PackageID> & i,
+ const Action & a) :
+ PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>(
+ new Implementation<CreateOutputManagerForPackageIDActionInfo>(i, a))
+{
+}
+
+CreateOutputManagerForPackageIDActionInfo::~CreateOutputManagerForPackageIDActionInfo()
+{
+}
+
+const std::tr1::shared_ptr<const PackageID>
+CreateOutputManagerForPackageIDActionInfo::package_id() const
+{
+ return _imp->id;
+}
+
+const Action &
+CreateOutputManagerForPackageIDActionInfo::action() const
+{
+ return _imp->action;
+}
+
+CreateOutputManagerForRepositorySyncInfo::CreateOutputManagerForRepositorySyncInfo(
+ const Repository & r) :
+ PrivateImplementationPattern<CreateOutputManagerForRepositorySyncInfo>(
+ new Implementation<CreateOutputManagerForRepositorySyncInfo>(r))
+{
+}
+
+CreateOutputManagerForRepositorySyncInfo::~CreateOutputManagerForRepositorySyncInfo()
+{
+}
+
+const Repository &
+CreateOutputManagerForRepositorySyncInfo::repository() const
+{
+ return _imp->repo;
+}
+
+template class PrivateImplementationPattern<CreateOutputManagerForRepositorySyncInfo>;
+template class PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>;
+
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 467b1a8..e1cdd08 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -25,6 +25,9 @@
#include <paludis/util/options-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/util/tribool-fwd.hh>
+#include <paludis/util/simple_visitor.hh>
+#include <paludis/util/output_manager-fwd.hh>
+#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/name-fwd.hh>
#include <paludis/hook-fwd.hh>
#include <paludis/repository-fwd.hh>
@@ -36,6 +39,7 @@
#include <paludis/selection-fwd.hh>
#include <paludis/metadata_key_holder.hh>
#include <paludis/choice-fwd.hh>
+#include <paludis/action-fwd.hh>
/** \file
* Declarations for the Environment class.
@@ -50,6 +54,67 @@
namespace paludis
{
/**
+ * Information for Environment::create_output_manager.
+ *
+ * \since 0.36
+ * \ingroup g_environment
+ * \see Environment::create_output_manager
+ */
+ class PALUDIS_VISIBLE CreateOutputManagerInfo :
+ public virtual DeclareAbstractAcceptMethods<CreateOutputManagerInfo, MakeTypeList<
+ CreateOutputManagerForPackageIDActionInfo,
+ CreateOutputManagerForRepositorySyncInfo
+ >::Type>
+ {
+ };
+
+ /**
+ * Information for Environment::create_output_manager, if we're performing a
+ * PackageID action.
+ *
+ * \since 0.36
+ * \ingroup g_environment
+ * \see Environment::create_output_manager
+ */
+ class PALUDIS_VISIBLE CreateOutputManagerForPackageIDActionInfo :
+ private PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>,
+ public CreateOutputManagerInfo,
+ public ImplementAcceptMethods<CreateOutputManagerInfo, CreateOutputManagerForPackageIDActionInfo>
+ {
+ public:
+ CreateOutputManagerForPackageIDActionInfo(
+ const std::tr1::shared_ptr<const PackageID> & id,
+ const Action & action);
+
+ ~CreateOutputManagerForPackageIDActionInfo();
+
+ const std::tr1::shared_ptr<const PackageID> package_id() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const Action & action() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ /**
+ * Information for Environment::create_output_manager, if we're performing a
+ * Repository sync.
+ *
+ * \since 0.36
+ * \ingroup g_environment
+ * \see Environment::create_output_manager
+ */
+ class PALUDIS_VISIBLE CreateOutputManagerForRepositorySyncInfo :
+ private PrivateImplementationPattern<CreateOutputManagerForRepositorySyncInfo>,
+ public CreateOutputManagerInfo,
+ public ImplementAcceptMethods<CreateOutputManagerInfo, CreateOutputManagerForRepositorySyncInfo>
+ {
+ public:
+ CreateOutputManagerForRepositorySyncInfo(
+ const Repository & repo);
+
+ ~CreateOutputManagerForRepositorySyncInfo();
+
+ const Repository & repository() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
+
+ /**
* Represents a working environment, which contains an available packages
* database and provides various methods for querying package visibility
* and options.
@@ -365,7 +430,26 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const = 0;
///\}
+
+ ///\name Output management
+ ///\{
+
+ /**
+ * Create an output manager.
+ *
+ * \since 0.36
+ */
+ virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
+ const CreateOutputManagerInfo &) const = 0;
+
+ ///\}
};
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<CreateOutputManagerForRepositorySyncInfo>;
+ extern template class PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>;
+#endif
+
}
#endif
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 48a5953..eb07ec5 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -35,6 +35,7 @@
#include <paludis/util/graph-impl.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/member_iterator-impl.hh>
+#include <paludis/util/standard_output_manager.hh>
#include <paludis/distribution.hh>
#include <paludis/package_database.hh>
#include <paludis/hook.hh>
@@ -632,3 +633,9 @@ NoConfigEnvironment::known_choice_value_names(
return make_shared_ptr(new Set<UnprefixedChoiceName>);
}
+const std::tr1::shared_ptr<OutputManager>
+NoConfigEnvironment::create_output_manager(const CreateOutputManagerInfo &) const
+{
+ return make_shared_ptr(new StandardOutputManager);
+}
+
diff --git a/paludis/environments/no_config/no_config_environment.hh b/paludis/environments/no_config/no_config_environment.hh
index e41a613..08307c1 100644
--- a/paludis/environments/no_config/no_config_environment.hh
+++ b/paludis/environments/no_config/no_config_environment.hh
@@ -202,6 +202,9 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
+
+ virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
+ const CreateOutputManagerInfo &) const;
};
}
diff --git a/paludis/environments/paludis/paludis_environment.cc b/paludis/environments/paludis/paludis_environment.cc
index bf4d050..2f72d38 100644
--- a/paludis/environments/paludis/paludis_environment.cc
+++ b/paludis/environments/paludis/paludis_environment.cc
@@ -55,6 +55,7 @@
#include <paludis/util/options.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/standard_output_manager.hh>
#include <tr1/functional>
#include <functional>
@@ -550,3 +551,9 @@ PaludisEnvironment::known_choice_value_names(
return _imp->config->use_conf()->known_choice_value_names(id, choice);
}
+const std::tr1::shared_ptr<OutputManager>
+PaludisEnvironment::create_output_manager(const CreateOutputManagerInfo &) const
+{
+ return make_shared_ptr(new StandardOutputManager);
+}
+
diff --git a/paludis/environments/paludis/paludis_environment.hh b/paludis/environments/paludis/paludis_environment.hh
index b8159c9..166e687 100644
--- a/paludis/environments/paludis/paludis_environment.hh
+++ b/paludis/environments/paludis/paludis_environment.hh
@@ -162,6 +162,9 @@ namespace paludis
const std::tr1::shared_ptr<const Choice> &
) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
+ const CreateOutputManagerInfo &) const;
};
}
#endif
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 70da1c2..7334611 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -37,6 +37,7 @@
#include <paludis/util/config_file.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/standard_output_manager.hh>
#include <paludis/hooker.hh>
#include <paludis/hook.hh>
#include <paludis/mask.hh>
@@ -1006,3 +1007,9 @@ PortageEnvironment::set_names() const
return result;
}
+const std::tr1::shared_ptr<OutputManager>
+PortageEnvironment::create_output_manager(const CreateOutputManagerInfo &) const
+{
+ return make_shared_ptr(new StandardOutputManager);
+}
+
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index b5d1715..0e2a8d5 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -168,6 +168,9 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > format_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > config_location_key() const;
+
+ virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
+ const CreateOutputManagerInfo &) const;
};
}
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 58a71b3..57e52fc 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -29,6 +29,7 @@
#include <paludis/util/destringify.hh>
#include <paludis/util/system.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/standard_output_manager.hh>
#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/hook.hh>
@@ -276,3 +277,9 @@ TestEnvironment::known_choice_value_names(
return make_shared_ptr(new Set<UnprefixedChoiceName>);
}
+const std::tr1::shared_ptr<OutputManager>
+TestEnvironment::create_output_manager(const CreateOutputManagerInfo &) const
+{
+ return make_shared_ptr(new StandardOutputManager);
+}
+
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 5bad55b..6cf563e 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -137,6 +137,8 @@ namespace paludis
) const
PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
+ const CreateOutputManagerInfo &) const;
};
}
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 81765d0..7c8600f 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -67,6 +67,12 @@ template class WrappedForwardIterator<InstallTask::TargetsConstIteratorTag, cons
namespace
{
+ std::tr1::shared_ptr<OutputManager> make_output_manager_for_action(
+ const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const Action & a)
+ {
+ return env->create_output_manager(CreateOutputManagerForPackageIDActionInfo(id, a));
+ }
+
WantPhase want_all_phases_function(InstallTask * const task, bool & done_any, const std::string & phase)
{
task->on_phase_proceed_unconditionally(phase);
@@ -116,7 +122,6 @@ namespace paludis
{
Environment * const env;
DepList dep_list;
- FetchActionOptions fetch_options;
std::string config_protect;
@@ -128,6 +133,7 @@ namespace paludis
bool pretend;
bool fetch_only;
bool preserve_world;
+ bool safe_resume;
bool had_set_targets;
bool had_package_targets;
@@ -149,19 +155,13 @@ namespace paludis
std::tr1::shared_ptr<const DestinationsSet> d) :
env(e),
dep_list(e, o),
- fetch_options(
- make_named_values<FetchActionOptions>(
- value_for<n::exclude_unmirrorable>(false),
- value_for<n::fetch_unneeded>(false),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager)),
- value_for<n::safe_resume>(false)
- )),
config_protect(""),
targets(new SetSpecTree(make_shared_ptr(new AllDepSpec))),
destinations(d),
pretend(false),
fetch_only(false),
preserve_world(false),
+ safe_resume(false),
had_set_targets(false),
had_package_targets(false),
override_target_type(false),
@@ -754,7 +754,8 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
SupportsActionTest<FetchAction> test_fetch;
if (dep->package_id()->supports_action(test_fetch))
{
- FetchAction fetch_action(_imp->fetch_options);
+ FetchActionOptions fetch_options(make_fetch_action_options(*dep));
+ FetchAction fetch_action(fetch_options);
dep->package_id()->perform_action(fetch_action);
}
@@ -762,7 +763,8 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
{
InstallActionOptions install_options(make_named_values<InstallActionOptions>(
value_for<n::destination>(dep->destination()),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager)),
+ value_for<n::make_output_manager>(std::tr1::bind(&make_output_manager_for_action,
+ _imp->env, dep->package_id(), std::tr1::placeholders::_1)),
value_for<n::used_this_for_config_protect>(std::tr1::bind(
&Implementation<InstallTask>::assign_config_protect,
_imp.get(), std::tr1::placeholders::_1)),
@@ -877,7 +879,8 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
UninstallAction uninstall_action(
make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(_imp->config_protect),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager))
+ value_for<n::make_output_manager>(std::tr1::bind(&make_output_manager_for_action,
+ _imp->env, dep->package_id(), std::tr1::placeholders::_1))
));
(*c)->perform_action(uninstall_action);
}
@@ -1267,7 +1270,7 @@ InstallTask::on_installed_paludis()
void
InstallTask::set_safe_resume(const bool value)
{
- _imp->fetch_options.safe_resume() = value;
+ _imp->safe_resume = value;
}
HookResult
@@ -1762,12 +1765,6 @@ InstallTask::already_done(const DepListEntry & e) const
return v.result;
}
-FetchActionOptions &
-InstallTask::fetch_action_options()
-{
- return _imp->fetch_options;
-}
-
void
InstallTask::set_skip_phases(const std::tr1::shared_ptr<const Set<std::string> > & s)
{
@@ -1804,3 +1801,15 @@ InstallTask::set_phase_options_apply_to_all(const bool b)
_imp->phase_options_apply_to_all = b;
}
+FetchActionOptions
+InstallTask::make_fetch_action_options(const DepListEntry & dep) const
+{
+ return make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(false),
+ value_for<n::fetch_unneeded>(false),
+ value_for<n::make_output_manager>(std::tr1::bind(&make_output_manager_for_action,
+ _imp->env, dep.package_id(), std::tr1::placeholders::_1)),
+ value_for<n::safe_resume>(_imp->safe_resume)
+ );
+}
+
diff --git a/paludis/install_task.hh b/paludis/install_task.hh
index 51a1100..927ffc4 100644
--- a/paludis/install_task.hh
+++ b/paludis/install_task.hh
@@ -81,7 +81,8 @@ namespace paludis
///\}
bool already_done(const DepListEntry &) const PALUDIS_ATTRIBUTE((warn_unused_result));
- FetchActionOptions & fetch_action_options() PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ FetchActionOptions make_fetch_action_options(const DepListEntry &) const PALUDIS_ATTRIBUTE((warn_unused_result));
public:
///\name Basic operations
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index 1188642..9bd26a7 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -432,6 +432,9 @@ AccountsID::perform_action(Action & action) const
+ "' to destination '" + stringify(install_action->options.destination()->name())
+ "' because destination does not provide destination_interface");
+ std::tr1::shared_ptr<OutputManager> output_manager(install_action->options.make_output_manager()(
+ *install_action));
+
switch (install_action->options.want_phase()("merge"))
{
case wp_yes:
@@ -441,7 +444,7 @@ AccountsID::perform_action(Action & action) const
value_for<n::environment_file>(FSEntry("/dev/null")),
value_for<n::image_dir>(fs_location_key()->value()),
value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
- value_for<n::output_manager>(install_action->options.output_manager()),
+ value_for<n::output_manager>(output_manager),
value_for<n::package_id>(shared_from_this()),
value_for<n::used_this_for_config_protect>(install_action->options.used_this_for_config_protect())
));
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index b2155c9..748fc30 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -878,8 +878,9 @@ namespace
void visit(const UninstallAction & a)
{
- std::tr1::static_pointer_cast<const EInstalledRepository>(id->repository())->perform_uninstall(id, false, a.options.config_protect(),
- a.options.output_manager());
+ std::tr1::shared_ptr<OutputManager> output_manager(a.options.make_output_manager()(a));
+ std::tr1::static_pointer_cast<const EInstalledRepository>(id->repository())->perform_uninstall(
+ id, false, a.options.config_protect(), output_manager);
}
void visit(const InstalledAction &)
diff --git a/paludis/repositories/e/e_repository_entries.hh b/paludis/repositories/e/e_repository_entries.hh
index 612c74d..83031fa 100644
--- a/paludis/repositories/e/e_repository_entries.hh
+++ b/paludis/repositories/e/e_repository_entries.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -82,13 +82,14 @@ namespace paludis
/**
* Handle an install.
*/
- virtual void install(const std::tr1::shared_ptr<const ERepositoryID> &, const InstallActionOptions &,
+ virtual void install(const std::tr1::shared_ptr<const ERepositoryID> &, const InstallAction &,
const std::tr1::shared_ptr<const ERepositoryProfile> &) const = 0;
/**
* Handle a fetch.
*/
- virtual void fetch(const std::tr1::shared_ptr<const ERepositoryID> &, const FetchActionOptions &,
+ virtual void fetch(const std::tr1::shared_ptr<const ERepositoryID> &,
+ const FetchAction &,
const std::tr1::shared_ptr<const ERepositoryProfile> &) const = 0;
/**
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index cc715d9..e3a8a6e 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -349,7 +349,7 @@ namespace
void
EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
- const FetchActionOptions & o, const std::tr1::shared_ptr<const ERepositoryProfile> & p) const
+ const FetchAction & fetch_action, const std::tr1::shared_ptr<const ERepositoryProfile> & p) const
{
using namespace std::tr1::placeholders;
@@ -426,6 +426,8 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
archives = strip_trailing(archives, " ");
all_archives = strip_trailing(all_archives, " ");
+ std::tr1::shared_ptr<OutputManager> output_manager(fetch_action.options.make_output_manager()(fetch_action));
+
if (id->fetches_key())
{
/* always use mirror://gentoo/, where gentoo is the name of our first master repository,
@@ -435,14 +437,16 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
stringify((*_imp->e_repository->params().master_repositories()->begin())->name()) :
stringify(_imp->e_repository->name()));
FetchVisitor f(_imp->params.environment(), id, *id->eapi(),
- _imp->e_repository->params().distdir(), o.fetch_unneeded(), fetch_userpriv_ok, mirrors_name,
- id->fetches_key()->initial_label(), o.safe_resume(), o.output_manager());
+ _imp->e_repository->params().distdir(), fetch_action.options.fetch_unneeded(),
+ fetch_userpriv_ok, mirrors_name,
+ id->fetches_key()->initial_label(), fetch_action.options.safe_resume(),
+ output_manager);
id->fetches_key()->value()->root()->accept(f);
CheckFetchedFilesVisitor c(_imp->environment, id, _imp->e_repository->params().distdir(),
- o.fetch_unneeded(), fetch_restrict,
+ fetch_action.options.fetch_unneeded(), fetch_restrict,
((_imp->e_repository->layout()->package_directory(id->name())) / "Manifest"),
_imp->e_repository->params().use_manifest(),
- o.output_manager(), o.exclude_unmirrorable());
+ output_manager, fetch_action.options.exclude_unmirrorable());
id->fetches_key()->value()->root()->accept(c);
if (c.need_nofetch())
@@ -483,7 +487,7 @@ EbuildEntries::fetch(const std::tr1::shared_ptr<const ERepositoryID> & id,
value_for<n::a>(archives),
value_for<n::aa>(all_archives),
value_for<n::expand_vars>(expand_vars),
- value_for<n::output_manager>(o.output_manager()),
+ value_for<n::output_manager>(output_manager),
value_for<n::profiles>(_imp->params.profiles()),
value_for<n::root>("/"),
value_for<n::use>(use),
@@ -520,12 +524,14 @@ EbuildEntries::pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> & i
void
EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
- const InstallActionOptions & o, const std::tr1::shared_ptr<const ERepositoryProfile> & p) const
+ const InstallAction & install_action, const std::tr1::shared_ptr<const ERepositoryProfile> & p) const
{
using namespace std::tr1::placeholders;
Context context("When installing '" + stringify(*id) + "':");
+ std::tr1::shared_ptr<OutputManager> output_manager(install_action.options.make_output_manager()(install_action));
+
bool userpriv_restrict, test_restrict, strip_restrict;
{
DepSpecFlattener<PlainTextSpecTree, PlainTextDepSpec> restricts(_imp->params.environment());
@@ -620,7 +626,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
bool skip(false);
do
{
- switch (o.want_phase()(phase->equal_option("skipname")))
+ switch (install_action.options.want_phase()(phase->equal_option("skipname")))
{
case wp_yes:
continue;
@@ -644,27 +650,27 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
if (can_skip_phase(id, *phase))
{
- o.output_manager()->stdout_stream() << "--- No need to do anything for " << phase->equal_option("skipname") << " phase" << std::endl;
+ output_manager->stdout_stream() << "--- No need to do anything for " << phase->equal_option("skipname") << " phase" << std::endl;
continue;
}
if (phase->option("merge"))
{
- if (! (*o.destination()).destination_interface())
+ if (! (*install_action.options.destination()).destination_interface())
throw InstallActionError("Can't install '" + stringify(*id)
- + "' to destination '" + stringify(o.destination()->name())
+ + "' to destination '" + stringify(install_action.options.destination()->name())
+ "' because destination does not provide destination_interface");
- (*o.destination()).destination_interface()->merge(
+ (*install_action.options.destination()).destination_interface()->merge(
make_named_values<MergeParams>(
value_for<n::environment_file>(_imp->params.builddir() / (stringify(id->name().category()) + "-" +
stringify(id->name().package()) + "-" + stringify(id->version())) / "temp" / "loadsaveenv"),
value_for<n::image_dir>(_imp->params.builddir() / (stringify(id->name().category()) + "-" +
stringify(id->name().package()) + "-" + stringify(id->version())) / "image"),
value_for<n::options>(id->eapi()->supported()->merger_options()),
- value_for<n::output_manager>(o.output_manager()),
+ value_for<n::output_manager>(output_manager),
value_for<n::package_id>(id),
- value_for<n::used_this_for_config_protect>(o.used_this_for_config_protect())
+ value_for<n::used_this_for_config_protect>(install_action.options.used_this_for_config_protect())
));
}
else if (phase->option("strip"))
@@ -672,8 +678,8 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
if (! strip_restrict)
{
std::string libdir("lib");
- FSEntry root(o.destination()->installed_root_key() ?
- stringify(o.destination()->installed_root_key()->value()) : "/");
+ FSEntry root(install_action.options.destination()->installed_root_key() ?
+ stringify(install_action.options.destination()->installed_root_key()->value()) : "/");
if ((root / "usr" / "lib").is_symbolic_link())
{
libdir = (root / "usr" / "lib").readlink();
@@ -693,7 +699,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
stringify(id->name().package()) + "-" + stringify(id->version())) / "image" / "usr" / libdir / "debug"),
value_for<n::image_dir>(_imp->params.builddir() / (stringify(id->name().category()) + "-" +
stringify(id->name().package()) + "-" + stringify(id->version())) / "image"),
- value_for<n::output_manager>(o.output_manager()),
+ value_for<n::output_manager>(output_manager),
value_for<n::package_id>(id),
value_for<n::split>(split_choice && split_choice->enabled()),
value_for<n::strip>(strip_choice && strip_choice->enabled())
@@ -702,8 +708,8 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
}
}
else if ((! phase->option("prepost")) ||
- ((*o.destination()).destination_interface() &&
- (*o.destination()).destination_interface()->want_pre_post_phases()))
+ ((*install_action.options.destination()).destination_interface() &&
+ (*install_action.options.destination()).destination_interface()->want_pre_post_phases()))
{
if (phase->option("optional_tests"))
{
@@ -753,7 +759,9 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
value_for<n::expand_vars>(expand_vars),
value_for<n::loadsaveenv_dir>(_imp->params.builddir() / (stringify(id->name().category()) + "-" + stringify(id->name().package()) + "-" + stringify(id->version())) / "temp"),
value_for<n::profiles>(_imp->params.profiles()),
- value_for<n::root>(o.destination()->installed_root_key() ? stringify(o.destination()->installed_root_key()->value()) : "/"),
+ value_for<n::root>(install_action.options.destination()->installed_root_key() ?
+ stringify(install_action.options.destination()->installed_root_key()->value()) :
+ "/"),
value_for<n::slot>(id->slot_key() ? stringify(id->slot_key()->value()) : ""),
value_for<n::use>(use),
value_for<n::use_expand>(join(p->use_expand()->begin(), p->use_expand()->end(), " ")),
diff --git a/paludis/repositories/e/ebuild_entries.hh b/paludis/repositories/e/ebuild_entries.hh
index f1c6e86..07d7aa3 100644
--- a/paludis/repositories/e/ebuild_entries.hh
+++ b/paludis/repositories/e/ebuild_entries.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh
+ * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -81,13 +81,15 @@ namespace paludis
virtual std::string get_environment_variable(const std::tr1::shared_ptr<const ERepositoryID> &, const std::string & var,
const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
- virtual void fetch(const std::tr1::shared_ptr<const ERepositoryID> &, const FetchActionOptions &,
+ virtual void fetch(const std::tr1::shared_ptr<const ERepositoryID> &,
+ const FetchAction &,
const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
virtual void pretend_fetch(const std::tr1::shared_ptr<const ERepositoryID> &, PretendFetchAction &,
const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
- virtual void install(const std::tr1::shared_ptr<const ERepositoryID> &, const InstallActionOptions &,
+ virtual void install(const std::tr1::shared_ptr<const ERepositoryID> &,
+ const InstallAction &,
const std::tr1::shared_ptr<const ERepositoryProfile> &) const;
virtual bool pretend(const std::tr1::shared_ptr<const ERepositoryID> &,
diff --git a/paludis/repositories/unpackaged/installed_id.cc b/paludis/repositories/unpackaged/installed_id.cc
index 2ccd92d..097c2f2 100644
--- a/paludis/repositories/unpackaged/installed_id.cc
+++ b/paludis/repositories/unpackaged/installed_id.cc
@@ -774,7 +774,8 @@ namespace
void visit(UninstallAction & a)
{
- id->uninstall(false, a.options.output_manager());
+ std::tr1::shared_ptr<OutputManager> output_manager(a.options.make_output_manager()(a));
+ id->uninstall(false, output_manager);
}
};
}
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 31b7aa9..f766fea 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -295,6 +295,8 @@ UnpackagedID::perform_action(Action & action) const
+ "' to destination '" + stringify(install_action->options.destination()->name())
+ "' because destination does not provide destination_interface");
+ std::tr1::shared_ptr<OutputManager> output_manager(install_action->options.make_output_manager()(*install_action));
+
std::string libdir("lib");
FSEntry root(install_action->options.destination()->installed_root_key() ?
stringify(install_action->options.destination()->installed_root_key()->value()) : "/");
@@ -319,7 +321,7 @@ UnpackagedID::perform_action(Action & action) const
UnpackagedStripper stripper(make_named_values<UnpackagedStripperOptions>(
value_for<n::debug_dir>(fs_location_key()->value() / "usr" / libdir / "debug"),
value_for<n::image_dir>(fs_location_key()->value()),
- value_for<n::output_manager>(install_action->options.output_manager()),
+ value_for<n::output_manager>(output_manager),
value_for<n::package_id>(shared_from_this()),
value_for<n::split>(split_choice && split_choice->enabled()),
value_for<n::strip>(strip_choice && strip_choice->enabled())
@@ -348,7 +350,7 @@ UnpackagedID::perform_action(Action & action) const
value_for<n::environment_file>(FSEntry("/dev/null")),
value_for<n::image_dir>(fs_location_key()->value()),
value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
- value_for<n::output_manager>(install_action->options.output_manager()),
+ value_for<n::output_manager>(output_manager),
value_for<n::package_id>(shared_from_this()),
value_for<n::used_this_for_config_protect>(install_action->options.used_this_for_config_protect())
));
diff --git a/paludis/uninstall_task.cc b/paludis/uninstall_task.cc
index ae45f93..cef0aaa 100644
--- a/paludis/uninstall_task.cc
+++ b/paludis/uninstall_task.cc
@@ -35,7 +35,6 @@
#include <paludis/util/wrapped_forward_iterator-impl.hh>
#include <paludis/util/options.hh>
#include <paludis/util/make_named_values.hh>
-#include <paludis/util/standard_output_manager.hh>
#include <paludis/package_database.hh>
#include <paludis/hook.hh>
#include <paludis/dep_tag.hh>
@@ -51,6 +50,15 @@ using namespace paludis;
template class WrappedForwardIterator<AmbiguousUnmergeTargetError::ConstIteratorTag, const std::tr1::shared_ptr<const PackageID> >;
+namespace
+{
+ std::tr1::shared_ptr<OutputManager> make_output_manager_for_action(
+ const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const Action & a)
+ {
+ return env->create_output_manager(CreateOutputManagerForPackageIDActionInfo(id, a));
+ }
+}
+
AmbiguousUnmergeTargetError::AmbiguousUnmergeTargetError(const std::string & t,
const std::tr1::shared_ptr<const PackageIDSequence> m) throw () :
Exception("Ambiguous unmerge target '" + t + "'"),
@@ -361,7 +369,8 @@ UninstallTask::execute()
UninstallAction uninstall_action(
make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager))
+ value_for<n::make_output_manager>(std::tr1::bind(&make_output_manager_for_action,
+ _imp->env, i->package_id(), std::tr1::placeholders::_1))
));
i->package_id()->perform_action(uninstall_action);
}
diff --git a/python/action.cc b/python/action.cc
index b725160..5c55ee3 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -60,12 +60,17 @@ namespace
return wp_yes;
}
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
InstallActionOptions * make_install_action_options(
const std::tr1::shared_ptr<paludis::Repository> & r)
{
return new InstallActionOptions(make_named_values<InstallActionOptions>(
value_for<n::destination>(r),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager)),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
@@ -76,7 +81,7 @@ namespace
{
return new UninstallActionOptions(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(c),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager))
+ value_for<n::make_output_manager>(&make_standard_output_manager)
));
}
@@ -89,7 +94,7 @@ namespace
return new FetchActionOptions(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(exclude_unmirrorable),
value_for<n::fetch_unneeded>(fetch_unneeded),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager)),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(safe_resume)
));
}
diff --git a/python/environment.cc b/python/environment.cc
index fe15bd8..7c7a4af 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -35,6 +35,7 @@
#include <paludis/util/tribool.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/standard_output_manager.hh>
using namespace paludis;
using namespace paludis::python;
@@ -427,6 +428,12 @@ class EnvironmentImplementationWrapper :
{
throw PythonMethodNotImplemented("EnvironmentImplementation", "known_choice_value_names");
}
+
+ virtual const std::tr1::shared_ptr<OutputManager> create_output_manager(
+ const CreateOutputManagerInfo &) const
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
};
struct NoConfigEnvironmentWrapper :
diff --git a/ruby/action.cc b/ruby/action.cc
index 78bb1d4..de77477 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -215,6 +215,11 @@ namespace
}
}
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
/*
* call-seq:
* FetchActionOptions.new(exclude_unmirrorable, fetch_unneeded, safe_resume) -> FetchActionOptions
@@ -257,7 +262,7 @@ namespace
ptr = new FetchActionOptions(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(v_exclude_unmirrorable),
value_for<n::fetch_unneeded>(v_fetch_unneeded),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager)),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(v_safe_resume)
));
@@ -516,7 +521,7 @@ namespace
ptr = new InstallActionOptions(make_named_values<InstallActionOptions>(
value_for<n::destination>(v_destination),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager)),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
@@ -602,7 +607,7 @@ namespace
ptr = new UninstallActionOptions(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(v_config_protect),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager))
+ value_for<n::make_output_manager>(&make_standard_output_manager)
));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<UninstallActionOptions>::free, ptr));
diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc
index 82142f5..f1dfc4c 100644
--- a/src/clients/accerso/accerso.cc
+++ b/src/clients/accerso/accerso.cc
@@ -49,6 +49,15 @@ using std::cout;
using std::cerr;
using std::endl;
+namespace
+{
+ std::tr1::shared_ptr<OutputManager> make_output_manager_for_action(
+ const Environment * const env, const std::tr1::shared_ptr<const PackageID> & id, const Action & a)
+ {
+ return env->create_output_manager(CreateOutputManagerForPackageIDActionInfo(id, a));
+ }
+}
+
int
main(int argc, char *argv[])
{
@@ -140,7 +149,8 @@ main(int argc, char *argv[])
FetchAction a(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(true),
value_for<n::fetch_unneeded>(true),
- value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager)),
+ value_for<n::make_output_manager>(std::tr1::bind(&make_output_manager_for_action,
+ &env, *i, std::tr1::placeholders::_1)),
value_for<n::safe_resume>(true)
));
if ((*i)->supports_action(SupportsActionTest<FetchAction>()))
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index bf06943..677d798 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -1260,7 +1260,7 @@ ConsoleInstallTask::display_merge_list_entry_distsize(const DepListEntry & d,
if (! d.package_id()->supports_action(action_test))
return;
- FindDistfilesSize action(fetch_action_options(), _already_downloaded);
+ FindDistfilesSize action(make_fetch_action_options(d), _already_downloaded);
d.package_id()->perform_action(action);
if (! action.size)