Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

get_maintainer: add --keywords-in-file option

There were some recent attempts [1] [2] to make the K: field less noisy
and its behavior more obvious. Ultimately, a shift in the default
behavior and an associated command line flag is the best choice.

Currently, K: will match keywords found in both patches and files.

Matching content from entire files is (while documented) not obvious
behavior and is usually not wanted by maintainers.

Now only patch content will be matched against unless --keywords-in-file
is also provided as an argument to get_maintainer.

Add the actual keyword matched to the role or rolestats as well.

For instance given the diff below that removes clang:

: diff --git a/drivers/hid/bpf/entrypoints/README b/drivers/hid/bpf/entrypoints/README
: index 147e0d41509f..f88eb19e8ef2 100644
: --- a/drivers/hid/bpf/entrypoints/README
: +++ b/drivers/hid/bpf/entrypoints/README
: @@ -1,4 +1,4 @@
: WARNING:
: If you change "entrypoints.bpf.c" do "make -j" in this directory to rebuild "entrypoints.skel.h".
: -Make sure to have clang 10 installed.
: +Make sure to have 10 installed.
: See Documentation/bpf/bpf_devel_QA.rst

The new role/rolestats output includes ":Keyword:\b(?i:clang|llvm)\b"

$ git diff drivers/hid/bpf/entrypoints/README | .scripts/get_maintainer.pl
Jiri Kosina <jikos@kernel.org> (maintainer:HID CORE LAYER,commit_signer:1/1=100%)
Benjamin Tissoires <benjamin.tissoires@redhat.com> (maintainer:HID CORE LAYER,commit_signer:1/1=100%,authored:1/1=100%,added_lines:4/4=100%)
Nathan Chancellor <nathan@kernel.org> (supporter:CLANG/LLVM BUILD SUPPORT:Keyword:\b(?i:clang|llvm)\b)
Nick Desaulniers <ndesaulniers@google.com> (supporter:CLANG/LLVM BUILD SUPPORT:Keyword:\b(?i:clang|llvm)\b)
Tom Rix <trix@redhat.com> (reviewer:CLANG/LLVM BUILD SUPPORT:Keyword:\b(?i:clang|llvm)\b)
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:1/1=100%)
linux-input@vger.kernel.org (open list:HID CORE LAYER)
linux-kernel@vger.kernel.org (open list)
llvm@lists.linux.dev (open list:CLANG/LLVM BUILD SUPPORT:Keyword:\b(?i:clang|llvm)\b)

Link: https://lore.kernel.org/r/20231004-get_maintainer_change_k-v1-1-ac7ced18306a@google.com
Link: https://lore.kernel.org/all/20230928-get_maintainer_add_d-v2-0-8acb3f394571@google.com
Link: https://lore.kernel.org/all/3dca40b677dd2fef979a5a581a2db91df2c21801.camel@perches.com
Original-patch-by: Justin Stitt <justinstitt@google.com>
Link: https://lkml.kernel.org/r/01fe46f0c58aa8baf92156ae2bdccfb2bf0cb48e.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Tested-by: Justin Stitt <justinstitt@google.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Joe Perches and committed by
Andrew Morton
71ca5ee1 ead5a727

