e9b5252314
Christian König (DMA-buf maintainer) tends to reply on dri-devel. Rockchip SoC people land on linux-rockchip. Adding both to the watched-inbox list, generalized the loop so the array is the only thing to edit when adding more. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
89 lines
2.8 KiB
Bash
Executable File
89 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# lore-watch — daily check for replies to mfritsche@reauktion.de threads
|
|
# across multiple lore.kernel.org public-inboxes. Mails any matches via
|
|
# msmtp.
|
|
#
|
|
# Started 2026-04-29 to track the vb2 dma_resv RFC series.
|
|
|
|
set -euo pipefail
|
|
|
|
# List of public-inboxes to watch. Add more by appending here.
|
|
INBOXES=(
|
|
linux-media
|
|
dri-devel
|
|
linux-rockchip
|
|
)
|
|
|
|
STATE=$HOME/.local/state/lore-watch
|
|
mkdir -p "$STATE"
|
|
TMPDIR=$(mktemp -d)
|
|
trap 'rm -rf "$TMPDIR"' EXIT
|
|
|
|
GLOBAL_HITS=0
|
|
|
|
for INBOX in "${INBOXES[@]}"; do
|
|
REPO=$STATE/$INBOX-pi.git
|
|
STATE_FILE=$STATE/last-seen-$INBOX.sha
|
|
|
|
if [ ! -d "$REPO" ]; then
|
|
git clone --bare --depth 200 "https://lore.kernel.org/$INBOX/0" "$REPO" >/dev/null 2>&1 || {
|
|
printf 'lore-watch: clone of %s failed, skipping\n' "$INBOX" >&2
|
|
continue
|
|
}
|
|
fi
|
|
|
|
# Seed state on first sight (no compare possible yet)
|
|
if [ ! -s "$STATE_FILE" ]; then
|
|
git -C "$REPO" fetch --depth 200 origin >/dev/null 2>&1 || true
|
|
git -C "$REPO" rev-parse FETCH_HEAD > "$STATE_FILE" 2>/dev/null || \
|
|
git -C "$REPO" rev-parse HEAD > "$STATE_FILE"
|
|
continue
|
|
fi
|
|
|
|
LAST=$(cat "$STATE_FILE")
|
|
git -C "$REPO" fetch --depth 200 origin master >/dev/null 2>&1 || \
|
|
git -C "$REPO" fetch --depth 200 origin >/dev/null 2>&1 || {
|
|
printf 'lore-watch: fetch of %s failed, skipping\n' "$INBOX" >&2
|
|
continue
|
|
}
|
|
HEAD=$(git -C "$REPO" rev-parse FETCH_HEAD 2>/dev/null || git -C "$REPO" rev-parse HEAD)
|
|
|
|
if [ "$LAST" = "$HEAD" ]; then
|
|
continue
|
|
fi
|
|
|
|
HITS_HERE=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 'list: %s\n' "$INBOX"
|
|
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_HERE=$((HITS_HERE + 1))
|
|
GLOBAL_HITS=$((GLOBAL_HITS + 1))
|
|
fi
|
|
done < <(git -C "$REPO" log --reverse --format=%H "$LAST..$HEAD")
|
|
|
|
echo "$HEAD" > "$STATE_FILE"
|
|
done
|
|
|
|
if [ "$GLOBAL_HITS" -gt 0 ]; then
|
|
{
|
|
printf 'Subject: [lore-watch] %d new lore message(s) referencing your threads\n' "$GLOBAL_HITS"
|
|
printf 'From: lore-watch <mfritsche@reauktion.de>\n'
|
|
printf 'To: mfritsche@reauktion.de\n'
|
|
printf '\n'
|
|
printf 'Daily lore.kernel.org scan (lists: %s) caught %d message(s)\n' \
|
|
"$(IFS=,; printf '%s' "${INBOXES[*]}")" "$GLOBAL_HITS"
|
|
printf 'that reference your address:\n\n'
|
|
cat "$TMPDIR/digest.txt"
|
|
printf '\n-- \n(noether ~/.local/bin/lore-watch.sh, scheduled daily)\n'
|
|
} | /usr/bin/msmtp -t
|
|
fi
|