Add a new helper script requeue_by_log
authorSteve McIntyre <steve@einval.com>
Thu, 15 Nov 2018 13:10:58 +0000 (13:10 +0000)
committerSteve McIntyre <steve@einval.com>
Thu, 15 Nov 2018 13:10:58 +0000 (13:10 +0000)
bin/requeue_by_log [new file with mode: 0755]

diff --git a/bin/requeue_by_log b/bin/requeue_by_log
new file mode 100755 (executable)
index 0000000..83a1138
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# Given a build log filename, look up and requeue the build
+
+IN=/home/build/in
+
+for LOGFILE in $@; do
+    case $LOGFILE in
+       *.log)
+           # OK
+       ;;
+       *)
+           echo "ERROR: non-logfile $LOGFILE specified"
+           echo "ABORT"
+           exit 1
+           ;;
+    esac
+    PKG_VER_ARCH=$(basename $LOGFILE .log)
+    BUILDFILE=$(grep -rl $PKG_VER_ARCH $IN | tail -1)
+    if [ "$BUILDFILE"x = ""x ]; then
+       echo "Can't find job for $PKG_VER_ARCH"
+    else
+       case "$BUILDFILE" in
+           *.proc)
+               rm -v $LOGFILE
+               BUILDFILE=$(basename $BUILDFILE)
+               echo "Requeuing $BUILDFILE"
+               ~build/bin/requeue $BUILDFILE
+               ;;
+           *)
+               echo "Ignoring non-proc file $BUILDFILE"
+               ;;
+       esac
+    fi
+done