die: defer die hooks for EAPI 4 helpers_die
authorZac Medico <zmedico@gentoo.org>
Thu, 25 Aug 2011 16:37:11 +0000 (09:37 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 25 Aug 2011 16:37:11 +0000 (09:37 -0700)
This will fix bug #380625.

bin/isolated-functions.sh

index 65bb1d5d5fd90869af59b867ebe7cc899d3a53a3..1de1f7f0d667ee9a5c3277baba9b7c6cd8312476 100644 (file)
@@ -203,7 +203,12 @@ die() {
                fi
        fi
 
-       if [[ "${EBUILD_PHASE/depend}" == "${EBUILD_PHASE}" ]] ; then
+       # Only call die hooks here if we are executed via ebuild.sh or
+       # misc-functions.sh, since those are the only cases where the environment
+       # contains the hook functions. When necessary (like for helpers_die), die
+       # hooks are automatically called later by a misc-functions.sh invocation.
+       if has ${BASH_SOURCE[$main_index]##*/} ebuild.sh misc-functions.sh && \
+               [[ ${EBUILD_PHASE} != depend ]] ; then
                local x
                for x in $EBUILD_DEATH_HOOKS; do
                        ${x} "$@" >&2 1>&2