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

View File

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