#!/bin/sh
export TOPDIR=$(dirname $0)
. $TOPDIR/settings.sh
. $TOPDIR/common.sh
OUTDIR=$1
ARCH=$2
RESULTS=$3
OUTFILE=$OUTDIR/$ARCH/HEADER.html
INLOGS="/org/cdbuilder.debian.org/dst/deb-cd/log"
OUTLOGS="build-logs/$DATE"
grep -q WARNING $OUTFILE
if [ $? -ne 0 ] ; then
echo >> $OUTFILE
echo "
WARNING:" >> $OUTFILE
echo "This build is not up to date; it is the most recent successful build.
" >> $OUTFILE
echo >> $OUTFILE
echo "Later weekly builds failed with errors:
" >> $OUTFILE
fi
echo "
" >> $OUTFILE
echo "" >> $OUTFILE
mkdir -p ${OUTDIR}/${ARCH}/${OUTLOGS}
for RESULT in $RESULTS; do
TYPE=`echo $RESULT | awk -F / '{print $1}'`
ERROR=`echo $RESULT | awk -F / '{print $2}'`
DATE=`echo $RESULT | awk -F / '{print $3}'`
LOGFILE=`echo $RESULT | awk -F / '{print $4}'`
BUILDTYPE=`echo $TYPE | sed 's/FAIL//g'`
cp ${INLOGS}/${LOGFILE} ${OUTDIR}/${ARCH}/${OUTLOGS}/${BUILDTYPE}.log
DESC=`build_description ${BUILDTYPE}`
echo "- $DESC build failed with error $ERROR at $DATE; logfile" >> $OUTFILE
done
echo "
" >> $OUTFILE