aboutsummaryrefslogtreecommitdiff
path: root/0.4.0/hooks
diff options
context:
space:
mode:
Diffstat (limited to '0.4.0/hooks')
-rw-r--r--0.4.0/hooks/Makefile.am.m4176
-rwxr-xr-x0.4.0/hooks/eselect_env_update.bash27
-rwxr-xr-x0.4.0/hooks/find_config_updates.bash43
-rwxr-xr-x0.4.0/hooks/gnu_info_index.bash83
-rwxr-xr-x0.4.0/hooks/log.bash86
-rwxr-xr-x0.4.0/hooks/news.bash51
6 files changed, 466 insertions, 0 deletions
diff --git a/0.4.0/hooks/Makefile.am.m4 b/0.4.0/hooks/Makefile.am.m4
new file mode 100644
index 000000000..56314b35d
--- /dev/null
+++ b/0.4.0/hooks/Makefile.am.m4
@@ -0,0 +1,176 @@
+ifdef(`__gnu__',`',`errprint(`This is not GNU m4...
+')m4exit(1)') include(`misc/generated-file.txt')
+
+dnl vim: set ft=m4 noet :
+
+MAINTAINERCLEANFILES = Makefile.in Makefile.am
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda .keep
+SUBDIRS = .
+
+installvarlibpaludisnewsdir = $(localstatedir)/paludis/news
+
+installhookcommonprogdir = $(libexecdir)/paludis/hooks/common
+installhookinstallallpostdir = $(libexecdir)/paludis/hooks/install_all_post
+
+installhookcommonprog_SCRIPTS = \
+ gnu_info_index.bash \
+ eselect_env_update.bash \
+ log.bash \
+ news.bash
+
+installhookinstallallpost_SCRIPTS = \
+ find_config_updates.bash
+
+installvarlibpaludisnews_SCRIPTS = \
+ .keep
+
+TESTS_ENVIRONMENT = env \
+ PALUDIS_EBUILD_DIR="$(srcdir)/ebuild/" \
+ TEST_SCRIPT_DIR="$(srcdir)/" \
+ bash $(top_srcdir)/ebuild/run_test.bash
+
+TESTS =
+EXTRA_DIST = \
+ Makefile.am.m4 \
+ $(installhookcommonprog_SCRIPTS) \
+ $(installhookinstallallpost_SCRIPTS) \
+ $(TESTS)
+
+check_SCRIPTS = $(TESTS)
+check_PROGRAMS =
+
+.keep :
+ touch $@
+
+define(`userhook', `
+installuserhooks$1dir = $(datadir)/paludis/hooks/$1
+installuserhooks$1_SCRIPTS = .keep')
+
+userhook(`install_pre')
+userhook(`install_post')
+userhook(`install_all_pre')
+userhook(`install_all_post')
+userhook(`install_pretend_pre')
+userhook(`install_pretend_post')
+userhook(`uninstall_pre')
+userhook(`uninstall_post')
+userhook(`uninstall_all_pre')
+userhook(`uninstall_all_post')
+userhook(`sync_pre')
+userhook(`sync_post')
+userhook(`sync_all_pre')
+userhook(`sync_all_post')
+userhook(`fetch_all_pre')
+userhook(`fetch_all_post')
+userhook(`fetch_all_all_pre')
+userhook(`fetch_all_all_post')
+userhook(`ebuild_metadata_pre')
+userhook(`ebuild_metadata_post')
+userhook(`ebuild_init_pre')
+userhook(`ebuild_init_post')
+userhook(`ebuild_fetch_pre')
+userhook(`ebuild_fetch_post')
+userhook(`ebuild_merge_pre')
+userhook(`ebuild_merge_post')
+userhook(`ebuild_unmerge_pre')
+userhook(`ebuild_unmerge_post')
+userhook(`ebuild_tidyup_pre')
+userhook(`ebuild_tidyup_post')
+userhook(`ebuild_strip_pre')
+userhook(`ebuild_strip_post')
+userhook(`ebuild_unpack_pre')
+userhook(`ebuild_unpack_post')
+userhook(`ebuild_compile_pre')
+userhook(`ebuild_compile_post')
+userhook(`ebuild_install_pre')
+userhook(`ebuild_install_post')
+userhook(`ebuild_test_pre')
+userhook(`ebuild_test_post')
+userhook(`ebuild_setup_pre')
+userhook(`ebuild_setup_post')
+userhook(`ebuild_config_pre')
+userhook(`ebuild_config_post')
+userhook(`ebuild_nofetch_pre')
+userhook(`ebuild_nofetch_post')
+userhook(`ebuild_preinst_pre')
+userhook(`ebuild_preinst_post')
+userhook(`ebuild_postinst_pre')
+userhook(`ebuild_postinst_post')
+userhook(`ebuild_prerm_pre')
+userhook(`ebuild_prerm_post')
+userhook(`ebuild_postrm_pre')
+userhook(`ebuild_postrm_post')
+
+define(`systemhook', `
+installsystemhooks$1dir = $(libexecdir)/paludis/hooks/$1
+installsystemhooks$1_SCRIPTS = .keep')
+
+systemhook(`install_pre')
+systemhook(`install_post')
+systemhook(`install_all_pre')
+systemhook(`install_all_post')
+systemhook(`install_pretend_pre')
+systemhook(`install_pretend_post')
+systemhook(`uninstall_pre')
+systemhook(`uninstall_post')
+systemhook(`uninstall_all_pre')
+systemhook(`uninstall_all_post')
+systemhook(`sync_pre')
+systemhook(`sync_post')
+systemhook(`sync_all_pre')
+systemhook(`sync_all_post')
+systemhook(`fetch_all_pre')
+systemhook(`fetch_all_post')
+systemhook(`fetch_all_all_pre')
+systemhook(`fetch_all_all_post')
+
+install-data-local :
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_pretend_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/install_pretend_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_all_pre/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_all_post/
+ install -d $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_all_pre/
+ 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/
+ 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/
+ ln -sf ../common/eselect_env_update.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_all_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_all_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/fetch_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_pre/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_all_post/
+ ln -sf ../common/log.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_pre/
+ 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.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/sync_all_post/
+ ln -sf ../common/news.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
+ ln -sf ../common/news.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_pretend_post/
+
+uninstall-local :
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/gnu_info_index.bash
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/eselect_env_update.bash
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/log.bash
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/news.bash
+
+Makefile.am : Makefile.am.m4
+ $(top_srcdir)/misc/do_m4.bash Makefile.am
+
diff --git a/0.4.0/hooks/eselect_env_update.bash b/0.4.0/hooks/eselect_env_update.bash
new file mode 100755
index 000000000..37f1f69b4
--- /dev/null
+++ b/0.4.0/hooks/eselect_env_update.bash
@@ -0,0 +1,27 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# 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
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
+
+echo
+einfo "Regenerating environment..."
+eselect env update || exit 1
+einfo "Done regenerating environment"
+
diff --git a/0.4.0/hooks/find_config_updates.bash b/0.4.0/hooks/find_config_updates.bash
new file mode 100755
index 000000000..fb2ff72e0
--- /dev/null
+++ b/0.4.0/hooks/find_config_updates.bash
@@ -0,0 +1,43 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# 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
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
+
+echo
+einfo "Searching for configuration files requiring action..."
+
+dir_count=0
+for dir in /etc ${CONFIG_PROTECT} ; do
+ [[ -d "${ROOT%/}/${dir}" ]] || continue
+ if [[ -n $(find "${ROOT%/}/${dir}" -iname '._cfg????_*' ) ]] ; then
+ einfo "Found files in ${ROOT%/}/${dir}"
+ dir_count=$((dir_count + 1))
+ fi
+done
+
+if [[ 0 -eq "${dir_count}" ]] ; then
+ einfo "No configuration file updates required"
+ exit 0
+else
+ ewarn "Found files in ${dir_count} directories"
+ ewarn "Your action is required"
+ exit 0
+fi
+
diff --git a/0.4.0/hooks/gnu_info_index.bash b/0.4.0/hooks/gnu_info_index.bash
new file mode 100755
index 000000000..64baaeb7f
--- /dev/null
+++ b/0.4.0/hooks/gnu_info_index.bash
@@ -0,0 +1,83 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# 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
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
+
+echo
+einfo "Checking whether the GNU info directory needs updating..."
+
+regen_info_dirs=
+for info_path in ${INFOPATH/:/ } ; do
+ info_path="${ROOT%/}/${info_path}"
+ [[ -d "${info_path}" ]] || continue
+ info_time=$(getmtime "${info_path}" )
+
+ if [[ -f "${ROOT}/var/db/pkg/.cache/info_time_cache" ]] ; then
+ info_time_cache=$(getmtime "${ROOT}"/var/db/pkg/.cache/info_time_cache )
+ [[ "${info_time}" -le "${info_time_cache}" ]] && continue
+ fi
+
+ regen_info_dirs="${regen_info_dirs} ${info_path}"
+done
+
+if [[ -z "${regen_info_dirs}" ]] ; then
+ einfo "No updates needed"
+ exit 0
+fi
+
+good_count=0
+bad_count=0
+
+for info_path in ${regen_info_dirs} ; do
+ einfo "Updating directory ${info_path}..."
+
+ [[ -e "${info_path}"/dir ]] && mv -f "${info_path}/"dir{,.old}
+
+ for d in ${regen_info_dirs}/* ; do
+ [[ -f "${d}" ]] || continue
+ [[ "${d}" != "${d%dir}" ]] && continue
+ [[ "${d}" != "${d%dir.old}" ]] && continue
+
+ is_bad=
+ /usr/bin/install-info --quiet --dir-file="${info_path}/dir" "${d}" 2>&1 | \
+ while read line ; do
+ [[ "${line/already exists, for file/}" != "${line}" ]] && continue
+ [[ "${line/warning: no info dir entry in /}" != "${line}" ]] && continue
+ is_bad=probably
+ done
+
+ if [[ -n "${is_bad}" ]] ; then
+ bad_count=$(( bad_count + 1 ))
+ else
+ good_count=$(( good_count + 1 ))
+ fi
+ done
+done
+
+touch "${ROOT}/var/db/pkg/.cache/info_time_cache"
+
+if [[ ${bad_count} -gt 0 ]] ; then
+ ewarn "Processed $(( good_count + bad_count )) info files, with ${bad_count} errors"
+ exit 1
+else
+ einfo "Processed ${good_count} info files"
+ exit 0
+fi
+
diff --git a/0.4.0/hooks/log.bash b/0.4.0/hooks/log.bash
new file mode 100755
index 000000000..d4828ad11
--- /dev/null
+++ b/0.4.0/hooks/log.bash
@@ -0,0 +1,86 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# 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
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+mkdir -p "${ROOT}/var/log"
+
+(
+ echo -n "$(date +%s ): "
+
+ case "${HOOK}" in
+ install_pre)
+ echo "starting install of package ${TARGET}"
+ ;;
+
+ install_post)
+ echo "finished install of package ${TARGET}"
+ ;;
+
+ install_all_pre)
+ echo "starting install of targets ${TARGETS}"
+ ;;
+
+ install_all_post)
+ echo "finished install of targets ${TARGETS}"
+ ;;
+
+ uninstall_pre)
+ echo "starting uninstall of package ${TARGET}"
+ ;;
+
+ uninstall_post)
+ echo "finished uninstall of package ${TARGET}"
+ ;;
+
+ uninstall_all_pre)
+ echo "starting uninstall of targets ${TARGETS}"
+ ;;
+
+ uninstall_all_post)
+ echo "finished uninstall of targets ${TARGETS}"
+ ;;
+
+ fetch_pre)
+ echo "starting fetch of package ${TARGET}"
+ ;;
+
+ fetch_post)
+ echo "finished fetch of package ${TARGET}"
+ ;;
+
+ fetch_all_pre)
+ echo "starting fetch of targets ${TARGETS}"
+ ;;
+
+ fetch_all_post)
+ echo "finished fetch of targets ${TARGETS}"
+ ;;
+
+ sync_pre)
+ echo "starting sync of repository ${TARGET}"
+ ;;
+
+ sync_post)
+ echo "finished sync of repository ${TARGET}"
+ ;;
+
+ *)
+ echo "unknown hook ${HOOK}"
+ esac
+) >> ${ROOT}/var/log/paludis.log
+
diff --git a/0.4.0/hooks/news.bash b/0.4.0/hooks/news.bash
new file mode 100755
index 000000000..670f29e2e
--- /dev/null
+++ b/0.4.0/hooks/news.bash
@@ -0,0 +1,51 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+#
+# 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
+# Public License as published by the Free Software Foundation; either version
+# 2 of the License, or (at your option) any later version.
+#
+# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA
+
+export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
+
+mkdir -p ${ROOT}/var/lib/paludis/news/
+
+done_echo=
+
+if [[ "${HOOK/pretend}" == "${HOOK}" ]] ; then
+ [[ -z "${done_echo}" ]] && echo ; done_echo=yes
+ einfo "Checking for news items..."
+
+ ${PALUDIS_COMMAND} --update-news
+fi
+
+count=0
+for f in "${ROOT}/var/lib/paludis/news/"news-*.unread ; do
+ [[ -f "${f}" ]] || continue
+ if grep --silent . "${f}" ; then
+ count=$(( count + $(grep --count . < "${f}" ) ))
+ fi
+done
+
+if [[ ${count} -gt 0 ]] ; then
+ [[ -z "${done_echo}" ]] && echo ; done_echo=yes
+ ewarn "You have ${count} unread news items"
+elif [[ "${HOOK/pretend}" == "${HOOK}" ]] ; then
+ [[ -z "${done_echo}" ]] && echo ; done_echo=yes
+ einfo "No unread news items found"
+fi
+
+true
+