summaryrefslogtreecommitdiff
path: root/v4l/scripts/prep_commit_msg.pl
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-12-03 16:18:12 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-12-03 16:18:12 -0200
commitf038f28e4892d23a5f89fe6173e668e94c59281b (patch)
tree7158a073189d86850b85a733fbc173ed29834bd1 /v4l/scripts/prep_commit_msg.pl
parentaa8c8a2d0104bfc51e0b8888acd66e67a9615ab1 (diff)
downloadmediapointer-dvb-s2-f038f28e4892d23a5f89fe6173e668e94c59281b.tar.gz
mediapointer-dvb-s2-f038f28e4892d23a5f89fe6173e668e94c59281b.tar.bz2
Copy kernel's checkpatch.pl and improve prep_commit_msg.pl
From: Mauro Carvalho Chehab <mchehab@infradead.org> Kernel's checkpatch.pl appeared only on kernel version 2.6.22. However, several improvements happened on recent kernels. This patch copies the latest version (0.11) of checkpatch.pl to the v4l-dvb development tree. Also, now, prep_commit_msg.pl checks if the script is available at Kernel and checks for its version. If the version is older than the in-tree one, it uses the in-tree. Otherwise, kernel version is used. It is always a good idea to use kernel's checkpatch.pl, since some additional tests can be done when using the kernel's, like checking for the usage of depreciated API's. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l/scripts/prep_commit_msg.pl')
-rwxr-xr-xv4l/scripts/prep_commit_msg.pl36
1 files changed, 34 insertions, 2 deletions
diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl
index 1316a7c44..ffd8aeb84 100755
--- a/v4l/scripts/prep_commit_msg.pl
+++ b/v4l/scripts/prep_commit_msg.pl
@@ -55,14 +55,46 @@ 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;
+
print "# Added/removed/changed files:\n";
system "hg $diff | diffstat -p1 -c";
-open IN,"hg $diff | $checkpatch -q --nosignoff --notree -|";
+open IN,"hg $diff | $checkpatch -q --nosignoff -|";
my $err=0;
while (<IN>) {
if (!$err) {
- print "#\n# WARN: checkpatch.pl returned some errors. Please fix.\n";
+ print "#\n# WARNING: $checkpatch version $cp_version returned ".
+ "some errors.\n# Please fix.\n#\n";
+
+
$err=1;
}
print "# $_";