]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
checkpatch: Ignore removed lines in license check
authorNabih Estefan <nabihestefan@google.com>
Mon, 22 Sep 2025 09:36:48 +0000 (10:36 +0100)
committerAlex Bennée <alex.bennee@linaro.org>
Fri, 26 Sep 2025 08:55:19 +0000 (09:55 +0100)
When running the license check, if we are updating a license it is
possible for the checkpatch script to test against old license lines
instead of newer ones, since the removal lines appear before the
addition lines in a .patch file.

Fix this by skipping over lines that start with "-" in the checkpatch
script.

Signed-off-by: Nabih Estefan <nabihestefan@google.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250916165928.10048-1-nabihestefan@google.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250922093711.2768983-4-alex.bennee@linaro.org>

scripts/checkpatch.pl

index 91616c974f2c3cb327a1d8416c910cab11672bea..40b6955c69863a304a97d76929df3152594b4c28 100755 (executable)
@@ -1816,7 +1816,8 @@ sub process {
                }
 
 # Check SPDX-License-Identifier references a permitted license
-               if ($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) {
+               if (($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) &&
+                       $rawline !~ /^-/) {
                        $fileinfo->{facts}->{sawspdx} = 1;
                        &checkspdx($realfile, $1);
                }