+20 -18
+20 -18
scripts/get_maintainer.pl
··· 57 57 my $status = 0; 58 58 my $letters = ""; 59 59 my $keywords = 1; 60 + my $keywords_in_file = 0; 60 61 my $sections = 0; 61 62 my $email_file_emails = 0; 62 63 my $from_filename = 0; ··· 273 272 'letters=s' => \$letters, 274 273 'pattern-depth=i' => \$pattern_depth, 275 274 'k|keywords!' => \$keywords, 275 + 'kf|keywords-in-file!' => \$keywords_in_file, 276 276 'sections!' => \$sections, 277 277 'fe|file-emails!' => \$email_file_emails, 278 278 'f|file' => \$from_filename, ··· 320 318 $subsystem = 0; 321 319 $web = 0; 322 320 $keywords = 0; 321 + $keywords_in_file = 0; 323 322 $interactive = 0; 324 323 } else { 325 324 my $selections = $email + $scm + $status + $subsystem + $web; ··· 551 548 $file =~ s/^\Q${cur_path}\E//; #strip any absolute path 552 549 $file =~ s/^\Q${lk_path}\E//; #or the path to the lk tree 553 550 push(@files, $file); 554 - if ($file ne "MAINTAINERS" && -f $file && $keywords) { 551 + if ($file ne "MAINTAINERS" && -f $file && $keywords && $keywords_in_file) { 555 552 open(my $f, '<', $file) 556 553 or die "$P: Can't open $file: $!\n"; 557 554 my $text = do { local($/) ; <$f> }; 558 555 close($f); 559 - if ($keywords) { 560 - foreach my $line (keys %keyword_hash) { 561 - if ($text =~ m/$keyword_hash{$line}/x) { 562 - push(@keyword_tvi, $line); 563 - } 556 + foreach my $line (keys %keyword_hash) { 557 + if ($text =~ m/$keyword_hash{$line}/x) { 558 + push(@keyword_tvi, $line); 564 559 } 565 560 } 566 561 } ··· 920 919 } 921 920 922 921 foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { 923 - add_categories($line); 922 + add_categories($line, ""); 924 923 if ($sections) { 925 924 my $i; 926 925 my $start = find_starting_index($line); ··· 948 947 if ($keywords) { 949 948 @keyword_tvi = sort_and_uniq(@keyword_tvi); 950 949 foreach my $line (@keyword_tvi) { 951 - add_categories($line); 950 + add_categories($line, ":Keyword:$keyword_hash{$line}"); 952 951 } 953 952 } 954 953 ··· 1077 1076 Other options: 1078 1077 --pattern-depth => Number of pattern directory traversals (default: 0 (all)) 1079 1078 --keywords => scan patch for keywords (default: $keywords) 1079 + --keywords-in-file => scan file for keywords (default: $keywords_in_file) 1080 1080 --sections => print all of the subsystem sections with pattern matches 1081 1081 --letters => print all matching 'letter' types from all matching sections 1082 1082 --mailmap => use .mailmap file (default: $email_use_mailmap) ··· 1088 1086 1089 1087 Default options: 1090 1088 [--email --tree --nogit --git-fallback --m --r --n --l --multiline 1091 - --pattern-depth=0 --remove-duplicates --rolestats] 1089 + --pattern-depth=0 --remove-duplicates --rolestats --keywords] 1092 1090 1093 1091 Notes: 1094 1092 Using "-f directory" may give unexpected results: ··· 1314 1312 } 1315 1313 1316 1314 sub add_categories { 1317 - my ($index) = @_; 1315 + my ($index, $suffix) = @_; 1318 1316 1319 1317 my $i; 1320 1318 my $start = find_starting_index($index); ··· 1344 1342 if (!$hash_list_to{lc($list_address)}) { 1345 1343 $hash_list_to{lc($list_address)} = 1; 1346 1344 push(@list_to, [$list_address, 1347 - "subscriber list${list_role}"]); 1345 + "subscriber list${list_role}" . $suffix]); 1348 1346 } 1349 1347 } 1350 1348 } else { ··· 1354 1352 if ($email_moderated_list) { 1355 1353 $hash_list_to{lc($list_address)} = 1; 1356 1354 push(@list_to, [$list_address, 1357 - "moderated list${list_role}"]); 1355 + "moderated list${list_role}" . $suffix]); 1358 1356 } 1359 1357 } else { 1360 1358 $hash_list_to{lc($list_address)} = 1; 1361 1359 push(@list_to, [$list_address, 1362 - "open list${list_role}"]); 1360 + "open list${list_role}" . $suffix]); 1363 1361 } 1364 1362 } 1365 1363 } ··· 1367 1365 } elsif ($ptype eq "M") { 1368 1366 if ($email_maintainer) { 1369 1367 my $role = get_maintainer_role($i); 1370 - push_email_addresses($pvalue, $role); 1368 + push_email_addresses($pvalue, $role . $suffix); 1371 1369 } 1372 1370 } elsif ($ptype eq "R") { 1373 1371 if ($email_reviewer) { 1374 1372 my $subsystem = get_subsystem_name($i); 1375 - push_email_addresses($pvalue, "reviewer:$subsystem"); 1373 + push_email_addresses($pvalue, "reviewer:$subsystem" . $suffix); 1376 1374 } 1377 1375 } elsif ($ptype eq "T") { 1378 - push(@scm, $pvalue); 1376 + push(@scm, $pvalue . $suffix); 1379 1377 } elsif ($ptype eq "W") { 1380 - push(@web, $pvalue); 1378 + push(@web, $pvalue . $suffix); 1381 1379 } elsif ($ptype eq "S") { 1382 - push(@status, $pvalue); 1380 + push(@status, $pvalue . $suffix); 1383 1381 } 1384 1382 } 1385 1383 }