#!/bin/sh # # processfail arch=$1 branch=$2 pbc=${PORTBUILD_CHECKOUT:-/a/portbuild} pbd=${PORTBUILD_DATA:-/a/portbuild} . ${pbc}/admin/conf/admin.conf . ${pbc}/conf/server.conf ERRORLOGS_DIRECTORY="${WWW_DIRECTORY}/errorlogs" of=${ERRORLOGS_DIRECTORY}/.${arch}-${branch}-failure.html cd ${pbd}/${arch}/${branch} if [ -e .newfailure.stamp -a $(echo $(find . -maxdepth 1 -newer .newfailure.stamp -name newfailure 2>&1 /dev/null | wc -l)) = "0" ]; then exit; fi touch .newfailure.stamp newfailure=${pbd}/${arch}/${branch}/newfailure num=0 if [ -e ${newfailure} ]; then num=$(wc -l ${newfailure} | awk '{print $1}') fi header() { echo "New package building errors" >$of echo "

New package building errors

" >>$of if [ "$num" -eq "0" ]; then echo "No errors (yet)" >>$of else echo "" >>$of echo "$1" >>$of fi } footer() { echo "
" >>$of echo "" >>$of echo "" >>$of } # # Create "default" output, sorted on portname # header "PortBuild logFirst brokenLast tried# tries" dirname() { echo ${1%/*} } basename() { echo ${1##*/} } if [ ! -f failure ]; then touch failure fi sort -r -n -k 4 -t \| failure > newfailure IFS='|' while read dir name ver date last count; do echo "" >> $of echo "$dir" >> $of if [ -L ${pbd}/${arch}/${branch}/latest/${dir} ]; then err=$(readlink ${pbd}/${arch}/${branch}/latest/${dir}) echo "$ver" >> $of else echo "$ver" >> $of fi # echo "$affby$4 Kb" >> $of # echo "$5" >> $of # echo "$6" >> $of # echo "" >> $of alphadate=$(date -jf %s ${date} "+%F %T") alphalast=$(date -jf %s ${last} "+%F %T") echo "${alphadate}" >> $of echo "${alphalast}" >> $of echo "$count" >> $of echo "" >> $of done < newfailure footer "" mv -f $of ${ERRORLOGS_DIRECTORY}/${arch}-${branch}-failure.html