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