Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTasos Sahanidis <tasos@tasossah.com>2024-02-07 10:16:48 +0200
committerTasos Sahanidis <tasos@tasossah.com>2024-02-07 10:19:06 +0200
commit4231d5d4f5fd903a20021eece669996d814babd5 (patch)
tree5a76449e84486062a791813b36839c90a9094d69
parent2f6f3c20f7ce393512b1607c58935abf52044edf (diff)
bin/watch-build-logs: Add new script to watch build logs
-rwxr-xr-xbin/watch-build-logs26
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/watch-build-logs b/bin/watch-build-logs
new file mode 100755
index 0000000..064dc85
--- /dev/null
+++ b/bin/watch-build-logs
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+trap 'echo ""; kill -- -$$' INT
+
+# shellcheck source=../lib/load-configuration
+. "${0%/*}/../lib/load-configuration"
+
+runtail() {
+ # tail will quit with follow=name when the file is deleted
+ # thus no manual cleanup is needed
+ tail --follow=name "$1" -n +1 2>/dev/null &
+}
+
+# Check if we're already building something, and if so, tail it before we wait for new files
+CURRENTLOG=$(printf '%s\n' "$work_dir/"tmp.build-packages.*/*.build-log | sort | tail -n 1)
+if [[ -f $CURRENTLOG ]]; then
+ runtail "$CURRENTLOG"
+fi
+
+inotifywait -P -r -m "$work_dir" -e create --include '(\.build-log$)|(tmp\.build-packages\.[a-zA-Z0-9]+$)' --format '%w%f' -q |
+ while read -r FILE; do
+ if [[ -z $FILE || -d $FILE ]]; then
+ continue
+ fi
+
+ runtail "$FILE"
+ done