summaryrefslogtreecommitdiff
path: root/v4l/scripts
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-12-10 06:24:02 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-12-10 06:24:02 -0200
commit61e5a6aab4808f04a473de863f5a902dab216b93 (patch)
tree3df2854948eb5ae2895d2be333685e9f17d35752 /v4l/scripts
parentb6b28e59f3a63abba79eda2ef1de8b4e76e8cdc8 (diff)
downloadmediapointer-dvb-s2-61e5a6aab4808f04a473de863f5a902dab216b93.tar.gz
mediapointer-dvb-s2-61e5a6aab4808f04a473de863f5a902dab216b93.tar.bz2
Add a tool for checking codingstyle and report to emacs "Compile" command
From: Mauro Carvalho Chehab <mchehab@infradead.org> For those who develp using emacs, checking a patch is now a matter of asking emacs to compile, using "make checkemacs" command. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l/scripts')
-rwxr-xr-xv4l/scripts/check.pl51
1 files changed, 51 insertions, 0 deletions
diff --git a/v4l/scripts/check.pl b/v4l/scripts/check.pl
new file mode 100755
index 000000000..3e6eb6e47
--- /dev/null
+++ b/v4l/scripts/check.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+my $cmd=shift;
+
+if ($cmd) {
+ $cmd="diff -upr /dev/null $cmd";
+} else {
+ $cmd="hg diff";
+}
+
+$checkpatch=$ENV{CHECKPATCH};
+
+if (!$checkpatch) {
+ $checkpatch="/lib/modules/`uname -r`/build/scripts/checkpatch.pl";
+}
+
+my $cp_version;
+open IN,"$checkpatch|";
+while (<IN>) {
+ tr/A-Z/a-z/;
+ if (m/version\s*:\s*([\d\.]+)/) {
+ $cp_version = $1;
+ }
+}
+close IN;
+
+my $intree_checkpatch = "scripts/checkpatch.pl --no-tree";
+if (!open IN,"$intree_checkpatch|") {
+ $intree_checkpatch = "v4l/".$intree_checkpatch;
+ open IN,"$intree_checkpatch|";
+}
+while (<IN>) {
+ tr/A-Z/a-z/;
+ if (m/version\s*:\s*([\d\.]+)/) {
+ if ($1 > $cp_version) {
+ print "# WARNING: $checkpatch version $cp_version is\n"
+ ."# older than $intree_checkpatch version"
+ ." $1.\n# Using in-tree one.\n#\n";
+ $cp_version = $1;
+ $checkpatch = $intree_checkpatch;
+ }
+ }
+}
+close IN;
+
+open IN,"$cmd | $checkpatch -q --nosignoff --emacs -|";
+while (<IN>) {
+ s|#[\d]+:\s*FILE:\s*|../|;
+ print "$_";
+}
+close IN;