From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF754C433E0 for ; Thu, 4 Jun 2020 23:50:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 90AD620885 for ; Thu, 4 Jun 2020 23:50:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="F4jZ3Ws8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90AD620885 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 32870280049; Thu, 4 Jun 2020 19:50:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B0EF280005; Thu, 4 Jun 2020 19:50:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1781F280049; Thu, 4 Jun 2020 19:50:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0078.hostedemail.com [216.40.44.78]) by kanga.kvack.org (Postfix) with ESMTP id EE870280005 for ; Thu, 4 Jun 2020 19:50:03 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B7B593754 for ; Thu, 4 Jun 2020 23:50:03 +0000 (UTC) X-FDA: 76893175086.24.stick52_2e1330b26d9b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 9933A1A4A0 for ; Thu, 4 Jun 2020 23:50:03 +0000 (UTC) X-HE-Tag: stick52_2e1330b26d9b X-Filterd-Recvd-Size: 6130 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Jun 2020 23:50:03 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F86D20872; Thu, 4 Jun 2020 23:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591314602; bh=Muva1gFcmgbk41rvMeszkwd9b13Gc6iB0sC6ngXOGpM=; h=Date:From:To:Subject:In-Reply-To:From; b=F4jZ3Ws8F6xv/ANTlpDsciPuhp1H/0YZEnhR+at+JoOqu9lokh8UIH93xhG/vbX3x Zivfkx9nhQ9v9P6xMEv7iAdoZ1tootrq7vzeWbS9I1CqFB0v5ZIuXIxCpNloUnJ7JD YVKnlP/ykP3OmyE481FyuqfMGcJpgWf1+qtgmh1Y= Date: Thu, 04 Jun 2020 16:50:01 -0700 From: Andrew Morton To: akpm@linux-foundation.org, joe@perches.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, sam@ravnborg.org, torvalds@linux-foundation.org Subject: [patch 073/127] get_maintainer: add email addresses from .yaml files Message-ID: <20200604235001.NFkDNIS1i%akpm@linux-foundation.org> In-Reply-To: <20200604164523.e15f3177f4b69dcb4f2534a1@linux-foundation.org> User-Agent: s-nail v14.8.16 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 9933A1A4A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: =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); _