#!/bin/sh # # processfail arch=$1 branch=$2 pb=/var/portbuild of=/usr/local/www/data/errorlogs/.${arch}-${branch}-failure.html cd ${pb}/${arch}/${branch} find $of .failure.html.lock -mmin +60 -delete 2>/dev/null if [ -f $of -o -f .failure.html.lock ]; then exit; fi 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 touch .failure.html.lock newfailure=${pb}/${arch}/${branch}/newfailure num=$(wc -l ${newfailure} | awk '{print $1}') 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 "PortPackageBrokenLast#" 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 ${pb}/${arch}/${branch}/latest/${dir} ]; then err=$(readlink ${pb}/${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 "" rm .failure.html.lock mv -f $of /usr/local/www/data/errorlogs/${arch}-${branch}-failure.html