aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-11 21:14:08 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-11 21:14:08 +0000
commitc465194c342edfd626a27d0ec1f460dba361dcf3 (patch)
tree30732d5e0b6cbef99e949d7644d2bd1e08b595d3
parentadbe09b11a47017d5125ffb259d1ad3b74b9db99 (diff)
downloadpaludis-c465194c342edfd626a27d0ec1f460dba361dcf3.tar.gz
paludis-c465194c342edfd626a27d0ec1f460dba361dcf3.tar.xz
Specify output exclusivity
-rw-r--r--paludis/create_output_manager_info-fwd.hh6
-rw-r--r--paludis/create_output_manager_info.cc39
-rw-r--r--paludis/create_output_manager_info.hh9
-rw-r--r--paludis/create_output_manager_info.se21
-rw-r--r--paludis/files.m43
-rw-r--r--paludis/install_task.cc41
-rw-r--r--paludis/install_task.hh4
-rw-r--r--paludis/output_manager_from_environment-fwd.hh28
-rw-r--r--paludis/output_manager_from_environment.cc75
-rw-r--r--paludis/output_manager_from_environment.hh55
-rw-r--r--paludis/uninstall_task.cc19
-rw-r--r--src/clients/accerso/accerso.cc26
-rw-r--r--src/clients/paludis/do_config.cc12
-rw-r--r--src/clients/paludis/info.cc15
-rw-r--r--src/output/console_install_task.cc8
15 files changed, 287 insertions, 74 deletions
diff --git a/paludis/create_output_manager_info-fwd.hh b/paludis/create_output_manager_info-fwd.hh
index 897ab1e..ca25778 100644
--- a/paludis/create_output_manager_info-fwd.hh
+++ b/paludis/create_output_manager_info-fwd.hh
@@ -20,11 +20,17 @@
#ifndef PALUDIS_GUARD_PALUDIS_CREATE_OUTPUT_MANAGER_INFO_FWD_HH
#define PALUDIS_GUARD_PALUDIS_CREATE_OUTPUT_MANAGER_INFO_FWD_HH 1
+#include <paludis/util/attributes.hh>
+#include <iosfwd>
+
namespace paludis
{
class CreateOutputManagerInfo;
class CreateOutputManagerForPackageIDActionInfo;
class CreateOutputManagerForRepositorySyncInfo;
+
+#include <paludis/create_output_manager_info-se.hh>
+
}
#endif
diff --git a/paludis/create_output_manager_info.cc b/paludis/create_output_manager_info.cc
index 0ce7224..7717085 100644
--- a/paludis/create_output_manager_info.cc
+++ b/paludis/create_output_manager_info.cc
@@ -19,9 +19,14 @@
#include <paludis/create_output_manager_info.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/exception.hh>
+#include <ostream>
using namespace paludis;
+#include <paludis/create_output_manager_info-se.cc>
+
namespace paludis
{
template <>
@@ -29,11 +34,13 @@ namespace paludis
{
const std::tr1::shared_ptr<const PackageID> id;
const Action & action;
+ const OutputExclusivity output_exclusivity;
Implementation(const std::tr1::shared_ptr<const PackageID> & i,
- const Action & a) :
+ const Action & a, const OutputExclusivity e) :
id(i),
- action(a)
+ action(a),
+ output_exclusivity(e)
{
}
};
@@ -42,9 +49,11 @@ namespace paludis
struct Implementation<CreateOutputManagerForRepositorySyncInfo>
{
const Repository & repo;
+ const OutputExclusivity output_exclusivity;
- Implementation(const Repository & r) :
- repo(r)
+ Implementation(const Repository & r, const OutputExclusivity e) :
+ repo(r),
+ output_exclusivity(e)
{
}
};
@@ -52,9 +61,10 @@ namespace paludis
CreateOutputManagerForPackageIDActionInfo::CreateOutputManagerForPackageIDActionInfo(
const std::tr1::shared_ptr<const PackageID> & i,
- const Action & a) :
+ const Action & a,
+ const OutputExclusivity e) :
PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>(
- new Implementation<CreateOutputManagerForPackageIDActionInfo>(i, a))
+ new Implementation<CreateOutputManagerForPackageIDActionInfo>(i, a, e))
{
}
@@ -74,10 +84,16 @@ CreateOutputManagerForPackageIDActionInfo::action() const
return _imp->action;
}
+const OutputExclusivity
+CreateOutputManagerForPackageIDActionInfo::output_exclusivity() const
+{
+ return _imp->output_exclusivity;
+}
+
CreateOutputManagerForRepositorySyncInfo::CreateOutputManagerForRepositorySyncInfo(
- const Repository & r) :
+ const Repository & r, const OutputExclusivity e) :
PrivateImplementationPattern<CreateOutputManagerForRepositorySyncInfo>(
- new Implementation<CreateOutputManagerForRepositorySyncInfo>(r))
+ new Implementation<CreateOutputManagerForRepositorySyncInfo>(r, e))
{
}
@@ -91,7 +107,12 @@ CreateOutputManagerForRepositorySyncInfo::repository() const
return _imp->repo;
}
+const OutputExclusivity
+CreateOutputManagerForRepositorySyncInfo::output_exclusivity() const
+{
+ return _imp->output_exclusivity;
+}
+
template class PrivateImplementationPattern<CreateOutputManagerForRepositorySyncInfo>;
template class PrivateImplementationPattern<CreateOutputManagerForPackageIDActionInfo>;
-
diff --git a/paludis/create_output_manager_info.hh b/paludis/create_output_manager_info.hh
index fc6fdb2..4ce3f7d 100644
--- a/paludis/create_output_manager_info.hh
+++ b/paludis/create_output_manager_info.hh
@@ -62,12 +62,14 @@ namespace paludis
public:
CreateOutputManagerForPackageIDActionInfo(
const std::tr1::shared_ptr<const PackageID> & id,
- const Action & action);
+ const Action & action,
+ const OutputExclusivity output_exclusivity);
~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));
+ const OutputExclusivity output_exclusivity() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
/**
@@ -84,11 +86,14 @@ namespace paludis
public ImplementAcceptMethods<CreateOutputManagerInfo, CreateOutputManagerForRepositorySyncInfo>
{
public:
- CreateOutputManagerForRepositorySyncInfo(const Repository & repo);
+ CreateOutputManagerForRepositorySyncInfo(
+ const Repository & repo,
+ const OutputExclusivity);
~CreateOutputManagerForRepositorySyncInfo();
const Repository & repository() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ const OutputExclusivity output_exclusivity() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/create_output_manager_info.se b/paludis/create_output_manager_info.se
new file mode 100644
index 0000000..2549abb
--- /dev/null
+++ b/paludis/create_output_manager_info.se
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_OutputExclusivity()
+{
+ prefix oe
+
+ key oe_background "Run in the background, produce no output"
+ key oe_with_others "Other things may be running at the same time"
+ key oe_exclusive "We are the only thing running"
+
+ doxygen_comment << "END"
+ /**
+ * Options telling most CreateOutputManagerInfo subclasses whether we
+ * will be run exclusively or with other tasks.
+ *
+ * \see CreateOutputManagerInfo
+ */
+END
+}
+
diff --git a/paludis/files.m4 b/paludis/files.m4
index bc22126..e576687 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -13,7 +13,7 @@ add(`action', `hh', `cc', `fwd', `se')
add(`action_names', `hh', `cc', `fwd')
add(`choice', `hh', `cc', `fwd')
add(`contents', `hh', `cc', `fwd')
-add(`create_output_manager_info', `hh', `cc', `fwd')
+add(`create_output_manager_info', `hh', `cc', `fwd', `se')
add(`dep_label', `hh', `cc', `fwd')
add(`dep_list', `hh', `cc', `fwd', `test', `fwd')
add(`dep_list_exceptions', `hh', `cc')
@@ -56,6 +56,7 @@ add(`ndbam_merger', `hh', `cc')
add(`ndbam_unmerger', `hh', `cc')
add(`output_manager', `hh', `fwd', `cc', `se')
add(`output_manager_factory', `hh', `fwd', `cc')
+add(`output_manager_from_environment', `hh', `fwd', `cc')
add(`override_functions', `hh', `cc')
add(`package_database', `hh', `cc', `fwd', `test')
add(`package_dep_spec_properties', `hh', `cc', `fwd')
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 31565da..0a52497 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -51,6 +51,8 @@
#include <paludis/util/accept_visitor.hh>
#include <paludis/handled_information.hh>
#include <paludis/create_output_manager_info.hh>
+#include <paludis/output_manager_from_environment.hh>
+#include <paludis/output_manager.hh>
#include <tr1/functional>
#include <sstream>
#include <functional>
@@ -67,12 +69,6 @@ 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);
@@ -686,9 +682,9 @@ InstallTask::_pretend()
{
on_pretend_pre(*dep);
+ OutputManagerFromEnvironment output_manager_holder(_imp->env, dep->package_id(), oe_exclusive);
PretendActionOptions options(make_named_values<PretendActionOptions>(
- 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::make_output_manager>(std::tr1::ref(output_manager_holder))
));
PretendAction pretend_action(options);
dep->package_id()->perform_action(pretend_action);
@@ -697,6 +693,11 @@ InstallTask::_pretend()
pretend_failed = true;
dep->handled().reset(new DepListEntryHandledFailed);
}
+ else
+ {
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
+ }
on_pretend_post(*dep);
}
@@ -758,17 +759,21 @@ 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))
{
- FetchActionOptions fetch_options(make_fetch_action_options(*dep));
+ OutputManagerFromEnvironment output_manager_holder(_imp->env, dep->package_id(), oe_exclusive);
+ FetchActionOptions fetch_options(make_fetch_action_options(*dep, output_manager_holder));
FetchAction fetch_action(fetch_options);
dep->package_id()->perform_action(fetch_action);
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
}
if (! _imp->fetch_only)
{
+ OutputManagerFromEnvironment output_manager_holder(_imp->env, dep->package_id(), oe_exclusive);
+
InstallActionOptions install_options(make_named_values<InstallActionOptions>(
value_for<n::destination>(dep->destination()),
- 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::make_output_manager>(std::tr1::ref(output_manager_holder)),
value_for<n::used_this_for_config_protect>(std::tr1::bind(
&Implementation<InstallTask>::assign_config_protect,
_imp.get(), std::tr1::placeholders::_1)),
@@ -797,6 +802,9 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
InstallAction install_action(install_options);
dep->package_id()->perform_action(install_action);
+
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
}
}
catch (const InstallActionError & e)
@@ -880,13 +888,15 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
try
{
+ OutputManagerFromEnvironment output_manager_holder(_imp->env, dep->package_id(), oe_exclusive);
UninstallAction uninstall_action(
make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(_imp->config_protect),
- 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::make_output_manager>(std::tr1::ref(output_manager_holder))
));
(*c)->perform_action(uninstall_action);
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
}
catch (const UninstallActionError & e)
{
@@ -1806,13 +1816,12 @@ InstallTask::set_phase_options_apply_to_all(const bool b)
}
FetchActionOptions
-InstallTask::make_fetch_action_options(const DepListEntry & dep) const
+InstallTask::make_fetch_action_options(const DepListEntry &, OutputManagerFromEnvironment & o) 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::make_output_manager>(std::tr1::ref(o)),
value_for<n::safe_resume>(_imp->safe_resume)
);
}
diff --git a/paludis/install_task.hh b/paludis/install_task.hh
index 927ffc4..6d87a24 100644
--- a/paludis/install_task.hh
+++ b/paludis/install_task.hh
@@ -29,6 +29,7 @@
#include <paludis/repository-fwd.hh>
#include <paludis/action-fwd.hh>
#include <paludis/package_database-fwd.hh>
+#include <paludis/output_manager_from_environment-fwd.hh>
/** \file
* Declarations for InstallTask.
@@ -82,7 +83,8 @@ namespace paludis
bool already_done(const DepListEntry &) const PALUDIS_ATTRIBUTE((warn_unused_result));
- FetchActionOptions make_fetch_action_options(const DepListEntry &) const PALUDIS_ATTRIBUTE((warn_unused_result));
+ FetchActionOptions make_fetch_action_options(const DepListEntry &,
+ OutputManagerFromEnvironment & o) const PALUDIS_ATTRIBUTE((warn_unused_result));
public:
///\name Basic operations
diff --git a/paludis/output_manager_from_environment-fwd.hh b/paludis/output_manager_from_environment-fwd.hh
new file mode 100644
index 0000000..4360a0a
--- /dev/null
+++ b/paludis/output_manager_from_environment-fwd.hh
@@ -0,0 +1,28 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_OUTPUT_MANAGER_FROM_ENVIRONMENT_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_OUTPUT_MANAGER_FROM_ENVIRONMENT_FWD_HH 1
+
+namespace paludis
+{
+ class OutputManagerFromEnvironment;
+}
+
+#endif
diff --git a/paludis/output_manager_from_environment.cc b/paludis/output_manager_from_environment.cc
new file mode 100644
index 0000000..3c75433
--- /dev/null
+++ b/paludis/output_manager_from_environment.cc
@@ -0,0 +1,75 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/output_manager_from_environment.hh>
+#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/environment.hh>
+#include <paludis/create_output_manager_info.hh>
+
+using namespace paludis;
+
+namespace paludis
+{
+ template <>
+ struct Implementation<OutputManagerFromEnvironment>
+ {
+ const Environment * const env;
+ const std::tr1::shared_ptr<const PackageID> id;
+ const OutputExclusivity output_exclusivity;
+
+ std::tr1::shared_ptr<OutputManager> result;
+
+ Implementation(const Environment * const e, const std::tr1::shared_ptr<const PackageID> & i,
+ const OutputExclusivity x) :
+ env(e),
+ id(i),
+ output_exclusivity(x)
+ {
+ }
+ };
+}
+
+OutputManagerFromEnvironment::OutputManagerFromEnvironment(
+ const Environment * const e,
+ const std::tr1::shared_ptr<const PackageID> & i,
+ const OutputExclusivity x) :
+ PrivateImplementationPattern<OutputManagerFromEnvironment>(new Implementation<OutputManagerFromEnvironment>(e, i, x))
+{
+}
+
+OutputManagerFromEnvironment::~OutputManagerFromEnvironment()
+{
+}
+
+const std::tr1::shared_ptr<OutputManager>
+OutputManagerFromEnvironment::operator() (const Action & a)
+{
+ if (! _imp->result)
+ _imp->result = _imp->env->create_output_manager(CreateOutputManagerForPackageIDActionInfo(_imp->id, a, _imp->output_exclusivity));
+ return _imp->result;
+}
+
+const std::tr1::shared_ptr<OutputManager>
+OutputManagerFromEnvironment::output_manager_if_constructed()
+{
+ return _imp->result;
+}
+
+template class PrivateImplementationPattern<OutputManagerFromEnvironment>;
+
diff --git a/paludis/output_manager_from_environment.hh b/paludis/output_manager_from_environment.hh
new file mode 100644
index 0000000..410c40e
--- /dev/null
+++ b/paludis/output_manager_from_environment.hh
@@ -0,0 +1,55 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_OUTPUT_MANAGER_FROM_ENVIRONMENT_HH
+#define PALUDIS_GUARD_PALUDIS_OUTPUT_MANAGER_FROM_ENVIRONMENT_HH 1
+
+#include <paludis/output_manager_from_environment-fwd.hh>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/output_manager-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/action-fwd.hh>
+#include <paludis/create_output_manager_info-fwd.hh>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE OutputManagerFromEnvironment :
+ private PrivateImplementationPattern<OutputManagerFromEnvironment>
+ {
+ public:
+ OutputManagerFromEnvironment(
+ const Environment * const,
+ const std::tr1::shared_ptr<const PackageID> &,
+ const OutputExclusivity);
+
+ ~OutputManagerFromEnvironment();
+
+ const std::tr1::shared_ptr<OutputManager> operator() (const Action &);
+
+ const std::tr1::shared_ptr<OutputManager> output_manager_if_constructed();
+ };
+
+#ifdef PALUDIS_HAVE_EXTERN_TEMPLATE
+ extern template class PrivateImplementationPattern<OutputManagerFromEnvironment>;
+#endif
+}
+
+#endif
diff --git a/paludis/uninstall_task.cc b/paludis/uninstall_task.cc
index 0fbe06c..7f9f3be 100644
--- a/paludis/uninstall_task.cc
+++ b/paludis/uninstall_task.cc
@@ -39,7 +39,8 @@
#include <paludis/hook.hh>
#include <paludis/dep_tag.hh>
#include <paludis/repository.hh>
-#include <paludis/create_output_manager_info.hh>
+#include <paludis/output_manager_from_environment.hh>
+#include <paludis/output_manager.hh>
#include <tr1/functional>
#include <map>
#include <set>
@@ -51,15 +52,6 @@ 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 + "'"),
@@ -367,13 +359,16 @@ UninstallTask::execute()
try
{
+ OutputManagerFromEnvironment output_manager_holder(_imp->env, i->package_id(), oe_exclusive);
UninstallAction uninstall_action(
make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
- value_for<n::make_output_manager>(std::tr1::bind(&make_output_manager_for_action,
- _imp->env, i->package_id(), std::tr1::placeholders::_1))
+ value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder))
));
i->package_id()->perform_action(uninstall_action);
+
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
}
catch (const UninstallActionError & e)
{
diff --git a/src/clients/accerso/accerso.cc b/src/clients/accerso/accerso.cc
index 2a05ffe..54615cc 100644
--- a/src/clients/accerso/accerso.cc
+++ b/src/clients/accerso/accerso.cc
@@ -40,6 +40,7 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/package_database.hh>
+#include <paludis/output_manager_from_environment.hh>
#include <cstdlib>
#include <tr1/functional>
#include <iostream>
@@ -50,15 +51,6 @@ 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[])
{
@@ -147,17 +139,19 @@ main(int argc, char *argv[])
try
{
- FetchAction a(make_named_values<FetchActionOptions>(
- value_for<n::exclude_unmirrorable>(true),
- value_for<n::fetch_unneeded>(true),
- 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>()))
{
+ OutputManagerFromEnvironment output_manager_holder(&env, *i, oe_exclusive);
+ FetchAction a(make_named_values<FetchActionOptions>(
+ value_for<n::exclude_unmirrorable>(true),
+ value_for<n::fetch_unneeded>(true),
+ value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder)),
+ value_for<n::safe_resume>(true)
+ ));
(*i)->perform_action(a);
++success;
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
}
else
results.insert(std::make_pair(*i, "Does not support fetching"));
diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc
index 0d19f50..fbd24d4 100644
--- a/src/clients/paludis/do_config.cc
+++ b/src/clients/paludis/do_config.cc
@@ -46,25 +46,21 @@ 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
do_one_config_entry(const Environment * const env, const std::tr1::shared_ptr<const PackageID> & p)
{
int return_code(0);
+ OutputManagerFromEnvironment output_manager_holder(env, p, oe_exclusive);
ConfigActionOptions options(make_named_values<ConfigActionOptions>(
- value_for<n::make_output_manager>(std::tr1::bind(&make_output_manager_for_action,
- env, p, std::tr1::placeholders::_1))
+ value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder))
));
ConfigAction a(options);
try
{
p->perform_action(a);
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
}
catch (const UnsupportedActionError &)
{
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 0c343be..6eba17a 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -36,6 +36,8 @@
#include <paludis/filtered_generator.hh>
#include <paludis/selection.hh>
#include <paludis/create_output_manager_info.hh>
+#include <paludis/output_manager_from_environment.hh>
+#include <paludis/output_manager.hh>
#include <iostream>
#include <iomanip>
#include <set>
@@ -206,12 +208,6 @@ namespace
cout << std::setw(30) << (indent + k.human_name() + ":") << " " << endl;
}
};
-
- 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 do_one_info(
@@ -247,9 +243,9 @@ int do_one_info(
for (PackageIDSequence::ConstIterator p(to_show_entries->begin()), p_end(to_show_entries->end()) ;
p != p_end ; ++p)
{
+ OutputManagerFromEnvironment output_manager_holder(env.get(), *p, oe_exclusive);
InfoActionOptions options(make_named_values<InfoActionOptions>(
- value_for<n::make_output_manager>(std::tr1::bind(&make_output_manager_for_action,
- env.get(), *p, std::tr1::placeholders::_1))
+ value_for<n::make_output_manager>(std::tr1::ref(output_manager_holder))
));
InfoAction a(options);
@@ -259,6 +255,9 @@ int do_one_info(
cout << endl;
(*p)->perform_action(a);
cout << endl;
+
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
}
catch (const UnsupportedActionError &)
{
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 01e620d..2e63d43 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -52,6 +52,9 @@
#include <paludis/filter.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/choice.hh>
+#include <paludis/output_manager_from_environment.hh>
+#include <paludis/output_manager.hh>
+#include <paludis/dep_list.hh>
#include <tr1/functional>
#include <algorithm>
@@ -1260,8 +1263,11 @@ ConsoleInstallTask::display_merge_list_entry_distsize(const DepListEntry & d,
if (! d.package_id()->supports_action(action_test))
return;
- FindDistfilesSize action(make_fetch_action_options(d), _already_downloaded);
+ OutputManagerFromEnvironment output_manager_holder(environment(), d.package_id(), oe_exclusive);
+ FindDistfilesSize action(make_fetch_action_options(d, output_manager_holder), _already_downloaded);
d.package_id()->perform_action(action);
+ if (output_manager_holder.output_manager_if_constructed())
+ output_manager_holder.output_manager_if_constructed()->succeeded();
if (! action.size)
return;