[PATCH v2 6/7] binman: Show filename in missing blob help message
Jonas Karlman
jonas at kwiboo.se
Tue Jul 18 22:34:39 CEST 2023
Show the filename next to the node path in missing blob help messages,
also show a generic missing blob message when there was no help message
for the help tag.
Signed-off-by: Jonas Karlman <jonas at kwiboo.se>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
v2:
- Add test
- Collect r-b tag
tools/binman/control.py | 13 ++++++++++---
tools/binman/ftest.py | 2 ++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/tools/binman/control.py b/tools/binman/control.py
index fe5d704c4048..048d74a0b786 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -112,8 +112,8 @@ def _ReadMissingBlobHelp():
_FinishTag(tag, msg, result)
return result
-def _ShowBlobHelp(level, path, text):
- tout.do_output(level, '%s:' % path)
+def _ShowBlobHelp(level, path, text, fname):
+ tout.do_output(level, '%s (%s):' % (path, fname))
for line in text.splitlines():
tout.do_output(level, ' %s' % line)
tout.do_output(level, '')
@@ -133,10 +133,17 @@ def _ShowHelpForMissingBlobs(level, missing_list):
tags = entry.GetHelpTags()
# Show the first match help message
+ shown_help = False
for tag in tags:
if tag in missing_blob_help:
- _ShowBlobHelp(level, entry._node.path, missing_blob_help[tag])
+ _ShowBlobHelp(level, entry._node.path, missing_blob_help[tag],
+ entry.GetDefaultFilename())
+ shown_help = True
break
+ # Or a generic help message
+ if not shown_help:
+ _ShowBlobHelp(level, entry._node.path, "Missing blob",
+ entry.GetDefaultFilename())
def GetEntryModules(include_testing=True):
"""Get a set of entry class implementations
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 40ef6e5dce99..b2f78d3d0adb 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -3781,6 +3781,7 @@ class TestFunctional(unittest.TestCase):
allow_missing=True)
self.assertEqual(103, ret)
err = stderr.getvalue()
+ self.assertIn('(missing-file)', err)
self.assertRegex(err, "Image 'image'.*missing.*: blob-ext")
self.assertIn('Some images are invalid', err)
@@ -3791,6 +3792,7 @@ class TestFunctional(unittest.TestCase):
allow_missing=True, ignore_missing=True)
self.assertEqual(0, ret)
err = stderr.getvalue()
+ self.assertIn('(missing-file)', err)
self.assertRegex(err, "Image 'image'.*missing.*: blob-ext")
self.assertIn('Some images are invalid', err)
--
2.41.0
More information about the U-Boot
mailing list