From: Fabian Groffen Date: Sat, 3 Oct 2009 21:07:27 +0000 (-0000) Subject: - do not calculate source with of isolated-functions (for die function) X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=07b9d77ff28ce1f905627837dfcceb2e86d5c742;p=portage.git - do not calculate source with of isolated-functions (for die function) as we don't print it - move paths to the bottom and print ${S} as it's often necessary when a package fails. - move error message up directly after the message it says it failed (printing it below the code snippet usually just repeats the message) svn path=/main/branches/prefix/; revision=14484 --- diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index fec41fa58..ac14aac49 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -85,7 +85,7 @@ die() { (( n-- )) done (( n == 0 )) && (( n = ${#FUNCNAME[@]} - 1 )) - while (( n >= 0 )); do + while (( n > 0 )); do sourcefile=${BASH_SOURCE[${n}]} sourcefile=${sourcefile##*/} lineno=${BASH_LINENO[${n}]} ((filespacing < ${#sourcefile})) && filespacing=${#sourcefile} @@ -96,31 +96,31 @@ die() { eerror "ERROR: $CATEGORY/$PF failed:" eerror " ${*:-(no error message)}" eerror - dump_trace 2 ${filespacing} ${linespacing} + eerror " $(printf "%${filespacing}s" "${BASH_SOURCE[1]##*/}"), line $(printf "%${linespacing}s" "${BASH_LINENO[0]}"): Called die" + eerror "The specific snippet of code:" # This scans the file that called die and prints out the logic that # ended in the call to die. This really only handles lines that end # with '|| die' and any preceding lines with line continuations (\). # This tends to be the most common usage though, so let's do it. # Due to the usage of appending to the hold space (even when empty), # we always end up with the first line being a blank (thus the 2nd sed). - code=$(sed -n \ + sed -n \ -e "# When we get to the line that failed, append it to the - # hold space, move the hold space to the pattern space, - # then print out the pattern space and quit immediately - ${BASH_LINENO[0]}{H;g;p;q}" \ + # hold space, move the hold space to the pattern space, + # then print out the pattern space and quit immediately + ${BASH_LINENO[0]}{H;g;p;q}" \ -e '# If this line ends with a line continuation, append it - # to the hold space - /\\$/H' \ + # to the hold space + /\\$/H' \ -e '# If this line does not end with a line continuation, - # erase the line and set the hold buffer to it (thus - # erasing the hold buffer in the process) - /[^\]$/{s:^.*$::;h}' \ - ${BASH_SOURCE[1]} | \ - sed -e '1d') - eerror " $(printf "%${filespacing}s" "${BASH_SOURCE[1]##*/}"):$(printf "%${linespacing}s" "${BASH_LINENO[0]}"): ${code}" + # erase the line and set the hold buffer to it (thus + # erasing the hold buffer in the process) + /[^\]$/{s:^.*$::;h}' \ + ${BASH_SOURCE[1]} \ + | sed -e '1d' -e 's:^:RETAIN-LEADING-SPACE:' \ + | while read -r n ; do eerror " ${n#RETAIN-LEADING-SPACE}" ; done eerror - eerror "If you need support, post the topmost build error, and the call stack if relevant." if [[ -n ${EBUILD_OVERLAY_ECLASSES} ]] ; then eerror "This ebuild used the following eclasses from overlays:" @@ -157,6 +157,19 @@ die() { done fi + [[ -n ${PORTAGE_LOG_FILE} ]] \ + && eerror "A complete build log is located at '${PORTAGE_LOG_FILE}'." + if [ -f "${T}/environment" ] ; then + eerror "The ebuild environment file is located at '${T}/environment'." + elif [ -d "${T}" ] ; then + { + set + export + } > "${T}/die.env" + eerror "The ebuild environment file is located at '${T}/die.env'." + fi + eerror "S: '${S}'" + [ -n "$EBUILD_EXIT_STATUS_FILE" ] && > "$EBUILD_EXIT_STATUS_FILE" # subshell die support