Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Joe Perches and committed by
Linus Torvalds
5f0baf95 31bb82c9

+28 -16
+28 -16
scripts/get_maintainer.pl
··· 62 62 my $version = 0; 63 63 my $help = 0; 64 64 my $find_maintainer_files = 0; 65 - 65 + my $maintainer_path; 66 66 my $vcs_used = 0; 67 67 68 68 my $exit = 0; ··· 265 265 'fe|file-emails!' => \$file_emails, 266 266 'f|file' => \$from_filename, 267 267 'find-maintainer-files' => \$find_maintainer_files, 268 + 'mpath|maintainer-path=s' => \$maintainer_path, 268 269 'self-test:s' => \$self_test, 269 270 'v|version' => \$version, 270 271 'h|help|usage' => \$help, ··· 387 386 read_all_maintainer_files(); 388 387 389 388 sub read_all_maintainer_files { 390 - if (-d "${lk_path}MAINTAINERS") { 391 - opendir(DIR, "${lk_path}MAINTAINERS") or die $!; 392 - my @files = readdir(DIR); 393 - closedir(DIR); 394 - foreach my $file (@files) { 395 - push(@mfiles, "${lk_path}MAINTAINERS/$file") if ($file !~ /^\./); 396 - } 389 + my $path = "${lk_path}MAINTAINERS"; 390 + if (defined $maintainer_path) { 391 + $path = $maintainer_path; 392 + # Perl Cookbook tilde expansion if necessary 393 + $path =~ s@^~([^/]*)@ $1 ? (getpwnam($1))[7] : ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($<))[7])@ex; 397 394 } 398 395 399 - if ($find_maintainer_files) { 400 - find( { wanted => \&find_is_maintainer_file, 401 - preprocess => \&find_ignore_git, 402 - no_chdir => 1, 403 - }, "${lk_path}"); 396 + if (-d $path) { 397 + $path .= '/' if ($path !~ m@/$@); 398 + if ($path eq "${lk_path}MAINTAINERS/") { 399 + opendir(DIR, "$path") or die $!; 400 + my @files = readdir(DIR); 401 + closedir(DIR); 402 + foreach my $file (@files) { 403 + push(@mfiles, "$path$file") if ($file !~ /^\./); 404 + } 405 + } 406 + if ($find_maintainer_files) { 407 + find( { wanted => \&find_is_maintainer_file, 408 + preprocess => \&find_ignore_git, 409 + no_chdir => 1, 410 + }, "$path"); 411 + } 412 + } elsif (-f "$path") { 413 + push(@mfiles, "$path"); 404 414 } else { 405 - push(@mfiles, "${lk_path}MAINTAINERS") if -f "${lk_path}MAINTAINERS"; 415 + die "$P: MAINTAINER file not found '$path'\n"; 406 416 } 407 - 417 + die "$P: No MAINTAINER files found in '$path'\n" if (scalar(@mfiles) == 0); 408 418 foreach my $file (@mfiles) { 409 - read_maintainer_file("$file"); 419 + read_maintainer_file("$file"); 410 420 } 411 421 } 412 422