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"`
|
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"`
|
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
|
[ ! "$FORMAT" ] && FORMAT=html
|
||||||
|
|
||||||
[ "$LINES" ] || LINES=5
|
[ "$LINES" ] || LINES=5
|
||||||
@ -84,24 +100,26 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; 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
|
||||||
|
|
||||||
|
LOGDIR=`environment_logdir $i`
|
||||||
|
AUTOPORTLOGDIR=`environment_autoport_logdir $i`
|
||||||
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||||
LOGFILE="/var/autodist/log/autodist.log"
|
LOGFILE="$LOGDIR/autodist.log"
|
||||||
LASTLOGFILE="/var/autodist/log/autodist-last.log"
|
LASTLOGFILE="$LOGDIR/autodist-last.log"
|
||||||
STATEFILE="/var/autodist/log/autoupdate-current"
|
STATEFILE="$LOGDIR/autoupdate-current"
|
||||||
LASTSTATEFILE="/var/autodist/log/autoupdate-last"
|
LASTSTATEFILE="$LOGDIR/autoupdate-last"
|
||||||
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
|
||||||
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
|
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
|
||||||
LASTLOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}-last.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"
|
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
||||||
AUTODISTSTATEFILE="/var/autoport/${AUTOPORT_CHROOT[$i]}/var/autodist/log/autoport-$r-current"
|
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
|
||||||
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
|
||||||
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
LOGFILE="$LOGDIR/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
|
||||||
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
LASTLOGFILE="$LOGDIR/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
|
||||||
AUTODISTLOGFILE="/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
|
||||||
AUTODISTSTATEFILE="/var/autodist/log/autoport-$r-current"
|
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
|
||||||
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
|
||||||
LOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
|
LOGFILE="$LOGDIR/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
|
||||||
LASTLOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
|
LASTLOGFILE="$LOGDIR/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
|
||||||
else
|
else
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -151,8 +169,16 @@ _EOF
|
|||||||
done
|
done
|
||||||
echo "</table>"
|
echo "</table>"
|
||||||
fi
|
fi
|
||||||
[ -e ${BUILDLOGDIR}${SHOWLOG} ] && \
|
if [ -r ${BUILDLOGDIR}${SHOWLOG} ]; then
|
||||||
cat ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
|
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
|
fi
|
||||||
echo -n "</pre></code>"
|
echo -n "</pre></code>"
|
||||||
echo -n "</div></div>"
|
echo -n "</div></div>"
|
||||||
@ -205,7 +231,7 @@ _EOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
BUILDNOW[$BUILDNOWIDX]="$1"
|
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"
|
# BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586"
|
||||||
BUILDNOWSTATUS[$BUILDNOWIDX]=
|
BUILDNOWSTATUS[$BUILDNOWIDX]=
|
||||||
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
|
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
|
||||||
@ -240,7 +266,7 @@ _EOF
|
|||||||
for p in `dirname $LOGFILE`/current.*; do
|
for p in `dirname $LOGFILE`/current.*; do
|
||||||
CURRENT_FILE=`basename $p`
|
CURRENT_FILE=`basename $p`
|
||||||
AUTODIST_PID=${p/*.}
|
AUTODIST_PID=${p/*.}
|
||||||
[ -e /proc/$AUTODIST_PID ] && break
|
grep "autodist" /proc/$AUTODIST_PID/status &>/dev/null && break
|
||||||
AUTODIST_PID=
|
AUTODIST_PID=
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@ -253,20 +279,23 @@ _EOF
|
|||||||
JOBNAME=${BUILDNOW[$b]}
|
JOBNAME=${BUILDNOW[$b]}
|
||||||
[ "$JOBNAME" ] || continue
|
[ "$JOBNAME" ] || continue
|
||||||
if [ "$JOBNAME" != "$LASTJOBNAME" ]; then
|
if [ "$JOBNAME" != "$LASTJOBNAME" ]; then
|
||||||
[ "$LASTJOBNAME" -a "$JOBNAME" ] && echo ""
|
[ "$LASTJOBNAME" -a "$JOBNAME" ] && echo
|
||||||
echo -n "<a target=_webbuild href=\"/distribution/webbuild.php?ENVIRONMENT=$i&PACKAGE=$JOBNAME\"><b>$JOBNAME</b></a>: "
|
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
|
fi
|
||||||
rowcnt=0
|
rowcnt=0
|
||||||
if [ "${BUILDLOG[$b]}" ]; then
|
if [ "${BUILDLOG[$b]}" ]; then
|
||||||
for l in ${BUILDLOG[$b]}; do
|
for l in ${BUILDLOG[$b]}; do
|
||||||
SUBJOBNAME=`echo $l | sed "s|.*/${JOBNAME}_\(.*\)\..*|\1|"`
|
resolve_logname $l $JOBNAME
|
||||||
[ "${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|"`
|
|
||||||
# if [ $rowcnt -ge 4 ]; then
|
# if [ $rowcnt -ge 4 ]; then
|
||||||
# echo
|
# echo
|
||||||
# rowcnt=0
|
# rowcnt=0
|
||||||
@ -286,6 +315,9 @@ _EOF
|
|||||||
rowcnt=`expr $rowcnt + 1`
|
rowcnt=`expr $rowcnt + 1`
|
||||||
done
|
done
|
||||||
fi
|
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>"
|
[ "${BUILDNOWSTATUS[$b]}" ] && echo -n "<i>(${BUILDNOWSTATUS[$b]})</i>"
|
||||||
LASTJOBNAME=$JOBNAME
|
LASTJOBNAME=$JOBNAME
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user