Commit 5f0baf95 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

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.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
Suggested-by: default avatarDon Zickus <dzickus@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 31bb82c9
...@@ -62,7 +62,7 @@ my $self_test = undef; ...@@ -62,7 +62,7 @@ my $self_test = undef;
my $version = 0; my $version = 0;
my $help = 0; my $help = 0;
my $find_maintainer_files = 0; my $find_maintainer_files = 0;
my $maintainer_path;
my $vcs_used = 0; my $vcs_used = 0;
my $exit = 0; my $exit = 0;
...@@ -265,6 +265,7 @@ if (!GetOptions( ...@@ -265,6 +265,7 @@ if (!GetOptions(
'fe|file-emails!' => \$file_emails, 'fe|file-emails!' => \$file_emails,
'f|file' => \$from_filename, 'f|file' => \$from_filename,
'find-maintainer-files' => \$find_maintainer_files, 'find-maintainer-files' => \$find_maintainer_files,
'mpath|maintainer-path=s' => \$maintainer_path,
'self-test:s' => \$self_test, 'self-test:s' => \$self_test,
'v|version' => \$version, 'v|version' => \$version,
'h|help|usage' => \$help, 'h|help|usage' => \$help,
...@@ -386,26 +387,37 @@ sub find_ignore_git { ...@@ -386,26 +387,37 @@ sub find_ignore_git {
read_all_maintainer_files(); read_all_maintainer_files();
sub read_all_maintainer_files { sub read_all_maintainer_files {
if (-d "${lk_path}MAINTAINERS") { my $path = "${lk_path}MAINTAINERS";
opendir(DIR, "${lk_path}MAINTAINERS") or die $!; if (defined $maintainer_path) {
my @files = readdir(DIR); $path = $maintainer_path;
closedir(DIR); # Perl Cookbook tilde expansion if necessary
foreach my $file (@files) { $path =~ s@^~([^/]*)@ $1 ? (getpwnam($1))[7] : ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($<))[7])@ex;
push(@mfiles, "${lk_path}MAINTAINERS/$file") if ($file !~ /^\./); }
}
} if (-d $path) {
$path .= '/' if ($path !~ m@/$@);
if ($find_maintainer_files) { if ($path eq "${lk_path}MAINTAINERS/") {
find( { wanted => \&find_is_maintainer_file, opendir(DIR, "$path") or die $!;
preprocess => \&find_ignore_git, my @files = readdir(DIR);
no_chdir => 1, closedir(DIR);
}, "${lk_path}"); foreach my $file (@files) {
push(@mfiles, "$path$file") if ($file !~ /^\./);
}
}
if ($find_maintainer_files) {
find( { wanted => \&find_is_maintainer_file,
preprocess => \&find_ignore_git,
no_chdir => 1,
}, "$path");
}
} elsif (-f "$path") {
push(@mfiles, "$path");
} else { } else {
push(@mfiles, "${lk_path}MAINTAINERS") if -f "${lk_path}MAINTAINERS"; die "$P: MAINTAINER file not found '$path'\n";
} }
die "$P: No MAINTAINER files found in '$path'\n" if (scalar(@mfiles) == 0);
foreach my $file (@mfiles) { foreach my $file (@mfiles) {
read_maintainer_file("$file"); read_maintainer_file("$file");
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment