aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2018-08-22 00:56:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-22 13:52:48 -0400
commit5f0baf95b1edfff5eb9b6f571febb859b047de97 (patch)
tree5b45b0792a2a307a1e2688ac0fb03121b0d195cc /scripts
parent31bb82c9caa9bd8fa8865fa28a7a81f67ddc0539 (diff)
get_maintainer.pl: add -mpath=<path or file> for MAINTAINERS file location
Add the ability to have an override for the location of the MAINTAINERS file. Miscellanea: o Properly indent a few lines with leading spaces Link: http://lkml.kernel.org/r/a86e69195076ed3c4c526fddc76b86c28e0a1e37.camel@perches.com Signed-off-by: Joe Perches <joe@perches.com> Suggested-by: Don Zickus <dzickus@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get_maintainer.pl48
1 files changed, 30 insertions, 18 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 82a482f858ee..0ebdefe74d5b 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -62,7 +62,7 @@ my $self_test = undef;
62my $version = 0; 62my $version = 0;
63my $help = 0; 63my $help = 0;
64my $find_maintainer_files = 0; 64my $find_maintainer_files = 0;
65 65my $maintainer_path;
66my $vcs_used = 0; 66my $vcs_used = 0;
67 67
68my $exit = 0; 68my $exit = 0;
@@ -265,6 +265,7 @@ if (!GetOptions(
265 'fe|file-emails!' => \$file_emails, 265 'fe|file-emails!' => \$file_emails,
266 'f|file' => \$from_filename, 266 'f|file' => \$from_filename,
267 'find-maintainer-files' => \$find_maintainer_files, 267 'find-maintainer-files' => \$find_maintainer_files,
268 'mpath|maintainer-path=s' => \$maintainer_path,
268 'self-test:s' => \$self_test, 269 'self-test:s' => \$self_test,
269 'v|version' => \$version, 270 'v|version' => \$version,
270 'h|help|usage' => \$help, 271 'h|help|usage' => \$help,
@@ -386,26 +387,37 @@ sub find_ignore_git {
386read_all_maintainer_files(); 387read_all_maintainer_files();
387 388
388sub read_all_maintainer_files { 389sub read_all_maintainer_files {
389 if (-d "${lk_path}MAINTAINERS") { 390 my $path = "${lk_path}MAINTAINERS";
390 opendir(DIR, "${lk_path}MAINTAINERS") or die $!; 391 if (defined $maintainer_path) {
391 my @files = readdir(DIR); 392 $path = $maintainer_path;
392 closedir(DIR); 393 # Perl Cookbook tilde expansion if necessary
393 foreach my $file (@files) { 394 $path =~ s@^~([^/]*)@ $1 ? (getpwnam($1))[7] : ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($<))[7])@ex;
394 push(@mfiles, "${lk_path}MAINTAINERS/$file") if ($file !~ /^\./); 395 }
395 } 396
396 } 397 if (-d $path) {
397 398 $path .= '/' if ($path !~ m@/$@);
398 if ($find_maintainer_files) { 399 if ($path eq "${lk_path}MAINTAINERS/") {
399 find( { wanted => \&find_is_maintainer_file, 400 opendir(DIR, "$path") or die $!;
400 preprocess => \&find_ignore_git, 401 my @files = readdir(DIR);
401 no_chdir => 1, 402 closedir(DIR);
402 }, "${lk_path}"); 403 foreach my $file (@files) {
404 push(@mfiles, "$path$file") if ($file !~ /^\./);
405 }
406 }
407 if ($find_maintainer_files) {
408 find( { wanted => \&find_is_maintainer_file,
409 preprocess => \&find_ignore_git,
410 no_chdir => 1,
411 }, "$path");
412 }
413 } elsif (-f "$path") {
414 push(@mfiles, "$path");
403 } else { 415 } else {
404 push(@mfiles, "${lk_path}MAINTAINERS") if -f "${lk_path}MAINTAINERS"; 416 die "$P: MAINTAINER file not found '$path'\n";
405 } 417 }
406 418 die "$P: No MAINTAINER files found in '$path'\n" if (scalar(@mfiles) == 0);
407 foreach my $file (@mfiles) { 419 foreach my $file (@mfiles) {
408 read_maintainer_file("$file"); 420 read_maintainer_file("$file");
409 } 421 }
410} 422}
411 423