From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932767AbbJPRhy (ORCPT ); Fri, 16 Oct 2015 13:37:54 -0400 Received: from smtprelay0229.hostedemail.com ([216.40.44.229]:34023 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932727AbbJPRhv (ORCPT ); Fri, 16 Oct 2015 13:37:51 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::,RULES_HIT:41:69:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1543:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2553:2559:2562:2828:2911:3138:3139:3140:3141:3142:3355:3622:3653:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:4425:4605:5007:6261:6299:7903:9592:10004:10400:10848:11026:11232:11658:11914:12043:12291:12296:12438:12517:12519:12555:12679:12683:12740:21080:21221,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: nerve55_a0f00a8cb917 X-Filterd-Recvd-Size: 4025 Message-ID: <1445017068.22921.38.camel@perches.com> Subject: Re: [PATCH] get_maintainer: add support for using an alternate MAINTAINERS file From: Joe Perches To: Jani Nikula Cc: linux-kernel@vger.kernel.org Date: Fri, 16 Oct 2015 10:37:48 -0700 In-Reply-To: <1445012634.22921.34.camel@perches.com> References: <1444984605-7445-1-git-send-email-jani.nikula@intel.com> <1444985457.22921.12.camel@perches.com> <878u73npjg.fsf@intel.com> <1445012634.22921.34.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2015-10-16 at 09:23 -0700, Joe Perches wrote: > On Fri, 2015-10-16 at 12:14 +0300, Jani Nikula wrote: > > On Fri, 16 Oct 2015, Joe Perches wrote: > > > On Fri, 2015-10-16 at 11:36 +0300, Jani Nikula wrote: > > >> There are large and/or complex subsystems/drivers that have domain > > >> experts that should review patches in their domain. One such example is > > >> drm/i915. We'd like to be able to document this in a way that can be > > >> automatically queried for each patch, so people know who to ping for > > >> reviews. This is what get_maintainer.pl already solves. Maybe this: It reads optional REVIEWER files in the same style as MAINTAINERS. Most of the change is just making a block of code into a subroutine. --- scripts/get_maintainer.pl | 60 +++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 98bae86..79ba49a 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -300,35 +300,45 @@ if (!top_of_kernel_tree($lk_path)) { my @typevalue = (); my %keyword_hash; -open (my $maint, '<', "${lk_path}MAINTAINERS") - or die "$P: Can't open MAINTAINERS: $!\n"; -while (<$maint>) { - my $line = $_; - - if ($line =~ m/^([A-Z]):\s*(.*)/) { - my $type = $1; - my $value = $2; - - ##Filename pattern matching - if ($type eq "F" || $type eq "X") { - $value =~ s@\.@\\\.@g; ##Convert . to \. - $value =~ s/\*/\.\*/g; ##Convert * to .* - $value =~ s/\?/\./g; ##Convert ? to . - ##if pattern is a directory and it lacks a trailing slash, add one - if ((-d $value)) { - $value =~ s@([^/])$@$1/@; +read_maintainer_file("${lk_path}MAINTAINERS"); + +## Read optional REVIEWERS file(s) too +my @reviewer_files = glob("${lk_path}REVIEWERS*"); +foreach my $reviewer_file (@reviewer_files) { + read_maintainer_file($reviewer_file); +} + +sub read_maintainer_file { + my ($file) = @_; + open (my $maint, '<', "$file") + or die "$P: Can't open $file: $!\n"; + while (<$maint>) { + my $line = $_; + + if ($line =~ m/^([A-Z]):\s*(.*)/) { + my $type = $1; + my $value = $2; + + ##Filename pattern matching + if ($type eq "F" || $type eq "X") { + $value =~ s@\.@\\\.@g; ##Convert . to \. + $value =~ s/\*/\.\*/g; ##Convert * to .* + $value =~ s/\?/\./g; ##Convert ? to . + ##if pattern is a directory and it lacks a trailing slash, add one + if ((-d $value)) { + $value =~ s@([^/])$@$1/@; + } + } elsif ($type eq "K") { + $keyword_hash{@typevalue} = $value; } - } elsif ($type eq "K") { - $keyword_hash{@typevalue} = $value; + push(@typevalue, "$type:$value"); + } elsif (!/^(\s)*$/) { + $line =~ s/\n$//g; + push(@typevalue, $line); } - push(@typevalue, "$type:$value"); - } elsif (!/^(\s)*$/) { - $line =~ s/\n$//g; - push(@typevalue, $line); } + close($maint); } -close($maint); - # # Read mail address map