#!/bin/bash # Helper script to requeue a build that has failed, due to missing # source, missing build-deps etc. IN=/home/build/in LOGS=/home/build/logs SOURCES=/mirror/debian/dists/unstable/main/source/Sources.gz MAX_BUILD_NUM=$(ls -1 $IN | tail -1 | sed 's,\..*$,,') cd $IN for file in $@; do if [ ! -e $file ] && [ -e $file.proc ]; then file=$file.proc fi if [ ! -e $file ]; then echo "Ignoring non-existent $file" continue fi BASE=$(basename $file .proc) PKG_VER_ARCH=$(cat $file) PKG=$(echo $PKG_VER_ARCH | cut -d _ -f1) VER=$(echo $PKG_VER_ARCH | cut -d _ -f2) ARCH=$(echo $PKG_VER_ARCH | cut -d _ -f3) if [ -f ${LOGS}/${ARCH}/PASS/${PKG}_${VER}_${ARCH}.log ]; then echo "Ignoring successfully-built $file: $PKG_VER_ARCH" continue fi if [ -f ${LOGS}/${ARCH}/FAIL/${PKG}_${VER}_${ARCH}.log ]; then echo "Ignoring failed $file: $PKG_VER_ARCH" continue fi # echo "Original build attempt source-failed for $file: $PKG_VER_ARCH" echo " Old version was $VER" echo " Checking what version now exists" NEW_VER=$(zcat $SOURCES | grep-dctrl -S -X ${PKG} -s version | awk '{print $2}' | tail -1) if [ "$NEW_VER"x = ""x ]; then echo " Can't find any version for $PKG now, giving up" else if [ "$NEW_VER"x = "$VER"x ]; then echo " Same version still exists!" if [ -f ${LOGS}/${ARCH}/FAIL_SOURCE/${PKG}_${VER}_${ARCH}.log ]; then echo " Moving old log file to one side" mv ${LOGS}/${ARCH}/FAIL_SOURCE/${PKG}_${VER}_${ARCH}.log ${LOGS}/${ARCH}/FAIL_SOURCE/${PKG}_${VER}_${ARCH}.log.1 fi echo " And requeueing" rm -f $BASE.proc echo "${PKG}_${VER}_${ARCH}" > $BASE.q else echo " Version moved from $VER to $NEW_VER" echo " Deleting old log file" rm -f ${LOGS}/${ARCH}/FAIL_SOURCE/${PKG}_${VER}_${ARCH}.log echo " And queueing new version" MAX_BUILD_NUM=$(($MAX_BUILD_NUM + 1)) echo "${PKG}_${NEW_VER}_${ARCH}" > ${MAX_BUILD_NUM}.q ls -l ${MAX_BUILD_NUM}.q fi fi done