#!/bin/sh # $FreeBSD# # # create HTML showing numbers of packages vs errors. Run this in a directory # accessible to the web server. # # alpha is obsolete SUPPORTED_ARCHS="amd64 i386 ia64 sparc64" ROOT_DIRECTORY=/var/portbuild OUTFILE=packagestats.html TMPFILE=.${OUTFILE} echo "" > ${TMPFILE} echo "
" >> ${TMPFILE} echo "as of `date`
" >> ${TMPFILE} for arch in ${SUPPORTED_ARCHS}; do # begin table echo "" >> ${TMPFILE} echo " | as of | " >> ${TMPFILE} echo "INDEX | " >> ${TMPFILE} echo "packages | " >> ${TMPFILE} echo "errors | " >> ${TMPFILE} echo "skipped | " >> ${TMPFILE} echo "missing | " >> ${TMPFILE} echo "done? | " >> ${TMPFILE} echo "
---|---|---|---|---|---|---|---|
$arch-$branch | " >> ${TMPFILE} # column: datestamp of latest log latest=" " if [ -d $directory/logs ]; then #latest="$(cd $directory/logs; ls -rtTl | grep '\.log' | tail -1 | awk '{printf("%s %s %s %s\n",$6,$7,$8,$9)}')" latest="$(cd $directory/logs; ls -rtTl | grep '\.log' | tail -1 | awk '{printf("%s %s\n",$6,$7)}')" if [ "$latest" ]; then #latest="$latest `date '+%Z'`" else latest=" " fi fi echo "$latest | " >> ${TMPFILE} # column: INDEX count n_index=0 if [ -f $indexfile ]; then n_index=`cat $indexfile | wc -l` fi echo "$n_index | " >> ${TMPFILE} # column: package count n_packages=0 if [ -d $directory/packages/All ]; then n_packages=`find $directory/packages/All -name \*.tbz -o -name \*.tgz |wc -l` fi echo "" >> ${TMPFILE} echo "" >> ${TMPFILE} echo "$n_packages | " >> ${TMPFILE} # column: error count n_errors=0 if [ -d $directory/errors ]; then # XXX MCL why doesn't this work??? #n_errors=`find $directory/errors -name \*.log -o -name \*.log.bz2 |wc -l` n_errors=`ls $directory/errors | grep '.log' | wc -l` fi echo "" >> ${TMPFILE} echo "" >> ${TMPFILE} echo "$n_errors | " >> ${TMPFILE} # column: duds count n_duds=0 if [ -f $directory/duds ]; then n_duds=`cat $directory/duds | wc -l` fi echo "$n_duds | " >> ${TMPFILE} # column: missing count if [ $n_index -ne 0 ]; then n_missing=`expr $n_index - $n_packages - $n_errors - $n_duds` else # index currently being rebuilt n_missing=0 fi echo "$n_missing | " >> ${TMPFILE} # column: done flag done_flag="N" if [ -f $directory/build.log ]; then if [ ! -z "`grep 'all done at ' $directory/build.log`" ]; then done_flag="Y" fi fi echo "$done_flag | " >> ${TMPFILE} echo "
explanation of columns:
" >> ${TMPFILE} echo "