aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2006-07-27 00:46:51 +0000
committerAvatar Mike Kelly <pioto@pioto.org> 2006-07-27 00:46:51 +0000
commitbaef8cfd30786dcdd6177d10ca32bc3c6bfa1a1c (patch)
tree677bda2164228ff7ed454d50d64c5d2bb3032a61
parentac0ae7a7d6b892e3296e4361bab8108d150c8850 (diff)
downloadpaludis-baef8cfd30786dcdd6177d10ca32bc3c6bfa1a1c.tar.gz
paludis-baef8cfd30786dcdd6177d10ca32bc3c6bfa1a1c.tar.xz
Add myself to AUTHORS. Add failure hooks to all ebuild phases, and for
sync, install, and uninstall.
-rw-r--r--AUTHORS3
-rwxr-xr-xebuild/ebuild.bash10
-rw-r--r--hooks/Makefile.am.m421
-rw-r--r--paludis/tasks/install_task.cc21
-rw-r--r--paludis/tasks/uninstall_task.cc11
-rw-r--r--src/paludis/sync.cc5
6 files changed, 66 insertions, 5 deletions
diff --git a/AUTHORS b/AUTHORS
index 94938b4..67c4dfd 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -27,3 +27,6 @@ Robert S. Gerus <arachnist@gmail.com>
David Morgan <david.morgan@wadham.oxford.ac.uk>
Contributor
+
+Mike Kelly <pioto@pioto.org>
+ Contributor
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index 6725f92..fbe9441 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -260,14 +260,20 @@ ebuild_main()
done
PATH="" ebuild_load_ebuild "${ebuild}"
fi
- ebuild_f_${1} || die "${1} failed"
+ if ! ebuild_f_${1} ; then
+ perform_hook ebuild_${action}_fail
+ die "${1} failed"
+ fi
perform_hook ebuild_${action}_post
else
ebuild_load_ebuild "${ebuild}"
for action in $@ ; do
export EBUILD_PHASE="${action}"
perform_hook ebuild_${action}_pre
- ebuild_f_${action} || die "${action} failed"
+ if ! ebuild_f_${action} ; then
+ perform_hook ebuild_${action}_fail
+ die "${action} failed"
+ fi
if [[ ${action} == "init" ]] ; then
ebuild_load_ebuild "${ebuild}"
fi
diff --git a/hooks/Makefile.am.m4 b/hooks/Makefile.am.m4
index 56314b3..a3cf37a 100644
--- a/hooks/Makefile.am.m4
+++ b/hooks/Makefile.am.m4
@@ -47,16 +47,19 @@ installuserhooks$1dir = $(datadir)/paludis/hooks/$1
installuserhooks$1_SCRIPTS = .keep')
userhook(`install_pre')
+userhook(`install_fail')
userhook(`install_post')
userhook(`install_all_pre')
userhook(`install_all_post')
userhook(`install_pretend_pre')
userhook(`install_pretend_post')
userhook(`uninstall_pre')
+userhook(`uninstall_fail')
userhook(`uninstall_post')
userhook(`uninstall_all_pre')
userhook(`uninstall_all_post')
userhook(`sync_pre')
+userhook(`sync_fail')
userhook(`sync_post')
userhook(`sync_all_pre')
userhook(`sync_all_post')
@@ -65,40 +68,58 @@ userhook(`fetch_all_post')
userhook(`fetch_all_all_pre')
userhook(`fetch_all_all_post')
userhook(`ebuild_metadata_pre')
+userhook(`ebuild_metadata_fail')
userhook(`ebuild_metadata_post')
userhook(`ebuild_init_pre')
+userhook(`ebuild_init_fail')
userhook(`ebuild_init_post')
userhook(`ebuild_fetch_pre')
+userhook(`ebuild_fetch_fail')
userhook(`ebuild_fetch_post')
userhook(`ebuild_merge_pre')
+userhook(`ebuild_merge_fail')
userhook(`ebuild_merge_post')
userhook(`ebuild_unmerge_pre')
+userhook(`ebuild_unmerge_fail')
userhook(`ebuild_unmerge_post')
userhook(`ebuild_tidyup_pre')
+userhook(`ebuild_tidyup_fail')
userhook(`ebuild_tidyup_post')
userhook(`ebuild_strip_pre')
+userhook(`ebuild_strip_fail')
userhook(`ebuild_strip_post')
userhook(`ebuild_unpack_pre')
+userhook(`ebuild_unpack_fail')
userhook(`ebuild_unpack_post')
userhook(`ebuild_compile_pre')
+userhook(`ebuild_compile_fail')
userhook(`ebuild_compile_post')
userhook(`ebuild_install_pre')
+userhook(`ebuild_install_fail')
userhook(`ebuild_install_post')
userhook(`ebuild_test_pre')
+userhook(`ebuild_test_fail')
userhook(`ebuild_test_post')
userhook(`ebuild_setup_pre')
+userhook(`ebuild_setup_fail')
userhook(`ebuild_setup_post')
userhook(`ebuild_config_pre')
+userhook(`ebuild_config_fail')
userhook(`ebuild_config_post')
userhook(`ebuild_nofetch_pre')
+userhook(`ebuild_nofetch_fail')
userhook(`ebuild_nofetch_post')
userhook(`ebuild_preinst_pre')
+userhook(`ebuild_preinst_fail')
userhook(`ebuild_preinst_post')
userhook(`ebuild_postinst_pre')
+userhook(`ebuild_postinst_fail')
userhook(`ebuild_postinst_post')
userhook(`ebuild_prerm_pre')
+userhook(`ebuild_prerm_fail')
userhook(`ebuild_prerm_post')
userhook(`ebuild_postrm_pre')
+userhook(`ebuild_postrm_fail')
userhook(`ebuild_postrm_post')
define(`systemhook', `
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 323c0d1..26cff7e 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -284,7 +284,15 @@ InstallTask::execute()
if (! installable_interface)
throw InternalError(PALUDIS_HERE, "Trying to install from a non-installable repository");
- installable_interface->install(dep->get<dle_name>(), dep->get<dle_version>(), _imp->install_options);
+ try
+ {
+ installable_interface->install(dep->get<dle_name>(), dep->get<dle_version>(), _imp->install_options);
+ }
+ catch (const PackageInstallActionError & e)
+ {
+ _imp->env->perform_hook(Hook("install_fail")("TARGET", cpvr)("MESSAGE", e.message()));
+ throw;
+ }
/* we've fetched / installed one item */
if (_imp->install_options.get<io_fetchonly>())
@@ -344,7 +352,16 @@ InstallTask::execute()
get_interface<repo_uninstallable>());
if (! uninstall_interface)
throw InternalError(PALUDIS_HERE, "Trying to uninstall from a non-uninstallable repo");
- uninstall_interface->uninstall(c->get<pde_name>(), c->get<pde_version>(), _imp->install_options);
+
+ try
+ {
+ uninstall_interface->uninstall(c->get<pde_name>(), c->get<pde_version>(), _imp->install_options);
+ }
+ catch (const PackageUninstallActionError & e)
+ {
+ _imp->env->perform_hook(Hook("uninstall_fail")("TARGET", stringify(*c))("MESSAGE", e.message()));
+ throw;
+ }
on_clean_post(*dep, *c);
_imp->env->perform_hook(Hook("uninstall_post")("TARGET", stringify(*c)));
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index b5c04e8..dc3b113 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -181,7 +181,16 @@ UninstallTask::execute()
get_interface<repo_uninstallable>());
if (! uninstall_interface)
throw InternalError(PALUDIS_HERE, "Trying to uninstall from a non-uninstallable repo");
- uninstall_interface->uninstall(i->get<pde_name>(), i->get<pde_version>(), _imp->install_options);
+
+ try
+ {
+ uninstall_interface->uninstall(i->get<pde_name>(), i->get<pde_version>(), _imp->install_options);
+ }
+ catch (const PackageUninstallActionError & e)
+ {
+ _imp->env->perform_hook(Hook("uninstall_fail")("TARGET", cpvr)("MESSAGE", e.message()));
+ throw;
+ }
on_uninstall_post(*i);
_imp->env->perform_hook(Hook("uninstall_post")("TARGET", cpvr));
diff --git a/src/paludis/sync.cc b/src/paludis/sync.cc
index 3266dc2..93bd8e4 100644
--- a/src/paludis/sync.cc
+++ b/src/paludis/sync.cc
@@ -39,6 +39,10 @@ namespace
{
int return_code(0);
+ p::Context context("When performing sync action for '"
+ + p::stringify(r->name()) + "': ");
+ p::Environment * const env(p::DefaultEnvironment::get_instance());
+
std::cout << colour(cl_heading, "Sync " + p::stringify(r->name())) << std::endl;
try
{
@@ -56,6 +60,7 @@ namespace
std::cerr << " * " << e.backtrace("\n * ") << e.message() << std::endl;
std::cerr << std::endl;
std::cout << "Sync " << r->name() << " failed" << std::endl;
+ env->perform_hook(p::Hook("sync_fail")("TARGET", stringify((*r)->name())));
}
return return_code;