From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: [patch 073/127] get_maintainer: add email addresses from .yaml files Date: Thu, 04 Jun 2020 16:50:01 -0700 Message-ID: <20200604235001.NFkDNIS1i%akpm@linux-foundation.org> References: <20200604164523.e15f3177f4b69dcb4f2534a1@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail.kernel.org ([198.145.29.99]:47458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725930AbgFDXuD (ORCPT ); Thu, 4 Jun 2020 19:50:03 -0400 In-Reply-To: <20200604164523.e15f3177f4b69dcb4f2534a1@linux-foundation.org> Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: akpm@linux-foundation.org, joe@perches.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, sam@ravnborg.org, torvalds@linux-foundation.org =46rom: Joe Perches Subject: get_maintainer: add email addresses from .yaml files .yaml files can contain maintainer/author addresses and it seems unlikely or unnecessary that individual MAINTAINER file section entries for each .yaml file will be created. So add the email addresses found in .yaml files to the default get_maintainer output. The email addresses are marked with "(in file)" when using the "--roles" or "--rolestats" options. Miscellanea: o Change $file_emails to $email_file_emails to avoid visual naming conflicts with @file_emails Link: http://lkml.kernel.org/r/e85006456d9dbae55286c67ac5263668a72f5b58.158= 8022228.git.joe@perches.com Signed-off-by: Joe Perches Acked-by: Sam Ravnborg Tested-by: Sam Ravnborg Signed-off-by: Andrew Morton --- scripts/get_maintainer.pl | 44 +++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) --- a/scripts/get_maintainer.pl~get_maintainer-add-email-addresses-from-yam= l-files +++ a/scripts/get_maintainer.pl @@ -57,7 +57,7 @@ my $status =3D 0; my $letters =3D ""; my $keywords =3D 1; my $sections =3D 0; -my $file_emails =3D 0; +my $email_file_emails =3D 0; my $from_filename =3D 0; my $pattern_depth =3D 0; my $self_test =3D undef; @@ -69,6 +69,12 @@ my $vcs_used =3D 0; =20 my $exit =3D 0; =20 +my @files =3D (); +my @fixes =3D (); # If a patch description includes Fixes: lines +my @range =3D (); +my @keyword_tvi =3D (); +my @file_emails =3D (); + my %commit_author_hash; my %commit_signer_hash; =20 @@ -266,7 +272,7 @@ if (!GetOptions( 'pattern-depth=3Di' =3D> \$pattern_depth, 'k|keywords!' =3D> \$keywords, 'sections!' =3D> \$sections, - 'fe|file-emails!' =3D> \$file_emails, + 'fe|file-emails!' =3D> \$email_file_emails, 'f|file' =3D> \$from_filename, 'find-maintainer-files' =3D> \$find_maintainer_files, 'mpath|maintainer-path=3Ds' =3D> \$maintainer_path, @@ -424,6 +430,22 @@ sub read_all_maintainer_files { } } =20 +sub maintainers_in_file { + my ($file) =3D @_; + + return if ($file =3D~ m@\bMAINTAINERS$@); + + if (-f $file && ($email_file_emails || $file =3D~ /\.yaml$/)) { + open(my $f, '<', $file) + or die "$P: Can't open $file: $!\n"; + my $text =3D do { local($/) ; <$f> }; + close($f); + + my @poss_addr =3D $text =3D~ m$[A-Za-z=C3=80-=C3=BF\"\' \,\.\+-]*\s*[\,]*= \s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{0= ,1}$g; + push(@file_emails, clean_file_emails(@poss_addr)); + } +} + # # Read mail address map # @@ -504,12 +526,6 @@ sub read_mailmap { =20 ## use the filenames on the command line or find the filenames in the patc= hfiles =20 -my @files =3D (); -my @fixes =3D (); # If a patch description includes Fixes: lines -my @range =3D (); -my @keyword_tvi =3D (); -my @file_emails =3D (); - if (!@ARGV) { push(@ARGV, "&STDIN"); } @@ -527,7 +543,7 @@ foreach my $file (@ARGV) { $file =3D~ s/^\Q${cur_path}\E//; #strip any absolute path $file =3D~ s/^\Q${lk_path}\E//; #or the path to the lk tree push(@files, $file); - if ($file ne "MAINTAINERS" && -f $file && ($keywords || $file_emails)) { + if ($file ne "MAINTAINERS" && -f $file && $keywords) { open(my $f, '<', $file) or die "$P: Can't open $file: $!\n"; my $text =3D do { local($/) ; <$f> }; @@ -539,10 +555,6 @@ foreach my $file (@ARGV) { } } } - if ($file_emails) { - my @poss_addr =3D $text =3D~ m$[A-Za-z=C3=80-=C3=BF\"\' \,\.\+-]*\s*[\,]= *\s*[\(\<\{]{0,1}[A-Za-z0-9_\.\+-]+\@[A-Za-z0-9\.-]+\.[A-Za-z0-9]+[\)\>\}]{= 0,1}$g; - push(@file_emails, clean_file_emails(@poss_addr)); - } } } else { my $file_cnt =3D @files; @@ -923,6 +935,8 @@ sub get_maintainers { print("\n"); } } + + maintainers_in_file($file); } =20 if ($keywords) { @@ -1835,7 +1849,7 @@ tm toggle maintainers tg toggle git entries tl toggle open list entries ts toggle subscriber list entries -f emails in file [$file_emails] +f emails in file [$email_file_emails] k keywords in file [$keywords] r remove duplicates [$email_remove_duplicates] p# pattern match depth [$pattern_depth] @@ -1960,7 +1974,7 @@ EOT bool_invert(\$email_git_all_signature_types); $rerun =3D 1; } elsif ($sel eq "f") { - bool_invert(\$file_emails); + bool_invert(\$email_file_emails); $rerun =3D 1; } elsif ($sel eq "r") { bool_invert(\$email_remove_duplicates); _