From a49695c92c84a56696b659517c8ca9c6a1a7bf33 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 16 Oct 2018 14:46:52 +0200 Subject: generate-bug-report can now also generate bug-reports for build-failures --- generate-bug-report | 59 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/generate-bug-report b/generate-bug-report index f388a13..4ad845e 100755 --- a/generate-bug-report +++ b/generate-bug-report @@ -10,23 +10,55 @@ if ! diff -u PKGBUILD ../../trunk/PKGBUILD; then fi fi -if makepkg --verifysource; then - >&2 echo 'nothing wrong upstream.' - exit +if ! git archive HEAD -- PKGBUILD | tar -Ox | diff -u --color - PKGBUILD; then + >&2 echo "PKGBUILD differs from git - say something and I won't create a bug report." + read -r s + if [ -n "$s" ]; then + exit + fi fi -makepkg_info=$( - makepkg --verifysource 2>&1 -) git_revision=$( git rev-parse HEAD ) +if ! makepkg_info=$(makepkg --verifysource 2>&1); then + bug_report=$( + makepkg --verifysource 2>&1 + ) + fail_command='makepkg --verifysource' +else + >&2 echo 'Nothing wrong with upstream'"'"'s source - should I try to build? (empty="yes")' + read -r s + if [ -n "$s" ]; then + exit + fi + { + extra-x86_64-build 2>&1 + echo $? + } | \ + tee log.x86_64 + error=$( + sed -i ' + $ { + w /dev/stdout + d + } + ' log.x86_64 + ) + if [ "${error}" = '0' ]; then + >&2 echo 'Builds fine on x86_64.' + exit + fi + bug_report='extra-x86_64 fails with:' + fail_command='extra-x86_64-build' + log='full log is attached' + log_file=$(readlink -f 'log.x86_64') +fi + printf 'Bug report:\n\n' printf 'Description:\n\n' -printf '%s\n' \ - "${makepkg_info}" -printf '\n' +printf '%s\n' "${bug_report}" printf 'Additional info:\n' printf '* package version(s)\n' printf '%s\n' \ @@ -39,6 +71,10 @@ printf '%s\n' \ tr -d '\n' printf ' (git revision %s)\n' \ "${git_revision}" +if [ -n "${log}" ]; then + printf '* config and/or log files etc.\n' + printf '%s\n' "${log}" +fi printf '\n' printf 'Steps to reproduce:\n' printf '> git checkout %s\n' \ @@ -50,4 +86,7 @@ printf '> cd %s\n' \ s,^.*/\([^/]\+/repos/[^/]\+\)$,\1, ' )" -printf '> makepkg --verifysource\n' +printf '> %s\n' "${fail_command}" +if [ -n "${log_file}" ]; then + printf '\nupload: %s\n' "${log_file}" +fi -- cgit v1.2.3-70-g09d2