From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS6315 166.70.0.0/16 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from out03.mta.xmission.com (out03.mta.xmission.com [166.70.13.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 8C2D11F597; Wed, 18 Jul 2018 17:32:42 +0000 (UTC) Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ffqJc-000264-Vs; Wed, 18 Jul 2018 11:32:41 -0600 Received: from [97.119.167.31] (helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ffqJc-00044W-F4; Wed, 18 Jul 2018 11:32:40 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Eric Wong Cc: meta@public-inbox.org References: <87a7qpjve8.fsf@xmission.com> <20180717233058.30820-3-ebiederm@xmission.com> <20180718102233.jt4loti4k3x3wkp7@whir> <87bmb4ilfc.fsf@xmission.com> <20180718163139.sqgr7im572bnlrgg@dcvr> <87pnzkh4fx.fsf_-_@xmission.com> Date: Wed, 18 Jul 2018 12:32:34 -0500 In-Reply-To: <87pnzkh4fx.fsf_-_@xmission.com> (Eric W. Biederman's message of "Wed, 18 Jul 2018 11:52:18 -0500") Message-ID: <87efg0h2kt.fsf_-_@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1ffqJc-00044W-F4;;;mid=<87efg0h2kt.fsf_-_@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.167.31;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/lMu4pXMViB0cF6anBYnOl6VM6N+0bhLg= X-SA-Exim-Connect-IP: 97.119.167.31 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: [PATCH v2 3/4] public-inbox-init: Initialize indexlevel X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) List-Id: If indexlevel is specified on the command line prefer that. If indexlevel is specified in the config file prefer that. If indexlevel is not specified anywhere default to full. This should make indexlevel somewhat approachable. Signed-off-by: "Eric W. Biederman" --- I believe this is the other piece of the user interface needed to make indexlevel accessible. script/public-inbox-init | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/script/public-inbox-init b/script/public-inbox-init index 3ef6c3bdba2d..5e961c803203 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -16,7 +16,10 @@ use Cwd qw/abs_path/; sub x { system(@_) and die join(' ', @_). " failed: $?\n" } sub usage { print STDERR "Usage: $usage\n"; exit 1 } my $version = undef; -my %opts = ( 'V|version=i' => \$version ); +my $indexlevel = undef; +my %opts = ( 'V|version=i' => \$version, + 'L|indexlevel=s' => \$indexlevel, +); GetOptions(%opts) or usage(); my $name = shift @ARGV or usage(); my $mainrepo = shift @ARGV or usage(); @@ -64,8 +67,16 @@ if (-e $pi_config) { } exit(1) if $conflict; + + my $ibx = $cfg->lookup_name($name); + if ($ibx) { + if (!defined($indexlevel) && $ibx->{indexlevel}) { + $indexlevel = $ibx->{indexlevel}; + } + } } close $fh or die "failed to close $pi_config_tmp: $!\n"; +$indexlevel ||= 'full'; my $pfx = "publicinbox.$name"; my @x = (qw/git config/, "--file=$pi_config_tmp"); @@ -114,6 +125,7 @@ foreach my $addr (@address) { } x(@x, "$pfx.url", $http_url); x(@x, "$pfx.mainrepo", $mainrepo); +x(@x, "$pfx.indexlevel", $indexlevel); rename $pi_config_tmp, $pi_config or die "failed to rename `$pi_config_tmp' to `$pi_config': $!\n"; -- 2.17.1