]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
binman: Show filename in missing blob help message
authorJonas Karlman <jonas@kwiboo.se>
Tue, 18 Jul 2023 20:34:39 +0000 (20:34 +0000)
committerSimon Glass <sjg@chromium.org>
Wed, 2 Aug 2023 18:05:57 +0000 (12:05 -0600)
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@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/binman/control.py
tools/binman/ftest.py

index 94abea5c38e32edbf4214a7e1a4ba8d9cff5d183..2aa6307750ee413d8d9ba8517a27e6ed05801b9f 100644 (file)
@@ -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
index a5ce44bbb2d4d09ffa136cc3044e79749949060a..0e026ecc31a4de4de985b5c1889d5eda18f4132e 100644 (file)
@@ -3806,6 +3806,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)
 
@@ -3816,6 +3817,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)