diff mbox

[V4,1/2] get_maintainer: allow keywords to match filenames

Message ID 1360629574-23989-1-git-send-email-swarren@wwwdotorg.org (mailing list archive)
State New, archived
Headers show

Commit Message

Stephen Warren Feb. 12, 2013, 12:39 a.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Allow K: entries in MAINTAINERS to match directly against filenames;
either those extracted from patch +++ or --- lines, or those specified
on the command-line using the -f option.

This potentially allows fewer lines in a MAINTAINERS entry, if all the
relevant files are scattered throughout the whole kernel tree, yet
contain some common keyword. An example would be using an ARM SoC name
as the keyword to catch all related drivers.

I don't think setting exact_pattern_match_hash would be appropriate here;
at least for intended Tegra use case, this feature is to ensure that all
Tegra-related driver changes get Cc'd to the Tegra mailing list. Setting
exact_pattern_match_hash would prevent git history parsing for e.g. S-o-b
tags, which still seems like it would be useful. Hence, this flag isn't
set.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
V4:
* Updated documentation at the start of MAINTAINERS to mention filename
  matching.
* s/"/'/ in if check for type 'K'.

Note: I left in my comments in the patch description about not setting
exact_pattern_match_hash as rational for future git archaeologists.
---
 MAINTAINERS               |    8 ++++----
 scripts/get_maintainer.pl |    4 ++++
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Joe Perches Feb. 12, 2013, 6:17 a.m. UTC | #1
On Mon, 2013-02-11 at 17:39 -0700, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> Allow K: entries in MAINTAINERS to match directly against filenames;
> either those extracted from patch +++ or --- lines, or those specified
> on the command-line using the -f option.
[]
> diff --git a/MAINTAINERS b/MAINTAINERS
[]
> @@ -97,12 +97,12 @@ Descriptions of section entries:
>  	   X:	net/ipv6/
>  	   matches all files in and below net excluding net/ipv6/
>  	K: Keyword perl extended regex pattern to match content in a
> -	   patch or file.  For instance:
> +	   patch, or an affected filename.  For instance:

The removal of file isn't correct.

This should read "patch, file or filename".

If the -f pattern is a single file,
get_maintainer reads that file content and then
matches any K: patterns.

When the -f pattern is a directory, it doesn't.

>  	   K: of_get_profile
> -	      matches patches or files that contain "of_get_profile"
> +	      matches patches or filenames that contain "of_get_profile"

here too.

>  	   K: \b(printk|pr_(info|err))\b
> -	      matches patches or files that contain one or more of the words
> -	      printk, pr_info or pr_err
> +	      matches patches or filenames that contain one or more of
> +	      the words printk, pr_info or pr_err

three.

cheers, Joe
Stephen Warren Feb. 12, 2013, 6:17 p.m. UTC | #2
On 02/11/2013 11:17 PM, Joe Perches wrote:
> On Mon, 2013-02-11 at 17:39 -0700, Stephen Warren wrote:
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> Allow K: entries in MAINTAINERS to match directly against filenames;
>> either those extracted from patch +++ or --- lines, or those specified
>> on the command-line using the -f option.
> []
>> diff --git a/MAINTAINERS b/MAINTAINERS
> []
>> @@ -97,12 +97,12 @@ Descriptions of section entries:
>>  	   X:	net/ipv6/
>>  	   matches all files in and below net excluding net/ipv6/
>>  	K: Keyword perl extended regex pattern to match content in a
>> -	   patch or file.  For instance:
>> +	   patch, or an affected filename.  For instance:
> 
> The removal of file isn't correct.
> 
> This should read "patch, file or filename".
> 
> If the -f pattern is a single file,
> get_maintainer reads that file content and then
> matches any K: patterns.
> 
> When the -f pattern is a directory, it doesn't.

Yes, I guess that's true; I had convinced myself that "file" wasn't
accurate since "-f directory/" didn't scan the files within that
directory tree, but as you say "-f file" does scan the file content.

BTW, given I'm adding "filename" to the list, I intend to change the
existing "file" to "file content" to be clear. Are you OK with that?
Joe Perches Feb. 12, 2013, 6:22 p.m. UTC | #3
On Tue, 2013-02-12 at 11:17 -0700, Stephen Warren wrote:
> On 02/11/2013 11:17 PM, Joe Perches wrote:
> > If the -f pattern is a single file,
> > get_maintainer reads that file content and then
> > matches any K: patterns.
> > 
> > When the -f pattern is a directory, it doesn't.
> 
> Yes, I guess that's true; I had convinced myself that "file" wasn't
> accurate since "-f directory/" didn't scan the files within that
> directory tree, but as you say "-f file" does scan the file content.
> 
> BTW, given I'm adding "filename" to the list, I intend to change the
> existing "file" to "file content" to be clear. Are you OK with that?

Sure.
diff mbox

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 1d0651e..fbba896 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -97,12 +97,12 @@  Descriptions of section entries:
 	   X:	net/ipv6/
 	   matches all files in and below net excluding net/ipv6/
 	K: Keyword perl extended regex pattern to match content in a
-	   patch or file.  For instance:
+	   patch, or an affected filename.  For instance:
 	   K: of_get_profile
-	      matches patches or files that contain "of_get_profile"
+	      matches patches or filenames that contain "of_get_profile"
 	   K: \b(printk|pr_(info|err))\b
-	      matches patches or files that contain one or more of the words
-	      printk, pr_info or pr_err
+	      matches patches or filenames that contain one or more of
+	      the words printk, pr_info or pr_err
 	   One regex pattern per line.  Multiple K: lines acceptable.
 
 Note: For the hard of thinking, this list is meant to remain in alphabetical
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 18d4ab5..ce4cc83 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -611,6 +611,10 @@  sub get_maintainers {
 				    $hash{$tvi} = $value_pd;
 				}
 			    }
+			} elsif ($type eq 'K') {
+			    if ($file =~ m/$value/x) {
+				$hash{$tvi} = 0;
+			    }
 			}
 		    }
 		}