diff options
author | Martin Roth <gaumless@gmail.com> | 2023-08-10 10:00:51 -0600 |
---|---|---|
committer | Felix Singer <service+coreboot-gerrit@felixsinger.de> | 2023-08-17 21:31:45 +0000 |
commit | 873ebf201fac31bfb76523906ffeadbbd54108d6 (patch) | |
tree | 681163e5d95ae279bf57bb6ce7b2447cb7ba3897 | |
parent | bd36a313dee74aea1681cd1c9265e3279deca03b (diff) |
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
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77138
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
-rwxr-xr-x | util/lint/kconfig_lint | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 9c9a8a926d..107f01cdca 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -25,6 +25,7 @@ my $show_note_output = 0; # flag to show minor notes text 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 @@ sub Main { $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 @@ sub build_and_parse_kconfig_tree { # 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 @@ sub check_arguments { '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 @@ sub usage { 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); } |