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: AS6315 166.70.0.0/16 X-Spam-Status: No, score=-3.5 required=3.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) (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 44BB51F4BD; Wed, 9 Oct 2019 08:24:16 +0000 (UTC) Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1iI7GZ-0003PX-IT; Wed, 09 Oct 2019 02:24:15 -0600 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1iI7GY-0006U1-W6; Wed, 09 Oct 2019 02:24:15 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Eric Wong Cc: meta@public-inbox.org References: <87imp05hlm.fsf@alyssa.is> <20191008001050.rwd7bh7cek7qrydi@dcvr> <87wodfctwd.fsf@x220.int.ebiederm.org> <20191008221108.3wsso25kviiwd7ek@dcvr> <87wodec1um.fsf@x220.int.ebiederm.org> <20191008224104.GA24142@dcvr> <87h84ibb9m.fsf@x220.int.ebiederm.org> <87wode9vxw.fsf_-_@x220.int.ebiederm.org> Date: Wed, 09 Oct 2019 03:23:30 -0500 In-Reply-To: <87wode9vxw.fsf_-_@x220.int.ebiederm.org> (Eric W. Biederman's message of "Wed, 09 Oct 2019 03:15:07 -0500") Message-ID: <87bluq9vjx.fsf_-_@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1iI7GY-0006U1-W6;;;mid=<87bluq9vjx.fsf_-_@x220.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+rGWYgbCYkZeo71yU7PHYlKFDCFJ4tTSo= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: [PATCH 3/4] Config.pm: Add support for looking up repos by their directories 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: Date: Sun, 29 Jul 2018 15:52:57 -0500 Signed-off-by: "Eric W. Biederman" --- Hmm. I thought I was using this but now that I am quickly checking I don't see this being used anywhere. I think PublicInbox::Admin::resolve_inboxes has superceded this functionality. Please feel free to drop this one. I am just sending it at this point because it would be strange to get to 3/4 and not send the patch. lib/PublicInbox/Config.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm index 9ec00b0ddb6d..7c5221c395be 100644 --- a/lib/PublicInbox/Config.pm +++ b/lib/PublicInbox/Config.pm @@ -156,6 +156,23 @@ sub lookup_newsgroup { undef; } +sub lookup_repodir { + my ($self, $repodir) = @_; + my $rv = $self->{-by_repodir}->{$repodir}; + return $rv if $rv; + + foreach my $k (keys %$self) { + $k =~ /\A(publicinbox\.[\w-]+)\.mainrepo\z/ or next; + my $v = $self->{$k}; + my $pfx = $1; + if ($v eq $repodir) { + $rv = _fill($self, $pfx); + return $rv; + } + } + undef; +} + sub limiter { my ($self, $name) = @_; $self->{-limiters}->{$name} ||= do { -- 2.23.0