aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-28 14:39:20 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-11-28 14:39:20 +0000
commitba32458f33b82ab34e7a7b7996672edfa811c253 (patch)
tree2087145548ecc7ec47565c0ed0414d8e6665f546
parentd5ee88245eb7744372ae36204a97e73d754c0bc6 (diff)
downloadpaludis-ba32458f33b82ab34e7a7b7996672edfa811c253.tar.gz
paludis-ba32458f33b82ab34e7a7b7996672edfa811c253.tar.xz
Rewrite broken symlinks
-rwxr-xr-xebuild/ebuild.bash2
-rw-r--r--hooks/Makefile.am.m44
-rwxr-xr-xhooks/rewrite_broken_symlinks.bash50
3 files changed, 55 insertions, 1 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index 1084a22..db7700a 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -226,7 +226,7 @@ perform_hook()
if ! ( source "${hook_file}" ) ; then
ebuild_notice "warning" "Hook '${hook_file}' returned failure"
else
- ebuild_notice "warning" "Hook '${hook_file}' returned success"
+ ebuild_notice "debug" "Hook '${hook_file}' returned success"
fi
done
done
diff --git a/hooks/Makefile.am.m4 b/hooks/Makefile.am.m4
index d26ceca..30af5e7 100644
--- a/hooks/Makefile.am.m4
+++ b/hooks/Makefile.am.m4
@@ -12,6 +12,7 @@ installvarlibpaludisnewsdir = $(localstatedir)/paludis/news
installhookcommonprogdir = $(libexecdir)/paludis/hooks/common
installhookinstallallpostdir = $(libexecdir)/paludis/hooks/install_all_post
installhookinstallpostdir = $(libexecdir)/paludis/hooks/install_post
+installhookebuildmergepredir = $(libexecdir)/paludis/hooks/ebuild_merge_pre
installhookcommonprog_SCRIPTS = \
gnu_info_index.bash \
@@ -25,6 +26,9 @@ installhookinstallallpost_SCRIPTS = \
installhookinstallpost_SCRIPTS = \
update_config_protect_list.bash
+installhookebuildmergepre_SCRIPTS = \
+ rewrite_broken_symlinks.bash
+
installvarlibpaludisnews_DATA = \
.keep
diff --git a/hooks/rewrite_broken_symlinks.bash b/hooks/rewrite_broken_symlinks.bash
new file mode 100755
index 0000000..b9c9d6e
--- /dev/null
+++ b/hooks/rewrite_broken_symlinks.bash
@@ -0,0 +1,50 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# Copyright (c) 2006 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 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
+
+shopt -s extglob
+
+export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
+source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
+
+count=0
+echo
+einfo "Checking for broken symlinks..."
+
+find "${IMAGE}" -type l | while read link ; do
+ target=$(readlink "${link}" )
+ if [[ "${target#${IMAGE}}" != "${target}" ]] ; then
+ ebuild_notice "qa" "Found broken symlink '${link}' -> '${target}'"
+ echo rm -f "${link}" 1>&2
+ rm -f "${link}"
+ newtarget="${target#${IMAGE}}"
+ newtarget="/${newtarget##+(/)}"
+ echo ln -s "${newtarget}" "${link}" 1>&2
+ ln -s "${newtarget}" "${link}"
+ count=$(( ${count} + 1 ))
+ fi
+done
+
+if [[ ${count} == 0 ]] ; then
+ einfo "Done checking for broken symlinks"
+else
+ ewarn "Fixed ${count} broken symlinks"
+fi
+
+true
+