aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-09 16:07:13 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-09 16:07:13 +0000
commit58d9dd98d1bdfa81b810b9742c3f4cd93f6a5f8f (patch)
treebb8bf797880968675d55865997bc8ff72c66fcf3
parent768e6a2a4f80d4589e262f3241cdbc2273e029a5 (diff)
downloadpaludis-58d9dd98d1bdfa81b810b9742c3f4cd93f6a5f8f.tar.gz
paludis-58d9dd98d1bdfa81b810b9742c3f4cd93f6a5f8f.tar.xz
Update for output manager function
-rw-r--r--doc/api/cplusplus/examples/example_action.cc15
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc21
-rw-r--r--paludis/repositories/e/e_repository_TEST_ever.cc7
-rw-r--r--paludis/repositories/e/exndbam_repository_TEST.cc9
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc27
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc19
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc9
-rw-r--r--src/clients/appareo/appareo.cc7
8 files changed, 81 insertions, 33 deletions
diff --git a/doc/api/cplusplus/examples/example_action.cc b/doc/api/cplusplus/examples/example_action.cc
index d62f9df..45eacd8 100644
--- a/doc/api/cplusplus/examples/example_action.cc
+++ b/doc/api/cplusplus/examples/example_action.cc
@@ -23,6 +23,19 @@ using namespace examples;
using std::cout;
using std::endl;
+namespace
+{
+ /* Some actions need an OutputManager, but to avoid chicken / egg problems
+ * they take a function that creates an OutputManager as a parameter. Here
+ * we just use a StandardOutputManager, which sticks everything to stdout /
+ * stderr. More complex clients may use Environment::create_output_manager
+ * to use the user's preferences for logging etc. */
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+}
+
int main(int argc, char * argv[])
{
int exit_status(0);
@@ -63,7 +76,7 @@ int main(int argc, char * argv[])
FetchAction fetch_action(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(false),
- value_for<n::output_manager>(new StandardOutputManager()),
+ value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
));
try
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index f4b0b4a..2504bdf 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -58,6 +58,11 @@ using namespace paludis;
namespace
{
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
const std::string & k)
{
@@ -923,7 +928,7 @@ namespace test_cases
FetchAction action(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::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
));
@@ -1028,7 +1033,7 @@ namespace test_cases
FetchAction action(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::make_output_manager>(&make_standard_output_manager),
value_for<n::safe_resume>(true)
));
@@ -1100,7 +1105,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
@@ -1356,7 +1361,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
@@ -1451,7 +1456,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
@@ -1576,7 +1581,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
@@ -1779,7 +1784,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
@@ -2362,7 +2367,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
diff --git a/paludis/repositories/e/e_repository_TEST_ever.cc b/paludis/repositories/e/e_repository_TEST_ever.cc
index 6418889..0b71d1a 100644
--- a/paludis/repositories/e/e_repository_TEST_ever.cc
+++ b/paludis/repositories/e/e_repository_TEST_ever.cc
@@ -59,6 +59,11 @@ using namespace paludis;
namespace
{
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
const std::string & k)
{
@@ -141,7 +146,7 @@ namespace
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
diff --git a/paludis/repositories/e/exndbam_repository_TEST.cc b/paludis/repositories/e/exndbam_repository_TEST.cc
index 7c17f60..376b97b 100644
--- a/paludis/repositories/e/exndbam_repository_TEST.cc
+++ b/paludis/repositories/e/exndbam_repository_TEST.cc
@@ -40,6 +40,11 @@ using namespace paludis;
namespace
{
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
const std::string & k)
{
@@ -124,14 +129,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(exndbam_repo),
- 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)
));
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>(&make_standard_output_manager)
));
TEST_CHECK(exndbam_repo->package_ids(QualifiedPackageName("cat/pkg"))->empty());
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index 6aa0b65..9f07aa9 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -51,6 +51,11 @@ using namespace paludis;
namespace
{
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m,
const std::string & k)
{
@@ -352,14 +357,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
- 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)
));
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>(&make_standard_output_manager)
));
InfoAction info_action;
@@ -470,14 +475,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
- 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)
));
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>(&make_standard_output_manager)
));
InfoAction info_action;
@@ -588,14 +593,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
- 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)
));
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>(&make_standard_output_manager)
));
{
@@ -986,14 +991,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
- 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)
));
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>(&make_standard_output_manager)
));
TEST_CHECK_EQUAL(read_file(provides_cache), "paludis-3\ninstalled\n");
@@ -1225,7 +1230,7 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
- 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)
));
@@ -1317,14 +1322,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
- 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)
));
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>(&make_standard_output_manager)
));
TEST_CHECK(vdb_repo->package_ids(QualifiedPackageName("cat/pkg"))->empty());
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 102a56b..e376034 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -44,6 +44,11 @@ using namespace paludis;
namespace
{
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
struct ContentsDumper
{
std::stringstream s;
@@ -265,7 +270,7 @@ namespace test_cases
UninstallAction 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>(&make_standard_output_manager)
));
id->perform_action(action);
@@ -317,7 +322,7 @@ namespace test_cases
UninstallAction 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>(&make_standard_output_manager)
));
id->perform_action(action);
@@ -401,7 +406,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(repo),
- 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)
));
@@ -457,7 +462,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(repo),
- 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)
));
@@ -516,7 +521,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(repo),
- 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)
));
@@ -559,7 +564,7 @@ namespace test_cases
UninstallAction 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>(&make_standard_output_manager)
));
(*env[selection::RequireExactlyOne(generator::Matches(
parse_user_package_dep_spec("cat/pkg4a",
@@ -602,7 +607,7 @@ namespace test_cases
UninstallAction 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>(&make_standard_output_manager)
));
(*env[selection::RequireExactlyOne(generator::Matches(
parse_user_package_dep_spec("cat/pkg4b",
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index 1520ac0..9f82de2 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -42,6 +42,11 @@ using namespace paludis;
namespace
{
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
void dummy_used_this_for_config_protect(const std::string &)
{
}
@@ -231,7 +236,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
@@ -286,7 +291,7 @@ namespace test_cases
InstallAction action(make_named_values<InstallActionOptions>(
value_for<n::destination>(installed_repo),
- 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)
));
diff --git a/src/clients/appareo/appareo.cc b/src/clients/appareo/appareo.cc
index 1b0f022..e4a820d 100644
--- a/src/clients/appareo/appareo.cc
+++ b/src/clients/appareo/appareo.cc
@@ -54,6 +54,11 @@ typedef std::multimap<std::tr1::shared_ptr<const PackageID>, std::string, Packag
namespace
{
+ std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
+ {
+ return make_shared_ptr(new StandardOutputManager);
+ }
+
FSEntry get_location_and_add_filters()
{
Context context("When determining tree location:");
@@ -100,7 +105,7 @@ namespace
FetchAction a(make_named_values<FetchActionOptions>(
value_for<n::exclude_unmirrorable>(false),
value_for<n::fetch_unneeded>(true),
- 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>(true)
));
(*i)->perform_action(a);