public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] get_maintainer: add support for using an alternate MAINTAINERS file
Date: Fri, 16 Oct 2015 10:37:48 -0700	[thread overview]
Message-ID: <1445017068.22921.38.camel@perches.com> (raw)
In-Reply-To: <1445012634.22921.34.camel@perches.com>

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 <joe@perches.com> 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

 


  reply	other threads:[~2015-10-16 17:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16  8:36 [PATCH] get_maintainer: add support for using an alternate MAINTAINERS file Jani Nikula
2015-10-16  8:50 ` Joe Perches
2015-10-16  9:14   ` Jani Nikula
2015-10-16 16:23     ` Joe Perches
2015-10-16 17:37       ` Joe Perches [this message]
2015-10-16 18:35       ` Jani Nikula
2015-10-16 18:41         ` Joe Perches
2015-10-16 18:56           ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445017068.22921.38.camel@perches.com \
    --to=joe@perches.com \
    --cc=jani.nikula@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox