autoport, autoport cron: provide a prefix to log lines for parsing by autoport-cgi

This commit is contained in:
Silvan Calarco 2012-05-24 16:35:34 +02:00
parent 2a89f70381
commit d2b7713cff
2 changed files with 35 additions and 35 deletions

View File

@ -348,8 +348,8 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
break
}
echo "=========="
echo "Step $step"
echo "Scheduled jobs: ${JOB[*]}"
echo "# Step $step"
echo "> Scheduled jobs: ${JOB[*]}"
echo
JOB_MISSINGREQ_OLD=(${JOB_MISSINGREQ[*]})
JOB_MISSINGREQ=()
@ -361,26 +361,26 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
JOB_CURRENT=${JOB[$JOB_NUM-1]}
if [ "`grep "^${JOB_CURRENT}$" /etc/autodist/unstage 2>/dev/null`" -o \
"`grep "^${JOB_CURRENT}$" /etc/autodist/unstage.${TARGET_ARCH} 2>/dev/null`" ]; then
echo -n "$JOB_CURRENT: "
echo -n "^ $JOB_CURRENT: "
STAGEOPTS=
else
echo -n "$JOB_CURRENT(staging): "
STAGEOPTS="$AUTOPORT_STAGEVARS"
fi
if [ "$CROSS_MODE" -a "${JOB_CURRENT:0:5}" == "perl-" ]; then
echo " (SKIPPED) [unable to cross-build perl modules]"
echo "< (SKIPPED) [unable to cross-build perl modules]"
JOB_SKIPPED=(${JOB_SKIPPED[*]} $JOB_CURRENT)
continue
fi
[ "`grep ^$JOB_CURRENT\$ $DATAARCHDIR/sentjobs`" -a ! "$FORCE_MODE" ] && {
echo " (SKIPPED) [already sent]"
echo "< (SKIPPED) [already sent]"
JOB_SKIPPED=(${JOB_SKIPPED[*]} $JOB_CURRENT)
continue
}
if [ "${JOB_MAYBEINSTALLED_NEW[*]}" = "" -a \
"${JOB_MISSINGREQ_OLD[*]}" != "" -a \
"`echo "( ${JOB_FAILED_OLD[*]} )"| grep " $JOB_CURRENT "`" ]; then
echo " (FAILED) [nothing new since previous attempt]"
echo "< (FAILED) [nothing new since previous attempt]"
JOB_FAILED=(${JOB_FAILED[*]} $JOB_CURRENT)
continue
fi
@ -442,10 +442,10 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
echo "Failed output:"
echo "=============="
echo "= Failed output:"
echo "================"
cat $tmpfile
echo "=============="
echo "================"
echo
fi
cat $tmpfile >> $logfile
@ -471,10 +471,10 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
echo "Failed output:"
echo "=============="
echo "= Failed output:"
echo "================"
cat $tmpfile
echo "=============="
echo "================"
echo
fi
cat $tmpfile >> $logfile
@ -496,10 +496,10 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
echo "Failed output:"
echo "=============="
echo "= Failed output:"
echo "================"
cat $tmpfile
echo "=============="
echo "================"
echo
fi
cat $tmpfile >> $logfile
@ -542,10 +542,10 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
echo "Failed output:"
echo "=============="
echo "= Failed output:"
echo "================"
cat $tmpfile
echo "=============="
echo "================"
echo
fi
cat $tmpfile >> $logfile
@ -570,18 +570,18 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo
done
fi
echo "Skipped jobs: ${JOB_SKIPPED[*]}"
echo "Unpreparable jobs: ${JOB_CANTPREPARE[*]}"
echo "Missing requirements: ${JOB_MISSINGREQ[*]}"
echo "Completed jobs: ${JOB_COMPLETED[*]}"
echo "Installation error for: ${JOB_CANTINSTALL[*]}"
echo "Failed jobs: ${JOB_FAILED[*]}"
echo "| Skipped jobs: ${JOB_SKIPPED[*]}"
echo "| Unpreparable jobs: ${JOB_CANTPREPARE[*]}"
echo "| Missing requirements: ${JOB_MISSINGREQ[*]}"
echo "| Completed jobs: ${JOB_COMPLETED[*]}"
echo "| Installation error for: ${JOB_CANTINSTALL[*]}"
echo "| Failed jobs: ${JOB_FAILED[*]}"
write_last_file
[ "${JOB[*]}" == "${JOB_FAILED[*]}" -a \
"${JOB_MISSINGREQ[*]}" == "" -a \
"${JOB_CANTINSTALL_OLD[*]}" == "${JOB_CANTINSTALL[*]}" ] && {
echo "Loop detected. Finishing. See $logfile for details."
echo "! Loop detected. Finishing. See $logfile for details."
rm -f $tmpfile $tmpfile1
exit 1
}
@ -590,5 +590,5 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
done
rm -f $tmpfile $tmpfile1
done
echo "All jobs completed. See $logfile for details."
echo "* All jobs completed. See $logfile for details."
exit 0

View File

@ -56,19 +56,19 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
# for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "Autoport start at `date`" > $LOGFILE
echo "========================" >> $LOGFILE
echo "+ Autoport start at `date`" > $LOGFILE
echo "============================================" >> $LOGFILE
# done
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
a=${AUTOPORT_CHROOT[$i]}
# sudo mount -o bind /proc /var/autoport/$a/proc
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a chroot environment"
echo "Updating packages in $a chroot environment..." >> $LOGFILE
echo "= Updating packages in $a chroot environment..." >> $LOGFILE
LANG=C /usr/sbin/chroot /var/autoport/$a smart update --quiet > /dev/null
LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> $LOGFILE
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "Working on $r($a) in chroot mode..." >> $LOGFILE
echo "= Working on $r($a) in chroot mode..." >> $LOGFILE
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" >> $LOGFILE
# disable service restarts
mv /var/autoport/$a/sbin/service /var/autoport/$a/sbin/service.autoport
@ -84,11 +84,11 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
a=${AUTOPORT_ARCH[$i]}
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
echo "Updating packages in $a native environment..." >> $LOGFILE
echo "= Updating packages in $a native environment..." >> $LOGFILE
LANG=C smart update > /dev/null
LANG=C smart upgrade -y >> $LOGFILE
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "Working on $r($a) in native mode" >> $LOGFILE
echo "= Working on $r($a) in native mode" >> $LOGFILE
su -l autodist -c "autoport -b -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/log >> $LOGFILE
echo >> $LOGFILE
@ -99,7 +99,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
a=${AUTOPORT_CROSS[$i]}
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode"
echo "Working on $r($a) in cross-platform mode" >> $LOGFILE
echo "= Working on $r($a) in cross-platform mode" >> $LOGFILE
su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/log >> $LOGFILE
echo >> $LOGFILE
@ -107,8 +107,8 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
done
fi
echo "Autoport end at `date`" >> $LOGFILE
echo "========================" >> $LOGFILE
echo "- Autoport end at `date`" >> $LOGFILE
echo "============================================" >> $LOGFILE
# for r in ${AUTOPORT_REPOSITORIES[$i]}; do
# [ -e /var/autodist/log/autoport-$r.log ] && \