autodist cgi: lots of improvements in interface output and other fixes

This commit is contained in:
Silvan Calarco 2012-07-11 22:36:11 +02:00
parent 005fe6a6f5
commit 0be3a1fc97

View File

@ -13,7 +13,7 @@ LINES=`echo "$QUERY_STRING" | sed -n 's/^.*LINES=\([^&]*\).*$/\1/p' | sed "s/%20
echo -e "Content-type: text/html; charset=UTF-8\n\n"
[ ! "$AS_SECONDARY" ] && echo "Show: <a href=\"?NUM=\">ALL</a>&nbsp;"
[ ! "$AS_SECONDARY" ] && echo "Build environments: [<a href=\"?NUM=\">ALL</a>]<br>"
[ "$SHOWINDEX" -o ! "$AS_SECONDARY" ] && \
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
@ -34,13 +34,17 @@ done
if [ "$SHOWINDEX" ]; then
exit 0
else
curl "$AUTOPORT_CGI_SECONDARY?AS_SECONDARY=1&SHOWINDEX=1"
curl "$AUTOPORT_CGI_SECONDARY?AS_SECONDARY=1&SHOWINDEX=1" 2>/dev/null
fi
[ ! "$AS_SECONDARY" ] && echo "<br>"
[ ! "$AS_SECONDARY" ] && echo "<hr>"
[ ! "$SHOWLOG" -a "$SECONDARY" = "$AS_SECONDARY" ] && echo "<h2>Host: `hostname -s` (`uname -m`, kernel `uname -r`)</h2>"
if [ "$SHOWLOG" -a "$SECONDARY" != "$AS_SECONDARY" ]; then
curl "$AUTOPORT_CGI_SECONDARY?AS_SECONDARY=1&SHOWLOG=$SHOWLOG&NUM=$NUM&LOG=$LOG" 2>/dev/null
else
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
@ -64,7 +68,12 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
fi
if [ "$SHOWLOG" ]; then
if [ "$SECONDARY" = "$AS_SECONDARY" -a "$NUM" = "$i" ]; then
echo "<pre><code>"
echo "<h2>$SHOWLOG log in ${AUTOPORT_REPOSITORIES[$i]}(${AUTOPORT_ARCH[$i]}):</h2>"
cat << _EOF
<div class=downloadbox align=center>
<div align=left style="background-color: white; height: 550px; width: 850px; overflow: auto; font-size: 8pt; border:1px solid #2b6600; margin: 4px; padding:4; background-color: #e0f2d0;">
_EOF
echo -n "<pre><code>"
if [ "$SHOWLOG" = "current" ]; then
cat $LOGFILE | sed "s|<|\&lt;|g"
elif [ "$SHOWLOG" = "last" ]; then
@ -77,11 +86,8 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
fi
[ -e $BUILDLOGFILE ] && cat $BUILDLOGFILE | sed "s|<|\&lt;|g"
fi
echo "</code></pre>"
else
curl "$AUTOPORT_CGI_SECONDARY?AS_SECONDARY=1&SHOWLOG=$SHOWLOG&NUM=$i&LOG=$LOG"
echo "</code></pre></div></div>"
fi
exit 0
elif [ ! "$SHOWLOG" ]; then
[[ "$NUM" && "$NUM" != "$i" ]] && continue
[[ "$SECONDARY" = "$AS_SECONDARY" ]] || continue
@ -104,6 +110,10 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
echo "<b>* <a href=\"?NUM=$i&SECONDARY=$AS_SECONDARY\">cross-platform</a> autoport (arch:${AUTOPORT_CROSS[$i]})</b>"
echo " [ <a href=\"?SHOWLOG=current&NUM=$i$SECONDARY_ADD\">last</a> ]</b>"
fi
cat << _EOF
<div class=downloadbox align=center>
<div align=left style="background-color: white; height: 250px; width: 850px; overflow: auto; font-size: 8pt; border:1px solid #2b6600; margin: 4px; padding:4; background-color: #e0f2d0;">
_EOF
echo "<pre>"
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
unset STARTTIME ENDTIME JOBON BUILDNOW BUILDLOG SCHEDULED
@ -156,7 +166,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
*) [ ! "$AUTODISTON" ] && echo $line ;;
esac
done < $LOGFILE
BUILDNOWIDX=0
BUILDNOWIDX=1
while read line; do
line=`echo $line | sed "s|.*\r||"`
set -- $line
@ -183,10 +193,10 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
echo "<b>Start:</b> $STARTTIME"
echo "<b>Scheduled jobs:</b> $SCHEDULED"
for b in `seq 1 ${#BUILDNOW[*]}`; do
set -- ${BUILDNOW[$b-1]}
if [ "${BUILDLOG[$b-1]}" ]; then
echo "<b><a href=\"?SHOWLOG=${BUILDLOG[$b-1]}&NUM=$i$SECONDARY_ADD\">$1</a>:</b> $2 $3 $4 $5 $6 "
else
set -- ${BUILDNOW[$b]}
if [ "${BUILDLOG[$b]}" ]; then
echo "<b><a href=\"?SHOWLOG=${BUILDLOG[$b]}&NUM=$i$SECONDARY_ADD\">$1</a>:</b> $2 $3 $4 $5 $6 "
elif [ "$1" ]; then
echo "<b>$1:</b> $2 $3 $4 $5 $6 "
fi
done
@ -198,13 +208,15 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
echo
# grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||"
# echo
echo "</pre>"
echo "</pre></div></div>"
fi
done
if [ "$AUTOPORT_CGI_SECONDARY" -a ! "$SHOWLOG" ]; then
if [ "$NUM" -a "$SECONDARY" ]; then
curl "$AUTOPORT_CGI_SECONDARY?AS_SECONDARY=1&LINES=$LINES&NUM=$NUM&SECONDARY=$SECONDARY"
curl "$AUTOPORT_CGI_SECONDARY?AS_SECONDARY=1&LINES=$LINES&NUM=$NUM&SECONDARY=$SECONDARY" 2>/dev/null
elif [ ! "$NUM" ]; then
curl "$AUTOPORT_CGI_SECONDARY?AS_SECONDARY=1&LINES=$LINES"
curl "$AUTOPORT_CGI_SECONDARY?AS_SECONDARY=1&LINES=$LINES" 2>/dev/null
fi
fi
fi
[ ! "$AS_SECONDARY" ] && echo "<p><i>Generated by autodist CGI interface. Last update: `date`</i>"