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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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_ARCH[$i]}" ] || continue
|
||||||
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
||||||
|
|
||||||
|
RNUM=-1
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||||
|
RNUM=`expr $RNUM + 1`
|
||||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
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
|
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
|
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
|
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
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@ -74,7 +77,7 @@ fi
|
|||||||
[ ! "$SHOWLOG" -a "$HOST" = "$AS_HOST" ] && echo "<h2>Host: `hostname -s` (`uname -m`, kernel `uname -r`)</h2>"
|
[ ! "$SHOWLOG" -a "$HOST" = "$AS_HOST" ] && echo "<h2>Host: `hostname -s` (`uname -m`, kernel `uname -r`)</h2>"
|
||||||
|
|
||||||
if [ "$SHOWLOG" -a "$HOST" != "$AS_HOST" ]; then
|
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
|
else
|
||||||
|
|
||||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||||
@ -96,11 +99,11 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|||||||
RELOADTIME=15000
|
RELOADTIME=15000
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
RNUM=0
|
RNUM=-1
|
||||||
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||||
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
||||||
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
||||||
|
RNUM=`expr $RNUM + 1`
|
||||||
LOGDIR=`environment_logdir $i`
|
LOGDIR=`environment_logdir $i`
|
||||||
AUTOPORTLOGDIR=`environment_autoport_logdir $i`
|
AUTOPORTLOGDIR=`environment_autoport_logdir $i`
|
||||||
ENVROOTDIR=`environment_rootdir $i`
|
ENVROOTDIR=`environment_rootdir $i`
|
||||||
@ -127,7 +130,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [ "$SHOWLOG" ]; then
|
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 "
|
echo -n "<p><h2>$SHOWLOG log in "
|
||||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||||
echo -n "update"
|
echo -n "update"
|
||||||
@ -164,8 +167,8 @@ _EOF
|
|||||||
echo "<table style=\"color:black\"><tr><td colspan=3>Last ${SHOWLOGPKG} logs:</td>"
|
echo "<table style=\"color:black\"><tr><td colspan=3>Last ${SHOWLOGPKG} logs:</td>"
|
||||||
for t in prepare update build install send; do
|
for t in prepare update build install send; do
|
||||||
echo -n "<tr><td>$t:</td><td>"
|
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}/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$HOST_ADD&SHOWLOG=${t}/failed/${SHOWLOGPKG}\">FAILED</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>"
|
echo "</tr>"
|
||||||
done
|
done
|
||||||
echo "</table>"
|
echo "</table>"
|
||||||
@ -193,23 +196,23 @@ _EOF
|
|||||||
[[ "$NUM" && "$NUM" != "$i" ]] && continue
|
[[ "$NUM" && "$NUM" != "$i" ]] && continue
|
||||||
[[ "$HOST" = "$AS_HOST" ]] || continue
|
[[ "$HOST" = "$AS_HOST" ]] || continue
|
||||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
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 "<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$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
|
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
|
fi
|
||||||
|
|
||||||
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
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 "<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$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
|
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
|
fi
|
||||||
|
|
||||||
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
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 "<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$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
|
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
|
fi
|
||||||
|
|
||||||
if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
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 "<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$HOST_ADD\">last</a> ]</b>"
|
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i&REP=$RNUM$HOST_ADD\">last</a> ]</b>"
|
||||||
fi
|
fi
|
||||||
cat << _EOF
|
cat << _EOF
|
||||||
<div class=downloadbox align=center>
|
<div class=downloadbox align=center>
|
||||||
@ -309,23 +312,23 @@ _EOF
|
|||||||
# fi
|
# fi
|
||||||
case $OPERATIONNAME-$OPERATIONSTATUS in
|
case $OPERATIONNAME-$OPERATIONSTATUS in
|
||||||
build-ok|send-ok|install-ok|retryinstall-ok)
|
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)
|
update-failed|autoupdate-failed)
|
||||||
if [ "${BUILDNOWSTATUS[$b]}" = "4" ]; then
|
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
|
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
|
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
|
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
|
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
|
esac
|
||||||
# [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "(<a href=\"$AUTOPORT_WEBBUILD_HOST?ENVIRONMENT=$i&PACKAGE=$SUBJOBNAME\" target=\"webbuild\">$SUBJOBNAME</a>)"
|
# [ "$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
|
if [ "$ENDTIME" ]; then
|
||||||
echo "<b>End:</b> $ENDTIME"
|
echo "<b>End:</b> $ENDTIME"
|
||||||
elif [ "$AUTODIST_PID" ]; then
|
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
|
fi
|
||||||
echo
|
echo
|
||||||
# grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||"
|
# grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||"
|
||||||
# echo
|
# echo
|
||||||
echo "</pre></div></div>"
|
echo "</pre></div></div>"
|
||||||
fi
|
fi
|
||||||
RNUM=`expr $RNUM + 1`
|
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -357,7 +359,7 @@ done
|
|||||||
if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then
|
if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then
|
||||||
for h in `seq 1 ${#AUTOPORT_CGI_HOST[*]}`; do
|
for h in `seq 1 ${#AUTOPORT_CGI_HOST[*]}`; do
|
||||||
if [ "$NUM" -a "$HOST" = "$h" ]; then
|
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
|
elif [ ! "$NUM" ]; then
|
||||||
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES" 2>/dev/null
|
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES" 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user