mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
scripts/checkpatch: use new hook for MAINTAINERS update check
When seeing a new/deleted/renamed file we check to see if MAINTAINERS is updated, but we don't give the user a list of files affected, as we don't want to repeat the same warning many times over. Using the new file list hook, we can give a single warning at the end with a list of filenames included. Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
45abbf209f
commit
1d745e6d96
1 changed files with 19 additions and 18 deletions
|
@ -1443,6 +1443,25 @@ sub process_file_list {
|
|||
join("\n ", @acpi_nontestexpected) .
|
||||
"\n\nfound in the same patch\n");
|
||||
}
|
||||
|
||||
my $sawmaintainers = 0;
|
||||
my @maybemaintainers;
|
||||
foreach my $fileinfo (@fileinfos) {
|
||||
if ($fileinfo->{action} ne "modified" &&
|
||||
$fileinfo->{filenew} !~ m#^tests/data/acpi/#) {
|
||||
push @maybemaintainers, $fileinfo->{filenew};
|
||||
}
|
||||
if ($fileinfo->{filenew} eq "MAINTAINERS") {
|
||||
$sawmaintainers = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# If we don't see a MAINTAINERS update, prod the user to check
|
||||
if (int(@maybemaintainers) > 0 && !$sawmaintainers) {
|
||||
WARN("added, moved or deleted file(s):\n\n " .
|
||||
join("\n ", @maybemaintainers) .
|
||||
"\n\nDoes MAINTAINERS need updating?\n");
|
||||
}
|
||||
}
|
||||
|
||||
# Called at the start of processing a diff hunk for a file
|
||||
|
@ -1486,7 +1505,6 @@ sub process {
|
|||
|
||||
my $in_header_lines = $file ? 0 : 1;
|
||||
my $in_commit_log = 0; #Scanning lines before patch
|
||||
my $reported_maintainer_file = 0;
|
||||
my $reported_mixing_imported_file = 0;
|
||||
my $in_imported_file = 0;
|
||||
my $in_no_imported_file = 0;
|
||||
|
@ -1761,23 +1779,6 @@ sub process {
|
|||
}
|
||||
}
|
||||
|
||||
# Check if MAINTAINERS is being updated. If so, there's probably no need to
|
||||
# emit the "does MAINTAINERS need updating?" message on file add/move/delete
|
||||
if ($line =~ /^\s*MAINTAINERS\s*\|/) {
|
||||
$reported_maintainer_file = 1;
|
||||
}
|
||||
|
||||
# Check for added, moved or deleted files
|
||||
if (!$reported_maintainer_file && !$in_commit_log &&
|
||||
($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
|
||||
$line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
|
||||
($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
|
||||
(defined($1) || defined($2)))) &&
|
||||
$realfile !~ m#^tests/data/acpi/#) {
|
||||
$reported_maintainer_file = 1;
|
||||
WARN("added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
|
||||
}
|
||||
|
||||
# Check SPDX-License-Identifier references a permitted license
|
||||
if ($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) {
|
||||
&checkspdx($realfile, $1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue