1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

patman: Allow use outside of u-boot tree

To make it usable in git trees not providing a patch checker
implementation, add a command line option, allowing to suppress patch
check. While we are at it, sort debug options alphabetically.

Also, do not raise an exception if checkpatch.pl is not found - just
print an error message suggesting to use the new option, and return
nonzero status.

   . unit test passes:
    $ ./patman  -t
    <unittest.result.TestResult run=7 errors=0 failures=0>
   . successfully used patman in the autotest tree to generate a patch
     email (with --no-check option)
   . successfully used patman in the u-boot tree to generate a patch
     email
   . `patman --help' now shows command line options ordered
     alphabetically

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Acked-by: Doug Anderson <dianders@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Vadim Bendebury
2013-01-09 16:00:10 +00:00
committed by Simon Glass
parent 656cffeb49
commit 99adf6eda7
2 changed files with 15 additions and 9 deletions

View File

@@ -23,6 +23,7 @@ import command
import gitutil
import os
import re
import sys
import terminal
def FindCheckPatch():
@@ -47,8 +48,10 @@ def FindCheckPatch():
if os.path.isfile(fname):
return fname
path = os.path.dirname(path)
print 'Could not find checkpatch.pl'
return None
print >> sys.stderr, ('Cannot find checkpatch.pl - please put it in your ' +
'~/bin directory or use --no-check')
sys.exit(1)
def CheckPatch(fname, verbose=False):
"""Run checkpatch.pl on a file.
@@ -67,9 +70,6 @@ def CheckPatch(fname, verbose=False):
error_count, warning_count, lines = 0, 0, 0
problems = []
chk = FindCheckPatch()
if not chk:
raise OSError, ('Cannot find checkpatch.pl - please put it in your ' +
'~/bin directory')
item = {}
stdout = command.Output(chk, '--no-tree', fname)
#pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE)