Skip to contentSkip to conversation

get_maintainer improvements

PATCH New Joe Perches 1 participant 3 messages Jul 9, 2009 GET_MAINTAINER script

lore
Share & tools
lore

Joe Perches

author maintainer
#0 lore raw

cover get_maintainer improvements

Arnd Bergmann pointed out that the directory pattern trailing slash requirement is unnecessary and error prone. He also sent a patch to fix it which I've modified a bit.

Andrew Morton wanted the ability to use -f directory. Added it.

Joe Perches (2):
scripts/get_maintainer.pl: Add -f directory use
MAINTAINERS: Remove directory trailing slash pattern requirement

 MAINTAINERS               |    9 ++++-----
 scripts/get_maintainer.pl |   23 +++++++++++++++++++----
 2 files changed, 23 insertions(+), 9 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 scripts/get_maintainer.pl: Add -f directory use

Don't require a specific file in a directory to be tested.

Also Arnd Bergmann pointed out that the MAINTAINERS pattern requirement that directory patterns have a trailing slash was unnecessary and was likely to be error prone. Removed that requirement.

---
 scripts/get_maintainer.pl |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)
scripts/get_maintainer.pl +19 -4
index 3e73314..7fc09fc 100755
@@ -13,7 +13,7 @@
 use strict;
 
 my $P = $0;
-my $V = '0.16';
+my $V = '0.17';
 
 use Getopt::Long qw(:config no_auto_abbrev);
 
@@ -132,6 +132,10 @@ while (<MAINT>) {
 	    $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/@;
+	    }
 	}
 	push(@typevalue, "$type:$value");
     } elsif (!/^(\s)*$/) {
@@ -146,8 +150,10 @@ close(MAINT);
 my @files = ();
 
 foreach my $file (@ARGV) {
-    next if ((-d $file));
-    if (!(-f $file)) {
+    ##if $file is a directory and it lacks a trailing slash, add one
+    if ((-d $file)) {
+	$file =~ s@([^/])$@$1/@;
+    } elsif (!(-f $file)) {
 	die "$P: file '${file}' not found\n";
     }
     if ($from_filename) {
@@ -292,7 +298,7 @@ sub file_match_pattern {
 sub usage {
     print <<EOT;
 usage: $P [options] patchfile
-       $P [options] -f file
+       $P [options] -f file|directory
 version: $V
 
 MAINTAINER field selection options:
@@ -322,6 +328,15 @@ Other options:
   --version => show version
   --help => show this help information
 
+Notes:
+  Using "-f directory" may give unexpected results:
+
+  Used with "--git", git signators for _all_ files in and below
+     directory are examined as git recurses directories.
+     Any specified X: (exclude) pattern matches are _not_ ignored.
+  Used with "--nogit", directory is used as a pattern match,
+     no individual file within the directory or subdirectory
+     is matched.
 EOT
 }
 
Signature · 1 line
1.6.3.1.10.g659a0.dirty
author maintainer
#2 lore raw

PATCH 2/2 MAINTAINERS: Remove directory trailing slash pattern requirement

In reply to Joe Perches
---
 MAINTAINERS |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
MAINTAINERS +4 -5
index e4b1a3d..e4a4de9 100644
@@ -91,17 +91,16 @@ S: Status, one of the following:
 			should be using that.
 
 F: Files and directories with wildcard patterns.
-   A trailing slash includes all files and subdirectory files.
-	F:	drivers/net/	all files in and below drivers/net
+	F:	drivers/net	all files in and below drivers/net
 	F:	drivers/net/*	all files in drivers/net, but not below
 	F:	*/net/*		all files in "any top level directory"/net
    One pattern per line.  Multiple F: lines acceptable.
 X: Files and directories that are NOT maintained, same rules as F:
    Files exclusions are tested before file matches.
    Can be useful for excluding a specific subdirectory, for instance:
-	F:	net/
-	X:	net/ipv6/
-   matches all files in and below net excluding net/ipv6/
+	F:	net
+	X:	net/ipv6
+   matches all files in and below net excluding net/ipv6
 
 3C505 NETWORK DRIVER
 P:	Philip Blundell
Signature · 1 line
1.6.3.1.10.g659a0.dirty