summaryrefslogtreecommitdiffstats
path: root/bin/ebuild.sh
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-09-27 18:11:35 +0000
committerZac Medico <zmedico@gentoo.org>2007-09-27 18:11:35 +0000
commita48cb017ce957f0f5e740be2507f9559f1355ee5 (patch)
treebdc34164796c2b72ea5d73326e7e76e68d2795ba /bin/ebuild.sh
parent1ba6883daca0c6e96f37ca30ee51b6b20c27b98a (diff)
downloadportage-a48cb017ce957f0f5e740be2507f9559f1355ee5.tar.gz
portage-a48cb017ce957f0f5e740be2507f9559f1355ee5.tar.bz2
portage-a48cb017ce957f0f5e740be2507f9559f1355ee5.zip
with help from Donnie and Ulrich, use sed to extract the statement
that led to the call to die so we can print it out in our error message (trunk r7852) svn path=/main/branches/2.1.2/; revision=7855
Diffstat (limited to 'bin/ebuild.sh')
-rwxr-xr-xbin/ebuild.sh26
1 files changed, 24 insertions, 2 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index c85a49da7..233149f54 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -298,8 +298,30 @@ diefunc() {
eerror "ERROR: $CATEGORY/$PF failed."
dump_trace 2 ${filespacing} ${linespacing}
eerror " $(printf "%${filespacing}s" "${BASH_SOURCE[1]##*/}"), line $(printf "%${linespacing}s" "${BASH_LINENO[0]}"): Called die"
- eerror
- eerror " ${*:-(no error message)}"
+ 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).
+ 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}" \
+ -e '# If this line ends with a line continuation, append it
+ # 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' -e 's:^:RETAIN-LEADING-SPACE:' \
+ | while read -r n ; do eerror " ${n#RETAIN-LEADING-SPACE}" ; done
+ eerror " The die message:"
+ eerror " ${*:-(no error message)}"
eerror
eerror "If you need support, post the topmost build error, and the call stack if relevant."
[[ -n ${PORTAGE_LOG_FILE} ]] \