summaryrefslogtreecommitdiff
path: root/v4l/scripts
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-10-08 21:20:24 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-08 21:20:24 -0300
commit2c620029905d1d8a6b7a1d1861c12feaf3b4087e (patch)
treed39031a6ad16f00164fa951143107ec1df434c2c /v4l/scripts
parent1439b403314a1c183c00808a5d2574d4c22b8a63 (diff)
downloadmediapointer-dvb-s2-2c620029905d1d8a6b7a1d1861c12feaf3b4087e.tar.gz
mediapointer-dvb-s2-2c620029905d1d8a6b7a1d1861c12feaf3b4087e.tar.bz2
Runs checkpatch.pl during make commit
From: Mauro Carvalho Chehab <mchehab@infradead.org> checkpatch.pl is the official tool for checking CodingStyle violations on kernel patches. This changeset makes it run every time a "make commit" is called. This allows detecting CodingStyle violations during development phase. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l/scripts')
-rwxr-xr-xv4l/scripts/prep_commit_msg.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl
index cb0740a5d..1316a7c44 100755
--- a/v4l/scripts/prep_commit_msg.pl
+++ b/v4l/scripts/prep_commit_msg.pl
@@ -49,8 +49,27 @@ if ($user eq "") {
$user = "$ENV{USER} <>";
}
+$checkpatch=$ENV{CHECKPATCH};
+
+if (!$checkpatch) {
+ $checkpatch="/lib/modules/`uname -r`/build/scripts/checkpatch.pl";
+}
+
print "# Added/removed/changed files:\n";
system "hg $diff | diffstat -p1 -c";
+
+open IN,"hg $diff | $checkpatch -q --nosignoff --notree -|";
+my $err=0;
+while (<IN>) {
+ if (!$err) {
+ print "#\n# WARN: checkpatch.pl returned some errors. Please fix.\n";
+ $err=1;
+ }
+ print "# $_";
+}
+close IN;
+
+
if (-s $autopatch) {
print "#\n# Note, a problem with your patch was detected! These changes were made\n";
print "# automatically: $autopatch\n";