83a113879fe0fb175b9922f7be03144ae3d53561
[buildd-scripts.git] / bin / requeue_by_log
1 #!/bin/bash
2 #
3 # Given a build log filename, look up and requeue the build
4
5 IN=/home/build/in
6
7 for LOGFILE in $@; do
8     case $LOGFILE in
9         *.log)
10             # OK
11         ;;
12         *)
13             echo "ERROR: non-logfile $LOGFILE specified"
14             echo "ABORT"
15             exit 1
16             ;;
17     esac
18     PKG_VER_ARCH=$(basename $LOGFILE .log)
19     BUILDFILE=$(grep -rl $PKG_VER_ARCH $IN | tail -1)
20     if [ "$BUILDFILE"x = ""x ]; then
21         echo "Can't find job for $PKG_VER_ARCH"
22     else
23         case "$BUILDFILE" in
24             *.proc)
25                 rm -v $LOGFILE
26                 BUILDFILE=$(basename $BUILDFILE)
27                 echo "Requeuing $BUILDFILE"
28                 ~build/bin/requeue $BUILDFILE
29                 ;;
30             *)
31                 echo "Ignoring non-proc file $BUILDFILE"
32                 ;;
33         esac
34     fi
35 done