From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5D8EF1F4BD; Mon, 7 Oct 2019 00:07:45 +0000 (UTC) Date: Mon, 7 Oct 2019 00:07:45 +0000 From: Eric Wong To: Konstantin Ryabitsev Cc: meta@public-inbox.org Subject: Re: Git-only operation mode Message-ID: <20191007000745.GA7091@dcvr> References: <20190925182431.GA4628@chatter.i7.local> <20190925194503.GA21501@dcvr> <20190925195838.GB4628@chatter.i7.local> <20190925224500.GA28628@dcvr> <20190926205222.GC10467@chatter.i7.local> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190926205222.GC10467@chatter.i7.local> List-Id: Konstantin Ryabitsev 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/20191006235651.5725-1-e@80x24.org/ > ----- > > 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.