[PATCH v3 3/7] binman: btool: mkimage: use Bintool.version

Quentin Schulz foss+uboot at 0leil.net
Thu Sep 1 17:51:39 CEST 2022


From: Quentin Schulz <quentin.schulz at theobroma-systems.com>

Bintool.version already contains everything required to get the version
out of mkimage binary so let's not override it with its own
implementation.

Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---

v3:
 - added Rb,
 - removed version positional parameter for run() so that coverage still
 is 100%,

added in v2

 tools/binman/btool/mkimage.py | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/tools/binman/btool/mkimage.py b/tools/binman/btool/mkimage.py
index c85bfe053c..da5f344162 100644
--- a/tools/binman/btool/mkimage.py
+++ b/tools/binman/btool/mkimage.py
@@ -18,11 +18,11 @@ class Bintoolmkimage(bintool.Bintool):
     Support is provided for fetching this on Debian-like systems, using apt.
     """
     def __init__(self, name):
-        super().__init__(name, 'Generate image for U-Boot')
+        super().__init__(name, 'Generate image for U-Boot', r'mkimage version (.*)')
 
     # pylint: disable=R0913
     def run(self, reset_timestamp=False, output_fname=None, external=False,
-            pad=None, version=False):
+            pad=None):
         """Run mkimage
 
         Args:
@@ -44,8 +44,6 @@ class Bintoolmkimage(bintool.Bintool):
             args.append('-t')
         if output_fname:
             args += ['-F', output_fname]
-        if version:
-            args.append('-V')
         return self.run_cmd(*args)
 
     def fetch(self, method):
@@ -66,15 +64,3 @@ class Bintoolmkimage(bintool.Bintool):
         if method != bintool.FETCH_BIN:
             return None
         return self.apt_install('u-boot-tools')
-
-    def version(self):
-        """Version handler for mkimage
-
-        Returns:
-            str: Version string for mkimage
-        """
-        out = self.run(version=True).strip()
-        if not out:
-            return super().version()
-        m_version = re.match(r'mkimage version (.*)', out)
-        return m_version.group(1) if m_version else out
-- 
2.37.2



More information about the U-Boot mailing list