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
-----

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.

-K

Reply via email to