common/xbps-src: add stacktraces on build errors

This commit is contained in:
Enno Boland 2018-03-28 11:20:50 +02:00
parent 94ea905d98
commit 7e55558944
No known key found for this signature in database
GPG key ID: D09964719BDE9971

View file

@ -80,9 +80,18 @@ run_step() {
}
error_func() {
if [ -n "$1" -a -n "$2" ]; then
msg_red "$pkgver: failed to run $1() at line $2.\n"
fi
local err=$?
local src=
local i=
[ -n "$1" -a -n "$2" ] || exit 1;
msg_red "$pkgver: $1: '${BASH_COMMAND}' exited with $err\n"
for ((i=1;i<${#FUNCNAME[@]};i++)); do
src=${BASH_SOURCE[$i]}
src=${src#$XBPS_DISTDIR/}
msg_red " in ${FUNCNAME[$i]}() at $src:${BASH_LINENO[$i-1]}\n"
[ "${FUNCNAME[$i]}" = "$1" ] && break;
done
exit 1
}