Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1249022

Re: [PATCH] get_maintainer: add support for using an alternate MAINTAINERS file

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] get_maintainer: add support for using an alternate MAINTAINERS file
Date 2015-10-16 19:40 +0200
Message-ID <qkh90-4PP-15@gated-at.bofh.it> (permalink)
References <qk8Iq-QV-9@gated-at.bofh.it> <qk91N-1e0-29@gated-at.bofh.it> <qk9l7-1PY-7@gated-at.bofh.it> <qkg3f-3hI-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] get_maintainer: add support for using an alternate MAINTAINERS file Jani Nikula <jani.nikula@intel.com> - 2015-10-16 10:40 +0200
  Re: [PATCH] get_maintainer: add support for using an alternate  MAINTAINERS file Joe Perches <joe@perches.com> - 2015-10-16 11:00 +0200
    Re: [PATCH] get_maintainer: add support for using an alternate MAINTAINERS file Jani Nikula <jani.nikula@intel.com> - 2015-10-16 11:20 +0200
      Re: [PATCH] get_maintainer: add support for using an alternate  MAINTAINERS file Joe Perches <joe@perches.com> - 2015-10-16 18:30 +0200
        Re: [PATCH] get_maintainer: add support for using an alternate  MAINTAINERS file Joe Perches <joe@perches.com> - 2015-10-16 19:40 +0200
        Re: [PATCH] get_maintainer: add support for using an alternate MAINTAINERS file Jani Nikula <jani.nikula@intel.com> - 2015-10-16 20:40 +0200
          Re: [PATCH] get_maintainer: add support for using an alternate  MAINTAINERS file Joe Perches <joe@perches.com> - 2015-10-16 20:50 +0200
            Re: [PATCH] get_maintainer: add support for using an alternate MAINTAINERS file Jani Nikula <jani.nikula@intel.com> - 2015-10-16 21:00 +0200

csiph-web