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
If grok-pull is using multiple threads, there can be a race there because parallel runs of public-inbox-init can clobber each other (which needs to be fixed :x) > # Need logic here for adding to the config file Yeah, I've been meaning to add something like "$INBOX_URL/_/text/config" so some of the config keys can be easily cloned, too. Not sure if it's something that can be stuffed in manifest.js.gz or better as a separate file... Probably separate 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 -- unsubscribe: [email protected] archive: https://public-inbox.org/meta/
