die requires diefunc and dump_trace too; duh; also move extdebug into isolated-functi...
authorAlec Warner <antarus@gentoo.org>
Thu, 8 Feb 2007 04:38:21 +0000 (04:38 -0000)
committerAlec Warner <antarus@gentoo.org>
Thu, 8 Feb 2007 04:38:21 +0000 (04:38 -0000)
svn path=/main/trunk/; revision=5930

bin/ebuild.sh
bin/isolated-functions.sh

index db8193ae29dd9c5a939adb8e2b6f10acd23f6453..6004242ea46f7505aa63f8b515e466d2bf61430e 100755 (executable)
@@ -265,72 +265,6 @@ register_die_hook() {
        export EBUILD_DEATH_HOOKS="${EBUILD_DEATH_HOOKS} $*"
 }
 
-diefunc() {
-       local funcname="$1" lineno="$2" exitcode="$3"
-       shift 3
-       echo >&2
-       echo "!!! ERROR: $CATEGORY/$PF failed." >&2
-       dump_trace 2 1>&2
-       echo "  $(basename "${BASH_SOURCE[1]}"), line ${BASH_LINENO[0]}:   Called die" 1>&2
-       echo >&2
-       echo "!!! ${*:-(no error message)}" >&2
-       echo "!!! If you need support, post the topmost build error, and the call stack if relevant." >&2
-       echo "!!! A complete build log is located at '${PORTAGE_LOG_FILE}'." >&2
-       echo >&2
-       if [ -n "${EBUILD_OVERLAY_ECLASSES}" ] ; then
-               echo "This ebuild used the following eclasses from overlays:" >&2
-               echo >&2
-               for x in ${EBUILD_OVERLAY_ECLASSES} ; do
-                       echo "  ${x}" >&2
-               done
-               echo >&2
-       fi
-
-       if [ "${EBUILD_PHASE/depend}" == "${EBUILD_PHASE}" ]; then
-               local x
-               for x in $EBUILD_DEATH_HOOKS; do
-                       ${x} "$@" >&2 1>&2
-               done
-       fi
-
-       # subshell die support
-       kill -s SIGTERM ${EBUILD_MASTER_PID}
-       exit 1
-}
-
-shopt -s extdebug &> /dev/null
-
-# usage- first arg is the number of funcs on the stack to ignore.
-# defaults to 1 (ignoring dump_trace)
-dump_trace() {
-       local funcname="" sourcefile="" lineno="" n e s="yes"
-
-       declare -i strip=1
-
-       if [[ -n $1 ]]; then
-               strip=$(( $1 ))
-       fi
-       
-       echo "Call stack:"
-       for (( n = ${#FUNCNAME[@]} - 1, p = ${#BASH_ARGV[@]} ; n > $strip ; n-- )) ; do
-               funcname=${FUNCNAME[${n} - 1]}
-               sourcefile=$(basename ${BASH_SOURCE[${n}]})
-               lineno=${BASH_LINENO[${n} - 1]}
-               # Display function arguments
-               args=
-               if [[ -n "${BASH_ARGV[@]}" ]]; then
-                       for (( j = 1 ; j <= ${BASH_ARGC[${n} - 1]} ; ++j )); do
-                               newarg=${BASH_ARGV[$(( p - j - 1 ))]}
-                               args="${args:+${args} }'${newarg}'"
-                       done
-                       (( p -= ${BASH_ARGC[${n} - 1]} ))
-               fi
-               echo "  ${sourcefile}, line ${lineno}:   Called ${funcname}${args:+ ${args}}"
-       done
-}
-
-
-
 #if no perms are specified, dirs/files will have decent defaults
 #(not secretive, but not stupid)
 umask 022
index d9fafbcb67150aee0b17d3d26b23efa6b5e21cf1..41595ea30ab203486e4b80c93c854f49fcab271e 100755 (executable)
@@ -10,6 +10,37 @@ alias assert='_pipestatus="${PIPESTATUS[*]}"; [[ "${_pipestatus// /}" -eq 0 ]] |
 alias save_IFS='[ "${IFS:-unset}" != "unset" ] && old_IFS="${IFS}"'
 alias restore_IFS='if [ "${old_IFS:-unset}" != "unset" ]; then IFS="${old_IFS}"; unset old_IFS; else unset IFS; fi'
 
+shopt -s extdebug
+
+# usage- first arg is the number of funcs on the stack to ignore.
+# defaults to 1 (ignoring dump_trace)
+dump_trace() {
+        local funcname="" sourcefile="" lineno="" n e s="yes"
+
+        declare -i strip=1
+
+        if [[ -n $1 ]]; then
+                strip=$(( $1 ))
+        fi
+
+        echo "Call stack:"
+        for (( n = ${#FUNCNAME[@]} - 1, p = ${#BASH_ARGV[@]} ; n > $strip ; n-- )) ; do
+                funcname=${FUNCNAME[${n} - 1]}
+                sourcefile=$(basename ${BASH_SOURCE[${n}]})
+                lineno=${BASH_LINENO[${n} - 1]}
+                # Display function arguments
+                args=
+                if [[ -n "${BASH_ARGV[@]}" ]]; then
+                        for (( j = 1 ; j <= ${BASH_ARGC[${n} - 1]} ; ++j )); do
+                                newarg=${BASH_ARGV[$(( p - j - 1 ))]}
+                                args="${args:+${args} }'${newarg}'"
+                        done
+                        (( p -= ${BASH_ARGC[${n} - 1]} ))
+                fi
+                echo "  ${sourcefile}, line ${lineno}:   Called ${funcname}${args:+ ${args}}"
+        done
+}
+
 diefunc() {
         local funcname="$1" lineno="$2" exitcode="$3"
         shift 3