Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1089292imm; Fri, 3 Aug 2018 18:13:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe0DmOoYqda0rXRI8bUtTAIjGNS9u2ihTqbsvfg6867sl3dShhBDzWUN5lEZQKJ6P5gDIL4 X-Received: by 2002:a17:902:5617:: with SMTP id h23-v6mr5485599pli.324.1533345188828; Fri, 03 Aug 2018 18:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533345188; cv=none; d=google.com; s=arc-20160816; b=BAc2dwR3Zw7+zsm01AghByASetoYKQCX74k4Nj/nBrqaMW0rIElvmUuQVjzhURqljq 8pd7/Pd/t/8PsnsUE9Ps4PZ5ayUzgrXqFx/wX3fKIl5Vj9GYPccwIgZn0xDnSvlx55bl pCi94ljr3yTNooD0DeXc8WjyAhabJnWAzDw0uaAzTbLOAo14959G3CvUNARFqHSgDWj1 AYVHojJjv45fxAjLGeLDkJ7gZJz7jHS6fTELts6xTlosfaq/Q0ymJpfPo+R+rNSmGcJE MOhMjMm3+6ExnD6o5wDmS+kWK1xfkQ9Yz4aMcT8XdjXkGaIfkmy7U0Q1WRLl8zlKYI08 757A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=SyU9lLJLOttJfffhvslQUtTinAr69bSFq6Ck+AfByCg=; b=jBY4M9Z/zjeJ9IqwJqjR1payhvwm6qfcyGXw6EgFhBFL4+leifIBjHMQkOW7fYa7Vi sr3HrSPpB4pvdkctA4VqGpooGPOJjwnZCtFAIbW72Y3ZorlAwQBDbs36mXIv+0RVQjfY n2RRdrUZEudpo+6jEfZXsk5BBPdlb/Q9rJ3XOXg1ldU8dnTzWo/AouZxpE6k/hCPoG7+ rW4nr83QhA+6e8f06i+5NtbLeL1/DjMJRoE5TSyKT7v7i3SNN+RSxG8bKmKIizamD8/P 8X/ww7JYgtvQHLd9jCWwG0Oc9wHptPxkIAR7rwp4JMU1A1KUYG9oarxQj7ldsUysUgM5 dcgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23-v6si6248821pgj.543.2018.08.03.18.12.51; Fri, 03 Aug 2018 18:13:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732079AbeHDDKh (ORCPT + 99 others); Fri, 3 Aug 2018 23:10:37 -0400 Received: from smtprelay0120.hostedemail.com ([216.40.44.120]:36475 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731925AbeHDDKh (ORCPT ); Fri, 3 Aug 2018 23:10:37 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay04.hostedemail.com (Postfix) with ESMTP id 3FD75180A843A; Sat, 4 Aug 2018 01:11:55 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 30,2,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:69:355:379:541:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3653:3865:3866:3867:3870:4250:4605:5007:6299:7903:8957:9040:9592:10004:10400:10848:11026:11658:11914:12043:12291:12438:12555:12679:12683:12760:13255:13439:14110:14181:14394:14659:14721:21080:21221:21324:21433:21451:21505:21627:30025:30054,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:31,LUA_SUMMARY:none X-HE-Tag: scarf78_10a13f7acc11d X-Filterd-Recvd-Size: 3800 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf04.hostedemail.com (Postfix) with ESMTPA; Sat, 4 Aug 2018 01:11:54 +0000 (UTC) Message-ID: Subject: [PATCH] get_maintainer.pl: Add -mpath= for MAINTAINERS file location From: Joe Perches To: Andrew Morton , Don Zickus , LKML Cc: Prarit Bhargava , jtoppins@redhat.com Date: Fri, 03 Aug 2018 18:11:53 -0700 In-Reply-To: <20180706175419.6irtvs64e6dbz7hk@redhat.com> References: <20180626182505.4176-1-prarit@redhat.com> <601f0e6bf3baa88b9f6145e635d728a435542292.camel@perches.com> <20180706175419.6irtvs64e6dbz7hk@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the ability to have an override for the location of the MAINTAINERS file. Miscellanea: o Properly indent a few lines with leading spaces Suggested-by: Don Zickus Signed-off-by: Joe Perches --- scripts/get_maintainer.pl | 48 +++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 82a482f858ee..0ebdefe74d5b 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -62,7 +62,7 @@ my $self_test = undef; my $version = 0; my $help = 0; my $find_maintainer_files = 0; - +my $maintainer_path; my $vcs_used = 0; my $exit = 0; @@ -265,6 +265,7 @@ if (!GetOptions( 'fe|file-emails!' => \$file_emails, 'f|file' => \$from_filename, 'find-maintainer-files' => \$find_maintainer_files, + 'mpath|maintainer-path=s' => \$maintainer_path, 'self-test:s' => \$self_test, 'v|version' => \$version, 'h|help|usage' => \$help, @@ -386,26 +387,37 @@ 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 = "${lk_path}MAINTAINERS"; + if (defined $maintainer_path) { + $path = $maintainer_path; + # Perl Cookbook tilde expansion if necessary + $path =~ s@^~([^/]*)@ $1 ? (getpwnam($1))[7] : ( $ENV{HOME} || $ENV{LOGDIR} || (getpwuid($<))[7])@ex; + } + + if (-d $path) { + $path .= '/' if ($path !~ m@/$@); + if ($path eq "${lk_path}MAINTAINERS/") { + opendir(DIR, "$path") or die $!; + my @files = readdir(DIR); + closedir(DIR); + 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 { - 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) { - read_maintainer_file("$file"); + read_maintainer_file("$file"); } }