From 3181e6826afaab3ebc8c4df2b6bc61bb73a9c73b Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 3 Jul 2019 10:12:15 +0200 Subject: bin/build-packages: store name of log file in variable. After build failure, search inside log file for reference to other log files and append them to the log (which gets uploaded) --- bin/build-packages | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'bin/build-packages') diff --git a/bin/build-packages b/bin/build-packages index 479f5e6..9ae9891 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -606,15 +606,36 @@ while [ "${count}" -ne 0 ] && \ "${repository}" \ "${straw}" \ "${arch}" + log_file="${tmp_dir}/$( + date -u --iso-8601=seconds | \ + cut -d+ -f1 + ).build-log" # by piping the log, we don't see anything in the terminal, # but all ways to duplicate the logs seem pretty elaborate # shellcheck disable=SC2024,SC2086 if ! "${build_command}" ${outerParameters} -- ${middleParameters} -- ${innerParameters} > \ - "$( - date -u --iso-8601=seconds | \ - cut -d+ -f1 - ).build-log" 2>&1; then + "${log_file}" 2>&1; then success=false + build_dir="/var/lib/archbuild/${build_command%-build}/$(whoami)" + if [ -d "${build_dir}" ]; then + sed ' + s/^Full log written to\s\+\(\S\+\)\s*$/\1/ + t + /# An error report file with more information is saved as:/ { + N + s/^.*\n#\s\+// + t + d + } + s/^See also "\(\S\+\)"\.\s*$/\1/ + t + d + ' "${log_file}" | \ + while read -r extra_log_file; do + grep -HF '' "${build_dir}/${extra_log_file}" || true + done | \ + sponge -a "${log_file}" + fi fi fi -- cgit v1.2.3