unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* filtering stable patches in lore queries
@ 2024-04-27  0:28 Jason A. Donenfeld
  2024-04-27  7:19 ` Eric Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Jason A. Donenfeld @ 2024-04-27  0:28 UTC (permalink / raw)
  To: tools, stable, meta; +Cc: sashal, gregkh, mricon, krzk

Hi,

Greg and Sasha add the "X-stable: review" to their patch bombs, with the
intention that people will be able to filter these out should they
desire to do so. For example, I usually want all threads that match code
I care about, but I don't regularly want to see thousand-patch stable
series. So this header is helpful.

However, I'm not able to formulate a query for lore (to pass to `lei q`)
that will match on negating it. The idea would be to exclude the thread
if the parent has this header. It looks like public inbox might only
index on some headers, but can't generically search all? I'm not sure
how it works, but queries only seem to half way work when searching for
that header.

In the meantime, I've been using this ugly bash script, which gets the
job done, but means I have to download everything locally first:

    #!/bin/bash
    PWD="${BASH_SOURCE[0]}"
    PWD="${PWD%/*}"
    set -e
    cd "$PWD"
    echo "[+] Syncing new mail" >&2
    lei up "$PWD"
    echo "[+] Cleaning up stable patch bombs" >&2
    mapfile -d $'\0' -t parents < <(grep -F -x -Z -r -l 'X-stable: review' cur tmp new)
    {
      [[ -f stable-message-ids ]] && cat stable-message-ids
      [[ ${#parents[@]} -gt 0 ]] && sed -n 's/^Message-ID: <\(.*\)>$/\1/p' "${parents[@]}"
    } | sort -u > stable-message-ids.new
    mv stable-message-ids.new stable-message-ids
    [[ -s stable-message-ids ]] || exit 0
    mapfile -d $'\0' -t children < <(grep -F -Z -r -l -f - cur tmp new < stable-message-ids)
    total=$(( ${#parents[@]} + ${#children[@]} ))
    [[ $total -gt 0 ]] || exit 0
    echo "# rm <...$total messages...>" >&2
    rm -f "${parents[@]}" "${children[@]}"

This results in something like:

    zx2c4@thinkpad ~/Projects/lkml $ ./update.bash
    [+] Syncing new mail
    # https://lore.kernel.org/all/ limiting ...
    # /usr/bin/curl -gSf -s -d '' https://lore.kernel.org/all/?x=m&t=1&q=(...
    [+] Cleaning up stable patch bombs
    # rm <...24593 messages...>

It works, but it'd be nice to not even download these messages in the
first place. Since I'm deleting message I don't want, I have to keep
track of the message IDs of those deleted messages with the stable
header in case replies come in later. That's some book keeping, sheesh!

Any thoughts on this workflow?

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-08 17:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-27  0:28 filtering stable patches in lore queries Jason A. Donenfeld
2024-04-27  7:19 ` Eric Wong
2024-04-29 14:27   ` Konstantin Ryabitsev
2024-05-08 11:33     ` Eric Wong
2024-05-08 17:01       ` Konstantin Ryabitsev
2024-05-08 17:09         ` Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).