kconfig_lint: exclude payloads from search, add back specific files

Don't search for symbols in the payloads directory, except for specific
files that are actively added back to the search.

Change-Id: I6f28dc7dee040b8061fa5644066f3613367b6d84
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/17443
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2016-11-15 21:08:42 -07:00
parent e74ad21a91
commit e69c58d7c8
1 changed files with 4 additions and 3 deletions

View File

@ -45,9 +45,10 @@ my $root_dir = "src"; # Directory of the top level Kconfig file
my $errors_found = 0; # count of errors
my $warnings_found = 0;
my $exclude_dirs_and_files =
'^build/\|^coreboot-builds/\|^payloads/libpayload\|^payloads/coreinfo\|^configs/\|^util/\|^\.git/'
'^build/\|^coreboot-builds/\|^configs/\|^util/\|^\.git/\|^payloads'
. '\|' . # directories to exclude when searching for used symbols
'\.txt$\|\.tex$\|\.tags'; #files to exclude when looking for symbols
my $payload_files_to_check='payloads/Makefile.inc payloads/external/Makefile.inc';
my $config_file = ""; # name of config file to load symbol values from.
my @wholeconfig; # document the entire kconfig structure
my %loaded_files; # list of each Kconfig file loaded
@ -410,10 +411,10 @@ sub collect_used_symbols {
# find all references to CONFIG_ statements in the tree
if ($dont_use_git_grep) {
@collected_symbols = `grep -Irn -- "CONFIG_" | grep -v '$exclude_dirs_and_files'`;
@collected_symbols = `grep -Irn -- "CONFIG_" | grep -v '$exclude_dirs_and_files'; grep -In -- "CONFIG_" $payload_files_to_check`;
}
else {
@collected_symbols = `git grep -In -- "CONFIG_" | grep -v '$exclude_dirs_and_files'`;
@collected_symbols = `git grep -In -- "CONFIG_" | grep -v '$exclude_dirs_and_files'; git grep -In -- "CONFIG_" $payload_files_to_check`;
}
my @used_symbols = @collected_symbols;