aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-23 00:32:42 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-23 00:32:42 +0000
commit965fa1db89e7de5fb3cf56f0013fb1fedc754047 (patch)
tree90fe6481ea5f2a17daf158e4ac9f789e16179ff7
parent0c20e7cf36ed3505724666fe440c74270233af1e (diff)
downloadpaludis-965fa1db89e7de5fb3cf56f0013fb1fedc754047.tar.gz
paludis-965fa1db89e7de5fb3cf56f0013fb1fedc754047.tar.xz
Add merge item hooks. Fixes: ticket:142
-rw-r--r--doc/hooks.html.skel6
-rw-r--r--hooks/Makefile.am.m42
-rw-r--r--paludis/tasks/install_task.cc12
3 files changed, 19 insertions, 1 deletions
diff --git a/doc/hooks.html.skel b/doc/hooks.html.skel
index 10914db..00eb141 100644
--- a/doc/hooks.html.skel
+++ b/doc/hooks.html.skel
@@ -49,6 +49,8 @@ that is executed when a particular well defined action occurs.</p>
<li><code>install_all_post</code></li>
<li><code>install_pretend_pre</code></li>
<li><code>install_pretend_post</code></li>
+ <li><code>install_pretend_display_item_pre</code></li>
+ <li><code>install_pretend_display_item_post</code></li>
<li><code>uninstall_pre</code></li>
<li><code>uninstall_fail</code></li>
<li><code>uninstall_post</code></li>
@@ -68,7 +70,9 @@ that is executed when a particular well defined action occurs.</p>
<p>In general, certain special environment variables will be set. <code>HOOK</code> will contain
the name of the hook. For <code>all</code> hooks, <code>TARGETS</code> will contain the targets
for the operation. For non-<code>all</code> hooks, <code>TARGET</code> will contain the current
-target. The <code>PALUDIS_CMDLINE</code> variables described below are also available.</p>
+target. The <code>PALUDIS_CMDLINE</code> variables described below are also available. For the
+<code>install_pretend_display_item</code> hooks, the <code>KIND</code> variable will also be of
+interest.</p>
<h4>Ebuild Hooks</h4>
diff --git a/hooks/Makefile.am.m4 b/hooks/Makefile.am.m4
index 306618f..8d2b5eb 100644
--- a/hooks/Makefile.am.m4
+++ b/hooks/Makefile.am.m4
@@ -62,6 +62,8 @@ userhook(`install_all_pre')
userhook(`install_all_post')
userhook(`install_pretend_pre')
userhook(`install_pretend_post')
+userhook(`install_pretend_display_item_pre')
+userhook(`install_pretend_display_item_post')
userhook(`uninstall_pre')
userhook(`uninstall_fail')
userhook(`uninstall_post')
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 339bc42..a47817c 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -199,8 +199,20 @@ InstallTask::execute()
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end ; ++dep)
{
+ if (_imp->pretend &&
+ 0 != _imp->env->perform_hook(Hook("install_pretend_display_item_pre")
+ ("TARGET", stringify(dep->package))
+ ("KIND", stringify(dep->kind))))
+ throw PackageInstallActionError("Pretend install aborted by hook");
+
_imp->current_dep_list_entry = dep;
on_display_merge_list_entry(*dep);
+
+ if (_imp->pretend &&
+ 0 != _imp->env->perform_hook(Hook("install_pretend_display_item_post")
+ ("TARGET", stringify(dep->package))
+ ("KIND", stringify(dep->kind))))
+ throw PackageInstallActionError("Pretend install aborted by hook");
}
/* we're done displaying our task list */