Konstantin Ryabitsev <[email protected]> wrote: > On Wed, Sep 25, 2019 at 10:45:00PM +0000, Eric Wong wrote: > > > A follow-up to that -- is running "public-inbox-index" on the > > > repository > > > after it's been updated enough to update the xapian db? It would be easy > > > to > > > do so as part of the grok-pull post-update hook. > > > > Yes, on a fresh clone. You'll need to change indexlevel to > > medium or full if it was setup using basic. > > > > I haven't figured out how to use a grok-pull post-update hook to > > run index on my clone of erol, since there's multiple epochs > > per-inbox to deal with. > > Theoretically, shouldn't be that difficult. The post-update hook fires on > clone/update with the full path to the repo that got updated, e.g. > > post-update-hook.sh /var/lib/public-inbox/lkml/git/7.git > > Here's a quick and dirty start to the post-update-hook that I came up with: > > ----- > #!/bin/bash > > topdir=$(echo $1 | sed 's|/git/[[:digit:]]*\.git$||g') > pidir=$(basename $topdir) > url="http://localhost:8080/${pidir}" > > cd $topdir/.. > > if [[ ! -f $pidir/msgmap.sqlite3 ]]; then > listid=$(git --git-dir=$1 show master:m | grep -i '^List-Id:' | sed > 's|.*:.*<\(.*\)>$|\1|g') > email=$(echo $listid | sed 's|\.|@|') > public-inbox-init -V2 $pidir $pidir/ $url $email > # Need logic here for adding to the config file > fi > > public-inbox-index $pidir
Running public-inbox-index blindly there can be dangerous/surprising when multiple epochs are initially cloned in non-sequential order. The example I sent out won't index unless there's messages in msgmap: https://public-inbox.org/meta/[email protected]/ > ----- > > It needs some kind of a template entry for adding to the config file > post-init, but this should at least do the right thing for running > public-inbox-index on repo updates. I tried to use the $INBOX_URL/_/text/config/raw endpoint, which fell down when I tried to clone erol.kernel.org :x (but works on lore) I don't have List-Id: as a fallback, yet... Not sure if it's really worth the effort, but it just creates a bogus $inbox_name@$$.$(hostname).example.com address if curl fails on the config URL. -- unsubscribe: [email protected] archive: https://public-inbox.org/meta/
