autodist-cgi: support for multiple packages jobs with link available for each operation performed (prepare,update,build,install)

This commit is contained in:
Silvan Calarco 2012-08-16 11:38:14 +02:00
parent cd1132a916
commit 61a6f72850

View File

@ -94,7 +94,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${line:0:6}" = "listcs" ] && printon=1
done
echo "<br>"
RELOADTIME=5000
RELOADTIME=15000
break
elif [ "$SHOWLOG" ]; then
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$i" ]; then
@ -174,22 +174,36 @@ _EOF
case $PREF in
"%%" ) if [ "$2 $3" == "Autodist started" ]; then
STARTTIME=`echo $line | sed "s|.* @ ||"`
AUTODIST_PID=`echo $line | sed "s|.*PID \([0-9]*\) .*|\1|"`
elif [ "$2 $3 $4" == "All jobs done" ]; then
ENDTIME=`echo $line | sed "s|.* @ ||"`
elif [ "$2 $3" == "autoupdate jobs:" ]; then
SCHEDULED=`echo $line | sed "s|.*autoupdate jobs: ||"`
elif [ "$2" == "Doing" ]; then
BUILDNOW[$BUILDNOWIDX]="$3"
BUILDLOG[$BUILDNOWIDX]=
BUILDNOWSTATUS[$BUILDNOWIDX]=
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
# elif [ "$2" == "Starting" ]; then
# case $3 in
# "PREPARE"|"UPDATE"|"BUILD"|"SEND") BUILDNOW[$BUILDNOWIDX-1]="${BUILDNOW[$BUILDNOWIDX-1]} $3" ;;
# esac
#elif [ "$2" != "Starting" -a "$2" != "Updating" ]; then
# [ "$JOBON" ] || echo $line
fi ;;
"?=") if [ "$2" == "See" ]; then
BUILDLOG[$BUILDNOWIDX-1]=`echo $line | sed "s|.*autodist/log/||"`
BUILDLOG[$BUILDNOWIDX-1]="${BUILDLOG[$BUILDNOWIDX-1]} `echo $line | sed 's|.*autodist/log/||'`"
fi ;;
"=>") JOBON=1 ;;
"%!"|"!!") BUILDNOW[$BUILDNOWIDX-1]="${BUILDNOW[$BUILDNOWIDX-1]} $line"; JOBON= ;;
"==") [ "${2:0:2}" == "==" ] && JOBON= ;;
"%!"|"!!") BUILDNOWSTATUS[$BUILDNOWIDX-1]="$line"; JOBON= ;;
"==") if [ "${2:0:2}" == "==" ]; then
JOBON=
# else
# if [ "$2" != "${BUILDNOW[$BUILDNOWIDX-1]}" ]; then
# BUILDNOW[$BUILDNOWIDX]="$2"
# BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
# fi
fi ;;
"Hunk"|"") ;;
*) [ "$JOBON" ] || {
line=`echo $line | sed "s|.*\r||"`
@ -220,15 +234,18 @@ _EOF
"%%" ) if [ "$2" == "Doing" ]; then
if [ "$3" != "${BUILDNOW[$BUILDNOWIDX-1]}" ]; then
BUILDNOW[$BUILDNOWIDX]="$3"
BUILDLOG[$BUILDNOWIDX]=
BUILDNOWSTATUS[$BUILDNOWIDX]=
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
fi
JOBON=1
fi ;;
"?=") if [ "$2" == "See" ]; then
BUILDLOG[$BUILDNOWIDX-1]=`echo $line | sed "s|.*autodist/log/||"`
BUILDLOG[$BUILDNOWIDX-1]="${BUILDLOG[$BUILDNOWIDX-1]} `echo $line | sed 's|.*autodist/log/||'`"
# BUILDLOG[$BUILDNOWIDX-1]=`echo $line | sed "s|.*autodist/log/||"`
fi ;;
"=>") JOBON=1 ;;
"%!"|"!!") BUILDNOW[$BUILDNOWIDX-1]="${BUILDNOW[$BUILDNOWIDX-1]} $line"; JOBON= ;;
"%!"|"!!") BUILDNOWSTATUS[$BUILDNOWIDX-1]="$line"; JOBON= ;;
"==") [ "${2:0:2}" == "==" ] && JOBON= ;;
"Hunk"|"") ;;
*) [ "$JOBON" ] || echo $line ;;
@ -236,21 +253,46 @@ _EOF
done < $AUTODISTLOGFILE
LASTLINE=$line
fi
echo "<b>Start:</b> $STARTTIME"
echo "<b>Scheduled jobs:</b> $SCHEDULED"
for b in `seq 1 ${#BUILDNOW[*]}`; do
set -- ${BUILDNOW[$b]}
if [ "${BUILDLOG[$b]}" ]; then
echo "<b><a href=\"?SHOWLOG=${BUILDLOG[$b]}&NUM=$i$HOST_ADD\">$1</a>:</b> $2 $3 $4 $5 $6 "
elif [ "$1" ]; then
echo "<b>$1:</b> $2 $3 $4 $5 $6 "
fi
done
if [ "$LASTLINE" ]; then
set -- $LASTLINE
[ "$1" = "^" ] && echo "<font color=red><b>${2}</b> ${3} ${4} ${5} ${6} ${7}</font>"
echo "<b>Start:</b> $STARTTIME"
echo "<b>Scheduled jobs:</b> $SCHEDULED"
for b in `seq 0 ${#BUILDNOW[*]}`; do
# set -- ${BUILDNOW[$b]}
JOBNAME=${BUILDNOW[$b]}
[ "$JOBNAME" ] || continue
echo -n "<b>$JOBNAME</b>: "
rowcnt=0
if [ "${BUILDLOG[$b]}" ]; then
for l in ${BUILDLOG[$b]}; do
SUBJOBNAME=`echo $l | sed "s|.*/${JOBNAME}_\(.*\)\..*|\1|"`
[ "${SUBJOBNAME:0:1}" = "_" ] && SUBJOBNAME=$l
[ "$SUBJOBNAME" = "$l" ] && SUBJOBNAME=`echo $l | sed "s|.*/\(.*\)\..*|\1|"`
OPERATIONNAME=`echo $l | sed "s|\(.*\)/.*/.*|\1|"`
OPERATIONSTATUS=`echo $l | sed "s|.*/\(.*\)/.*|\1|"`
if [ $rowcnt -ge 4 ]; then
echo
rowcnt=0
fi
if [ "$OPERATIONNAME" = "send" -a "$OPERATIONSTATUS" = "ok" ]; then
echo -n "<a href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\">$OPERATIONNAME/$OPERATIONSTATUS</a>"
elif [ "$OPERATIONNAME" = "install" -a "$OPERATIONSTATUS" = "ok" ]; then
echo -n "<a href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\">$OPERATIONNAME/$OPERATIONSTATUS</a>"
elif [ "$OPERATIONSTATUS" = "ok" ]; then
echo -n "<a href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=black>$OPERATIONNAME/$OPERATIONSTATUS</font></a>"
else
echo -n "<a href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=red>$OPERATIONNAME/$OPERATIONSTATUS</font></a>"
fi
[ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "($SUBJOBNAME)"
echo -n " "
rowcnt=`expr $rowcnt + 1`
done
fi
[ "$ENDTIME" ] && echo "<b>End:</b> $ENDTIME" || echo "<b>End: <font color=green>in progress</font></b>"
[ "${BUILDNOWSTATUS[$b]}" ] && echo "<i>(${BUILDNOWSTATUS[$b]})</i>" || echo
done
if [ "$LASTLINE" ]; then
set -- $LASTLINE
[ "$1" = "^" ] && echo "<font color=red><b>${2}</b> ${3} ${4} ${5} ${6} ${7}</font>"
fi
[ "$ENDTIME" ] && echo "<b>End:</b> $ENDTIME" || echo "<b>End: <a href=\"?SHOWLOG=current.$AUTODIST_PID&NUM=$i$HOST_ADD\">in progress</a></b>"
echo
# grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||"
# echo