aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-09 01:39:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-09 01:39:49 +0000
commitd9de19673ae38c62105d2c1f11d906d45ca1ffa6 (patch)
tree789e58ce4553509fbf12da7cee485e7d3871ccb1
parent568e1d27a116f687dcaba35b315afd2c0c14950a (diff)
downloadpaludis-d9de19673ae38c62105d2c1f11d906d45ca1ffa6.tar.gz
paludis-d9de19673ae38c62105d2c1f11d906d45ca1ffa6.tar.xz
Add demonstration elog hooks. Use einfo_unhooked, ebegin_unhooked where appropriate
-rw-r--r--ebuild/builtin_fetch.bash4
-rw-r--r--ebuild/echo_functions.bash.in18
-rw-r--r--hooks/demos/Makefile.am9
-rwxr-xr-xhooks/eselect_env_update.bash4
-rwxr-xr-xhooks/find_config_updates.bash6
-rwxr-xr-xhooks/gnu_info_index.bash8
-rwxr-xr-xhooks/installable_cache_regen.bash4
-rwxr-xr-xhooks/installed_cache_regen.bash4
-rwxr-xr-xhooks/news.bash4
-rwxr-xr-xhooks/rewrite_broken_symlinks.bash14
10 files changed, 49 insertions, 26 deletions
diff --git a/ebuild/builtin_fetch.bash b/ebuild/builtin_fetch.bash
index 69c13db..cf840c1 100644
--- a/ebuild/builtin_fetch.bash
+++ b/ebuild/builtin_fetch.bash
@@ -90,7 +90,7 @@ builtin_fetch()
prg="${PALUDIS_EBUILD_DIR}/digests/do$(echo ${line[0]} | tr \
'[[:upper:]]' '[[:lower:]]')"
if [[ -x "${prg}" ]] ; then
- ebegin "Checking ${line[0]} for ${line[2]}"
+ ebegin_unhooked "Checking ${line[0]} for ${line[2]}"
if [[ $("${prg}" "${DISTDIR}/${line[2]}" ) == "${line[1]}" ]] ; then
eend 0
else
@@ -98,7 +98,7 @@ builtin_fetch()
hasq "${line[2]}" ${badfetch} || badfetch="${badfetch} ${line[2]}"
fi
else
- einfo "Can't check ${line[0]} for ${line[2]}"
+ einfo_unhooked "Can't check ${line[0]} for ${line[2]}"
fi
done < "${FILESDIR}"/digest-${PN}-${PVR%-r0}
diff --git a/ebuild/echo_functions.bash.in b/ebuild/echo_functions.bash.in
index ce85632..d36bca2 100644
--- a/ebuild/echo_functions.bash.in
+++ b/ebuild/echo_functions.bash.in
@@ -79,6 +79,15 @@ einfo()
"$*"
}
+einfo_unhooked()
+{
+ paludis_ecmd \
+ "einfo" \
+ "" \
+ "`echo -ne " ${COLOUR_GOOD}*${COLOUR_NORMAL} "`" \
+ "$*"
+}
+
elog()
{
paludis_ecmd \
@@ -119,6 +128,15 @@ ebegin()
"$* ..."
}
+ebegin_unhooked()
+{
+ paludis_ecmd \
+ "ebegin" \
+ "" \
+ "`echo -ne " ${COLOUR_GOOD}*${COLOUR_NORMAL} "`" \
+ "$* ..."
+}
+
_eend()
{
local retval=${1:-0} efunc=${2:-eerror} msg
diff --git a/hooks/demos/Makefile.am b/hooks/demos/Makefile.am
index f7fa3d3..ea6b7f2 100644
--- a/hooks/demos/Makefile.am
+++ b/hooks/demos/Makefile.am
@@ -1,10 +1,12 @@
SUBDIRS = .
DEMOS = \
- report.bash
+ report.bash \
+ elog.bash
EXTRA_DIST = \
- report.bash.in
+ report.bash.in \
+ elog.bash.in
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.o *.so $(DEMOS)
@@ -15,6 +17,9 @@ hooksdemos_DATA = $(DEMOS)
report.bash : $(srcdir)/report.bash.in
sed -e "s,@DATADIR@,$(datadir),g" < $(srcdir)/report.bash.in > report.bash
+elog.bash : $(srcdir)/elog.bash.in
+ sed -e "s,@DATADIR@,$(datadir),g" < $(srcdir)/elog.bash.in > elog.bash
+
built-sources : $(BUILT_SOURCES)
for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
diff --git a/hooks/eselect_env_update.bash b/hooks/eselect_env_update.bash
index 00ac62b..c75bf8e 100755
--- a/hooks/eselect_env_update.bash
+++ b/hooks/eselect_env_update.bash
@@ -21,7 +21,7 @@ export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/ut
source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
echo
-einfo "Regenerating environment..."
+einfo_unhooked "Regenerating environment..."
eselect env update || exit 1
-einfo "Done regenerating environment"
+einfo_unhooked "Done regenerating environment"
diff --git a/hooks/find_config_updates.bash b/hooks/find_config_updates.bash
index 0058995..43d32d1 100755
--- a/hooks/find_config_updates.bash
+++ b/hooks/find_config_updates.bash
@@ -23,20 +23,20 @@ export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/ut
source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
echo
-einfo "Searching for configuration files requiring action..."
+einfo_unhooked "Searching for configuration files requiring action..."
dir_count=0
for dir in /etc ${CONFIG_PROTECT} ; do
[[ -d "${ROOT%/}/${dir}" ]] || continue
c=$(find "${ROOT%/}/${dir}" -iname '._cfg????_*' | wc -l )
if [[ ${c} -gt 0 ]] ; then
- einfo "Found ${c} files in ${ROOT%%+(/)}/${dir}"
+ einfo_unhooked "Found ${c} files in ${ROOT%%+(/)}/${dir}"
dir_count=$((dir_count + 1))
fi
done
if [[ 0 -eq "${dir_count}" ]] ; then
- einfo "No configuration file updates required"
+ einfo_unhooked "No configuration file updates required"
exit 0
else
ewarn "Found files in ${dir_count} directories"
diff --git a/hooks/gnu_info_index.bash b/hooks/gnu_info_index.bash
index 62e70ca..055aa0b 100755
--- a/hooks/gnu_info_index.bash
+++ b/hooks/gnu_info_index.bash
@@ -21,7 +21,7 @@ export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/ut
source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
echo
-einfo "Checking whether the GNU info directory needs updating..."
+einfo_unhooked "Checking whether the GNU info directory needs updating..."
regen_info_dirs=
vdb_loc=$(${PALUDIS_COMMAND} --configuration-variable installed location )
@@ -39,7 +39,7 @@ for info_path in ${INFOPATH/:/ } ; do
done
if [[ -z "${regen_info_dirs}" ]] ; then
- einfo "No updates needed"
+ einfo_unhooked "No updates needed"
exit 0
fi
@@ -47,7 +47,7 @@ good_count=0
bad_count=0
for info_path in ${regen_info_dirs} ; do
- einfo "Updating directory ${info_path}..."
+ einfo_unhooked "Updating directory ${info_path}..."
[[ -e "${info_path}"/dir ]] && mv -f "${info_path}/"dir{,.old}
@@ -78,7 +78,7 @@ 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"
+ einfo_unhooked "Processed ${good_count} info files"
exit 0
fi
diff --git a/hooks/installable_cache_regen.bash b/hooks/installable_cache_regen.bash
index a739f83..64829a0 100755
--- a/hooks/installable_cache_regen.bash
+++ b/hooks/installable_cache_regen.bash
@@ -21,9 +21,9 @@ export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/ut
source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
echo
-einfo "Regenerating cache for installable repositories..."
+einfo_unhooked "Regenerating cache for installable repositories..."
${PALUDIS_COMMAND} --regenerate-installable-cache
-einfo "Done regenerating cache for installable repositories"
+einfo_unhooked "Done regenerating cache for installable repositories"
true
diff --git a/hooks/installed_cache_regen.bash b/hooks/installed_cache_regen.bash
index 940c5ff..f34cc9c 100755
--- a/hooks/installed_cache_regen.bash
+++ b/hooks/installed_cache_regen.bash
@@ -21,9 +21,9 @@ export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/ut
source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
echo
-einfo "Regenerating cache for installed repositories..."
+einfo_unhooked "Regenerating cache for installed repositories..."
${PALUDIS_COMMAND} --regenerate-installed-cache
-einfo "Done regenerating cache for installed repositories"
+einfo_unhooked "Done regenerating cache for installed repositories"
true
diff --git a/hooks/news.bash b/hooks/news.bash
index 44c379d..4f61180 100755
--- a/hooks/news.bash
+++ b/hooks/news.bash
@@ -26,7 +26,7 @@ done_echo=
if [[ "${HOOK/pretend}" == "${HOOK}" ]] ; then
[[ -z "${done_echo}" ]] && echo ; done_echo=yes
- einfo "Checking for news items..."
+ einfo_unhooked "Checking for news items..."
${PALUDIS_COMMAND} --update-news
fi
@@ -44,7 +44,7 @@ if [[ ${count} -gt 0 ]] ; then
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"
+ einfo_unhooked "No unread news items found"
fi
true
diff --git a/hooks/rewrite_broken_symlinks.bash b/hooks/rewrite_broken_symlinks.bash
index 6696fe3..3d6f7cf 100755
--- a/hooks/rewrite_broken_symlinks.bash
+++ b/hooks/rewrite_broken_symlinks.bash
@@ -22,10 +22,10 @@ shopt -s extglob
export PATH="$(${PALUDIS_EBUILD_DIR}/utils/canonicalise ${PALUDIS_EBUILD_DIR}/utils/ ):${PATH}"
source ${PALUDIS_EBUILD_DIR}/echo_functions.bash
-count=0
-einfo "Checking for broken symlinks..."
+export count=0
+einfo_unhooked "Checking for broken symlinks..."
-find "${IMAGE}" -type l | while read link ; do
+while read link ; do
target=$(readlink "${link}" )
if [[ "${target#${IMAGE}}" != "${target}" ]] ; then
ebuild_notice "qa" "Found broken symlink '${link}' -> '${target}'"
@@ -35,12 +35,12 @@ find "${IMAGE}" -type l | while read link ; do
newtarget="/${newtarget##+(/)}"
echo ln -s "${newtarget}" "${link}" 1>&2
ln -s "${newtarget}" "${link}"
- count=$(( ${count} + 1 ))
+ export count=$(( ${count} + 1 ))
fi
-done
+done < <(find "${IMAGE}" -type l )
-if [[ ${count} == 0 ]] ; then
- einfo "Done checking for broken symlinks"
+if [[ "${count}" -eq 0 ]] ; then
+ einfo_unhooked "Done checking for broken symlinks"
else
ewarn "Fixed ${count} broken symlinks"
fi