tools/lore-watch.sh: daily monitor for replies on linux-media public-inbox

Polls https://lore.kernel.org/linux-media/0 over the public-inbox
git protocol (bypasses Anubis JS-PoW that the lore web UI now
ships), walks new commits since last seen, mails any messages
whose headers reference mfritsche@reauktion.de via msmtp.

Cron entry on noether (manual install): 43 8 * * *

Started 2026-04-29 to track the vb2 dma_resv RFC series. Other
upstream threads (KWin MR, QtBase, ffmpeg-v4l2-request) live on
non-lore venues and are tracked separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-29 20:00:39 +00:00
parent 6c50354afb
commit 8ffe95470c
+72
View File
@@ -0,0 +1,72 @@
#!/bin/bash
# lore-watch — daily check for replies to mfritsche@reauktion.de threads on
# linux-media public-inbox. Mails any matches to mfritsche@reauktion.de.
#
# Started 2026-04-29 to track the vb2 dma_resv RFC series.
set -euo pipefail
REPO=$HOME/.local/state/lore-watch/linux-media-pi.git
STATE=$HOME/.local/state/lore-watch
mkdir -p "$STATE"
if [ ! -d "$REPO" ]; then
git clone --bare --depth 200 https://lore.kernel.org/linux-media/0 "$REPO" >/dev/null 2>&1
fi
# If state is missing, seed it with current HEAD and exit (nothing to compare).
if [ ! -s "$STATE/last-seen.sha" ]; then
git -C "$REPO" fetch --depth 200 origin >/dev/null 2>&1 || true
git -C "$REPO" rev-parse FETCH_HEAD > "$STATE/last-seen.sha" 2>/dev/null || \
git -C "$REPO" rev-parse HEAD > "$STATE/last-seen.sha"
exit 0
fi
LAST=$(cat "$STATE/last-seen.sha")
git -C "$REPO" fetch --depth 200 origin master >/dev/null 2>&1 || \
git -C "$REPO" fetch --depth 200 origin >/dev/null 2>&1
HEAD=$(git -C "$REPO" rev-parse FETCH_HEAD 2>/dev/null || git -C "$REPO" rev-parse HEAD)
if [ "$LAST" = "$HEAD" ]; then
exit 0 # no new messages
fi
# Walk new commits, only flag messages where the user's email appears in
# headers (To/Cc/From). This catches replies (which keep the original
# To/Cc per kernel convention) without matching unrelated videobuf2 threads.
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
RANGE="$LAST..$HEAD"
HITS=0
while read -r SHA; do
MSG=$(git -C "$REPO" show "$SHA:m" 2>/dev/null) || continue
HDR=$(printf '%s\n' "$MSG" | sed '/^$/q')
if printf '%s' "$HDR" | grep -qi "mfritsche@reauktion\.de"; then
{
printf 'commit: %s\n' "$SHA"
printf '%s\n' "$HDR" | grep -iE '^(From|Subject|Date|Message-Id|In-Reply-To):' | head -10
printf '\n--- snippet ---\n'
printf '%s\n' "$MSG" | sed -n '/^$/,${p;}' | head -40
printf '\n=========================================================\n\n'
} >> "$TMPDIR/digest.txt"
HITS=$((HITS + 1))
fi
done < <(git -C "$REPO" log --reverse --format=%H "$RANGE")
# Update state regardless of hits, so next run only sees newer messages
echo "$HEAD" > "$STATE/last-seen.sha"
if [ "$HITS" -gt 0 ]; then
{
printf 'Subject: [lore-watch] %d new linux-media message(s) referencing your threads\n' "$HITS"
printf 'From: lore-watch <mfritsche@reauktion.de>\n'
printf 'To: mfritsche@reauktion.de\n'
printf '\n'
printf 'Daily lore.kernel.org/linux-media scan caught %d message(s) that\n' "$HITS"
printf 'reference your address or vb2 dma_resv subject keywords:\n\n'
cat "$TMPDIR/digest.txt"
printf '\n-- \n(noether ~/.local/bin/lore-watch.sh, scheduled daily)\n'
} | /usr/bin/msmtp -t
fi