aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/get_maintainer.pl
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-11-06 02:00:48 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-11-06 02:00:48 -0500
commit02cee68998010c4a2cc2383c86babc2ecc737183 (patch)
tree13c6483472f672c3b2570b075ed2ad4fd4c5405e /scripts/get_maintainer.pl
parentf5ba35023697e54a24487bcd822194390a333893 (diff)
parentb419148e567728f6af0c3b01965c1cc141e3e13a (diff)
Merge commit 'v2.6.32-rc6' into next
Diffstat (limited to 'scripts/get_maintainer.pl')
-rwxr-xr-xscripts/get_maintainer.pl37
1 files changed, 35 insertions, 2 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index cdb44b63342e..102b76608f35 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -13,7 +13,7 @@
13use strict; 13use strict;
14 14
15my $P = $0; 15my $P = $0;
16my $V = '0.20'; 16my $V = '0.21';
17 17
18use Getopt::Long qw(:config no_auto_abbrev); 18use Getopt::Long qw(:config no_auto_abbrev);
19 19
@@ -37,6 +37,7 @@ my $scm = 0;
37my $web = 0; 37my $web = 0;
38my $subsystem = 0; 38my $subsystem = 0;
39my $status = 0; 39my $status = 0;
40my $keywords = 1;
40my $from_filename = 0; 41my $from_filename = 0;
41my $pattern_depth = 0; 42my $pattern_depth = 0;
42my $version = 0; 43my $version = 0;
@@ -84,6 +85,7 @@ if (!GetOptions(
84 'scm!' => \$scm, 85 'scm!' => \$scm,
85 'web!' => \$web, 86 'web!' => \$web,
86 'pattern-depth=i' => \$pattern_depth, 87 'pattern-depth=i' => \$pattern_depth,
88 'k|keywords!' => \$keywords,
87 'f|file' => \$from_filename, 89 'f|file' => \$from_filename,
88 'v|version' => \$version, 90 'v|version' => \$version,
89 'h|help' => \$help, 91 'h|help' => \$help,
@@ -132,6 +134,8 @@ if (!top_of_kernel_tree($lk_path)) {
132## Read MAINTAINERS for type/value pairs 134## Read MAINTAINERS for type/value pairs
133 135
134my @typevalue = (); 136my @typevalue = ();
137my %keyword_hash;
138
135open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; 139open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n";
136while (<MAINT>) { 140while (<MAINT>) {
137 my $line = $_; 141 my $line = $_;
@@ -149,6 +153,8 @@ while (<MAINT>) {
149 if ((-d $value)) { 153 if ((-d $value)) {
150 $value =~ s@([^/])$@$1/@; 154 $value =~ s@([^/])$@$1/@;
151 } 155 }
156 } elsif ($type eq "K") {
157 $keyword_hash{@typevalue} = $value;
152 } 158 }
153 push(@typevalue, "$type:$value"); 159 push(@typevalue, "$type:$value");
154 } elsif (!/^(\s)*$/) { 160 } elsif (!/^(\s)*$/) {
@@ -188,6 +194,7 @@ if ($email_remove_duplicates) {
188 194
189my @files = (); 195my @files = ();
190my @range = (); 196my @range = ();
197my @keyword_tvi = ();
191 198
192foreach my $file (@ARGV) { 199foreach my $file (@ARGV) {
193 ##if $file is a directory and it lacks a trailing slash, add one 200 ##if $file is a directory and it lacks a trailing slash, add one
@@ -198,11 +205,24 @@ foreach my $file (@ARGV) {
198 } 205 }
199 if ($from_filename) { 206 if ($from_filename) {
200 push(@files, $file); 207 push(@files, $file);
208 if (-f $file && $keywords) {
209 open(FILE, "<$file") or die "$P: Can't open ${file}\n";
210 while (<FILE>) {
211 my $patch_line = $_;
212 foreach my $line (keys %keyword_hash) {
213 if ($patch_line =~ m/^.*$keyword_hash{$line}/x) {
214 push(@keyword_tvi, $line);
215 }
216 }
217 }
218 close(FILE);
219 }
201 } else { 220 } else {
202 my $file_cnt = @files; 221 my $file_cnt = @files;
203 my $lastfile; 222 my $lastfile;
204 open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; 223 open(PATCH, "<$file") or die "$P: Can't open ${file}\n";
205 while (<PATCH>) { 224 while (<PATCH>) {
225 my $patch_line = $_;
206 if (m/^\+\+\+\s+(\S+)/) { 226 if (m/^\+\+\+\s+(\S+)/) {
207 my $filename = $1; 227 my $filename = $1;
208 $filename =~ s@^[^/]*/@@; 228 $filename =~ s@^[^/]*/@@;
@@ -213,6 +233,12 @@ foreach my $file (@ARGV) {
213 if ($email_git_blame) { 233 if ($email_git_blame) {
214 push(@range, "$lastfile:$1:$2"); 234 push(@range, "$lastfile:$1:$2");
215 } 235 }
236 } elsif ($keywords) {
237 foreach my $line (keys %keyword_hash) {
238 if ($patch_line =~ m/^[+-].*$keyword_hash{$line}/x) {
239 push(@keyword_tvi, $line);
240 }
241 }
216 } 242 }
217 } 243 }
218 close(PATCH); 244 close(PATCH);
@@ -286,6 +312,13 @@ foreach my $file (@files) {
286 } 312 }
287} 313}
288 314
315if ($keywords) {
316 @keyword_tvi = sort_and_uniq(@keyword_tvi);
317 foreach my $line (@keyword_tvi) {
318 add_categories($line);
319 }
320}
321
289if ($email) { 322if ($email) {
290 foreach my $chief (@penguin_chief) { 323 foreach my $chief (@penguin_chief) {
291 if ($chief =~ m/^(.*):(.*)/) { 324 if ($chief =~ m/^(.*):(.*)/) {
@@ -384,6 +417,7 @@ Output type options:
384 417
385Other options: 418Other options:
386 --pattern-depth => Number of pattern directory traversals (default: 0 (all)) 419 --pattern-depth => Number of pattern directory traversals (default: 0 (all))
420 --keywords => scan patch for keywords (default: 1 (on))
387 --version => show version 421 --version => show version
388 --help => show this help information 422 --help => show this help information
389 423
@@ -486,7 +520,6 @@ sub format_email {
486} 520}
487 521
488sub find_starting_index { 522sub find_starting_index {
489
490 my ($index) = @_; 523 my ($index) = @_;
491 524
492 while ($index > 0) { 525 while ($index > 0) {