qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: qemu-devel@nongnu.org
Cc: cohuck@redhat.com, berrange@redhat.com,
	Stefano Garzarella <sgarzare@redhat.com>
Subject: [PATCH] scripts/checkpatch: emit a warning if an imported file is touched
Date: Wed, 17 Jul 2024 11:37:52 +0200	[thread overview]
Message-ID: <20240717093752.50595-1-sgarzare@redhat.com> (raw)

If a file imported from Linux is touched, emit a warning and suggest
using scripts/update-linux-headers.sh

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
 scripts/checkpatch.pl | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ff373a7083..b0e8266fa2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1374,6 +1374,7 @@ 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_imported_file = 0;
 	my $non_utf8_charset = 0;
 
 	our @report = ();
@@ -1673,8 +1674,17 @@ sub process {
 # ignore non-hunk lines and lines being removed
 		next if (!$hunk_line || $line =~ /^-/);
 
-# ignore files that are being periodically imported from Linux
-		next if ($realfile =~ /^(linux-headers|include\/standard-headers)\//);
+# ignore files that are being periodically imported from Linux and emit a warning
+		if ($realfile =~ /^(linux-headers|include\/standard-headers)\//) {
+			if (!$reported_imported_file) {
+				$reported_imported_file = 1;
+				WARN("added, moved or deleted file(s) " .
+				     "imported from Linux, are you using " .
+				     "scripts/update-linux-headers.sh?\n" .
+				     $herecurr);
+			}
+			next;
+		}
 
 #trailing whitespace
 		if ($line =~ /^\+.*\015/) {
-- 
2.45.2



             reply	other threads:[~2024-07-17  9:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17  9:37 Stefano Garzarella [this message]
2024-07-17  9:50 ` [PATCH] scripts/checkpatch: emit a warning if an imported file is touched Daniel P. Berrangé
2024-07-17 12:26   ` Stefano Garzarella
2024-07-17  9:58 ` Cornelia Huck
2024-07-17 12:36   ` Stefano Garzarella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240717093752.50595-1-sgarzare@redhat.com \
    --to=sgarzare@redhat.com \
    --cc=berrange@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).