summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-12-06 10:22:54 +0000
committerZac Medico <zmedico@gentoo.org>2009-12-06 10:22:54 +0000
commitd0733a19ea2b08984589c5881b0a99c2ca26e4d6 (patch)
treed26846c08c46bc51337182743d2e6c513f3b37d7 /bin
parentc37a96a355c769037cf88be5f4638db521122310 (diff)
downloadportage-d0733a19ea2b08984589c5881b0a99c2ca26e4d6.tar.gz
portage-d0733a19ea2b08984589c5881b0a99c2ca26e4d6.tar.bz2
portage-d0733a19ea2b08984589c5881b0a99c2ca26e4d6.zip
Bug #295715 - Implement a register_success_hook function to complement
register_die_hook, and also add code to ensure the die hooks are called even when the failure is on the python side (like for file collisions). svn path=/main/trunk/; revision=14936
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ebuild.sh11
-rwxr-xr-xbin/isolated-functions.sh1
-rwxr-xr-xbin/misc-functions.sh16
3 files changed, 27 insertions, 1 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 3a203860d..6915296bf 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -267,6 +267,14 @@ register_die_hook() {
done
}
+register_success_hook() {
+ local x
+ for x in $* ; do
+ hasq $x $EBUILD_SUCCESS_HOOKS || \
+ export EBUILD_SUCCESS_HOOKS="$EBUILD_SUCCESS_HOOKS $x"
+ done
+}
+
# Ensure that $PWD is sane whenever possible, to protect against
# exploitation of insecure search path for python -c in ebuilds.
# See bug #239560.
@@ -741,7 +749,8 @@ dyn_clean() {
if [[ $EMERGE_FROM = binary ]] || ! hasq keepwork $FEATURES; then
rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,exit_status,logid,unpacked,prepared} \
- "$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged}
+ "$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \
+ "$PORTAGE_BUILDDIR"/.die_hooks
rm -rf "${PORTAGE_BUILDDIR}/build-info"
rm -rf "${WORKDIR}"
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 4d3c6960e..9741419b6 100755
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -156,6 +156,7 @@ die() {
for x in $EBUILD_DEATH_HOOKS; do
${x} "$@" >&2 1>&2
done
+ > "$PORTAGE_BUILDDIR/.die_hooks"
fi
[[ -n ${PORTAGE_LOG_FILE} ]] \
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index ef8b0a54a..87aaeff5a 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -781,6 +781,22 @@ dyn_rpm() {
die "Failed to move rpm"
}
+die_hooks() {
+ [[ -f $PORTAGE_BUILDDIR/.die_hooks ]] && return
+ local x
+ for x in $EBUILD_DEATH_HOOKS ; do
+ $x >&2
+ done
+ > "$PORTAGE_BUILDDIR/.die_hooks"
+}
+
+success_hooks() {
+ local x
+ for x in $EBUILD_SUCCESS_HOOKS ; do
+ $x
+ done
+}
+
if [ -n "${MISC_FUNCTIONS_ARGS}" ]; then
source_all_bashrcs
[ "$PORTAGE_DEBUG" == "1" ] && set -x