util/lint/kconfig_lint: Handle glob prefix and suffix

Change-Id: I9067a95ff171d6da58583b3d4f15596b4584d937
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36626
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Arthur Heymans 2019-11-05 12:06:59 +01:00 committed by Patrick Georgi
parent 4e39c824e0
commit 55f01326cc
1 changed files with 6 additions and 3 deletions

View File

@ -1213,9 +1213,11 @@ sub load_kconfig_file {
my @dir_file_data; my @dir_file_data;
#recursively handle coreboot's new source glob operator #recursively handle coreboot's new source glob operator
if ( $input_file =~ /^(.*?)\/\*\/(.*)$/ ) { if ( $input_file =~ /^(.*?)\/(\w*)\*(\w*)\/(.*)$/ ) {
my $dir_prefix = $1; my $dir_prefix = $1;
my $dir_suffix = $2; my $dir_glob_prefix = $2;
my $dir_glob_suffix = $3;
my $dir_suffix = $4;
if ( -d "$dir_prefix" ) { if ( -d "$dir_prefix" ) {
opendir( D, "$dir_prefix" ) || die "Can't open directory '$dir_prefix'\n"; opendir( D, "$dir_prefix" ) || die "Can't open directory '$dir_prefix'\n";
@ -1225,7 +1227,8 @@ sub load_kconfig_file {
while ( my $directory = shift @dirlist ) { while ( my $directory = shift @dirlist ) {
#ignore non-directory files #ignore non-directory files
if ( ( -d "$dir_prefix/$directory" ) && !( $directory =~ /^\..*/ ) ) { if ( ( -d "$dir_prefix/$directory" ) && !( $directory =~ /^\..*/ )
&& ( $directory =~ /\Q$dir_glob_prefix\E.*\Q$dir_glob_suffix\E/ ) ) {
push @dir_file_data, push @dir_file_data,
load_kconfig_file( "$dir_prefix/$directory/$dir_suffix", load_kconfig_file( "$dir_prefix/$directory/$dir_suffix",
$input_file, $loadline, 1, $loadfile, $loadline ); $input_file, $loadline, 1, $loadfile, $loadline );