aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-12 15:37:04 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-12 18:26:26 +0100
commit9932da12a0310806ada93eff65a71d389415449e (patch)
treec0d4734e234833bf3d21568cd56d2f083a3b0b1c
parente398520f7027130da8aae1b296c57d666caa6d89 (diff)
downloadpaludis-9932da12a0310806ada93eff65a71d389415449e.tar.gz
paludis-9932da12a0310806ada93eff65a71d389415449e.tar.xz
Use output managers for unmerger hooks
-rw-r--r--paludis/ndbam_unmerger.cc1
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc1
-rw-r--r--paludis/unmerger.cc28
-rw-r--r--paludis/unmerger.hh3
4 files changed, 19 insertions, 14 deletions
diff --git a/paludis/ndbam_unmerger.cc b/paludis/ndbam_unmerger.cc
index bbd7eac..d69fa43 100644
--- a/paludis/ndbam_unmerger.cc
+++ b/paludis/ndbam_unmerger.cc
@@ -72,6 +72,7 @@ NDBAMUnmerger::NDBAMUnmerger(const NDBAMUnmergerOptions & o) :
Unmerger(make_named_values<UnmergerOptions>(
n::environment() = o.environment(),
n::ignore() = o.ignore(),
+ n::maybe_output_manager() = o.output_manager(),
n::root() = o.root()
)),
Pimp<NDBAMUnmerger>(o),
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index 3aba094..710321d 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -72,6 +72,7 @@ VDBUnmerger::VDBUnmerger(const VDBUnmergerOptions & o) :
Unmerger(make_named_values<UnmergerOptions>(
n::environment() = o.environment(),
n::ignore() = o.ignore(),
+ n::maybe_output_manager() = o.output_manager(),
n::root() = o.root()
)),
Pimp<VDBUnmerger>(o),
diff --git a/paludis/unmerger.cc b/paludis/unmerger.cc
index 1a82a30..df5145e 100644
--- a/paludis/unmerger.cc
+++ b/paludis/unmerger.cc
@@ -80,7 +80,7 @@ Unmerger::unmerge()
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_pre")
("UNLINK_TARGET", stringify(_imp->options.root()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).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)
@@ -115,7 +115,7 @@ Unmerger::unmerge()
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_post")
("UNLINK_TARGET", stringify(_imp->options.root()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge from '" + stringify(_imp->options.root()) + "' aborted by hook");
}
@@ -128,7 +128,7 @@ Unmerger::unmerge_file(const std::shared_ptr<const ContentsEntry> & e) const
Hook("unmerger_unlink_file_override")
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force"))),
- make_null_shared_ptr()));
+ _imp->options.maybe_output_manager()));
if (hr.max_exit_status() != 0)
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
@@ -157,7 +157,7 @@ Unmerger::unmerge_sym(const std::shared_ptr<const ContentsEntry> & e) const
Hook("unmerger_unlink_sym_override")
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force"))),
- make_null_shared_ptr()));
+ _imp->options.maybe_output_manager()));
if (hr.max_exit_status() != 0)
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
@@ -186,7 +186,7 @@ Unmerger::unmerge_dir(const std::shared_ptr<const ContentsEntry> & e) const
Hook("unmerger_unlink_dir_override")
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip"))),
- make_null_shared_ptr()));
+ _imp->options.maybe_output_manager()));
if (hr.max_exit_status() != 0)
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
@@ -210,7 +210,7 @@ Unmerger::unmerge_misc(const std::shared_ptr<const ContentsEntry> & e) const
Hook("unmerger_unlink_misc_override")
("UNLINK_TARGET", stringify(f_real))
.grab_output(Hook::AllowedOutputValues()("skip")("force"))),
- make_null_shared_ptr()));
+ _imp->options.maybe_output_manager()));
if (hr.max_exit_status() != 0)
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
@@ -236,7 +236,7 @@ Unmerger::unlink_file(FSEntry f, const std::shared_ptr<const ContentsEntry> & e)
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_file_pre")
("UNLINK_TARGET", stringify(e->location_key()->value()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
if (f.is_regular_file())
@@ -254,7 +254,7 @@ Unmerger::unlink_file(FSEntry f, const std::shared_ptr<const ContentsEntry> & e)
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_file_post")
("UNLINK_TARGET", stringify(e->location_key()->value()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
}
@@ -264,7 +264,7 @@ Unmerger::unlink_sym(FSEntry f, const std::shared_ptr<const ContentsEntry> & e)
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_sym_pre")
("UNLINK_TARGET", stringify(e->location_key()->value()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
f.unlink();
@@ -272,7 +272,7 @@ Unmerger::unlink_sym(FSEntry f, const std::shared_ptr<const ContentsEntry> & e)
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_sym_post")
("UNLINK_TARGET", stringify(e->location_key()->value()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
}
@@ -282,7 +282,7 @@ Unmerger::unlink_dir(FSEntry f, const std::shared_ptr<const ContentsEntry> & e)
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_dir_pre")
("UNLINK_TARGET", stringify(e->location_key()->value()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
f.rmdir();
@@ -290,7 +290,7 @@ Unmerger::unlink_dir(FSEntry f, const std::shared_ptr<const ContentsEntry> & e)
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_dir_post")
("UNLINK_TARGET", stringify(e->location_key()->value()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
}
@@ -300,7 +300,7 @@ Unmerger::unlink_misc(FSEntry f, const std::shared_ptr<const ContentsEntry> & e)
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_misc_pre")
("UNLINK_TARGET", stringify(e->location_key()->value()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
f.unlink();
@@ -308,7 +308,7 @@ Unmerger::unlink_misc(FSEntry f, const std::shared_ptr<const ContentsEntry> & e)
if (0 != _imp->options.environment()->perform_hook(extend_hook(
Hook("unmerger_unlink_misc_post")
("UNLINK_TARGET", stringify(e->location_key()->value()))),
- make_null_shared_ptr()).max_exit_status())
+ _imp->options.maybe_output_manager()).max_exit_status())
throw UnmergerError("Unmerge of '" + stringify(e->location_key()->value()) + "' aborted by hook");
}
diff --git a/paludis/unmerger.hh b/paludis/unmerger.hh
index a872992..4b29faf 100644
--- a/paludis/unmerger.hh
+++ b/paludis/unmerger.hh
@@ -27,6 +27,7 @@
#include <paludis/util/named_value.hh>
#include <paludis/merger_entry_type.hh>
#include <paludis/contents-fwd.hh>
+#include <paludis/output_manager-fwd.hh>
#include <functional>
/** \file
@@ -49,6 +50,7 @@ namespace paludis
{
typedef Name<struct environment_name> environment;
typedef Name<struct ignore_name> ignore;
+ typedef Name<struct maybe_output_manager_name> maybe_output_manager;
typedef Name<struct root_name> root;
}
@@ -63,6 +65,7 @@ namespace paludis
{
NamedValue<n::environment, const Environment *> environment;
NamedValue<n::ignore, const std::function<bool (const FSEntry &)> > ignore;
+ NamedValue<n::maybe_output_manager, std::shared_ptr<OutputManager> > maybe_output_manager;
NamedValue<n::root, FSEntry> root;
};