aboutsummaryrefslogtreecommitdiff
path: root/hooks
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-22 15:59:52 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-22 15:59:52 +0000
commit0a479e1fc25255d60b573ba7b91295ff7b1bf080 (patch)
tree2d252ffe335bc70695701c2d2e0a04ba91868403 /hooks
parentef30feada12c02381e32b649b132e6a6c5efaf25 (diff)
downloadpaludis-0a479e1fc25255d60b573ba7b91295ff7b1bf080.tar.gz
paludis-0a479e1fc25255d60b573ba7b91295ff7b1bf080.tar.xz
Implement auto hooks, new install_task hook phases. Fixes: ticket:434, ticket:435, ticket:502
Diffstat (limited to 'hooks')
-rw-r--r--hooks/Makefile.am.m417
-rw-r--r--hooks/demos/elog.bash.in10
-rwxr-xr-xhooks/find_config_updates.hook24
-rwxr-xr-xhooks/news.hook20
4 files changed, 53 insertions, 18 deletions
diff --git a/hooks/Makefile.am.m4 b/hooks/Makefile.am.m4
index e7bfda0a5..265121170 100644
--- a/hooks/Makefile.am.m4
+++ b/hooks/Makefile.am.m4
@@ -10,19 +10,19 @@ SUBDIRS = . demos
installvarlibpaludisnewsdir = $(localstatedir)/gentoo/news
installhookcommonprogdir = $(libexecdir)/paludis/hooks/common
-installhookinstallallpostdir = $(libexecdir)/paludis/hooks/install_all_post
+installhookautoprogdir = $(libexecdir)/paludis/hooks/auto
installhookinstallpostdir = $(libexecdir)/paludis/hooks/install_post
installhookcommonprog_SCRIPTS = \
gnu_info_index.bash \
eselect_env_update.bash \
log.bash \
- news.hook \
installable_cache_regen.bash \
installed_cache_regen.bash \
write_cache_clean.bash
-installhookinstallallpost_SCRIPTS = \
+installhookautoprog_SCRIPTS = \
+ news.hook \
find_config_updates.hook
installhookinstallpost_SCRIPTS = \
@@ -44,7 +44,7 @@ check_PROGRAMS =
EXTRA_DIST = \
Makefile.am.m4 \
$(installhookcommonprog_SCRIPTS) \
- $(installhookinstallallpost_SCRIPTS) \
+ $(installhookautoprog_SCRIPTS) \
$(installhookinstallpost_SCRIPTS) \
$(check_SCRIPTS)
@@ -57,6 +57,7 @@ installuserhooks$1_DATA = .keep
installuserhooksplat$1dir = $(libdir)/paludis/hooks/$1
installuserhooksplat$1_DATA = .keep')
+userhook(`auto')
userhook(`install_pre')
userhook(`install_fail')
userhook(`install_post')
@@ -66,6 +67,8 @@ userhook(`install_pretend_pre')
userhook(`install_pretend_post')
userhook(`install_pretend_display_item_pre')
userhook(`install_pretend_display_item_post')
+userhook(`install_task_execute_pre')
+userhook(`install_task_execute_post')
userhook(`clean_all_post')
userhook(`clean_all_pre')
userhook(`clean_fail')
@@ -179,6 +182,7 @@ define(`systemhook', `
installsystemhooks$1dir = $(libexecdir)/paludis/hooks/$1
installsystemhooks$1_DATA = .keep')
+systemhook(`auto')
systemhook(`install_pre')
systemhook(`install_post')
systemhook(`install_all_pre')
@@ -221,6 +225,7 @@ install-data-local :
install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_all_post/
install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_pre/
install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_task_execute_post/
ln -sf ../common/gnu_info_index.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/
ln -sf ../common/gnu_info_index.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
ln -sf ../common/eselect_env_update.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/
@@ -243,9 +248,6 @@ install-data-local :
ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_post/
ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_pre/
ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_post/
- ln -sf ../common/news.hook $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_all_post/
- ln -sf ../common/news.hook $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
- ln -sf ../common/news.hook $(DESTDIR)/$(libexecdir)/paludis/hooks/install_pretend_post/
ln -sf ../common/installable_cache_regen.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_all_post/
ln -sf ../common/write_cache_clean.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_all_post/
ln -sf ../common/installed_cache_regen.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/
@@ -256,7 +258,6 @@ uninstall-local :
rm -f $(DESTDIR)/$(libexecdir)/paludis/hooks/*/gnu_info_index.bash
rm -f $(DESTDIR)/$(libexecdir)/paludis/hooks/*/eselect_env_update.bash
rm -f $(DESTDIR)/$(libexecdir)/paludis/hooks/*/log.bash
- rm -f $(DESTDIR)/$(libexecdir)/paludis/hooks/*/news.hook
rm -f $(DESTDIR)/$(libexecdir)/paludis/hooks/*/write_cache_clean.bash
Makefile.am : Makefile.am.m4
diff --git a/hooks/demos/elog.bash.in b/hooks/demos/elog.bash.in
index 6e1598a4d..fa6654564 100644
--- a/hooks/demos/elog.bash.in
+++ b/hooks/demos/elog.bash.in
@@ -6,13 +6,7 @@
# this functionality, this script should be copied or symlinked into:
#
# @DATADIR@/paludis/hooks/elog/
-# @DATADIR@/paludis/hooks/install_all_pre/
-# @DATADIR@/paludis/hooks/install_all_post/
-# @DATADIR@/paludis/hooks/install_fail/
-# @DATADIR@/paludis/hooks/uninstall_all_pre/
-# @DATADIR@/paludis/hooks/uninstall_all_post/
-# @DATADIR@/paludis/hooks/uninstall_fail/
-# @DATADIR@/paludis/hooks/clean_fail/
+# @DATADIR@/paludis/hooks/install_task_execute_post/
#
# And optionally:
#
@@ -56,7 +50,7 @@ case "${HOOK}" in
fi
;;
- install_all_post|uninstall_all_post|install_fail|uninstall_fail|clean_fail)
+ install_all_post|uninstall_all_post|install_fail|uninstall_fail|clean_fail|install_task_execute_post)
echo
old_pf=""
while read line ; do
diff --git a/hooks/find_config_updates.hook b/hooks/find_config_updates.hook
index da5156bae..8122a0fcb 100755
--- a/hooks/find_config_updates.hook
+++ b/hooks/find_config_updates.hook
@@ -18,6 +18,10 @@
check_for_config_updates()
{
+ if [[ "${PRETEND}" == true ]] ; then
+ return
+ fi
+
shopt -s extglob
export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
@@ -57,8 +61,26 @@ check_for_config_updates()
fi
}
-for h in install_all_post ; do
+stale_hook()
+{
+ export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+ source ${PALUDIS_ECHO_FUNCTIONS_DIR:-${PALUDIS_EBUILD_DIR}}/echo_functions.bash
+
+ echo
+ ewarn "find_config_updates hook should not be run in phase '${HOOK}'"
+ ewarn "Do you have stale symlinks?"
+}
+
+for h in install_task_execute_post ; do
eval "hook_run_${h}() { check_for_config_updates ; }"
eval "hook_after_${h}() { echo log write_cache_clean news ; }"
done
+for h in install_all_post ; do
+ eval "hook_run_${h}() { stale_hook ; }"
+done
+
+hook_auto_names() {
+ echo install_task_execute_post
+}
+
diff --git a/hooks/news.hook b/hooks/news.hook
index 7cb396b56..db4975ea8 100755
--- a/hooks/news.hook
+++ b/hooks/news.hook
@@ -33,8 +33,26 @@ check_for_news()
fi
}
-for h in sync_all_post install_all_post install_pretend_post ; do
+stale_hook()
+{
+ export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+ source ${PALUDIS_ECHO_FUNCTIONS_DIR:-${PALUDIS_EBUILD_DIR}}/echo_functions.bash
+
+ echo
+ ewarn "news hook should not be run in phase '${HOOK}'"
+ ewarn "Do you have stale symlinks?"
+}
+
+for h in sync_all_post install_all_post install_pretend_post install_task_execute_post ; do
eval "hook_run_${h}() { check_for_news ; }"
eval "hook_after_${h}() { echo gnu_info_index eselect_env_update log write_cache_clean ; }"
done
+for h in install_all_post install_pretend_post ; do
+ eval "hook_run_${h}() { stale_hook ; }"
+done
+
+hook_auto_names() {
+ echo sync_all_post install_task_execute_post
+}
+