autodist cgi: support for REP variable to fix multiple log windows showing bug
This commit is contained in:
parent
03d939419c
commit
0c9f7b442e
58
autodist-cgi
58
autodist-cgi
@ -4,6 +4,7 @@
|
||||
|
||||
NUM=`echo "$QUERY_STRING" | sed -n 's/^.*NUM=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
||||
HOST=`echo "$QUERY_STRING" | sed -n 's/^.*HOST=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
||||
REP=`echo "$QUERY_STRING" | sed -n 's/^.*REP=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
||||
AS_HOST=`echo "$QUERY_STRING" | sed -n 's/^.*AS_HOST=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
||||
SHOWLOG=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWLOG=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
||||
SHOWINDEX=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWINDEX=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
||||
@ -49,15 +50,17 @@ if [ "$SHOWINDEX" ]; then
|
||||
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
||||
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
||||
|
||||
RNUM=-1
|
||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||
RNUM=`expr $RNUM + 1`
|
||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a> "
|
||||
echo "<a href=\"?NUM=$i&REP=$RNUM$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a> "
|
||||
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a> "
|
||||
echo "<a href=\"?NUM=$i&REP=$RNUM$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a> "
|
||||
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a> "
|
||||
echo "<a href=\"?NUM=$i&REP=$RNUM$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a> "
|
||||
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]})</a> "
|
||||
echo "<a href=\"?NUM=$i&REP=$RNUM$HOST_ADD\">$r(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]})</a> "
|
||||
fi
|
||||
done
|
||||
done
|
||||
@ -74,7 +77,7 @@ fi
|
||||
[ ! "$SHOWLOG" -a "$HOST" = "$AS_HOST" ] && echo "<h2>Host: `hostname -s` (`uname -m`, kernel `uname -r`)</h2>"
|
||||
|
||||
if [ "$SHOWLOG" -a "$HOST" != "$AS_HOST" ]; then
|
||||
curl "${AUTOPORT_CGI_HOST[$HOST]}?AS_HOST=$HOST&SHOWLOG=$SHOWLOG&NUM=$NUM&LOG=$LOG" 2>/dev/null
|
||||
curl "${AUTOPORT_CGI_HOST[$HOST]}?AS_HOST=$HOST&SHOWLOG=$SHOWLOG&NUM=$NUM&REP=$REP&LOG=$LOG" 2>/dev/null
|
||||
else
|
||||
|
||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
@ -96,11 +99,11 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
RELOADTIME=15000
|
||||
break
|
||||
fi
|
||||
RNUM=0
|
||||
RNUM=-1
|
||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
||||
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
||||
|
||||
RNUM=`expr $RNUM + 1`
|
||||
LOGDIR=`environment_logdir $i`
|
||||
AUTOPORTLOGDIR=`environment_autoport_logdir $i`
|
||||
ENVROOTDIR=`environment_rootdir $i`
|
||||
@ -127,7 +130,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
continue
|
||||
fi
|
||||
if [ "$SHOWLOG" ]; then
|
||||
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$RNUM" ]; then
|
||||
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$i" -a "$REP" = "$RNUM" ]; then
|
||||
echo -n "<p><h2>$SHOWLOG log in "
|
||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||
echo -n "update"
|
||||
@ -164,8 +167,8 @@ _EOF
|
||||
echo "<table style=\"color:black\"><tr><td colspan=3>Last ${SHOWLOGPKG} logs:</td>"
|
||||
for t in prepare update build install send; do
|
||||
echo -n "<tr><td>$t:</td><td>"
|
||||
[ -e ${BUILDLOGDIR}${t}/ok/${SHOWLOGPKG} ] && echo -n "<td><a style=\"color:green;text-decoration:none\" target=_autodist href=\"?NUM=$i$HOST_ADD&SHOWLOG=${t}/ok/${SHOWLOGPKG}\">OK</a></td>" || echo "<td></td>"
|
||||
[ -e ${BUILDLOGDIR}${t}/failed/${SHOWLOGPKG} ] && echo -n "<td><a style=\"color:green;text-decoration:none\" target=_autodist href=\"?NUM=$i$HOST_ADD&SHOWLOG=${t}/failed/${SHOWLOGPKG}\">FAILED</a></td>" || echo "<td></td>"
|
||||
[ -e ${BUILDLOGDIR}${t}/ok/${SHOWLOGPKG} ] && echo -n "<td><a style=\"color:green;text-decoration:none\" target=_autodist href=\"?NUM=$i&REP=$RNUM$HOST_ADD&SHOWLOG=${t}/ok/${SHOWLOGPKG}\">OK</a></td>" || echo "<td></td>"
|
||||
[ -e ${BUILDLOGDIR}${t}/failed/${SHOWLOGPKG} ] && echo -n "<td><a style=\"color:green;text-decoration:none\" target=_autodist href=\"?NUM=$i&REP=$RNUM$HOST_ADD&SHOWLOG=${t}/failed/${SHOWLOGPKG}\">FAILED</a></td>" || echo "<td></td>"
|
||||
echo "</tr>"
|
||||
done
|
||||
echo "</table>"
|
||||
@ -193,23 +196,23 @@ _EOF
|
||||
[[ "$NUM" && "$NUM" != "$i" ]] && continue
|
||||
[[ "$HOST" = "$AS_HOST" ]] || continue
|
||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||
echo "<b>* <a target=_autodist href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:autodist update)"
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
|
||||
echo "<b>* <a target=_autodist href=\"?NUM=$i&REP=$RNUM&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:autodist update)"
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i&REP=$RNUM$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i&REP=$RNUM$HOST_ADD\">last</a> ]</b>"
|
||||
fi
|
||||
|
||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||
echo "<b>* <a target=_autodist href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:chroot autoport</a> chroot:${AUTOPORT_CHROOT[$i]})"
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
|
||||
echo "<b>* <a target=_autodist href=\"?NUM=$i&REP=$RNUM&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:chroot autoport</a> chroot:${AUTOPORT_CHROOT[$i]})"
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i&REP=$RNUM$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i&REP=$RNUM$HOST_ADD\">last</a> ]</b>"
|
||||
fi
|
||||
|
||||
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||
echo "<b>* <a target=_autodist href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:native autoport)"
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
|
||||
echo "<b>* <a target=_autodist href=\"?NUM=$i&REP=$RNUM&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:native autoport)"
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i&REP=$RNUM$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i&REP=$RNUM$HOST_ADD\">last</a> ]</b>"
|
||||
fi
|
||||
|
||||
if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||
echo "<b>* <a target=_autodist href=\"?NUM=$i&HOST=$AS_HOST\">cross-platform</a> autoport (arch:${AUTOPORT_CROSS[$i]})</b>"
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">last</a> ]</b>"
|
||||
echo "<b>* <a target=_autodist href=\"?NUM=$i&REP=$RNUM&HOST=$AS_HOST\">cross-platform</a> autoport (arch:${AUTOPORT_CROSS[$i]})</b>"
|
||||
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i&REP=$RNUM$HOST_ADD\">last</a> ]</b>"
|
||||
fi
|
||||
cat << _EOF
|
||||
<div class=downloadbox align=center>
|
||||
@ -309,23 +312,23 @@ _EOF
|
||||
# fi
|
||||
case $OPERATIONNAME-$OPERATIONSTATUS in
|
||||
build-ok|send-ok|install-ok|retryinstall-ok)
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\">$OPERATIONNAME:$OPERATIONSTATUS</a>"
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i&REP=$RNUM$HOST_ADD\">$OPERATIONNAME:$OPERATIONSTATUS</a>"
|
||||
;;
|
||||
update-failed|autoupdate-failed)
|
||||
if [ "${BUILDNOWSTATUS[$b]}" = "4" ]; then
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=green>$OPERATIONNAME:up-to-date</font></a>"
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i&REP=$RNUM$HOST_ADD\"><font color=green>$OPERATIONNAME:up-to-date</font></a>"
|
||||
elif [ "${BUILDNOWSTATUS[$b]}" = "3" ]; then
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=darkgoldenrod>$OPERATIONNAME:unknown</font></a>"
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i&REP=$RNUM$HOST_ADD\"><font color=darkgoldenrod>$OPERATIONNAME:unknown</font></a>"
|
||||
elif [ "${BUILDNOWSTATUS[$b]}" = "2" ]; then
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=darkgoldenrod>$OPERATIONNAME:newer</font></a>"
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i&REP=$RNUM$HOST_ADD\"><font color=darkgoldenrod>$OPERATIONNAME:newer</font></a>"
|
||||
else
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=red>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i&REP=$RNUM$HOST_ADD\"><font color=red>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
|
||||
fi
|
||||
;;
|
||||
*-ok) echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=black>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
|
||||
*-ok) echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i&REP=$RNUM$HOST_ADD\"><font color=black>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
|
||||
;;
|
||||
*)
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=red>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
|
||||
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i&REP=$RNUM$HOST_ADD\"><font color=red>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
|
||||
;;
|
||||
esac
|
||||
# [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "(<a href=\"$AUTOPORT_WEBBUILD_HOST?ENVIRONMENT=$i&PACKAGE=$SUBJOBNAME\" target=\"webbuild\">$SUBJOBNAME</a>)"
|
||||
@ -342,14 +345,13 @@ _EOF
|
||||
if [ "$ENDTIME" ]; then
|
||||
echo "<b>End:</b> $ENDTIME"
|
||||
elif [ "$AUTODIST_PID" ]; then
|
||||
echo "<b>End: <a target=_autodist href=\"?SHOWLOG=current.$AUTODIST_PID&NUM=$i$HOST_ADD\">in progress</a></b>"
|
||||
echo "<b>End: <a target=_autodist href=\"?SHOWLOG=current.$AUTODIST_PID&NUM=$i&REP=$RNUM$HOST_ADD\">in progress</a></b>"
|
||||
fi
|
||||
echo
|
||||
# grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||"
|
||||
# echo
|
||||
echo "</pre></div></div>"
|
||||
fi
|
||||
RNUM=`expr $RNUM + 1`
|
||||
done
|
||||
done
|
||||
|
||||
@ -357,7 +359,7 @@ done
|
||||
if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then
|
||||
for h in `seq 1 ${#AUTOPORT_CGI_HOST[*]}`; do
|
||||
if [ "$NUM" -a "$HOST" = "$h" ]; then
|
||||
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES&NUM=$NUM&HOST=$HOST" 2>/dev/null
|
||||
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES&NUM=$NUM&REP=$RNUM&HOST=$HOST" 2>/dev/null
|
||||
elif [ ! "$NUM" ]; then
|
||||
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES" 2>/dev/null
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user