freebsd-ports/Tools/portbuild/scripts/processfail
Mark Linimon 5b3b7d003e Generalize the packge building scripts to be able to be run on more than
one 'head' node, rather than just pointyhat itself.

Constants are factored out into installation-specific files known as
portbuild/conf/server.conf and portbuild/conf/client.conf.  There is
only one server.conf file.  Individual <arch> directories may have
their own client.conf files, or may symlink to ../conf/client.conf.

While here, fix error messages displayed on new runs.

Feature safe:	yes
2010-06-25 23:31:11 +00:00

83 lines
2.2 KiB
Bash
Executable file

#!/bin/sh
#
# processfail <arch> <branch>
arch=$1
branch=$2
pb=/var/portbuild
. ${pb}/conf/server.conf
ERRORLOGS_DIRECTORY="${WWW_DIRECTORY}/errorlogs"
of=${ERRORLOGS_DIRECTORY}/.${arch}-${branch}-failure.html
cd ${pb}/${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=${pb}/${arch}/${branch}/newfailure
num=0
if [ -e ${newfailure} ]; then
num=$(wc -l ${newfailure} | awk '{print $1}')
fi
header() {
echo "<html><head><title>New package building errors</title>" >$of
echo "</head><body><h1>New package building errors</h1>" >>$of
if [ "$num" -eq "0" ]; then
echo "No errors (yet)" >>$of
else
echo "<table border=1>" >>$of
echo "<tr>$1</tr>" >>$of
fi
}
footer() {
echo "</table>" >>$of
echo "</body>" >>$of
echo "</html>" >>$of
}
#
# Create "default" output, sorted on portname
#
header "<th>Port</th><th>Package</th><th>Broken</th><th>Last</th><th>#</th>"
dirname() {
echo ${1%/*}
}
basename() {
echo ${1##*/}
}
sort -r -n -k 4 -t \| failure > newfailure
IFS='|'
while read dir name ver date last count; do
echo "<tr>" >> $of
echo "<td><a href=\"http://cvsweb.freebsd.org/ports/$dir\">$dir</a></td>" >> $of
if [ -L ${pb}/${arch}/${branch}/latest/${dir} ]; then
err=$(readlink ${pb}/${arch}/${branch}/latest/${dir})
echo "<td><a href=\"${arch}-errorlogs/$(basename $(dirname ${err}))/$(basename ${err})\">$ver</a></td>" >> $of
else
echo "<td><a href=\"${arch}-${branch}-latest/$ver.log\">$ver</a></td>" >> $of
fi
# echo "<td align=\"right\">$affby</td><td align=\"right\">$4 Kb</td>" >> $of
# echo "<td><a href=\"http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/$5\">$5</a></td>" >> $of
# echo "<td><a href=\"mailto:$6\">$6</a></td>" >> $of
# echo "<td>" >> $of
alphadate=$(date -jf %s ${date} "+%F %T")
alphalast=$(date -jf %s ${last} "+%F %T")
echo "<td>${alphadate}</td>" >> $of
echo "<td>${alphalast}</td>" >> $of
echo "<td>$count</td>" >> $of
echo "</tr>" >> $of
done < newfailure
footer ""
mv -f $of ${ERRORLOGS_DIRECTORY}/${arch}-${branch}-failure.html