diff options
Diffstat (limited to 'v4l/scripts/prep_commit_msg.pl')
-rwxr-xr-x | v4l/scripts/prep_commit_msg.pl | 36 |
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 "# $_"; |