diff options
author | Simon Glass <sjg@chromium.org> | 2020-10-30 06:46:33 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-11-05 19:11:31 +0300 |
commit | b3348522b753450be9e442452bf42aaa032d15d1 (patch) | |
tree | 3a12fbf9765466d36e9bb1dfabe300aaed47764e /tools/patman | |
parent | a12ad7c94064759f5be02b879f3f52ed5111335f (diff) | |
download | u-boot-b3348522b753450be9e442452bf42aaa032d15d1.tar.xz |
patman: Improve handling of files
Sometimes warnings are associated with a file and sometimes with the
patch as a whole. Update the regular expression to handle both cases,
even in emacs mode. Also add support for detecting new files.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman')
-rw-r--r-- | tools/patman/checkpatch.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py index 98d962cd50..63a8e37e8c 100644 --- a/tools/patman/checkpatch.py +++ b/tools/patman/checkpatch.py @@ -93,7 +93,7 @@ def CheckPatch(fname, verbose=False, show_types=False): re_error = re.compile('ERROR:%s (.*)' % type_name) re_warning = re.compile(emacs_prefix + 'WARNING:%s (.*)' % type_name) re_check = re.compile('CHECK:%s (.*)' % type_name) - re_file = re.compile('#\d+: FILE: ([^:]*):(\d+):') + re_file = re.compile('#(\d+): (FILE: ([^:]*):(\d+):)?') re_note = re.compile('NOTE: (.*)') re_new_file = re.compile('new file mode .*') indent = ' ' * 6 @@ -153,8 +153,13 @@ def CheckPatch(fname, verbose=False, show_types=False): item['msg'] = check_match.group(2) item['type'] = 'check' elif file_match: - item['file'] = file_match.group(1) - item['line'] = int(file_match.group(2)) + err_fname = file_match.group(3) + if err_fname: + item['file'] = err_fname + item['line'] = int(file_match.group(4)) + else: + item['file'] = '<patch>' + item['line'] = int(file_match.group(1)) elif subject_match: item['file'] = '<patch subject>' item['line'] = None |