Ignore emacs backup files
[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     if [ -f "$LOGFILE" ]; then
19         PKG_VER_ARCH=$(basename $LOGFILE .log)
20         BUILDFILE=$(grep -rl $PKG_VER_ARCH $IN | tail -1)
21         if [ "$BUILDFILE"x = ""x ]; then
22             echo "Can't find job for $PKG_VER_ARCH"
23         else
24             case "$BUILDFILE" in
25                 *.proc)
26                     rm -v $LOGFILE
27                     BUILDFILE=$(basename $BUILDFILE)
28                     echo "Requeuing $BUILDFILE"
29                     ~build/bin/requeue $BUILDFILE
30                     ;;
31                 *)
32                     echo "Ignoring non-proc file $BUILDFILE"
33                     ;;
34             esac
35         fi
36     else
37         echo "Can't find logfile $LOGFILE, ignoring"
38     fi
39 done