From d96ef37df78eac5c636866d8f226991a5d96e6bb Mon Sep 17 00:00:00 2001 From: Doug Anderson Date: Mon, 26 Nov 2012 15:23:23 +0000 Subject: patman: Look for checkpatch in the scripts directory The Linux kernel stores checkpatch.pl in the scripts directory. Add that to the search path to make things more automatic for kernel development. Signed-off-by: Doug Anderson Acked-by: Simon Glass --- tools/patman/checkpatch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools/patman/checkpatch.py') diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index d831087d88b..f72f8ee261e 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -26,10 +26,12 @@ import re import terminal def FindCheckPatch(): + top_level = gitutil.GetTopLevel() try_list = [ os.getcwd(), os.path.join(os.getcwd(), '..', '..'), - os.path.join(gitutil.GetTopLevel(), 'tools'), + os.path.join(top_level, 'tools'), + os.path.join(top_level, 'scripts'), '%s/bin' % os.getenv('HOME'), ] # Look in current dir -- cgit v1.2.3 From 99adf6eda7bed1beb3fa3e18951342f67b108db7 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Wed, 9 Jan 2013 16:00:10 +0000 Subject: 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 . 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 Acked-by: Doug Anderson Acked-by: Simon Glass --- tools/patman/checkpatch.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tools/patman/checkpatch.py') diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index f72f8ee261e..d3a0477bbf1 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -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) -- cgit v1.2.3