From: Andy Whitcroft <apw@shadowen.org>
To: bbpetkov@yahoo.de, rdunlap@xenotime.net, jschopp@austin.ibm.com,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] scripts/checkpatch.pl: add a check for the patch level (patch -p<num>)
Date: Fri, 21 Dec 2007 18:12:02 +0000 [thread overview]
Message-ID: <20071221181202.GU13186@shadowen.org> (raw)
In-Reply-To: <20071218054641.GA15994@gollum.tnic>
On Tue, Dec 18, 2007 at 06:46:41AM +0100, Borislav Petkov wrote:
> On Mon, Dec 17, 2007 at 08:11:05AM +0100, Borislav Petkov wrote:
>
> A slightly microoptimized version 1.1:
>
> ---
> From: Borislav Petkov <bbpetkov@yahoo.de>
>
>
> Check the patch level of the single hunks in a patch file, however only when
> checkpatch.pl is called from within the kernel tree.
>
> Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
> --
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 579f50f..3eda27b 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -653,6 +653,18 @@ sub CHK {
> }
> }
>
> +sub check_patchlevel {
> +
> + if ($tree) {
> + my ($path) = @_;
> + $path =~ s![^/]*/!!;
> +
> + if (!stat($path)) {
> + WARN("Check the patchlevel (hint: patch option -p)");
> + }
> + }
Hmmm that will trigger on all patches which create new files if I am
grokking you correctly.
I would have thought this would pretty easy to check from the form of
the names. Hmmm.
> +}
> +
> sub process {
> my $filename = shift;
> my @lines = @_;
> @@ -713,10 +725,16 @@ sub process {
> #extract the filename as it passes
> if ($line=~/^\+\+\+\s+(\S+)/) {
> $realfile=$1;
> +
> + if ($realfile) {
> + check_patchlevel($realfile);
> + }
> +
> $realfile =~ s@^[^/]*/@@;
> $in_comment = 0;
> next;
> }
> +
> #extract the line range in the file after the patch is applied
> if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
> $is_patch = 1;
-apw
next prev parent reply other threads:[~2007-12-21 18:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-17 7:11 [PATCH] scripts/checkpatch.pl: add a check for the patch level (patch -p<num>) Borislav Petkov
2007-12-18 5:46 ` Borislav Petkov
2007-12-21 18:12 ` Andy Whitcroft [this message]
2007-12-23 7:52 ` Borislav Petkov
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=20071221181202.GU13186@shadowen.org \
--to=apw@shadowen.org \
--cc=akpm@linux-foundation.org \
--cc=bbpetkov@yahoo.de \
--cc=jschopp@austin.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.