aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-04 10:03:23 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-04 10:03:23 +0000
commita7119c8130cd8bf749ef46d072f5d1d84dc26d48 (patch)
tree9a3985df0256f2733e4ddd05aeba02c13aa48e0e
parent15939dd620642d33e5157242af8fbe18a50d7caf (diff)
downloadpaludis-a7119c8130cd8bf749ef46d072f5d1d84dc26d48.tar.gz
paludis-a7119c8130cd8bf749ef46d072f5d1d84dc26d48.tar.xz
Kill write cache after a sync. Fixes: ticket:38
-rw-r--r--hooks/Makefile.am.m45
-rwxr-xr-xhooks/write_cache_clean.bash40
2 files changed, 44 insertions, 1 deletions
diff --git a/hooks/Makefile.am.m4 b/hooks/Makefile.am.m4
index c7107d8..298239a 100644
--- a/hooks/Makefile.am.m4
+++ b/hooks/Makefile.am.m4
@@ -20,7 +20,8 @@ installhookcommonprog_SCRIPTS = \
log.bash \
news.bash \
installable_cache_regen.bash \
- installed_cache_regen.bash
+ installed_cache_regen.bash \
+ write_cache_clean.bash
installhookinstallallpost_SCRIPTS = \
find_config_updates.bash
@@ -211,6 +212,7 @@ install-data-local :
ln -sf ../common/news.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/install_all_post/
ln -sf ../common/news.bash $(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/
ln -sf ../common/installed_cache_regen.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/uninstall_post/
ln -sf ../common/installed_cache_regen.bash $(DESTDIR)/$(libexecdir)/paludis/hooks/clean_post/
@@ -220,6 +222,7 @@ uninstall-local :
rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/eselect_env_update.bash
rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/log.bash
rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/news.bash
+ rm $(DESTDIR)/$(libexecdir)/paludis/hooks/*/write_cache_clean.bash
Makefile.am : Makefile.am.m4
$(top_srcdir)/misc/do_m4.bash Makefile.am
diff --git a/hooks/write_cache_clean.bash b/hooks/write_cache_clean.bash
new file mode 100755
index 0000000..c06cdef
--- /dev/null
+++ b/hooks/write_cache_clean.bash
@@ -0,0 +1,40 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+#
+# 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, version 2, as published by the Free Software Foundation.
+#
+# 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
+
+[[ -n "${PALUDIS_NO_WRITE_CACHE_CLEAN}" ]] && exit 0
+
+echo
+einfo_unhooked "Cleaning write cache for ebuild format repositories..."
+
+while read repo ; do
+ wcloc=$(${PALUDIS_COMMAND} --configuration-variable ${repo} write_cache )
+
+ [[ $(readlink -f ${wcloc} ) == "/var/empty" ]] && continue
+ [[ $(echo "${wcloc}"/* ) != "${wcloc}/*" ]] || continue
+ echo rm -fr "${wcloc}/*" 1>&2
+ rm -fr "${wcloc}"/* || eerror "Couldn't clear cache for ${repo} at ${wcloc}"
+
+done < <(${PALUDIS_COMMAND} --list-repositories --repository-format ebuild | \
+ sed -n -e '/^\*/s,^\*\s*,,p' )
+
+einfo_unhooked "Done cleaning write cache for ebuild format repositories"
+echo
+