From fb631d1863c979fcaf92ec2283d7d36dd86ea25a Mon Sep 17 00:00:00 2001 From: JCZD Date: Tue, 29 Jul 2025 16:23:38 +0200 Subject: [PATCH 1/2] ebugreport: generate HTML report for portage compilation errors --- bin/ebugreport | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 bin/ebugreport diff --git a/bin/ebugreport b/bin/ebugreport new file mode 100755 index 00000000..43fa8727 --- /dev/null +++ b/bin/ebugreport @@ -0,0 +1,82 @@ +#!/bin/bash + +# +# generate a full HTML report when portage fails to build a package +# +# author: petaflot +# license: CC BY-NC-SA +# version history: +# 2023-11-04: first positive trace of using the script, was possibly started as far back as 2019 +# 2024-09-04: fixed date locale, added link to script, disabled gzipping the files, added +# conditional statements and full build log with $ARCH +# 2025-01-31: ansifilter on build.log +# 2025-07-29: changed URL, DEST to EBUGREPORT_URL, EBUGREPORT_DEST ; merge request for gentoolkit +# +# configuration: add +# export EBUGREPORT_URL='...' +# export EBUGREPORT_DEST='.../' +# to your .bashrc +# EBUGREPORT_DEST is some ssh server:path where the files are uplaoded and MUST end with a / +# EBUGREPORT_URL is the URL where the files will be available + +export LC_ALL=C.UTF-8 + +if [[ $# == 0 ]] +then + echo "usage: $0 category/ebuild-version::repos" + exit 1 +fi + +ARCH=`portageq envvar ARCH` + +CATEGORY=`echo $1|cut -f 1 -d '/'` +EBUILD=`echo $1|cut -f 2 -d '/' | cut -f 1 -d ':'` +REPOS=`echo $1|cut -f 2 -d '/' | cut -f 3 -d ':'` +d=/tmp/$EBUILD +mkdir $d +f=$d/index.html +TITLE="Gentoo bug report for ${EBUILD}" + +echo "${TITLE}

${TITLE}

" >$f +echo "Created on `LC_TIME=C date` with this script

" >>$f + +echo -e "\n

$ emerge -pqv =${CATEGORY}/${EBUILD}::${REPOS}

\n
" >> $f
+emerge -pqv =${CATEGORY}/${EBUILD}::${REPOS} >> $f
+echo -e "

$ emerge --info =${CATEGORY}/${EBUILD}::${REPOS}

\n
" >> $f
+emerge --info =${CATEGORY}/${EBUILD}::${REPOS} >> $f
+echo "

Other relevant files

" >>$f + +chmod -R a+r ${d} +scp -rv $d ${EBUGREPORT_DEST} +#echo "Your bug report for ${EBUILD} is available at `bpaste upload $f`" +echo "Your bug report for ${EBUILD} is available at ${EBUGREPORT_URL}${EBUILD}/" + +echo not doing rm -rf $d From 9527c7f87fdc94fd962f8152689ceb3e3484bcb3 Mon Sep 17 00:00:00 2001 From: JCZD Date: Tue, 29 Jul 2025 16:45:27 +0200 Subject: [PATCH 2/2] went though shellcheck ; making sure EBUGREPORT_ are set --- bin/ebugreport | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/ebugreport b/bin/ebugreport index 43fa8727..d03cdee2 100755 --- a/bin/ebugreport +++ b/bin/ebugreport @@ -27,18 +27,23 @@ then exit 1 fi -ARCH=`portageq envvar ARCH` +if [ -z "${EBUGREPORT_URL+x}" ] || [ -z "${EBUGREPORT_DEST+x}" ]; then + echo "both EBUGREPORT_DEST and EBUGREPORT_URL must be set ; try 'export EBUGREPORT_...'" + exit 2 +fi + +ARCH=$(portageq envvar ARCH) -CATEGORY=`echo $1|cut -f 1 -d '/'` -EBUILD=`echo $1|cut -f 2 -d '/' | cut -f 1 -d ':'` -REPOS=`echo $1|cut -f 2 -d '/' | cut -f 3 -d ':'` +CATEGORY=$(echo $1|cut -f 1 -d '/') +EBUILD=$(echo $1|cut -f 2 -d '/' | cut -f 1 -d ':') +REPOS=$(echo $1|cut -f 2 -d '/' | cut -f 3 -d ':') d=/tmp/$EBUILD mkdir $d f=$d/index.html TITLE="Gentoo bug report for ${EBUILD}" echo "${TITLE}

${TITLE}

" >$f -echo "Created on `LC_TIME=C date` with this script

" >>$f +echo "Created on $(LC_TIME=C date) with this script

" >>$f echo -e "\n

$ emerge -pqv =${CATEGORY}/${EBUILD}::${REPOS}

\n
" >> $f
 emerge -pqv =${CATEGORY}/${EBUILD}::${REPOS} >> $f