mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Michal Marek <mmarek@suse.cz>,
	Cesar Eduardo Barros <cesarb@cesarb.net>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	David Howells <dhowells@redhat.com>
Subject: Re: [PATCH] scripts: add checkmaintainers.py
Date: Tue, 18 Dec 2012 13:33:19 -0800	[thread overview]
Message-ID: <1355866399.3297.2.camel@joe-AO722> (raw)
In-Reply-To: <20121218204716.GJ31255@liondog.tnic>

[-- Attachment #1: Type: text/plain, Size: 119 bytes --]

On Tue, 2012-12-18 at 21:47 +0100, Borislav Petkov wrote:
> Oh well, enough games for today.

Maybe try this tomorrow?

[-- Attachment #2: Type: text/x-patch, Size: 2179 bytes --]

 scripts/checkpatch.pl |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 725c596..adc8de1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1317,6 +1317,19 @@ sub check_absolute_file {
 	}
 }
 
+sub check_filenames_changed {
+    my ($oldfile, $newfile, $herecurr) = @_;
+
+    return if ($oldfile eq $newfile);
+
+    my $action = "renames $oldfile to $newfile";
+    $action = "creates file $newfile" if ($oldfile =~ m@dev/null@);
+    $action = "deletes file $oldfile" if ($newfile =~ m@dev/null@);
+
+    CHK("MAINTAINERS",
+	"Patch $action, update MAINTAINERS?\n" . $herecurr);
+}
+
 sub pos_last_openparen {
 	my ($line) = @_;
 
@@ -1379,6 +1392,9 @@ sub process {
 	# Trace the real file/line as we go.
 	my $realfile = '';
 	my $realline = 0;
+	my $modifiedfile = '';
+	my $gitrealfile = '';
+	my $gitmodifiedfile = '';
 	my $realcnt = 0;
 	my $here = '';
 	my $in_comment = 0;
@@ -1536,10 +1552,17 @@ sub process {
 		$here = "#$realline: " if ($file);
 
 		# extract the filename as it passes
-		if ($line =~ /^diff --git.*?(\S+)$/) {
-			$realfile = $1;
+		if ($line =~ /^diff --git\s+(\S+)\s+(\S+)$/) {
+			$modifiedfile = $1;
+			$realfile = $2;
+			$modifiedfile =~ s@^([^/]*)/@@;
 			$realfile =~ s@^([^/]*)/@@;
+
+			$gitmodifiedfile = $modifiedfile;
+			$gitrealfile = $realfile;
 			$in_commit_log = 0;
+			check_filenames_changed($gitmodifiedfile, $gitrealfile);
+
 		} elsif ($line =~ /^\+\+\+\s+(\S+)/) {
 			$realfile = $1;
 			$realfile =~ s@^([^/]*)/@@;
@@ -1556,6 +1579,19 @@ sub process {
 				ERROR("MODIFIED_INCLUDE_ASM",
 				      "do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");
 			}
+
+			if ($modifiedfile ne $gitmodifiedfile ||
+			    $realfile ne $gitrealfile) {
+				check_filenames_changed($modifiedfile, $realfile);
+				$gitmodifiedfile = '';
+				$gitrealfile = '';
+			}
+
+			next;
+		} elsif ($line =~ /^\-\-\-\s+(\S+)/) {
+			$modifiedfile = $1;
+			$modifiedfile =~ s@^([^/]*)/@@;
+			$in_commit_log = 0;
 			next;
 		}
 

  reply	other threads:[~2012-12-18 21:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-14 22:19 Cesar Eduardo Barros
2012-12-17 10:14 ` Michal Marek
2012-12-17 10:27   ` Borislav Petkov
2012-12-17 15:35     ` Joe Perches
2012-12-17 17:00       ` Borislav Petkov
2012-12-17 18:56         ` Joe Perches
2012-12-17 19:09           ` Joe Perches
2012-12-18 18:28             ` Borislav Petkov
2012-12-18 19:34               ` Joe Perches
2012-12-18 20:31                 ` Borislav Petkov
2012-12-18 20:36                   ` Joe Perches
2012-12-18 20:47                     ` Borislav Petkov
2012-12-18 21:33                       ` Joe Perches [this message]
2012-12-19 15:07                         ` Borislav Petkov
2012-12-19 17:43                           ` Joe Perches
2012-12-20 19:31                             ` Borislav Petkov
2012-12-17 21:59         ` Cesar Eduardo Barros

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=1355866399.3297.2.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=cesarb@cesarb.net \
    --cc=dhowells@redhat.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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

all inboxes | Powered by JetHome®