aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-06-13 09:01:01 -0400
committerTom Rini <trini@konsulko.com>2020-06-13 09:01:01 -0400
commitf9e3d2e147ee3b18dbc09e56d13e6fc8758ac375 (patch)
treebd93f43be8a3ea14724aeb5686fbdcb80125623e /tools
parent8a1292ce3e21205645a155b23ac083a3fc6b64c1 (diff)
parentcea8f2c995b9d87af6ef42f967402e1c8a3506db (diff)
downloadu-boot-f9e3d2e147ee3b18dbc09e56d13e6fc8758ac375.zip
u-boot-f9e3d2e147ee3b18dbc09e56d13e6fc8758ac375.tar.gz
u-boot-f9e3d2e147ee3b18dbc09e56d13e6fc8758ac375.tar.bz2
Merge tag 'dm-pull-12jun20' of git://git.denx.de/u-boot-dm into next
patman improvements to allow it to work with Zephyr change to how sequence numbers are assigned to devices minor fixes and improvements
Diffstat (limited to 'tools')
-rw-r--r--tools/buildman/builder.py10
-rw-r--r--tools/buildman/test.py8
-rw-r--r--tools/patman/checkpatch.py43
3 files changed, 43 insertions, 18 deletions
diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
index f8e71de..f2756ea 100644
--- a/tools/buildman/builder.py
+++ b/tools/buildman/builder.py
@@ -70,12 +70,12 @@ As an example, say we are building branch 'us-net' for boards 'sandbox' and
like this:
us-net/ base directory
- 01_of_02_g4ed4ebc_net--Add-tftp-speed-/
+ 01_g4ed4ebc_net--Add-tftp-speed-/
sandbox/
u-boot.bin
seaboard/
u-boot.bin
- 02_of_02_g4ed4ebc_net--Check-tftp-comp/
+ 02_g4ed4ebc_net--Check-tftp-comp/
sandbox/
u-boot.bin
seaboard/
@@ -487,8 +487,8 @@ class Builder:
commit = self.commits[commit_upto]
subject = commit.subject.translate(trans_valid_chars)
# See _GetOutputSpaceRemovals() which parses this name
- commit_dir = ('%02d_of_%02d_g%s_%s' % (commit_upto + 1,
- self.commit_count, commit.hash, subject[:20]))
+ commit_dir = ('%02d_g%s_%s' % (commit_upto + 1,
+ commit.hash, subject[:20]))
elif not self.no_subdirs:
commit_dir = 'current'
if not commit_dir:
@@ -1599,7 +1599,7 @@ class Builder:
for dirname in glob.glob(os.path.join(self.base_dir, '*')):
if dirname not in dir_list:
leaf = dirname[len(self.base_dir) + 1:]
- m = re.match('[0-9]+_of_[0-9]+_g[0-9a-f]+_.*', leaf)
+ m = re.match('[0-9]+_g[0-9a-f]+_.*', leaf)
if m:
to_remove.append(dirname)
return to_remove
diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index 40811ba..82d25cf 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -541,7 +541,7 @@ class TestBuild(unittest.TestCase):
build.commits = self.commits
build.commit_count = len(self.commits)
subject = self.commits[1].subject.translate(builder.trans_valid_chars)
- dirname ='/%02d_of_%02d_g%s_%s' % (2, build.commit_count, commits[1][0],
+ dirname ='/%02d_g%s_%s' % (2, build.commit_count, commits[1][0],
subject[:20])
self.CheckDirs(build, dirname)
@@ -609,9 +609,9 @@ class TestBuild(unittest.TestCase):
base_dir = tempfile.mkdtemp()
# Add various files that we want removed and left alone
- to_remove = ['01_of_22_g0982734987_title', '102_of_222_g92bf_title',
- '01_of_22_g2938abd8_title']
- to_leave = ['something_else', '01-something.patch', '01_of_22_another']
+ to_remove = ['01_g0982734987_title', '102_g92bf_title',
+ '01_g2938abd8_title']
+ to_leave = ['something_else', '01-something.patch', '01_another']
for name in to_remove + to_leave:
_Touch(name)
diff --git a/tools/patman/checkpatch.py b/tools/patman/checkpatch.py
index 795b519..98c63af 100644
--- a/tools/patman/checkpatch.py
+++ b/tools/patman/checkpatch.py
@@ -59,7 +59,7 @@ def CheckPatch(fname, verbose=False):
'stdout']
result = collections.namedtuple('CheckPatchResult', fields)
result.ok = False
- result.errors, result.warning, result.checks = 0, 0, 0
+ result.errors, result.warnings, result.checks = 0, 0, 0
result.lines = 0
result.problems = []
chk = FindCheckPatch()
@@ -72,24 +72,39 @@ def CheckPatch(fname, verbose=False):
# total: 0 errors, 0 warnings, 159 lines checked
# or:
# total: 0 errors, 2 warnings, 7 checks, 473 lines checked
- re_stats = re.compile('total: (\\d+) errors, (\d+) warnings, (\d+)')
- re_stats_full = re.compile('total: (\\d+) errors, (\d+) warnings, (\d+)'
+ emacs_prefix = '(?:[0-9]{4}.*\.patch:[0-9]+: )?'
+ emacs_stats = '(?:[0-9]{4}.*\.patch )?'
+ re_stats = re.compile(emacs_stats +
+ 'total: (\\d+) errors, (\d+) warnings, (\d+)')
+ re_stats_full = re.compile(emacs_stats +
+ 'total: (\\d+) errors, (\d+) warnings, (\d+)'
' checks, (\d+)')
re_ok = re.compile('.*has no obvious style problems')
re_bad = re.compile('.*has style problems, please review')
re_error = re.compile('ERROR: (.*)')
- re_warning = re.compile('WARNING: (.*)')
+ re_warning = re.compile(emacs_prefix + 'WARNING:(?:[A-Z_]+:)? (.*)')
re_check = re.compile('CHECK: (.*)')
re_file = re.compile('#\d+: FILE: ([^:]*):(\d+):')
-
+ re_note = re.compile('NOTE: (.*)')
+ indent = ' ' * 6
for line in result.stdout.splitlines():
if verbose:
print(line)
# A blank line indicates the end of a message
- if not line and item:
- result.problems.append(item)
- item = {}
+ if not line:
+ if item:
+ result.problems.append(item)
+ item = {}
+ continue
+ if re_note.match(line):
+ continue
+ # Skip lines which quote code
+ if line.startswith(indent):
+ continue
+ # Skip code quotes and #<n>
+ if line.startswith('+') or line.startswith('#'):
+ continue
match = re_stats_full.match(line)
if not match:
match = re_stats.match(line)
@@ -101,14 +116,18 @@ def CheckPatch(fname, verbose=False):
result.lines = int(match.group(4))
else:
result.lines = int(match.group(3))
+ continue
elif re_ok.match(line):
result.ok = True
+ continue
elif re_bad.match(line):
result.ok = False
+ continue
err_match = re_error.match(line)
warn_match = re_warning.match(line)
file_match = re_file.match(line)
check_match = re_check.match(line)
+ subject_match = line.startswith('Subject:')
if err_match:
item['msg'] = err_match.group(1)
item['type'] = 'error'
@@ -121,6 +140,11 @@ def CheckPatch(fname, verbose=False):
elif file_match:
item['file'] = file_match.group(1)
item['line'] = int(file_match.group(2))
+ elif subject_match:
+ item['file'] = '<patch subject>'
+ item['line'] = None
+ else:
+ print('bad line "%s", %d' % (line, len(line)))
return result
@@ -139,7 +163,8 @@ def GetWarningMsg(col, msg_type, fname, line, msg):
msg_type = col.Color(col.RED, msg_type)
elif msg_type == 'check':
msg_type = col.Color(col.MAGENTA, msg_type)
- return '%s:%d: %s: %s\n' % (fname, line, msg_type, msg)
+ line_str = '' if line is None else '%d' % line
+ return '%s:%s: %s: %s\n' % (fname, line_str, msg_type, msg)
def CheckPatches(verbose, args):
'''Run the checkpatch.pl script on each patch'''