diff --git a/autodist-cgi b/autodist-cgi index cd29766..f6b401a 100755 --- a/autodist-cgi +++ b/autodist-cgi @@ -93,7 +93,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do 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/autoport-$r-current" + AUTODISTSTATEFILE="/var/autoport/${AUTOPORT_CHROOT[$i]}/var/autodist/log/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" @@ -122,24 +122,15 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do echo -n ":" cat << _EOF
"
if [ "$SHOWLOG" = "current" ]; then
RELOADTIME=3600000
cat $LOGFILE | parse_build_output
-# sed "s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g;
-# s|^\([\+#] .*\)|\1|;
-# s|\(.*error[[:space:]]*:.*\)|\1|i;
-# s|^\(== =.*\)|\1|;
-# s|^\([%?=][!=>] .*\)|\1|;"
elif [ "$SHOWLOG" = "last" ]; then
cat $LASTLOGFILE | parse_build_output
-# sed "s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g;
-# s|^\([\+#] .*\)|\1|;
-# s|\(.*error[[:space:]]*:.*\)|\1|i;
-# s|^\(== =.*\)|\1|;
-# s|^\([%?=][!=>] .*\)|\1|;"
else
# Security check
[ "${SHOWLOG/\/\.}" != "${SHOWLOG}" ] && continue
@@ -154,19 +145,14 @@ _EOF
echo "Last ${SHOWLOGPKG} logs: "
for t in prepare update build install send; do
echo -n "$t: "
- [ -e ${BUILDLOGDIR}${t}/ok/${SHOWLOGPKG} ] && echo -n " OK " || echo " "
- [ -e ${BUILDLOGDIR}${t}/failed/${SHOWLOGPKG} ] && echo -n "FAILED " || echo " "
+ [ -e ${BUILDLOGDIR}${t}/ok/${SHOWLOGPKG} ] && echo -n "OK " || echo " "
+ [ -e ${BUILDLOGDIR}${t}/failed/${SHOWLOGPKG} ] && echo -n "FAILED " || echo " "
echo " "
done
echo "
"
fi
[ -e ${BUILDLOGDIR}${SHOWLOG} ] && \
cat ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
-# sed "s|<|\<|g;s|[[:cntrl:]]\[[0-9;]*m||g;
-# s|^\([\+#] .*\)|\1|;
-# s|\(.*error:.*\)|\1|i;
-# s|^\(== =.*\)|\1|;
-# s|^\([%?=][!=>] .*\)|\1|;"
fi
echo -n "
"
echo -n "" + unset BUILDNOWIDX BUILDLOG BUILDNOW BUILDNOWSTATUS SCHEDULED STARTTIME AUTODIST_PID ENDTIME if [ "${AUTOPORT_UPDATE[$i]}" ]; then BUILDNOWIDX=0 STARTTIME=`head $LOGFILE | grep "%% Autodist started" | sed "s|.* @ ||"` @@ -223,83 +210,43 @@ _EOF BUILDNOWSTATUS[$BUILDNOWIDX]= BUILDNOWIDX=`expr $BUILDNOWIDX + 1` done < $STATEFILE - elif [ -e $AUTODISTSTATEFILE ]; then - BUILDNOWIDX=0 + else 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 ||"` - while read line; do - set -- $line - for c in `seq 0 ${#BUILDNOW[*]}`; do - if [ "${BUILDNOW[c]}" = "$1" ]; then - BUILDNOWIDX=$c - break + 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" + if [ "$2" = "port" ]; then + CURRLOGFILE=build/$3/$1.${AUTOPORT_ARCH[$i]} else - BUILDNOWIDX=$c + CURRLOGFILE=$2/$3/$1.${AUTOPORT_ARCH[$i]} fi + BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $CURRLOGFILE" +# BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586" + BUILDNOWSTATUS[$BUILDNOWIDX]= + BUILDNOWIDX=`expr $BUILDNOWIDX + 1` + done < $AUTODISTSTATEFILE + for p in `dirname $LOGFILE`/current.*; do + CURRENT_FILE=`basename $p` + AUTODIST_PID=${p/*.} + [ -e /proc/$AUTODIST_PID ] && break + AUTODIST_PID= done - BUILDNOW[$BUILDNOWIDX]="$1" - 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" -# BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586" - BUILDNOWSTATUS[$BUILDNOWIDX]= - BUILDNOWIDX=`expr $BUILDNOWIDX + 1` - done < $AUTODISTSTATEFILE - else - unset STARTTIME ENDTIME BUILDNOW BUILDLOG AUTODISTON LASTLINE SCHEDULED - while read line; do - line=`echo $line | sed "s|.*\r||"` - set -- $line - case $1 in - "%%" ) AUTODISTON=1 ;; - "^"|"="*|""|"!"|"|"|"#"|"->") ;; #comment - "+") [ "$STARTTIME" ] || STARTTIME=`echo $line | sed "s|.*start at ||"` ;; - "-") ENDTIME=`echo $line | sed "s|.*end at ||"` ;; - [A-Za-z0-9]*) ;; - ">") [ "$SCHEDULED" ] || SCHEDULED=`echo $line | sed "s|.*Scheduled jobs: ||"` ;; - *) [ ! "$AUTODISTON" ] && echo $line ;; - esac - done < $LOGFILE - BUILDNOWIDX=1 - while read line; do - line=`echo $line | sed "s|.*\r||"` - set -- $line - case $1 in - "%%" ) if [ "$2" == "Doing" ]; then - if [ "$3" != "${BUILDNOW[$BUILDNOWIDX-1]}" ]; then - BUILDNOW[$BUILDNOWIDX]="$3" - BUILDLOG[$BUILDNOWIDX]= - BUILDNOWSTATUS[$BUILDNOWIDX]= - BUILDNOWIDX=`expr $BUILDNOWIDX + 1` - fi - JOBON=1 - fi ;; - "?=") if [ "$2" == "See" ]; then - BUILDLOG[$BUILDNOWIDX-1]="${BUILDLOG[$BUILDNOWIDX-1]} `echo $line | sed 's|.*autodist/log/||'`" -# BUILDLOG[$BUILDNOWIDX-1]=`echo $line | sed "s|.*autodist/log/||"` - fi ;; - "=>") JOBON=1 ;; - "%!"|"!!") BUILDNOWSTATUS[$BUILDNOWIDX-1]="$line"; JOBON= ;; - "==") [ "${2:0:2}" == "==" ] && JOBON= ;; - "Hunk"|"") ;; - *) [ "$JOBON" ] || echo $line ;; - esac - done < $AUTODISTLOGFILE - for p in `dirname $LOGFILE`/current.*; do - CURRENT_FILE=`basename $p` - AUTODIST_PID=${p/*.} - [ -e /proc/$AUTODIST_PID ] && break - AUTODIST_PID= - done - LASTLINE=$line + fi fi - echo "Start: $STARTTIME" - echo "Scheduled jobs: $SCHEDULED" + [ "$STARTTIME" ] && echo "Start: $STARTTIME" + [ "$SCHEDULED" ] && echo "Scheduled jobs: $SCHEDULED" LASTJOBNAME= for b in `seq 0 ${#BUILDNOW[*]}`; do # set -- ${BUILDNOW[$b]} @@ -307,7 +254,7 @@ _EOF [ "$JOBNAME" ] || continue if [ "$JOBNAME" != "$LASTJOBNAME" ]; then [ "$LASTJOBNAME" -a "$JOBNAME" ] && echo "" - echo -n "$JOBNAME: " + echo -n "$JOBNAME: " fi rowcnt=0 if [ "${BUILDLOG[$b]}" ]; then @@ -324,16 +271,17 @@ _EOF # echo # rowcnt=0 # fi - if [ "$OPERATIONNAME" = "send" -a "$OPERATIONSTATUS" = "ok" ]; then - echo -n "$OPERATIONNAME:$OPERATIONSTATUS" - elif [ "$OPERATIONNAME" = "install" -a "$OPERATIONSTATUS" = "ok" ]; then - echo -n "$OPERATIONNAME:$OPERATIONSTATUS" - elif [ "$OPERATIONSTATUS" = "ok" ]; then - echo -n "$OPERATIONNAME:$OPERATIONSTATUS" - else - echo -n "$OPERATIONNAME:$OPERATIONSTATUS" - fi - [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "($SUBJOBNAME)" + case $OPERATIONNAME-$OPERATIONSTATUS in + build-ok|send-ok|install-ok|retryinstall-ok) + echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + ;; + *-failed) + echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + ;; + *) echo -n "$OPERATIONNAME:$OPERATIONSTATUS" + ;; + esac +# [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "($SUBJOBNAME)" echo -n " " rowcnt=`expr $rowcnt + 1` done @@ -342,13 +290,11 @@ _EOF LASTJOBNAME=$JOBNAME done [ "$LASTJOBNAME" ] && echo - if [ "$LASTLINE" ]; then - set -- $LASTLINE - [ "$1" = "^" ] && echo "${2} ${3} ${4} ${5} ${6} ${7}" + if [ "$ENDTIME" ]; then + echo "End: $ENDTIME" + elif [ "$AUTODIST_PID" ]; then + echo "End: in progress" fi - [ "$ENDTIME" ] && \ - echo "End: $ENDTIME" || \ - echo "End: in progress" echo # grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||" # echo