From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933892AbdDELbD (ORCPT ); Wed, 5 Apr 2017 07:31:03 -0400 Received: from regular1.263xmail.com ([211.150.99.137]:45427 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933875AbdDELbB (ORCPT ); Wed, 5 Apr 2017 07:31:01 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: <20d13c4ab95c223ffca5f2e33f6a4085> X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Jeffy Chen To: linux-kernel@vger.kernel.org Cc: joe@perches.com, briannorris@chromium.org, dianders@chromium.org, Jeffy Chen Subject: [PATCH] get_maintainer: apply all .get_maintainer.ignore files Date: Wed, 5 Apr 2017 19:30:11 +0800 Message-Id: <1491391811-1027-1-git-send-email-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently we are searching "./:$ENV{HOME}/:.scripts/" for ignore file, but would always get "./.get_maintainer.ignore" only. This patch applies all .get_maintainer.ignore, so it would be easier to add ignore list locally. Signed-off-by: Jeffy Chen --- scripts/get_maintainer.pl | 49 ++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 633f2dd..357e171 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl @@ -193,24 +193,26 @@ if (-f $conf) { } my @ignore_emails = (); -my $ignore_file = which_conf(".get_maintainer.ignore"); -if (-f $ignore_file) { - open(my $ignore, '<', "$ignore_file") - or warn "$P: Can't find a readable .get_maintainer.ignore file $!\n"; - while (<$ignore>) { - my $line = $_; - - $line =~ s/\s*\n?$//; - $line =~ s/^\s*//; - $line =~ s/\s+$//; - $line =~ s/#.*$//; - - next if ($line =~ m/^\s*$/); - if (rfc822_valid($line)) { - push(@ignore_emails, $line); +my @ignore_files = which_confs(".get_maintainer.ignore"); +foreach my $ignore_file (@ignore_files) { + if (-f $ignore_file) { + open(my $ignore, '<', "$ignore_file") + or warn "$P: Can't find a readable .get_maintainer.ignore file $!\n"; + while (<$ignore>) { + my $line = $_; + + $line =~ s/\s*\n?$//; + $line =~ s/^\s*//; + $line =~ s/\s+$//; + $line =~ s/#.*$//; + + next if ($line =~ m/^\s*$/); + if (rfc822_valid($line)) { + push(@ignore_emails, $line); + } } + close($ignore); } - close($ignore); } if (!GetOptions( @@ -1237,15 +1239,26 @@ sub which { return ""; } -sub which_conf { +sub which_confs { my ($conf) = @_; + my @confs = (); foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) { if (-e "$path/$conf") { - return "$path/$conf"; + push(@confs, "$path/$conf"); } } + return @confs; +} + +sub which_conf { + my @confs = which_confs(@_); + + if (@confs) { + return $confs[0]; + } + return ""; } -- 2.1.4