autodist-cgi: various fixes
This commit is contained in:
parent
95c366a940
commit
a0314b874b
84
autodist-cgi
84
autodist-cgi
@ -10,6 +10,22 @@ SHOWINDEX=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWINDEX=\([^&]*\).*$/\1/p' | se
|
||||
LINES=`echo "$QUERY_STRING" | sed -n 's/^.*LINES=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
||||
FORMAT=`echo "$QUERY_STRING" | sed -n 's/^.*FORMAT=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
|
||||
|
||||
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|"`
|
||||
}
|
||||
|
||||
[ ! "$FORMAT" ] && FORMAT=html
|
||||
|
||||
[ "$LINES" ] || LINES=5
|
||||
@ -84,24 +100,26 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||
[ "${AUTOPORT_ARCH[$i]}" ] || continue
|
||||
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
|
||||
|
||||
LOGDIR=`environment_logdir $i`
|
||||
AUTOPORTLOGDIR=`environment_autoport_logdir $i`
|
||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||
LOGFILE="/var/autodist/log/autodist.log"
|
||||
LASTLOGFILE="/var/autodist/log/autodist-last.log"
|
||||
STATEFILE="/var/autodist/log/autoupdate-current"
|
||||
LASTSTATEFILE="/var/autodist/log/autoupdate-last"
|
||||
LOGFILE="$LOGDIR/autodist.log"
|
||||
LASTLOGFILE="$LOGDIR/autodist-last.log"
|
||||
STATEFILE="$LOGDIR/autoupdate-current"
|
||||
LASTSTATEFILE="$LOGDIR/autoupdate-last"
|
||||
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
|
||||
LASTLOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}-last.log"
|
||||
AUTODISTLOGFILE="/var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
||||
AUTODISTSTATEFILE="/var/autoport/${AUTOPORT_CHROOT[$i]}/var/autodist/log/autoport-$r-current"
|
||||
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
||||
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
|
||||
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
||||
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
||||
AUTODISTLOGFILE="/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
||||
AUTODISTSTATEFILE="/var/autodist/log/autoport-$r-current"
|
||||
LOGFILE="$LOGDIR/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
||||
LASTLOGFILE="$LOGDIR/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
||||
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
||||
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
|
||||
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||
LOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
|
||||
LASTLOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
|
||||
LOGFILE="$LOGDIR/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
|
||||
LASTLOGFILE="$LOGDIR/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
@ -151,8 +169,16 @@ _EOF
|
||||
done
|
||||
echo "</table>"
|
||||
fi
|
||||
[ -e ${BUILDLOGDIR}${SHOWLOG} ] && \
|
||||
cat ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
|
||||
if [ -r ${BUILDLOGDIR}${SHOWLOG} ]; then
|
||||
LOGFILESIZE=`stat -c %s ${BUILDLOGDIR}${SHOWLOG}`
|
||||
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
|
||||
fi
|
||||
echo -n "</pre></code>"
|
||||
echo -n "</div></div>"
|
||||
@ -205,7 +231,7 @@ _EOF
|
||||
fi
|
||||
done
|
||||
BUILDNOW[$BUILDNOWIDX]="$1"
|
||||
BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} `echo $4 | sed "s|.*autodist/log/||"`"
|
||||
[ "$4" ] && BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} `echo $4 | sed "s|.*autodist/log/||"`"
|
||||
# BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586"
|
||||
BUILDNOWSTATUS[$BUILDNOWIDX]=
|
||||
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
|
||||
@ -240,7 +266,7 @@ _EOF
|
||||
for p in `dirname $LOGFILE`/current.*; do
|
||||
CURRENT_FILE=`basename $p`
|
||||
AUTODIST_PID=${p/*.}
|
||||
[ -e /proc/$AUTODIST_PID ] && break
|
||||
grep "autodist" /proc/$AUTODIST_PID/status &>/dev/null && break
|
||||
AUTODIST_PID=
|
||||
done
|
||||
fi
|
||||
@ -253,20 +279,23 @@ _EOF
|
||||
JOBNAME=${BUILDNOW[$b]}
|
||||
[ "$JOBNAME" ] || continue
|
||||
if [ "$JOBNAME" != "$LASTJOBNAME" ]; then
|
||||
[ "$LASTJOBNAME" -a "$JOBNAME" ] && echo ""
|
||||
echo -n "<a target=_webbuild href=\"/distribution/webbuild.php?ENVIRONMENT=$i&PACKAGE=$JOBNAME\"><b>$JOBNAME</b></a>: "
|
||||
[ "$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
|
||||
echo -n "<a target=_webbuild href=\"/distribution/webbuild.php?REQUEST=autobuildedit&ENVIRONMENT=$i&PACKAGE=$JOBNAME&LOGTYPE=$OPERATIONNAME${WEBBUILD_APPEND}\"><b>$JOBNAME</b></a>: "
|
||||
else
|
||||
echo -n "<a target=_webbuild href=\"/distribution/webbuild.php?ENVIRONMENT=$i&PACKAGE=$JOBNAME\"><b>$JOBNAME</b></a>: "
|
||||
fi
|
||||
fi
|
||||
rowcnt=0
|
||||
if [ "${BUILDLOG[$b]}" ]; then
|
||||
for l in ${BUILDLOG[$b]}; do
|
||||
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|"`
|
||||
resolve_logname $l $JOBNAME
|
||||
# if [ $rowcnt -ge 4 ]; then
|
||||
# echo
|
||||
# rowcnt=0
|
||||
@ -286,6 +315,9 @@ _EOF
|
||||
rowcnt=`expr $rowcnt + 1`
|
||||
done
|
||||
fi
|
||||
if [[ $b -eq $BUILDNOWIDX-1 && ! "$ENDTIME" ]]; then
|
||||
echo -n "<font color=green>${BUILDOPERATION[$b]}(in progress...)</font>"
|
||||
fi
|
||||
[ "${BUILDNOWSTATUS[$b]}" ] && echo -n "<i>(${BUILDNOWSTATUS[$b]})</i>"
|
||||
LASTJOBNAME=$JOBNAME
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user