]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
get_maintainer.pl: add support for scanning multiple MAINTAINERS files
authorDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Fri, 1 Aug 2014 00:24:11 +0000 (02:24 +0200)
committerTom Rini <trini@ti.com>
Sat, 9 Aug 2014 15:17:05 +0000 (11:17 -0400)
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
scripts/get_maintainer.pl

index e62c4681546ecfc092a8b130198e0a252373c85d..7717d689bfc5053d8ecd4318deaae7673fc18f46 100755 (executable)
@@ -16,6 +16,7 @@ my $P = $0;
 my $V = '0.26';
 
 use Getopt::Long qw(:config no_auto_abbrev);
+use File::Find;
 
 my $lk_path = "./";
 my $email = 1;
@@ -273,34 +274,53 @@ if (!top_of_kernel_tree($lk_path)) {
 my @typevalue = ();
 my %keyword_hash;
 
-open (my $maint, '<', "${lk_path}MAINTAINERS")
-    or die "$P: Can't open MAINTAINERS: $!\n";
-while (<$maint>) {
-    my $line = $_;
-
-    if ($line =~ m/^(\C):\s*(.*)/) {
-       my $type = $1;
-       my $value = $2;
-
-       ##Filename pattern matching
-       if ($type eq "F" || $type eq "X") {
-           $value =~ s@\.@\\\.@g;       ##Convert . to \.
-           $value =~ s/\*/\.\*/g;       ##Convert * to .*
-           $value =~ s/\?/\./g;         ##Convert ? to .
-           ##if pattern is a directory and it lacks a trailing slash, add one
-           if ((-d $value)) {
-               $value =~ s@([^/])$@$1/@;
+my @maint_files = ();
+push(@maint_files, "${lk_path}MAINTAINERS");
+
+sub maint_wanted {
+    return unless $_ =~ /^MAINTAINERS/;
+    push(@maint_files, "$File::Find::name");
+}
+
+File::Find::find(\&maint_wanted, "${lk_path}board");
+
+foreach my $maint_file (@maint_files) {
+    my $maint;
+    open ($maint, '<', "$maint_file")
+       or die "$P: Can't open $maint_file: $!\n";
+    read_maintainers($maint);
+    close($maint);
+}
+
+sub read_maintainers {
+    my ($maint) = @_;
+
+    while (<$maint>) {
+       my $line = $_;
+
+       if ($line =~ m/^(\C):\s*(.*)/) {
+           my $type = $1;
+           my $value = $2;
+
+           ##Filename pattern matching
+           if ($type eq "F" || $type eq "X") {
+               $value =~ s@\.@\\\.@g;       ##Convert . to \.
+               $value =~ s/\*/\.\*/g;       ##Convert * to .*
+               $value =~ s/\?/\./g;         ##Convert ? to .
+               ##if pattern is a directory and it lacks a trailing slash, add one
+               if ((-d $value)) {
+                   $value =~ s@([^/])$@$1/@;
+               }
+           } elsif ($type eq "K") {
+               $keyword_hash{@typevalue} = $value;
            }
-       } elsif ($type eq "K") {
-           $keyword_hash{@typevalue} = $value;
+           push(@typevalue, "$type:$value");
+       } elsif (!/^(\s)*$/) {
+           $line =~ s/\n$//g;
+           push(@typevalue, $line);
        }
-       push(@typevalue, "$type:$value");
-    } elsif (!/^(\s)*$/) {
-       $line =~ s/\n$//g;
-       push(@typevalue, $line);
     }
 }
-close($maint);
 
 
 #