2012-05-24 16:29:41 +02:00
|
|
|
#!/bin/bash
|
|
|
|
. /etc/sysconfig/autoport
|
2012-10-18 00:52:41 +02:00
|
|
|
. /usr/share/autodist/webbuild-functions
|
2012-05-24 16:29:41 +02:00
|
|
|
|
|
|
|
NUM=`echo "$QUERY_STRING" | sed -n 's/^.*NUM=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
2012-08-01 11:48:43 +02:00
|
|
|
HOST=`echo "$QUERY_STRING" | sed -n 's/^.*HOST=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
|
|
|
AS_HOST=`echo "$QUERY_STRING" | sed -n 's/^.*AS_HOST=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
2012-05-24 16:29:41 +02:00
|
|
|
SHOWLOG=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWLOG=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
2012-06-09 16:35:51 +02:00
|
|
|
SHOWINDEX=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWINDEX=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
2012-05-24 16:29:41 +02:00
|
|
|
LINES=`echo "$QUERY_STRING" | sed -n 's/^.*LINES=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
2012-07-29 10:56:54 +02:00
|
|
|
FORMAT=`echo "$QUERY_STRING" | sed -n 's/^.*FORMAT=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
|
|
|
|
2013-01-19 16:22:21 +01:00
|
|
|
function resolve_logname() {
|
|
|
|
local l=$1
|
|
|
|
local jobname=$2
|
|
|
|
|
|
|
|
unset SUBJOBNAME OPERATIONNAME OPERATIONSTATUS
|
|
|
|
|
|
|
|
SUBJOBNAME=`echo $l | sed "s|.*/${jobname}_\(.*\)\..*|\1|"`
|
|
|
|
[ "${SUBJOBNAME:0:1}" = "_" ] && SUBJOBNAME=$l
|
|
|
|
[ "$SUBJOBNAME" = "$l" ] && SUBJOBNAME=`echo $l | sed "s|.*/\(.*\)\..*|\1|"`
|
|
|
|
SUBJOBNAME=${SUBJOBNAME/__*}
|
|
|
|
[ "${BUILDOPERATION[$b]}" ] && \
|
|
|
|
OPERATIONNAME=${BUILDOPERATION[$b]} || OPERATIONNAME=`echo $l | sed "s|\(.*\)/.*/.*|\1|"`
|
|
|
|
[ "${BUILDOPERATIONSTATUS[$b]}" ] && \
|
|
|
|
OPERATIONSTATUS=${BUILDOPERATIONSTATUS[$b]} || OPERATIONSTATUS=`echo $l | sed "s|.*/\(.*\)/.*|\1|"`
|
|
|
|
}
|
|
|
|
|
2012-07-29 10:56:54 +02:00
|
|
|
[ ! "$FORMAT" ] && FORMAT=html
|
2012-05-24 16:29:41 +02:00
|
|
|
|
|
|
|
[ "$LINES" ] || LINES=5
|
|
|
|
|
2012-08-01 11:48:43 +02:00
|
|
|
[ "$HOST" ] || HOST=0
|
|
|
|
[ "$AS_HOST" ] || AS_HOST=0
|
|
|
|
|
|
|
|
[ "$AS_HOST" -a "$HOST" != "0" ] && HOST_ADD="&HOST=$HOST"
|
|
|
|
|
|
|
|
if [ "$AS_HOST" = "0" -a "$FORMAT" = "xml" ]; then
|
2012-07-29 10:56:54 +02:00
|
|
|
echo -e "Content-type: text/xml\nPragma: no-cache\n"
|
|
|
|
echo -n "<autodist><output><![CDATA["
|
|
|
|
RELOADTIME=3600000
|
|
|
|
else
|
|
|
|
echo -e "Content-type: text/html; charset=UTF-8\n"
|
|
|
|
fi
|
2012-05-24 16:29:41 +02:00
|
|
|
|
2012-06-09 16:35:51 +02:00
|
|
|
if [ "$SHOWINDEX" ]; then
|
2012-08-01 11:48:43 +02:00
|
|
|
echo "Host $AS_HOST:"
|
|
|
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|
|
|
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
|
|
|
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
|
|
|
|
2012-09-04 13:04:11 +02:00
|
|
|
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
|
|
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
|
|
|
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a> "
|
|
|
|
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
|
|
|
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a> "
|
|
|
|
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
|
|
|
echo "<a href=\"?NUM=$i$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> "
|
|
|
|
fi
|
|
|
|
done
|
2012-08-01 11:48:43 +02:00
|
|
|
done
|
|
|
|
echo "<br>"
|
2012-06-09 16:35:51 +02:00
|
|
|
exit 0
|
2012-08-01 11:48:43 +02:00
|
|
|
elif [ "$AS_HOST" = "0" ]; then
|
|
|
|
echo "Show: [<a href=\"?NUM=\">All hosts</a>] [<a href=\"?SHOWLOG=monitor\">Build hosts monitor</a>]<br>"
|
|
|
|
for h in `seq 0 ${#AUTOPORT_CGI_HOST[*]}`; do
|
2014-04-25 12:12:07 +02:00
|
|
|
curl --connect-timeout 20 "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&SHOWINDEX=1" 2>/dev/null
|
2012-08-01 11:48:43 +02:00
|
|
|
done
|
|
|
|
echo "<hr>"
|
2012-06-09 16:35:51 +02:00
|
|
|
fi
|
|
|
|
|
2012-08-01 11:48:43 +02:00
|
|
|
[ ! "$SHOWLOG" -a "$HOST" = "$AS_HOST" ] && echo "<h2>Host: `hostname -s` (`uname -m`, kernel `uname -r`)</h2>"
|
2012-06-09 16:35:51 +02:00
|
|
|
|
2012-08-01 11:48:43 +02:00
|
|
|
if [ "$SHOWLOG" -a "$HOST" != "$AS_HOST" ]; then
|
|
|
|
curl "${AUTOPORT_CGI_HOST[$HOST]}?AS_HOST=$HOST&SHOWLOG=$SHOWLOG&NUM=$NUM&LOG=$LOG" 2>/dev/null
|
2012-07-11 22:36:11 +02:00
|
|
|
else
|
|
|
|
|
2012-05-24 16:29:41 +02:00
|
|
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
2012-09-06 18:54:25 +02:00
|
|
|
if [ "$SHOWLOG" = "monitor" ]; then
|
|
|
|
echo "<h2>Build hosts monitor</h2>"
|
2014-05-22 18:20:42 +02:00
|
|
|
icecream-monitor $ICECREAM_MONITOR_HOST listcs | \
|
2012-09-06 18:54:25 +02:00
|
|
|
while read line; do
|
|
|
|
[ "${line:0:8}" = "200 done" ] && printon=
|
|
|
|
if [ "$printon" ]; then
|
|
|
|
set -- $line
|
|
|
|
case $2 in
|
|
|
|
\(*) echo "<b>$line</b><br>" ;;
|
|
|
|
*) echo "$line<br>" ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
[ "${line:0:6}" = "listcs" ] && printon=1
|
|
|
|
done
|
|
|
|
echo "<br>"
|
|
|
|
RELOADTIME=15000
|
|
|
|
break
|
|
|
|
fi
|
2014-05-24 16:05:40 +02:00
|
|
|
RNUM=0
|
2012-09-04 13:04:11 +02:00
|
|
|
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
2012-05-24 16:29:41 +02:00
|
|
|
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
|
|
|
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
|
|
|
|
2013-01-19 16:22:21 +01:00
|
|
|
LOGDIR=`environment_logdir $i`
|
|
|
|
AUTOPORTLOGDIR=`environment_autoport_logdir $i`
|
2013-11-09 14:19:34 +01:00
|
|
|
ENVROOTDIR=`environment_rootdir $i`
|
|
|
|
|
2012-05-26 13:28:28 +02:00
|
|
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
2013-01-19 16:22:21 +01:00
|
|
|
LOGFILE="$LOGDIR/autodist.log"
|
|
|
|
LASTLOGFILE="$LOGDIR/autodist-last.log"
|
|
|
|
STATEFILE="$LOGDIR/autoupdate-current"
|
|
|
|
LASTSTATEFILE="$LOGDIR/autoupdate-last"
|
2012-05-26 13:28:28 +02:00
|
|
|
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
2012-09-21 12:51:11 +02:00
|
|
|
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
|
|
|
|
LASTLOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}-last.log"
|
2013-01-19 16:22:21 +01:00
|
|
|
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
|
|
|
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
|
2012-05-24 16:29:41 +02:00
|
|
|
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
2014-05-24 16:05:40 +02:00
|
|
|
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
|
|
|
LASTLOGFILE="/var/autodist/log/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
2013-01-19 16:22:21 +01:00
|
|
|
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
|
|
|
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
|
2012-05-24 16:29:41 +02:00
|
|
|
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
2013-01-19 16:22:21 +01:00
|
|
|
LOGFILE="$LOGDIR/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
|
|
|
|
LASTLOGFILE="$LOGDIR/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
|
2012-05-24 16:29:41 +02:00
|
|
|
else
|
|
|
|
continue
|
|
|
|
fi
|
2012-09-06 18:54:25 +02:00
|
|
|
if [ "$SHOWLOG" ]; then
|
2014-05-24 16:05:40 +02:00
|
|
|
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$RNUM" ]; then
|
2013-11-09 14:19:34 +01:00
|
|
|
echo -n "<p><h2>$SHOWLOG log in "
|
2012-09-21 12:51:11 +02:00
|
|
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
|
|
|
echo -n "update"
|
|
|
|
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
|
|
|
echo -n "${AUTOPORT_CHROOT[i]} chroot"
|
|
|
|
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
|
|
|
echo -n "native"
|
|
|
|
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
|
|
|
echo -n "cross"
|
|
|
|
fi
|
|
|
|
echo " environment for ${AUTOPORT_ARCH[$i]}"
|
|
|
|
[ "${SHOWLOG}" = "current" -o "${SHOWLOG}" = "last" -a ! "${AUTOPORT_UPDATE[$i]}" ] && echo -n " ($r)"
|
|
|
|
echo -n ":</h2>"
|
2012-07-11 22:36:11 +02:00
|
|
|
cat << _EOF
|
|
|
|
<div class=downloadbox align=center>
|
2012-11-20 00:04:33 +01:00
|
|
|
<div class=output align=left style="height:550px;width:850px;">
|
|
|
|
<!--overflow:auto;font-size:8pt;border:1px solid #2b6600;margin:4px;padding:2px;color:lightgray;background-color:black;"-->
|
2012-07-11 22:36:11 +02:00
|
|
|
_EOF
|
|
|
|
echo -n "<pre><code>"
|
2012-06-09 16:35:51 +02:00
|
|
|
if [ "$SHOWLOG" = "current" ]; then
|
2012-10-18 00:52:41 +02:00
|
|
|
RELOADTIME=3600000
|
|
|
|
cat $LOGFILE | parse_build_output
|
2012-06-09 16:35:51 +02:00
|
|
|
elif [ "$SHOWLOG" = "last" ]; then
|
2012-10-18 00:52:41 +02:00
|
|
|
cat $LASTLOGFILE | parse_build_output
|
2013-11-09 14:19:34 +01:00
|
|
|
LASTLOGDETAILS=`tail $LASTLOGFILE | grep "See .* for details" | sed "s|.*See \(.*\) for details.*|\1|"`
|
|
|
|
cat $ENVROOTDIR/$LASTLOGDETAILS | parse_build_output
|
2012-06-09 16:35:51 +02:00
|
|
|
else
|
2012-07-29 10:56:54 +02:00
|
|
|
# Security check
|
|
|
|
[ "${SHOWLOG/\/\.}" != "${SHOWLOG}" ] && continue
|
2014-05-24 16:05:40 +02:00
|
|
|
BUILDLOGDIR="$LOGDIR"
|
2012-07-29 10:56:54 +02:00
|
|
|
if [ "${SHOWLOG/\/ok\/}" != "${SHOWLOG}" -o "${SHOWLOG/\failed\/}" != "${SHOWLOG}" ]; then
|
|
|
|
SHOWLOGPKG=${SHOWLOG/*\/}
|
|
|
|
[ "${SHOWLOGPKG}" ] || continue
|
2012-10-18 00:52:41 +02:00
|
|
|
echo "<table style=\"color:black\"><tr><td colspan=3>Last ${SHOWLOGPKG} logs:</td>"
|
2012-07-29 10:56:54 +02:00
|
|
|
for t in prepare update build install send; do
|
|
|
|
echo -n "<tr><td>$t:</td><td>"
|
2012-11-20 00:04:33 +01:00
|
|
|
[ -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>"
|
2012-07-29 10:56:54 +02:00
|
|
|
echo "</tr>"
|
|
|
|
done
|
|
|
|
echo "</table>"
|
|
|
|
fi
|
2013-01-19 16:22:21 +01:00
|
|
|
if [ -r ${BUILDLOGDIR}${SHOWLOG} ]; then
|
|
|
|
LOGFILESIZE=`stat -c %s ${BUILDLOGDIR}${SHOWLOG}`
|
2013-05-04 15:40:10 +02:00
|
|
|
LOGDATE=`stat -c %y ${BUILDLOGDIR}${SHOWLOG}`
|
|
|
|
echo -n "<b>${SHOWLOG} ($LOGDATE; $LOGFILESIZE):</b>"
|
2013-01-19 16:22:21 +01:00
|
|
|
if [ $LOGFILESIZE -lt 131072 ]; then
|
|
|
|
cat ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
|
|
|
|
else
|
|
|
|
head -c 65535 ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
|
|
|
|
echo "<br><font style=\"background-color:yellow;color:black\"><------ CUT (long file) ------></font>"
|
|
|
|
tail -c 65535 ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
|
|
|
|
fi
|
|
|
|
fi
|
2012-06-09 16:35:51 +02:00
|
|
|
fi
|
2012-10-18 00:52:41 +02:00
|
|
|
echo -n "</pre></code>"
|
|
|
|
echo -n "</div></div>"
|
2013-11-09 14:19:34 +01:00
|
|
|
# break
|
2012-05-24 16:29:41 +02:00
|
|
|
fi
|
2012-09-21 12:51:11 +02:00
|
|
|
[ "${AUTOPORT_UPDATE[$i]}" ] && break
|
2012-06-09 16:35:51 +02:00
|
|
|
elif [ ! "$SHOWLOG" ]; then
|
2012-07-29 10:56:54 +02:00
|
|
|
RELOADTIME=60000
|
2012-05-24 16:29:41 +02:00
|
|
|
[[ "$NUM" && "$NUM" != "$i" ]] && continue
|
2012-08-01 11:48:43 +02:00
|
|
|
[[ "$HOST" = "$AS_HOST" ]] || continue
|
2012-05-26 13:28:28 +02:00
|
|
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
2012-11-20 00:04:33 +01:00
|
|
|
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>"
|
2012-05-26 13:28:28 +02:00
|
|
|
fi
|
|
|
|
|
2012-05-24 16:29:41 +02:00
|
|
|
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
2012-11-20 00:04:33 +01:00
|
|
|
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>"
|
2012-05-24 16:29:41 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
2012-11-20 00:04:33 +01:00
|
|
|
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>"
|
2012-05-24 16:29:41 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${AUTOPORT_CROSS[$i]}" ]; then
|
2012-11-20 00:04:33 +01:00
|
|
|
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>"
|
2012-05-24 16:29:41 +02:00
|
|
|
fi
|
2012-07-11 22:36:11 +02:00
|
|
|
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
|
2014-05-24 16:05:40 +02:00
|
|
|
echo -n "<pre style='margin:1px'>"
|
2012-11-20 00:04:33 +01:00
|
|
|
unset BUILDNOWIDX BUILDLOG BUILDNOW BUILDNOWSTATUS SCHEDULED STARTTIME AUTODIST_PID ENDTIME
|
2012-06-09 16:35:51 +02:00
|
|
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
|
|
|
BUILDNOWIDX=0
|
2012-10-18 00:52:41 +02:00
|
|
|
STARTTIME=`head $LOGFILE | grep "%% Autodist started" | sed "s|.* @ ||"`
|
|
|
|
AUTODIST_PID=`head $LOGFILE | grep "%% Autodist started" | sed "s|.*PID \([0-9]*\) .*|\1|"`
|
|
|
|
SCHEDULED=`head $LOGFILE | grep "%% autoupdate jobs:" | sed "s|.*autoupdate jobs: ||"`
|
|
|
|
ENDTIME=`tail $LOGFILE | grep "%% All jobs done @" | sed "s|.*@ ||"`
|
2012-06-09 16:35:51 +02:00
|
|
|
while read line; do
|
|
|
|
set -- $line
|
2012-10-18 00:52:41 +02:00
|
|
|
for c in `seq 0 ${#BUILDNOW[*]}`; do
|
|
|
|
if [ "${BUILDNOW[c]}" = "$1" ]; then
|
|
|
|
BUILDNOWIDX=$c
|
|
|
|
break
|
|
|
|
else
|
|
|
|
BUILDNOWIDX=$c
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
BUILDNOW[$BUILDNOWIDX]="$1"
|
2013-01-19 16:22:21 +01:00
|
|
|
[ "$4" ] && BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} `echo $4 | sed "s|.*autodist/log/||"`"
|
2012-10-18 00:52:41 +02:00
|
|
|
# BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586"
|
2013-06-05 14:03:56 +02:00
|
|
|
BUILDNOWSTATUS[$BUILDNOWIDX]=$3
|
2012-10-18 00:52:41 +02:00
|
|
|
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
|
|
|
|
done < $STATEFILE
|
2012-11-20 00:04:33 +01:00
|
|
|
else
|
2012-10-18 00:52:41 +02:00
|
|
|
STARTTIME=`head $LOGFILE | grep "^+ .*start at " | sed "s|.*start at ||"`
|
|
|
|
# AUTODIST_PID=`head $LOGFILE | grep "%% Autodist started" | sed "s|.*PID \([0-9]*\) .*|\1|"`
|
|
|
|
SCHEDULED=`head -n 40 $LOGFILE | grep -m 1 "^> .*Scheduled jobs: " | sed "s|.*Scheduled jobs: ||"`
|
|
|
|
ENDTIME=`tail $LOGFILE | grep "^- .*end at " | sed "s|.*end at ||"`
|
2012-11-20 00:04:33 +01:00
|
|
|
if [ -e "$AUTODISTSTATEFILE" ]; then
|
|
|
|
while read line; do
|
|
|
|
set -- $line
|
|
|
|
for c in `seq 0 ${#BUILDNOW[*]}`; do
|
|
|
|
if [ "${BUILDNOW[c]}" = "$1" ]; then
|
|
|
|
BUILDNOWIDX=$c
|
|
|
|
break
|
|
|
|
else
|
|
|
|
BUILDNOWIDX=$c
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
BUILDNOW[$BUILDNOWIDX]="$1"
|
2013-05-04 15:40:10 +02:00
|
|
|
if [ "$4" ]; then
|
|
|
|
BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} `echo $4 | sed "s|.*/log/||"`"
|
2012-10-18 00:52:41 +02:00
|
|
|
else
|
2013-05-04 15:40:10 +02:00
|
|
|
if [ "$2" = "port" ]; then
|
|
|
|
CURRLOGFILE=build/$3/$1.${AUTOPORT_ARCH[$i]}
|
|
|
|
else
|
|
|
|
CURRLOGFILE=$2/$3/$1.${AUTOPORT_ARCH[$i]}
|
|
|
|
fi
|
|
|
|
BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $CURRLOGFILE"
|
2012-10-18 00:52:41 +02:00
|
|
|
fi
|
2012-11-20 00:04:33 +01:00
|
|
|
# BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586"
|
2013-06-05 14:03:56 +02:00
|
|
|
BUILDNOWSTATUS[$BUILDNOWIDX]=$3
|
2012-11-20 00:04:33 +01:00
|
|
|
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
|
|
|
|
done < $AUTODISTSTATEFILE
|
|
|
|
for p in `dirname $LOGFILE`/current.*; do
|
|
|
|
CURRENT_FILE=`basename $p`
|
|
|
|
AUTODIST_PID=${p/*.}
|
2013-01-19 16:22:21 +01:00
|
|
|
grep "autodist" /proc/$AUTODIST_PID/status &>/dev/null && break
|
2012-11-20 00:04:33 +01:00
|
|
|
AUTODIST_PID=
|
2012-10-18 00:52:41 +02:00
|
|
|
done
|
2012-11-20 00:04:33 +01:00
|
|
|
fi
|
2012-06-09 16:35:51 +02:00
|
|
|
fi
|
2012-11-20 00:04:33 +01:00
|
|
|
[ "$STARTTIME" ] && echo "<b>Start:</b> $STARTTIME"
|
|
|
|
[ "$SCHEDULED" ] && echo "<b>Scheduled jobs:</b> $SCHEDULED"
|
2012-10-18 00:52:41 +02:00
|
|
|
LASTJOBNAME=
|
2012-08-16 11:38:14 +02:00
|
|
|
for b in `seq 0 ${#BUILDNOW[*]}`; do
|
|
|
|
# set -- ${BUILDNOW[$b]}
|
|
|
|
JOBNAME=${BUILDNOW[$b]}
|
|
|
|
[ "$JOBNAME" ] || continue
|
2012-10-18 00:52:41 +02:00
|
|
|
if [ "$JOBNAME" != "$LASTJOBNAME" ]; then
|
2013-01-19 16:22:21 +01:00
|
|
|
[ "$LASTJOBNAME" -a "$JOBNAME" ] && echo
|
|
|
|
if [ "${BUILDLOG[$b]}" ]; then
|
|
|
|
resolve_logname ${BUILDLOG[$b]/* } $JOBNAME
|
|
|
|
if [ "${OPERATIONSTATUS}" = "ok" ]; then
|
|
|
|
WEBBUILD_APPEND="&LOGSTATUSOK=true"
|
|
|
|
else
|
|
|
|
WEBBUILD_APPEND="&LOGSTATUSOK=false"
|
|
|
|
fi
|
2014-05-24 16:05:40 +02:00
|
|
|
echo -n "<a target=_webbuild href=\"$AUTOPORT_WEBBUILD_HOST?REQUEST=autobuildedit&ENVIRONMENT=$i&PACKAGE=$JOBNAME&LOGTYPE=$OPERATIONNAME${WEBBUILD_APPEND}\"><b>$JOBNAME</b></a>: "
|
2013-01-19 16:22:21 +01:00
|
|
|
else
|
2014-05-24 16:05:40 +02:00
|
|
|
echo -n "<a target=_webbuild href=\"$AUTOPORT_WEBBUILD_HOST?ENVIRONMENT=$i&PACKAGE=$JOBNAME\"><b>$JOBNAME</b></a>: "
|
2013-01-19 16:22:21 +01:00
|
|
|
fi
|
2012-10-18 00:52:41 +02:00
|
|
|
fi
|
2012-08-16 11:38:14 +02:00
|
|
|
rowcnt=0
|
|
|
|
if [ "${BUILDLOG[$b]}" ]; then
|
|
|
|
for l in ${BUILDLOG[$b]}; do
|
2013-01-19 16:22:21 +01:00
|
|
|
resolve_logname $l $JOBNAME
|
2012-10-18 00:52:41 +02:00
|
|
|
# if [ $rowcnt -ge 4 ]; then
|
|
|
|
# echo
|
|
|
|
# rowcnt=0
|
|
|
|
# fi
|
2013-06-05 14:03:56 +02:00
|
|
|
case $OPERATIONNAME-$OPERATIONSTATUS in
|
2012-11-20 00:04:33 +01:00
|
|
|
build-ok|send-ok|install-ok|retryinstall-ok)
|
|
|
|
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\">$OPERATIONNAME:$OPERATIONSTATUS</a>"
|
|
|
|
;;
|
2013-06-05 14:03:56 +02:00
|
|
|
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>"
|
|
|
|
elif [ "${BUILDNOWSTATUS[$b]}" = "3" ]; then
|
|
|
|
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$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>"
|
|
|
|
else
|
|
|
|
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$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>"
|
2012-11-20 00:04:33 +01:00
|
|
|
;;
|
2013-06-05 14:03:56 +02:00
|
|
|
*)
|
|
|
|
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=red>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
|
2012-11-20 00:04:33 +01:00
|
|
|
;;
|
|
|
|
esac
|
2014-05-24 16:05:40 +02:00
|
|
|
# [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "(<a href=\"$AUTOPORT_WEBBUILD_HOST?ENVIRONMENT=$i&PACKAGE=$SUBJOBNAME\" target=\"webbuild\">$SUBJOBNAME</a>)"
|
2012-08-16 11:38:14 +02:00
|
|
|
echo -n " "
|
|
|
|
rowcnt=`expr $rowcnt + 1`
|
|
|
|
done
|
2012-06-09 16:35:51 +02:00
|
|
|
fi
|
2013-01-19 16:22:21 +01:00
|
|
|
if [[ $b -eq $BUILDNOWIDX-1 && ! "$ENDTIME" ]]; then
|
|
|
|
echo -n "<font color=green>${BUILDOPERATION[$b]}(in progress...)</font>"
|
|
|
|
fi
|
2012-10-18 00:52:41 +02:00
|
|
|
LASTJOBNAME=$JOBNAME
|
2012-08-16 11:38:14 +02:00
|
|
|
done
|
2012-10-18 00:52:41 +02:00
|
|
|
[ "$LASTJOBNAME" ] && echo
|
2012-11-20 00:04:33 +01:00
|
|
|
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>"
|
2012-08-16 11:38:14 +02:00
|
|
|
fi
|
2012-10-18 00:52:41 +02:00
|
|
|
echo
|
2012-06-09 16:35:51 +02:00
|
|
|
# grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||"
|
|
|
|
# echo
|
2012-07-11 22:36:11 +02:00
|
|
|
echo "</pre></div></div>"
|
2012-05-24 16:29:41 +02:00
|
|
|
fi
|
2014-05-24 16:05:40 +02:00
|
|
|
RNUM=`expr $RNUM + 1`
|
2012-09-04 13:04:11 +02:00
|
|
|
done
|
2012-05-24 16:29:41 +02:00
|
|
|
done
|
2012-08-01 11:48:43 +02:00
|
|
|
|
|
|
|
# only root host (0) calls other hosts
|
|
|
|
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
|
|
|
|
elif [ ! "$NUM" ]; then
|
|
|
|
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES" 2>/dev/null
|
|
|
|
fi
|
|
|
|
done
|
2012-05-24 16:29:41 +02:00
|
|
|
fi
|
2012-07-11 22:36:11 +02:00
|
|
|
fi
|
2012-08-01 11:48:43 +02:00
|
|
|
if [ "$AS_HOST" = "0" ]; then
|
2014-05-24 16:05:40 +02:00
|
|
|
echo "<p><i>Generated by autodist CGI interface. Last update: `date`</i>"
|
2012-08-01 11:48:43 +02:00
|
|
|
if [ "$FORMAT" = "xml" ]; then
|
|
|
|
echo -n "]]></output>"
|
|
|
|
[ "$RELOADTIME" ] && echo -n "<reloadtime>$RELOADTIME</reloadtime>"
|
|
|
|
echo "</autodist>"
|
|
|
|
fi
|
2012-07-29 10:56:54 +02:00
|
|
|
fi
|