[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230928-get_maintainer_add_d-v2-1-8acb3f394571@google.com>
Date: Thu, 28 Sep 2023 04:23:05 +0000
From: Justin Stitt <justinstitt@...gle.com>
To: Joe Perches <joe@...ches.com>
Cc: linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
Jakub Kicinski <kuba@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
geert@...ux-m68k.org, gregkh@...uxfoundation.org,
workflows@...r.kernel.org, mario.limonciello@....com,
Justin Stitt <justinstitt@...gle.com>
Subject: [PATCH v2 1/2] get_maintainer: add patch-only keyword-matching
Add the "D:" type which behaves the same as "K:" but will only match
content present in a patch file.
To illustrate:
Imagine this entry in MAINTAINERS:
NEW REPUBLIC
M: Han Solo <hansolo@...elalliance.co>
W: https://www.jointheresistance.org
D: \bstrncpy\b
Our maintainer, Han, will only be added to the recipients if a patch
file is passed to get_maintainer (like what b4 does):
$ ./scripts/get_maintainer.pl 0004-some-change.patch
If the above patch has a `strncpy` present in the subject, commit log or
diff then Han will be to/cc'd.
However, in the event of a file from the tree given like:
$ ./scripts/get_maintainer.pl ./lib/string.c
Han will not be noisily to/cc'd (like a K: type would in this
circumstance)
Signed-off-by: Justin Stitt <justinstitt@...gle.com>
---
MAINTAINERS | 5 +++++
scripts/get_maintainer.pl | 12 ++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index b19995690904..94e431daa7c2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -59,6 +59,11 @@ Descriptions of section entries and preferred order
matches patches or files that contain one or more of the words
printk, pr_info or pr_err
One regex pattern per line. Multiple K: lines acceptable.
+ D: *Diff content regex* (perl extended) pattern match that applies only to
+ patches and not entire files (e.g. when using the get_maintainers.pl
+ script).
+ Usage same as K:.
+
Maintainers List
----------------
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ab123b498fd9..a3e697926ddd 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -342,6 +342,7 @@ if ($tree && !top_of_kernel_tree($lk_path)) {
my @typevalue = ();
my %keyword_hash;
+my %patch_keyword_hash;
my @mfiles = ();
my @self_test_info = ();
@@ -369,8 +370,10 @@ sub read_maintainer_file {
$value =~ s@([^/])$@$1/@;
}
} elsif ($type eq "K") {
- $keyword_hash{@...evalue} = $value;
- }
+ $keyword_hash{@...evalue} = $value;
+ } elsif ($type eq "D") {
+ $patch_keyword_hash{@...evalue} = $value;
+ }
push(@typevalue, "$type:$value");
} elsif (!(/^\s*$/ || /^\s*\#/)) {
push(@typevalue, $line);
@@ -607,6 +610,11 @@ foreach my $file (@ARGV) {
push(@keyword_tvi, $line);
}
}
+ foreach my $line(keys %patch_keyword_hash) {
+ if ($patch_line =~ m/${patch_prefix}$patch_keyword_hash{$line}/x) {
+ push(@keyword_tvi, $line);
+ }
+ }
}
}
close($patch);
--
2.42.0.582.g8ccd20d70d-goog
Powered by blists - more mailing lists