Re: [PATCH] get_maintainer.pl: Add optional .get_maintainer.MAINTAINERS override
From: Joe Perches
Date: Fri Jul 06 2018 - 17:36:35 EST
On Fri, 2018-07-06 at 15:39 -0400, Prarit Bhargava wrote:
>
> On 07/06/2018 02:44 PM, Don Zickus wrote:
> > On Fri, Jul 06, 2018 at 11:31:13AM -0700, Joe Perches wrote:
> > > On Fri, 2018-07-06 at 13:54 -0400, Don Zickus wrote:
> > > > On Tue, Jun 26, 2018 at 01:16:11PM -0700, Joe Perches wrote:
> > > > > On Tue, 2018-06-26 at 14:25 -0400, Prarit Bhargava wrote:
> > > > > > OSes have additional maintainers that should be cc'd on patches or may
> > > > > > want to circulate internal patches.
> > > > > >
> > > > > > Parse the .get_maintainer.MAINTAINERS file. Entries in the file
> > > > > > can begin with a '+' to indicate the email and list entries should be
> > > > > > added to the exiting MAINTAINERS output, or a '-' to indicate that the
> > > > > > entries should override the existing MAINTAINERS file.
> > > > > >
> > > > > > Also add a help entry for the .get_maintainers.ignore file.
> > > > >
> > > > > I see no reason for this patch to be applied.
> > > > > Why should it?
> > > > > Why shouldn't this be in your private repository?
> > > >
> > > > Hi Joe,
> > > >
> > > > Would you be open to a '--mfile=<path>/MAINTAINERS' option that would
> > > > override the default ./MAINTAINERS file? Then we could just add that to our
> > > > .get_maintainers.conf file.
> > >
> > > Hi Don.
> > >
> > > Sure.
> > >
> > > And that kinda already exists in mainline with
> > > --find-maintainer-files where any subdirectory
> > > that contains a MAINTAINER file is also read.
> >
> > Hi Joe,
> >
> > Yes, I saw and played with it. My only quirk with it was that option still
> > found and added ./MAINTAINERS to the list which I/we were trying to avoid
> > (we have our own private MAINTAINERS copy).
> >
> > But yes, it easily found our private MAINTAINERS file.
> >
> > >
> > > > Just trying to find ways to minimize our collection of private patches.
> > >
> > > Perhaps that could be extended for your purpose
> > > with some additional argument like a specific
> > > optional directory/path where every subdirectory
> > > would be found.
> >
> > So something like --find-maintainer-files=<dir> ? I think that could work.
>
> So --find-maintainers-files=./kernel/pci
>
> would only look for MAINTAINERS files under kernel/pci?
Well, perhaps yes. Perhaps it would also read
a top level MAINTAINERS file. Dunno. What seems
right to you?
I don't have an objection to
--find-maintainer-files=<path_or_file> where
the existing behavior of --find-maintainer-files
without <path_or_file> is all subdirs.
Perhaps something like the below
(some of this is whitespace change only)
---
scripts/get_maintainer.pl | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index c87fa734e3e1..2eb11b5c8f34 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -60,7 +60,7 @@ my $pattern_depth = 0;
my $self_test = undef;
my $version = 0;
my $help = 0;
-my $find_maintainer_files = 0;
+my $find_maintainer_files;
my $vcs_used = 0;
@@ -262,7 +262,7 @@ if (!GetOptions(
'sections!' => \$sections,
'fe|file-emails!' => \$file_emails,
'f|file' => \$from_filename,
- 'find-maintainer-files' => \$find_maintainer_files,
+ 'find-maintainer-files:s' => \$find_maintainer_files,
'self-test:s' => \$self_test,
'v|version' => \$version,
'h|help|usage' => \$help,
@@ -384,26 +384,30 @@ sub find_ignore_git {
read_all_maintainer_files();
sub read_all_maintainer_files {
- if (-d "${lk_path}MAINTAINERS") {
- opendir(DIR, "${lk_path}MAINTAINERS") or die $!;
- my @files = readdir(DIR);
- closedir(DIR);
- foreach my $file (@files) {
- push(@mfiles, "${lk_path}MAINTAINERS/$file") if ($file !~ /^\./);
- }
- }
-
- if ($find_maintainer_files) {
- find( { wanted => \&find_is_maintainer_file,
- preprocess => \&find_ignore_git,
- no_chdir => 1,
- }, "${lk_path}");
+ my $path = defined $find_maintainer_files && $find_maintainer_files ne ""
+ ? $find_maintainer_files : $lk_path;
+ if (-d "${path}MAINTAINERS") {
+ opendir(DIR, "${path}MAINTAINERS") or die $!;
+ my @files = readdir(DIR);
+ closedir(DIR);
+ foreach my $file (@files) {
+ push(@mfiles, "${path}MAINTAINERS/$file") if ($file !~ /^\./);
+ }
+ }
+
+ if (defined $find_maintainer_files) {
+ die "$P: invalid find-maintainer-files <$path>" if (!-d $path);
+ find( { wanted => \&find_is_maintainer_file,
+ preprocess => \&find_ignore_git,
+ no_chdir => 1,
+ }, "${path}");
} else {
- push(@mfiles, "${lk_path}MAINTAINERS") if -f "${lk_path}MAINTAINERS";
+ push(@mfiles, "${path}MAINTAINERS") if -f "${path}MAINTAINERS";
}
+ die "$P: No MAINTAINER files found in $path\n" if (scalar(@mfiles) == 0);
foreach my $file (@mfiles) {
- read_maintainer_file("$file");
+ read_maintainer_file("$file");
}
}