aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-05 22:40:00 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-05 22:40:00 +0000
commit52132956b5ffb54aeb99a72e375e48e3fa18ff36 (patch)
tree3ef028f347e96f39f4ee76581417fdf59bfa6497
parent79e482a013061ab2e9fd4f87eeb3babb4d1ba1e2 (diff)
downloadpaludis-52132956b5ffb54aeb99a72e375e48e3fa18ff36.tar.gz
paludis-52132956b5ffb54aeb99a72e375e48e3fa18ff36.tar.xz
kill some sr
-rw-r--r--paludis/environments/no_config/no_config_environment.cc3
-rw-r--r--paludis/environments/test/test_environment.cc3
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/hook.cc5
-rw-r--r--paludis/hook.hh20
-rw-r--r--paludis/hook.sr22
-rw-r--r--paludis/hooker.cc40
-rw-r--r--paludis/hooker_TEST.cc73
-rw-r--r--paludis/install_task.cc36
-rw-r--r--paludis/merger.cc60
-rw-r--r--paludis/python_hooks.cc13
-rw-r--r--paludis/repositories/e/e_installed_repository.cc2
-rw-r--r--paludis/repositories/e/e_repository.cc2
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc2
-rw-r--r--paludis/sohooks_TEST.cc9
-rw-r--r--paludis/sync_task.cc8
-rw-r--r--paludis/uninstall_task.cc8
-rw-r--r--paludis/unmerger.cc42
-rw-r--r--python/environment.cc3
-rw-r--r--src/clients/cave/cmd_sync.cc10
20 files changed, 184 insertions, 179 deletions
diff --git a/paludis/environments/no_config/no_config_environment.cc b/paludis/environments/no_config/no_config_environment.cc
index 95f2892..ffa52d6 100644
--- a/paludis/environments/no_config/no_config_environment.cc
+++ b/paludis/environments/no_config/no_config_environment.cc
@@ -31,6 +31,7 @@
#include <paludis/util/config_file.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/tribool.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/distribution.hh>
#include <paludis/package_database.hh>
#include <paludis/hook.hh>
@@ -512,7 +513,7 @@ NoConfigEnvironment::root() const
HookResult
NoConfigEnvironment::perform_hook(const Hook &) const
{
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
std::tr1::shared_ptr<const FSEntrySequence>
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index e15e537..7f999a1 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -29,6 +29,7 @@
#include <paludis/util/tribool.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/system.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
#include <paludis/hook.hh>
@@ -172,7 +173,7 @@ TestEnvironment::mirrors(const std::string & s) const
HookResult
TestEnvironment::perform_hook(const Hook &) const
{
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
std::tr1::shared_ptr<const FSEntrySequence>
diff --git a/paludis/files.m4 b/paludis/files.m4
index 74d674b..f13875e 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -41,7 +41,7 @@ add(`formatter', `hh', `fwd', `cc')
add(`generator', `hh', `cc', `fwd', `test')
add(`generator_handler', `hh', `cc', `fwd')
add(`handled_information', `hh', `fwd', `cc')
-add(`hook', `hh', `cc', `fwd',`se', `sr')
+add(`hook', `hh', `cc', `fwd',`se')
add(`hooker', `hh', `cc', `test', `testscript')
add(`install_task', `hh', `cc', `se')
add(`literal_metadata_key', `hh', `cc')
diff --git a/paludis/hook.cc b/paludis/hook.cc
index 8fe54d8..bf78b6f 100644
--- a/paludis/hook.cc
+++ b/paludis/hook.cc
@@ -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, 2008 Ciaran McCreesh
* Copyright (c) 2007 Piotr JaroszyƄski
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -18,7 +18,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "hook.hh"
+#include <paludis/hook.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/stringify.hh>
@@ -32,7 +32,6 @@ using namespace paludis;
template class WrappedForwardIterator<Hook::ConstIteratorTag, const std::pair<const std::string, std::string> >;
#include <paludis/hook-se.cc>
-#include <paludis/hook-sr.cc>
namespace paludis
{
diff --git a/paludis/hook.hh b/paludis/hook.hh
index f09a4b1..e0ef755 100644
--- a/paludis/hook.hh
+++ b/paludis/hook.hh
@@ -26,9 +26,9 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/graph-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/operators.hh>
#include <paludis/util/wrapped_forward_iterator-fwd.hh>
#include <paludis/util/sequence-fwd.hh>
+#include <paludis/util/named_value.hh>
#include <tr1/memory>
#include <string>
@@ -44,8 +44,24 @@
namespace paludis
{
+ namespace n
+ {
+ struct max_exit_status;
+ struct output;
+ }
-#include <paludis/hook-sr.hh>
+ /**
+ * Result of a Hook.
+ *
+ * \see Hook
+ * \ingroup g_hooks
+ * \nosubgrouping
+ */
+ struct HookResult
+ {
+ NamedValue<n::max_exit_status, int> max_exit_status;
+ NamedValue<n::output, std::string> output;
+ };
/**
* Represents the data for a hook call.
diff --git a/paludis/hook.sr b/paludis/hook.sr
deleted file mode 100644
index 6bb95e1..0000000
--- a/paludis/hook.sr
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et :
-
-make_class_HookResult()
-{
- visible
-
- key max_exit_status int
- key output std::string
-
- comparison_operators all max_exit_status
-
- doxygen_comment << "END"
- /**
- * Result of a Hook.
- *
- * \see Hook
- * \ingroup g_hooks
- * \nosubgrouping
- */
-END
-}
diff --git a/paludis/hooker.cc b/paludis/hooker.cc
index d530a54..638128b 100644
--- a/paludis/hooker.cc
+++ b/paludis/hooker.cc
@@ -36,6 +36,7 @@
#include <paludis/util/sequence-impl.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/join.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/about.hh>
#include <list>
#include <iterator>
@@ -192,7 +193,9 @@ BashHookFile::run(const Hook & hook) const
Log::get_instance()->message("hook.bash.failure", ll_warning, lc_no_context) << "Hook '" << file_name()
<< "' returned failure '" << exit_status << "'";
- return HookResult(exit_status, output);
+ return make_named_values<HookResult>(
+ value_for<n::max_exit_status>(exit_status),
+ value_for<n::output>(output));
}
HookResult
@@ -243,7 +246,10 @@ FancyHookFile::run(const Hook & hook) const
Log::get_instance()->message("hook.fancy.failure", ll_warning, lc_no_context) << "Hook '" << file_name()
<< "' returned failure '" << exit_status << "'";
- return HookResult(exit_status, output);
+ return make_named_values<HookResult>(
+ value_for<n::max_exit_status>(exit_status),
+ value_for<n::output>(output)
+ );
}
const std::tr1::shared_ptr<const Sequence<std::string > >
@@ -402,7 +408,7 @@ SoHookFile::run(const Hook & hook) const
Context c("When running .so hook '" + stringify(file_name()) + "' for hook '" + hook.name() + "':");
if (! _run)
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
Log::get_instance()->message("hook.so.starting", ll_debug, lc_no_context) << "Starting .so hook '" <<
file_name() << "' for '" << hook.name() << "'";
@@ -691,7 +697,7 @@ Hooker::_find_hooks(const Hook & hook) const
HookResult
Hooker::perform_hook(const Hook & hook) const
{
- HookResult result(0, "");
+ HookResult result(make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>("")));
Context context("When triggering hook '" + hook.name() + "':");
Log::get_instance()->message("hook.starting", ll_debug, lc_no_context) << "Starting hook '" << hook.name() << "'";
@@ -706,8 +712,8 @@ Hooker::perform_hook(const Hook & hook) const
for (PackageDatabase::RepositoryConstIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
if ((**r).hook_interface())
- result.max_exit_status = std::max(result.max_exit_status,
- ((**r).hook_interface()->perform_hook(hook)).max_exit_status);
+ result.max_exit_status() = std::max(result.max_exit_status(),
+ ((**r).hook_interface()->perform_hook(hook)).max_exit_status());
continue;
case hod_grab:
@@ -716,18 +722,18 @@ Hooker::perform_hook(const Hook & hook) const
if ((**r).hook_interface())
{
HookResult tmp((**r).hook_interface()->perform_hook(hook));
- if (tmp > result)
+ if (tmp.max_exit_status() > result.max_exit_status())
result = tmp;
- else if (! tmp.output.empty())
+ else if (! tmp.output().empty())
{
- if (hook.validate_value(tmp.output))
+ if (hook.validate_value(tmp.output()))
{
- if (result.max_exit_status == 0)
+ if (result.max_exit_status() == 0)
return tmp;
}
else
Log::get_instance()->message("hook.bad_output", ll_warning, lc_context)
- << "Hook returned invalid output: '" << tmp.output << "'";
+ << "Hook returned invalid output: '" << tmp.output() << "'";
}
}
continue;
@@ -757,7 +763,7 @@ Hooker::perform_hook(const Hook & hook) const
for (Sequence<std::tr1::shared_ptr<HookFile> >::ConstIterator f(h->second->begin()),
f_end(h->second->end()) ; f != f_end ; ++f)
if ((*f)->file_name().is_regular_file_or_symlink_to_regular_file())
- result.max_exit_status = std::max(result.max_exit_status, (*f)->run(hook).max_exit_status);
+ result.max_exit_status() = std::max(result.max_exit_status(), (*f)->run(hook).max_exit_status());
else
Log::get_instance()->message("hook.not_regular_file", ll_warning, lc_context) << "Hook file '" <<
(*f)->file_name() << "' is not a regular file or has been removed";
@@ -775,18 +781,18 @@ Hooker::perform_hook(const Hook & hook) const
}
HookResult tmp((*f)->run(hook));
- if (tmp > result)
+ if (tmp.max_exit_status() > result.max_exit_status())
result = tmp;
- else if (! tmp.output.empty())
+ else if (! tmp.output().empty())
{
- if (hook.validate_value(tmp.output))
+ if (hook.validate_value(tmp.output()))
{
- if (result.max_exit_status == 0)
+ if (result.max_exit_status() == 0)
return tmp;
}
else
Log::get_instance()->message("hook.bad_output", ll_warning, lc_context)
- << "Hook returned invalid output: '" << tmp.output << "'";
+ << "Hook returned invalid output: '" << tmp.output() << "'";
}
}
continue;
diff --git a/paludis/hooker_TEST.cc b/paludis/hooker_TEST.cc
index 7d95f18..17ea9ec 100644
--- a/paludis/hooker_TEST.cc
+++ b/paludis/hooker_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 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
@@ -22,6 +22,7 @@
#include <paludis/hook.hh>
#include <paludis/environments/test/test_environment.hh>
#include <paludis/util/fs_entry.hh>
+#include <paludis/util/make_named_values.hh>
#include <test/test_runner.hh>
#include <test/test_framework.hh>
#include <fstream>
@@ -40,25 +41,25 @@ namespace test_cases
{
TestEnvironment env;
Hooker hooker(&env);
- HookResult result(0, "");
+ HookResult result(make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>("")));
hooker.add_dir(FSEntry("hooker_TEST_dir/"), false);
#ifdef ENABLE_PYTHON_HOOKS
result = hooker.perform_hook(Hook("py_hook"));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
#endif
result = hooker.perform_hook(Hook("simple_hook"));
- TEST_CHECK_EQUAL(result.max_exit_status, 3);
- TEST_CHECK_EQUAL(result.output, "");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 3);
+ TEST_CHECK_EQUAL(result.output(), "");
result = hooker.perform_hook(Hook("fancy_hook"));
- TEST_CHECK_EQUAL(result.max_exit_status, 5);
- TEST_CHECK_EQUAL(result.output, "");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 5);
+ TEST_CHECK_EQUAL(result.output(), "");
result = hooker.perform_hook(Hook("so_hook"));
- TEST_CHECK_EQUAL(result.max_exit_status, 6);
- TEST_CHECK_EQUAL(result.output, "");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 6);
+ TEST_CHECK_EQUAL(result.output(), "");
result = hooker.perform_hook(Hook("several_hooks"));
- TEST_CHECK_EQUAL(result.max_exit_status, 7);
- TEST_CHECK_EQUAL(result.output, "");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 7);
+ TEST_CHECK_EQUAL(result.output(), "");
}
} test_hooker;
@@ -76,8 +77,8 @@ namespace test_cases
hooker.add_dir(FSEntry("hooker_TEST_dir/"), false);
HookResult result(hooker.perform_hook(Hook("ordering")));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "");
std::ifstream f(stringify(FSEntry("hooker_TEST_dir/ordering.out")).c_str());
std::string line((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
@@ -104,8 +105,8 @@ namespace test_cases
hooker.add_dir(FSEntry("hooker_TEST_dir/"), false);
HookResult result(hooker.perform_hook(Hook("bad_hooks")));
- TEST_CHECK_EQUAL(result.max_exit_status, 123);
- TEST_CHECK_EQUAL(result.output, "");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 123);
+ TEST_CHECK_EQUAL(result.output(), "");
std::ifstream f(stringify(FSEntry("hooker_TEST_dir/bad_hooks.out")).c_str());
std::string line((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
@@ -127,8 +128,8 @@ namespace test_cases
hooker.add_dir(FSEntry("hooker_TEST_dir/"), false);
HookResult result(hooker.perform_hook(Hook("cycles")));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "");
std::ifstream f(stringify(FSEntry("hooker_TEST_dir/cycles.out")).c_str());
std::string line((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
@@ -145,7 +146,7 @@ namespace test_cases
{
TestEnvironment env;
Hooker hooker(&env);
- HookResult result(0, "");
+ HookResult result(make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>("")));
FSEntry("hooker_TEST_dir/several_output.out").unlink();
@@ -153,45 +154,45 @@ namespace test_cases
result = hooker.perform_hook(Hook("simple_hook_output")
.grab_output(Hook::AllowedOutputValues()("foo")));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "foo");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "foo");
result = hooker.perform_hook(Hook("fancy_hook_output")
.grab_output(Hook::AllowedOutputValues()("foo")));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "foo");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "foo");
result = hooker.perform_hook(Hook("so_hook_output")
.grab_output(Hook::AllowedOutputValues()("foo")));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "foo");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "foo");
#ifdef ENABLE_PYTHON_HOOKS
result = hooker.perform_hook(Hook("py_hook_output")
.grab_output(Hook::AllowedOutputValues()("foo")));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "foo");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "foo");
#endif
result = hooker.perform_hook(Hook("several_hooks_output")
.grab_output(Hook::AllowedOutputValues()));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "one");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "one");
result = hooker.perform_hook(Hook("several_hooks_output")
.grab_output(Hook::AllowedOutputValues()("one")));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "one");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "one");
result = hooker.perform_hook(Hook("several_hooks_output")
.grab_output(Hook::AllowedOutputValues()("two")("three")));
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
- TEST_CHECK_EQUAL(result.output, "two");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
+ TEST_CHECK_EQUAL(result.output(), "two");
result = hooker.perform_hook(Hook("several_hooks_output")
.grab_output(Hook::AllowedOutputValues()("blah")));
- TEST_CHECK_EQUAL(result.output, "");
- TEST_CHECK_EQUAL(result.max_exit_status, 0);
+ TEST_CHECK_EQUAL(result.output(), "");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 0);
std::ifstream f(stringify(FSEntry("hooker_TEST_dir/several_output.out")).c_str());
std::string line((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
@@ -216,8 +217,8 @@ namespace test_cases
HookResult result(hooker.perform_hook(Hook("several_hooks_output_bad")
.grab_output(Hook::AllowedOutputValues())));
- TEST_CHECK_EQUAL(result.output, "two");
- TEST_CHECK_EQUAL(result.max_exit_status, 99);
+ TEST_CHECK_EQUAL(result.output(), "two");
+ TEST_CHECK_EQUAL(result.max_exit_status(), 99);
std::ifstream f(stringify(FSEntry("hooker_TEST_dir/several_output_bad.out")).c_str());
std::string line((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
diff --git a/paludis/install_task.cc b/paludis/install_task.cc
index 2da262c..0c6b3e5 100644
--- a/paludis/install_task.cc
+++ b/paludis/install_task.cc
@@ -503,7 +503,7 @@ InstallTask::_display_task_list()
("TARGETS", join(
_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
("DEPLIST_HAS_ERRORS", stringify(_imp->dep_list.has_errors()))
- ).max_exit_status)
+ ).max_exit_status())
throw InstallActionError("Pretend install aborted by hook");
on_display_merge_list_pre();
@@ -515,7 +515,7 @@ InstallTask::_display_task_list()
if (_imp->pretend &&
0 != perform_hook(Hook("install_pretend_display_item_pre")
("TARGET", stringify(*dep->package_id))
- ("KIND", stringify(dep->kind))).max_exit_status)
+ ("KIND", stringify(dep->kind))).max_exit_status())
throw InstallActionError("Pretend install aborted by hook");
on_display_merge_list_entry(*dep);
@@ -523,7 +523,7 @@ InstallTask::_display_task_list()
if (_imp->pretend &&
0 != perform_hook(Hook("install_pretend_display_item_post")
("TARGET", stringify(*dep->package_id))
- ("KIND", stringify(dep->kind))).max_exit_status)
+ ("KIND", stringify(dep->kind))).max_exit_status())
throw InstallActionError("Pretend install aborted by hook");
}
@@ -655,7 +655,7 @@ InstallTask::_pretend()
("TARGETS", join(
_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
("DEPLIST_HAS_ERRORS", stringify(_imp->dep_list.has_errors()))
- ).max_exit_status)
+ ).max_exit_status())
throw InstallActionError("Pretend install aborted by hook");
}
@@ -683,7 +683,7 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
{
if (0 != perform_hook(Hook("fetch_pre")
("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status())
throw InstallActionError("Fetch of '" + cpvr + "' aborted by hook");
on_fetch_pre(*dep, x, y, s, f);
}
@@ -692,7 +692,7 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
if (0 != perform_hook(Hook("install_pre")
("TARGET", cpvr)
("X_OF_Y", stringify(x) + " of " + stringify(y))
- ("PALUDIS_NO_LIVE_DESTINATION", live_destination ? "" : "yes")).max_exit_status)
+ ("PALUDIS_NO_LIVE_DESTINATION", live_destination ? "" : "yes")).max_exit_status())
throw InstallActionError("Install of '" + cpvr + "' aborted by hook");
on_install_pre(*dep, x, y, s, f);
}
@@ -727,7 +727,7 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
on_fetch_post(*dep, x, y, s, f);
if (0 != perform_hook(Hook("fetch_post")
("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status())
throw InstallActionError("Fetch of '" + cpvr + "' aborted by hook");
}
else
@@ -736,7 +736,7 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
if (0 != perform_hook(Hook("install_post")
("TARGET", cpvr)
("X_OF_Y", stringify(x) + " of " + stringify(y))
- ("PALUDIS_NO_LIVE_DESTINATION", live_destination ? "" : "yes")).max_exit_status)
+ ("PALUDIS_NO_LIVE_DESTINATION", live_destination ? "" : "yes")).max_exit_status())
throw InstallActionError("Install of '" + cpvr + "' aborted by hook");
}
@@ -781,7 +781,7 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
else
{
if (0 != perform_hook(Hook("clean_all_pre")("TARGETS", join(
- indirect_iterator(clean_list.begin()), indirect_iterator(clean_list.end()), " "))).max_exit_status)
+ indirect_iterator(clean_list.begin()), indirect_iterator(clean_list.end()), " "))).max_exit_status())
throw InstallActionError("Clean aborted by hook");
on_clean_all_pre(*dep, clean_list);
@@ -790,7 +790,7 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
{
/* clean one item */
if (0 != perform_hook(Hook("clean_pre")("TARGET", stringify(**c))
- ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status())
throw InstallActionError("Clean of '" + cpvr + "' aborted by hook");
on_clean_pre(*dep, **c, x, y, s, f);
@@ -812,13 +812,13 @@ InstallTask::_one(const DepList::Iterator dep, const int x, const int y, const i
on_clean_post(*dep, **c, x, y, s, f);
if (0 != perform_hook(Hook("clean_post")("TARGET", stringify(**c))
- ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status())
throw InstallActionError("Clean of '" + cpvr + "' aborted by hook");
}
/* we're done cleaning */
if (0 != perform_hook(Hook("clean_all_post")("TARGETS", join(
- indirect_iterator(clean_list.begin()), indirect_iterator(clean_list.end()), " "))).max_exit_status)
+ indirect_iterator(clean_list.begin()), indirect_iterator(clean_list.end()), " "))).max_exit_status())
throw InstallActionError("Clean aborted by hook");
on_clean_all_post(*dep, clean_list);
}
@@ -851,7 +851,7 @@ InstallTask::_main_actions()
if (_imp->fetch_only)
{
if (0 != perform_hook(Hook("fetch_all_pre")("TARGETS", join(
- _imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status)
+ _imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status())
throw InstallActionError("Fetch aborted by hook");
on_fetch_all_pre();
}
@@ -866,7 +866,7 @@ InstallTask::_main_actions()
if (0 != perform_hook(Hook("install_all_pre")
("TARGETS", join(_imp->raw_targets.begin(), _imp->raw_targets.end(), " "))
- ("PALUDIS_NO_LIVE_DESTINATION", any_live_destination ? "" : "yes")).max_exit_status)
+ ("PALUDIS_NO_LIVE_DESTINATION", any_live_destination ? "" : "yes")).max_exit_status())
throw InstallActionError("Install aborted by hook");
on_install_all_pre();
}
@@ -1022,14 +1022,14 @@ InstallTask::_main_actions()
{
on_fetch_all_post();
if (0 != perform_hook(Hook("fetch_all_post")("TARGETS", join(
- _imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status)
+ _imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status())
throw InstallActionError("Fetch aborted by hook");
}
else
{
on_install_all_post();
if (0 != perform_hook(Hook("install_all_post")("TARGETS", join(
- _imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status)
+ _imp->raw_targets.begin(), _imp->raw_targets.end(), " "))).max_exit_status())
throw InstallActionError("Install aborted by hook");
}
}
@@ -1067,7 +1067,7 @@ InstallTask::execute()
("PRETEND", stringify(_imp->pretend))
("FETCH_ONLY", stringify(_imp->fetch_only))
("DEPLIST_HAS_ERRORS", stringify(_imp->dep_list.has_errors()))
- ).max_exit_status)
+ ).max_exit_status())
throw InstallActionError("Install task execute aborted by hook");
_execute();
@@ -1116,7 +1116,7 @@ InstallTask::execute()
("FETCH_ONLY", stringify(_imp->fetch_only))
("SUCCESS", stringify(success))
("DEPLIST_HAS_ERRORS", stringify(_imp->dep_list.has_errors()))
- ).max_exit_status)
+ ).max_exit_status())
throw InstallActionError("Install task execute aborted by hook");
}
diff --git a/paludis/merger.cc b/paludis/merger.cc
index 65eda7a..97625fe 100644
--- a/paludis/merger.cc
+++ b/paludis/merger.cc
@@ -94,7 +94,7 @@ Merger::check()
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_pre")
("INSTALL_SOURCE", stringify(_imp->params.image()))
- ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status())
make_check_fail();
do_dir_recursive(true, _imp->params.image(), _imp->params.root() / _imp->params.install_under());
@@ -102,7 +102,7 @@ Merger::check()
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_post")
("INSTALL_SOURCE", stringify(_imp->params.image()))
- ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status())
make_check_fail();
return _imp->result;
@@ -138,7 +138,7 @@ Merger::merge()
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_pre")
("INSTALL_SOURCE", stringify(_imp->params.image()))
- ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status())
Log::get_instance()->message("merger.pre_hooks.failure", ll_warning, lc_context) <<
"Merge of '" << _imp->params.image() << "' to '" << _imp->params.root() << "' pre hooks returned non-zero";
@@ -169,7 +169,7 @@ Merger::merge()
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_post")
("INSTALL_SOURCE", stringify(_imp->params.image()))
- ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(_imp->params.root())))).max_exit_status())
Log::get_instance()->message("merger.post_hooks.failure", ll_warning, lc_context) <<
"Merge of '" << _imp->params.image() << "' to '" << _imp->params.root() << "' post hooks returned non-zero";
}
@@ -269,7 +269,7 @@ Merger::on_file(bool is_check, const FSEntry & src, const FSEntry & dst)
0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_file_pre")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status())
make_check_fail();
if (! is_check)
@@ -280,10 +280,10 @@ Merger::on_file(bool is_check, const FSEntry & src, const FSEntry & dst)
("INSTALL_DESTINATION", stringify(dst / src.basename()))
.grab_output(Hook::AllowedOutputValues()("skip")))));
- if (hr.max_exit_status != 0)
+ if (hr.max_exit_status() != 0)
Log::get_instance()->message("merger.file.skip_hooks.failure", ll_warning, lc_context) << "Merge of '"
<< stringify(src) << "' to '" << stringify(dst) << "' skip hooks returned non-zero";
- else if (hr.output == "skip")
+ else if (hr.output() == "skip")
{
std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params.root().realpath())));
display_override("--- [skp] " + tidy);
@@ -326,7 +326,7 @@ Merger::on_file(bool is_check, const FSEntry & src, const FSEntry & dst)
0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_file_post")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status())
make_check_fail();
}
@@ -341,7 +341,7 @@ Merger::on_dir(bool is_check, const FSEntry & src, const FSEntry & dst)
0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_dir_pre")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status())
make_check_fail();
if (! is_check)
@@ -352,10 +352,10 @@ Merger::on_dir(bool is_check, const FSEntry & src, const FSEntry & dst)
("INSTALL_DESTINATION", stringify(dst / src.basename()))
.grab_output(Hook::AllowedOutputValues()("skip")))));
- if (hr.max_exit_status != 0)
+ if (hr.max_exit_status() != 0)
Log::get_instance()->message("merger.dir.skip_hooks.failure", ll_warning, lc_context) << "Merge of '"
<< stringify(src) << "' to '" << stringify(dst) << "' skip hooks returned non-zero";
- else if (hr.output == "skip")
+ else if (hr.output() == "skip")
{
std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params.root().realpath())));
display_override("--- [skp] " + tidy);
@@ -400,7 +400,7 @@ Merger::on_dir(bool is_check, const FSEntry & src, const FSEntry & dst)
0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_dir_post")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status())
make_check_fail();
}
@@ -415,7 +415,7 @@ Merger::on_sym(bool is_check, const FSEntry & src, const FSEntry & dst)
0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_sym_post")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status())
make_check_fail();
if (! is_check)
@@ -426,10 +426,10 @@ Merger::on_sym(bool is_check, const FSEntry & src, const FSEntry & dst)
("INSTALL_DESTINATION", stringify(dst / src.basename()))
.grab_output(Hook::AllowedOutputValues()("skip")))));
- if (hr.max_exit_status != 0)
+ if (hr.max_exit_status() != 0)
Log::get_instance()->message("merger.sym.skip_hooks.failure", ll_warning, lc_context) << "Merge of '"
<< stringify(src) << "' to '" << stringify(dst) << "' skip hooks returned non-zero";
- else if (hr.output == "skip")
+ else if (hr.output() == "skip")
{
std::string tidy(stringify((dst / src.basename()).strip_leading(_imp->params.root().realpath())));
display_override("--- [skp] " + tidy);
@@ -477,7 +477,7 @@ Merger::on_sym(bool is_check, const FSEntry & src, const FSEntry & dst)
0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_check_sym_post")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst / src.basename())))).max_exit_status())
make_check_fail();
}
@@ -725,7 +725,7 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
Hook("merger_install_file_pre")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst_dir / src.basename()))
- ("REAL_DESTINATION", stringify(dst_real)))).max_exit_status)
+ ("REAL_DESTINATION", stringify(dst_real)))).max_exit_status())
Log::get_instance()->message("merger.file.pre_hooks.failure", ll_warning, lc_context) <<
"Merge of '" << src << "' to '" << dst_dir << "' pre hooks returned non-zero";
@@ -818,7 +818,7 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
Hook("merger_install_file_post")
("INSTALL_SOURCE", stringify(src))
("INSTALL_DESTINATION", stringify(dst_dir / src.basename()))
- ("REAL_DESTINATION", stringify(dst_real)))).max_exit_status)
+ ("REAL_DESTINATION", stringify(dst_real)))).max_exit_status())
Log::get_instance()->message("merger.file.post_hooks.failed", ll_warning, lc_context) <<
"Merge of '" << src << "' to '" << dst_dir << "' post hooks returned non-zero";
@@ -925,7 +925,7 @@ Merger::install_dir(const FSEntry & src, const FSEntry & dst_dir)
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_dir_pre")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst_dir / src.basename())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst_dir / src.basename())))).max_exit_status())
Log::get_instance()->message("merger.dir.pre_hooks.failure", ll_warning, lc_context)
<< "Merge of '" << src << "' to '" << dst_dir << "' pre hooks returned non-zero";
@@ -978,7 +978,7 @@ Merger::install_dir(const FSEntry & src, const FSEntry & dst_dir)
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_dir_post")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst_dir / src.basename())))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst_dir / src.basename())))).max_exit_status())
Log::get_instance()->message("merger.dir.post_hooks.failure", ll_warning, lc_context)
<< "Merge of '" << src << "' to '" << dst_dir << "' post hooks returned non-zero";
@@ -997,7 +997,7 @@ Merger::install_sym(const FSEntry & src, const FSEntry & dst_dir)
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_sym_pre")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst)))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst)))).max_exit_status())
Log::get_instance()->message("merger.sym.pre_hooks.failure", ll_warning, lc_context)
<< "Merge of '" << src << "' to '" << dst_dir << "' pre hooks returned non-zero";
@@ -1047,7 +1047,7 @@ Merger::install_sym(const FSEntry & src, const FSEntry & dst_dir)
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_install_sym_post")
("INSTALL_SOURCE", stringify(src))
- ("INSTALL_DESTINATION", stringify(dst)))).max_exit_status)
+ ("INSTALL_DESTINATION", stringify(dst)))).max_exit_status())
Log::get_instance()->message("merger.sym.post_hooks.failure", ll_warning, lc_context) <<
"Merge of '" << src << "' to '" << dst_dir << "' post hooks returned non-zero";
@@ -1059,7 +1059,7 @@ Merger::unlink_file(FSEntry d)
{
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_file_pre")
- ("UNLINK_TARGET", stringify(d)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(d)))).max_exit_status())
Log::get_instance()->message("merger.unlink_file.pre_hooks.failure", ll_warning, lc_context) <<
"Unmerge of '" << d << "' pre hooks returned non-zero";
@@ -1068,7 +1068,7 @@ Merger::unlink_file(FSEntry d)
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_file_post")
- ("UNLINK_TARGET", stringify(d)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(d)))).max_exit_status())
Log::get_instance()->message("merger.unlink_file.post_hooks.failure", ll_warning, lc_context) <<
"Unmerge of '" << d << "' post hooks returned non-zero";
}
@@ -1078,7 +1078,7 @@ Merger::unlink_sym(FSEntry d)
{
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_sym_pre")
- ("UNLINK_TARGET", stringify(d)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(d)))).max_exit_status())
Log::get_instance()->message("merger.unlink_sym.pre_hooks.failure", ll_warning, lc_context) <<
"Unmerge of '" << d << "' pre hooks returned non-zero";
@@ -1086,7 +1086,7 @@ Merger::unlink_sym(FSEntry d)
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_sym_post")
- ("UNLINK_TARGET", stringify(d)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(d)))).max_exit_status())
Log::get_instance()->message("merger.unlink_sym.post_hooks.failure", ll_warning, lc_context) <<
"Unmerge of '" << d << "' post hooks returned non-zero";
}
@@ -1096,7 +1096,7 @@ Merger::unlink_dir(FSEntry d)
{
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_dir_pre")
- ("UNLINK_TARGET", stringify(d)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(d)))).max_exit_status())
Log::get_instance()->message("merger.unlink_dir.pre_hooks.failure", ll_warning, lc_context) <<
"Unmerge of '" << d << "' pre hooks returned non-zero";
@@ -1104,7 +1104,7 @@ Merger::unlink_dir(FSEntry d)
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_dir_post")
- ("UNLINK_TARGET", stringify(d)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(d)))).max_exit_status())
Log::get_instance()->message("merger.unlink_dir.post_hooks.failure", ll_warning, lc_context) <<
"Unmerge of '" << d << "' post hooks returned non-zero";
}
@@ -1114,7 +1114,7 @@ Merger::unlink_misc(FSEntry d)
{
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_misc_pre")
- ("UNLINK_TARGET", stringify(d)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(d)))).max_exit_status())
Log::get_instance()->message("merger.unlink_misc.pre_hooks.failure", ll_warning, lc_context) <<
"Unmerge of '" << d << "' pre hooks returned non-zero";
@@ -1122,7 +1122,7 @@ Merger::unlink_misc(FSEntry d)
if (0 != _imp->params.environment()->perform_hook(extend_hook(
Hook("merger_unlink_misc_post")
- ("UNLINK_TARGET", stringify(d)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(d)))).max_exit_status())
Log::get_instance()->message("merger.unlink_misc.post_hooks.failure", ll_warning, lc_context) <<
"Unmerge of '" << d << "' post hooks returned non-zero";
}
diff --git a/paludis/python_hooks.cc b/paludis/python_hooks.cc
index e707234..0dd23ca 100644
--- a/paludis/python_hooks.cc
+++ b/paludis/python_hooks.cc
@@ -14,6 +14,7 @@
#include <paludis/util/mutex.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
#include <set>
@@ -156,7 +157,7 @@ PyHookFile::run(const Hook & hook) const
Context c("When running hook '" + stringify(file_name()) + "' for hook '" + hook.name() + "':");
if (! _loaded)
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
Lock l(_mutex);
@@ -182,7 +183,7 @@ PyHookFile::run(const Hook & hook) const
<< _get_traceback() << "'";
}
- return HookResult(1, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(1), value_for<n::output>(""));
}
Prefix p(this, _run_prefixed ? strip_trailing_string(file_name().basename(), ".py") + "> " : "");
@@ -207,7 +208,7 @@ PyHookFile::run(const Hook & hook) const
Log::get_instance()->message("hook.python.failure", ll_warning, lc_no_context) <<
"Hook '" << file_name() << "': running hook_run_" << hook.name()
<< " function failed: '" << _get_traceback() << "'";
- return HookResult(1, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(1), value_for<n::output>(""));
}
if (hook.output_dest == hod_grab)
@@ -220,18 +221,18 @@ PyHookFile::run(const Hook & hook) const
<< "Hook '" << file_name() << "': hook_run_" << hook.name()
<< " function returned '" << result_s << "'";
- return HookResult(0, result_s);
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(result_s));
}
else
{
Log::get_instance()->message("hook.python.bad_output", ll_warning, lc_no_context)
<< "Hook '" << file_name() << "': hook_run_" << hook.name()
<< " function returned not a string.";
- return HookResult(1, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(1), value_for<n::output>(""));
}
}
else
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
void
diff --git a/paludis/repositories/e/e_installed_repository.cc b/paludis/repositories/e/e_installed_repository.cc
index bfbe4e1..84c6b16 100644
--- a/paludis/repositories/e/e_installed_repository.cc
+++ b/paludis/repositories/e/e_installed_repository.cc
@@ -158,7 +158,7 @@ EInstalledRepository::perform_hook(const Hook & hook) const
Context context("When performing hook '" + stringify(hook.name()) + "' for repository '"
+ stringify(name()) + "':");
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
std::tr1::shared_ptr<SetSpecTree::ConstItem>
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 06505d1..59424e8 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -985,7 +985,7 @@ ERepository::perform_hook(const Hook & hook) const
|| hook.name() == "uninstall_all_post")
update_news();
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
std::tr1::shared_ptr<const CategoryNamePartSet>
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 4c5697a..304e2d6 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -242,7 +242,7 @@ InstalledVirtualsRepository::perform_hook(const Hook & hook) const
Context context("When performing hook '" + stringify(hook.name()) + "' for repository '"
+ stringify(name()) + "':");
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
bool
diff --git a/paludis/sohooks_TEST.cc b/paludis/sohooks_TEST.cc
index c1fff74..7395a86 100644
--- a/paludis/sohooks_TEST.cc
+++ b/paludis/sohooks_TEST.cc
@@ -22,6 +22,7 @@
#include <paludis/util/graph.hh>
#include <paludis/util/graph-impl.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/make_named_values.hh>
#include <iostream>
#include <fstream>
@@ -32,13 +33,13 @@ namespace
HookResult
so_hook_run(const Environment *, const Hook &)
{
- return HookResult(6, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(6), value_for<n::output>(""));
}
HookResult
so_hook_output_run(const Environment *, const Hook &)
{
- return HookResult(0, "foo");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>("foo"));
}
HookResult
@@ -46,7 +47,7 @@ namespace
{
std::ofstream f("hooker_TEST_dir/ordering.out", std::ios_base::app);
f << "sohook" << std::endl;
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
void
@@ -67,7 +68,7 @@ paludis_hook_run(const Environment * env, const Hook & hook)
if ("ordering" == hook.name())
return ordering_run(env, hook);
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
void
diff --git a/paludis/sync_task.cc b/paludis/sync_task.cc
index f4e3a5e..ddf8204 100644
--- a/paludis/sync_task.cc
+++ b/paludis/sync_task.cc
@@ -104,7 +104,7 @@ namespace
if (0 !=
env->perform_hook(Hook("sync_pre")("TARGET", stringify(r))
("X_OF_Y", stringify(x) + " of " + stringify(y) + " (" + stringify(a) + " active)")
- ).max_exit_status)
+ ).max_exit_status())
throw SyncFailedError("Sync of '" + stringify(r) + "' aborted by hook");
{
@@ -132,7 +132,7 @@ namespace
if (0 !=
env->perform_hook(Hook("sync_post")("TARGET", stringify(r))
("X_OF_Y", stringify(x) + " of " + stringify(y) + " (" + stringify(a) + " active)")
- ).max_exit_status)
+ ).max_exit_status())
throw SyncFailedError("Sync of '" + stringify(r) + "' aborted by hook");
{
@@ -167,7 +167,7 @@ SyncTask::execute()
if (0 !=
_imp->env->perform_hook(Hook("sync_all_pre")("TARGETS", join(_imp->targets.begin(),
- _imp->targets.end(), " "))).max_exit_status)
+ _imp->targets.end(), " "))).max_exit_status())
throw SyncFailedError("Sync aborted by hook");
on_sync_all_pre();
@@ -187,7 +187,7 @@ SyncTask::execute()
on_sync_all_post();
if (0 !=
_imp->env->perform_hook(Hook("sync_all_post")("TARGETS", join(_imp->targets.begin(),
- _imp->targets.end(), " "))).max_exit_status)
+ _imp->targets.end(), " "))).max_exit_status())
throw SyncFailedError("Sync aborted by hook");
}
diff --git a/paludis/uninstall_task.cc b/paludis/uninstall_task.cc
index 0bc0032..f06b402 100644
--- a/paludis/uninstall_task.cc
+++ b/paludis/uninstall_task.cc
@@ -334,7 +334,7 @@ UninstallTask::execute()
if (0 !=
_imp->env->perform_hook(Hook("uninstall_all_pre")("TARGETS", join(_imp->raw_targets.begin(),
- _imp->raw_targets.end(), " "))).max_exit_status)
+ _imp->raw_targets.end(), " "))).max_exit_status())
throw UninstallActionError("Uninstall aborted by hook");
on_uninstall_all_pre();
@@ -353,7 +353,7 @@ UninstallTask::execute()
if (0 !=
_imp->env->perform_hook(Hook("uninstall_pre")("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status())
throw UninstallActionError("Uninstall of '" + cpvr + "' aborted by hook");
on_uninstall_pre(*i);
@@ -374,14 +374,14 @@ UninstallTask::execute()
on_uninstall_post(*i);
if (0 !=
_imp->env->perform_hook(Hook("uninstall_post")("TARGET", cpvr)
- ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status)
+ ("X_OF_Y", stringify(x) + " of " + stringify(y))).max_exit_status())
throw UninstallActionError("Uninstall of '" + cpvr + "' aborted by hook");
}
on_uninstall_all_post();
if (0 !=
_imp->env->perform_hook(Hook("uninstall_all_post")("TARGETS", join(_imp->raw_targets.begin(),
- _imp->raw_targets.end(), " "))).max_exit_status)
+ _imp->raw_targets.end(), " "))).max_exit_status())
throw UninstallActionError("Uninstall aborted by hook");
}
diff --git a/paludis/unmerger.cc b/paludis/unmerger.cc
index 1dfb35a..9471cba 100644
--- a/paludis/unmerger.cc
+++ b/paludis/unmerger.cc
@@ -79,7 +79,7 @@ Unmerger::unmerge()
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_pre")
- ("UNLINK_TARGET", stringify(_imp->options.root())))).max_exit_status)
+ ("UNLINK_TARGET", stringify(_imp->options.root())))).max_exit_status())
throw UnmergerError("Unmerge from '" + stringify(_imp->options.root()) + "' aborted by hook");
for (UnmergeEntriesIterator i(_imp->unmerge_entries.rbegin()), i_end(_imp->unmerge_entries.rend()) ; i != i_end ; ++i)
@@ -113,7 +113,7 @@ Unmerger::unmerge()
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_post")
- ("UNLINK_TARGET", stringify(_imp->options.root())))).max_exit_status)
+ ("UNLINK_TARGET", stringify(_imp->options.root())))).max_exit_status())
throw UnmergerError("Unmerge from '" + stringify(_imp->options.root()) + "' aborted by hook");
}
@@ -127,11 +127,11 @@ Unmerger::unmerge_file(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei)
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force")))));
- if (hr.max_exit_status != 0)
+ if (hr.max_exit_status() != 0)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
- else if (hr.output == "skip")
+ else if (hr.output() == "skip")
display("--- [skip ] " + stringify(f));
- else if (hr.output == "force")
+ else if (hr.output() == "force")
{
display("<<< [force] " + stringify(f));
unlink_file(f_real, ei);
@@ -153,11 +153,11 @@ Unmerger::unmerge_sym(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) c
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force")))));
- if (hr.max_exit_status != 0)
+ if (hr.max_exit_status() != 0)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
- else if (hr.output == "skip")
+ else if (hr.output() == "skip")
display("--- [skip ] " + stringify(f));
- else if (hr.output == "force")
+ else if (hr.output() == "force")
{
display("<<< [force] " + stringify(f));
unlink_sym(f_real, ei);
@@ -179,9 +179,9 @@ Unmerger::unmerge_dir(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei) c
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")))));
- if (hr.max_exit_status != 0)
+ if (hr.max_exit_status() != 0)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
- else if (hr.output == "skip")
+ else if (hr.output() == "skip")
display("--- [skip ] " + stringify(f));
else if (check_dir(f, ei))
{
@@ -200,11 +200,11 @@ Unmerger::unmerge_misc(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> & ei)
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force")))));
- if (hr.max_exit_status != 0)
+ if (hr.max_exit_status() != 0)
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
- else if (hr.output == "skip")
+ else if (hr.output() == "skip")
display("--- [skip ] " + stringify(f));
- else if (hr.output == "force")
+ else if (hr.output() == "force")
{
display("<<< [force] " + stringify(f));
unlink_misc(f_real, ei);
@@ -221,7 +221,7 @@ Unmerger::unlink_file(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) cons
{
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_file_pre")
- ("UNLINK_TARGET", stringify(f)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(f)))).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
if (f.is_regular_file())
@@ -238,7 +238,7 @@ Unmerger::unlink_file(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) cons
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_file_post")
- ("UNLINK_TARGET", stringify(f)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(f)))).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
}
@@ -247,14 +247,14 @@ Unmerger::unlink_sym(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
{
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_sym_pre")
- ("UNLINK_TARGET", stringify(f)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(f)))).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
f.unlink();
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_sym_post")
- ("UNLINK_TARGET", stringify(f)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(f)))).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
}
@@ -263,14 +263,14 @@ Unmerger::unlink_dir(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) const
{
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_dir_pre")
- ("UNLINK_TARGET", stringify(f)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(f)))).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
f.rmdir();
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_dir_post")
- ("UNLINK_TARGET", stringify(f)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(f)))).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
}
@@ -279,14 +279,14 @@ Unmerger::unlink_misc(FSEntry & f, const std::tr1::shared_ptr<ExtraInfo> &) cons
{
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_misc_pre")
- ("UNLINK_TARGET", stringify(f)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(f)))).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
f.unlink();
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_misc_post")
- ("UNLINK_TARGET", stringify(f)))).max_exit_status)
+ ("UNLINK_TARGET", stringify(f)))).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(f) + "' aborted by hook");
}
diff --git a/python/environment.cc b/python/environment.cc
index 85450c0..fbf052d 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -33,6 +33,7 @@
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/tribool.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/make_named_values.hh>
using namespace paludis;
using namespace paludis::python;
@@ -299,7 +300,7 @@ class EnvironmentImplementationWrapper :
virtual HookResult perform_hook(const Hook & h) const
PALUDIS_ATTRIBUTE((warn_unused_result))
{
- return HookResult(0, "");
+ return make_named_values<HookResult>(value_for<n::max_exit_status>(0), value_for<n::output>(""));
}
virtual std::string distribution() const
diff --git a/src/clients/cave/cmd_sync.cc b/src/clients/cave/cmd_sync.cc
index f876d70..9227623 100644
--- a/src/clients/cave/cmd_sync.cc
+++ b/src/clients/cave/cmd_sync.cc
@@ -149,7 +149,7 @@ namespace
("NUMBER_DONE", stringify(nd))
("NUMBER_ACTIVE", stringify(na))
("NUMBER_PENDING", stringify(np))
- ).max_exit_status)
+ ).max_exit_status())
throw SyncFailedError("Sync of '" + stringify(r) + "' aborted by hook");
}
@@ -201,7 +201,7 @@ namespace
("NUMBER_DONE", stringify(nd))
("NUMBER_ACTIVE", stringify(na))
("NUMBER_PENDING", stringify(np))
- ).max_exit_status)
+ ).max_exit_status())
throw SyncFailedError("Sync of '" + stringify(r) + "' aborted by hook");
}
@@ -258,7 +258,7 @@ namespace
("NUMBER_DONE", stringify(nd))
("NUMBER_ACTIVE", stringify(na))
("NUMBER_PENDING", stringify(np))
- ).max_exit_status);
+ ).max_exit_status());
}
}
}
@@ -299,7 +299,7 @@ SyncCommand::run(
if (0 != env->perform_hook(Hook("sync_all_pre")
("TARGETS", join(repos.begin(), repos.end(), " ")
- )).max_exit_status)
+ )).max_exit_status())
throw SyncFailedError("Sync aborted by hook");
cout << format_general_s(f::sync_repos_title(), "");
@@ -318,7 +318,7 @@ SyncCommand::run(
if (0 != env->perform_hook(Hook("sync_all_post")
("TARGETS", join(repos.begin(), repos.end(), " ")
- )).max_exit_status)
+ )).max_exit_status())
throw SyncFailedError("Sync aborted by hook");
cout << endl << format_general_s(f::sync_heading(), "Sync results");