From patchwork Mon Dec 17 18:56:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 1888541 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 84437DF266 for ; Mon, 17 Dec 2012 18:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753493Ab2LQS4U (ORCPT ); Mon, 17 Dec 2012 13:56:20 -0500 Received: from perches-mx.perches.com ([206.117.179.246]:48847 "EHLO labridge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753476Ab2LQS4U (ORCPT ); Mon, 17 Dec 2012 13:56:20 -0500 Received: from [173.51.221.202] (account joe@perches.com HELO [192.168.1.167]) by labridge.com (CommuniGate Pro SMTP 5.0.14) with ESMTPA id 20410015; Mon, 17 Dec 2012 10:56:19 -0800 Message-ID: <1355770579.13361.41.camel@joe-AO722> Subject: Re: [PATCH] scripts: add checkmaintainers.py From: Joe Perches To: Borislav Petkov Cc: Michal Marek , Cesar Eduardo Barros , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Andrew Morton , David Howells Date: Mon, 17 Dec 2012 10:56:19 -0800 In-Reply-To: <20121217170011.GC31866@liondog.tnic> References: <1355523576-7596-1-git-send-email-cesarb@cesarb.net> <50CEF080.8010208@suse.cz> <20121217102714.GB31947@liondog.tnic> <1355758544.13361.14.camel@joe-AO722> <20121217170011.GC31866@liondog.tnic> X-Mailer: Evolution 3.6.0-0ubuntu3 Mime-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org On Mon, 2012-12-17 at 18:00 +0100, Borislav Petkov wrote: > On Mon, Dec 17, 2012 at 07:35:44AM -0800, Joe Perches wrote: > > Perhaps Cesar can use his script as a starting point to find those > > pattern invalidating commits or maybe add the capability (or a > > --strict check) to checkpatch. > > Or that, I don't have a strict preference. > > So, yeah, I can see how checkpatch saying: "you've just renamed a > file and thusly invalidated a pattern in MAINTAINERS. Pls, consider > correcting the pattern" could make sense. And I would even add it to > default functionality since the MAINTAINERS patterns are something we > want to always have up-to-date, IMO. Maybe something like this: scripts/checkpatch.pl | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 725c596..a7dddc1 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1379,6 +1379,7 @@ sub process { # Trace the real file/line as we go. my $realfile = ''; my $realline = 0; + my $modifiedfile = ''; my $realcnt = 0; my $here = ''; my $in_comment = 0; @@ -1536,8 +1537,10 @@ 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@^([^/]*)/@@; $in_commit_log = 0; } elsif ($line =~ /^\+\+\+\s+(\S+)/) { @@ -1556,6 +1559,19 @@ sub process { ERROR("MODIFIED_INCLUDE_ASM", "do not modify files in include/asm, change architecture specific files in include/asm-\n" . "$here$rawline\n"); } + + my $action = "renames $modifiedfile to $realfile"; + $action = "creates file $realfile" if ($modifiedfile =~ m@dev/null@); + $action = "deletes file $modifiedfile" if ($realfile =~ m@dev/null@); + + CHK("MAINTAINERS", + "Patch $action, update MAINTAINERS?\n"); + + next; + } elsif ($line =~ /^\-\-\-\s+(\S+)/) { + $modifiedfile = $1; + $modifiedfile =~ s@^([^/]*)/@@; + $in_commit_log = 0; next; }