Martin L Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/77138?usp=email )
Change subject: util/lint/kconfig_lint: Exclude site-local directory by default ......................................................................
util/lint/kconfig_lint: Exclude site-local directory by default
The site-local directory is not checked into the coreboot tree, so this change excludes it by default. By adding the site-local directory, an issue could be missed in the rest of the coreboot tree.
This change also adds a new command-line argument of -S or --site_local that re-enables the site-local checking.
Signed-off-by: Martin Roth gaumless@gmail.com Change-Id: I95efa3e7b2cbb84e5c84d263222d8e914626d314 --- M util/lint/kconfig_lint 1 file changed, 11 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/77138/1
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 9c9a8a9..107f01c 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -25,6 +25,7 @@ my $print_full_output = 0; # flag to print wholeconfig output my $output_file = "-"; # filename of output - set stdout by default my $dont_use_git_grep = 0; +my $include_site_local = 0;
# Globals my $top_dir = "."; # Directory where Kconfig is run @@ -63,6 +64,9 @@ $dont_use_git_grep = 1; print STDERR "\nGit grep unavailable, falling back to regular grep...\n"; } + if ( !$include_site_local) { + $exclude_dirs_and_files = "^site-local|" . $exclude_dirs_and_files; + }
open( STDOUT, "> $output_file" ) or die "Can't open $output_file for output: $!\n";
@@ -730,9 +734,12 @@
# source <prompt> elsif ( $line =~ /^\s*source\s+"?([^"\s]+)"?\s*(?>#.*)?$/ ) { - my @newfile = load_kconfig_file( $1, $filename, $line_no, 0, $filename, $line_no ); - unshift( @config_to_parse, @newfile ); + my $input_file = $1; $parseline[0]{text} = "# '$line'\n"; + if ( $line !~ "site-local" || $include_site_local ) { + my @newfile = load_kconfig_file( $input_file, $filename, $line_no, 0, $filename, $line_no ); + unshift( @config_to_parse, @newfile ); + } } elsif ( ( $line =~ /^\s*#/ ) || #comments @@ -1356,6 +1363,7 @@ 'path=s' => $top_dir, 'c|config=s' => $config_file, 'G|no_git_grep' => $dont_use_git_grep, + 'S|site_local' => $include_site_local, );
if ($suppress_error_output) { @@ -1379,6 +1387,7 @@ print " --path=dir Path to top level kconfig\n"; print " -c|--config=file Filename of config file to load\n"; print " -G|--no_git_grep Use standard grep tools instead of git grep\n"; + print " -S|--site_local Include the site-local directory\n";
exit(0); }