get_maintainer.pl: add support for scanning multiple MAINTAINERS files
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
This commit is contained in:
parent
ee360cd26a
commit
68dc8769e3
|
@ -16,6 +16,7 @@ my $P = $0;
|
||||||
my $V = '0.26';
|
my $V = '0.26';
|
||||||
|
|
||||||
use Getopt::Long qw(:config no_auto_abbrev);
|
use Getopt::Long qw(:config no_auto_abbrev);
|
||||||
|
use File::Find;
|
||||||
|
|
||||||
my $lk_path = "./";
|
my $lk_path = "./";
|
||||||
my $email = 1;
|
my $email = 1;
|
||||||
|
@ -273,34 +274,53 @@ if (!top_of_kernel_tree($lk_path)) {
|
||||||
my @typevalue = ();
|
my @typevalue = ();
|
||||||
my %keyword_hash;
|
my %keyword_hash;
|
||||||
|
|
||||||
open (my $maint, '<', "${lk_path}MAINTAINERS")
|
my @maint_files = ();
|
||||||
or die "$P: Can't open MAINTAINERS: $!\n";
|
push(@maint_files, "${lk_path}MAINTAINERS");
|
||||||
while (<$maint>) {
|
|
||||||
my $line = $_;
|
|
||||||
|
|
||||||
if ($line =~ m/^(\C):\s*(.*)/) {
|
sub maint_wanted {
|
||||||
my $type = $1;
|
return unless $_ =~ /^MAINTAINERS/;
|
||||||
my $value = $2;
|
push(@maint_files, "$File::Find::name");
|
||||||
|
}
|
||||||
|
|
||||||
##Filename pattern matching
|
File::Find::find(\&maint_wanted, "${lk_path}board");
|
||||||
if ($type eq "F" || $type eq "X") {
|
|
||||||
$value =~ s@\.@\\\.@g; ##Convert . to \.
|
foreach my $maint_file (@maint_files) {
|
||||||
$value =~ s/\*/\.\*/g; ##Convert * to .*
|
my $maint;
|
||||||
$value =~ s/\?/\./g; ##Convert ? to .
|
open ($maint, '<', "$maint_file")
|
||||||
##if pattern is a directory and it lacks a trailing slash, add one
|
or die "$P: Can't open $maint_file: $!\n";
|
||||||
if ((-d $value)) {
|
read_maintainers($maint);
|
||||||
$value =~ s@([^/])$@$1/@;
|
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") {
|
push(@typevalue, "$type:$value");
|
||||||
$keyword_hash{@typevalue} = $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);
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue