diff mbox series

[v2,3/7] binman: btool: mkimage: use Bintool.version

Message ID 20220831173936.150114-3-foss+uboot@0leil.net
State Superseded
Delegated to: Simon Glass
Headers show
Series [v2,1/7] binman: bintool: move version check implementation into bintool class | expand

Commit Message

Quentin Schulz Aug. 31, 2022, 5:39 p.m. UTC
From: Quentin Schulz <quentin.schulz@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@theobroma-systems.com>
---

added in v2

 tools/binman/btool/mkimage.py | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

Comments

Simon Glass Sept. 1, 2022, 2:27 a.m. UTC | #1
On Wed, 31 Aug 2022 at 11:39, Quentin Schulz <foss+uboot@0leil.net> wrote:
>
> From: Quentin Schulz <quentin.schulz@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@theobroma-systems.com>
> ---
>
> added in v2
>
>  tools/binman/btool/mkimage.py | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/tools/binman/btool/mkimage.py b/tools/binman/btool/mkimage.py
index c85bfe053c..e08e3ef709 100644
--- a/tools/binman/btool/mkimage.py
+++ b/tools/binman/btool/mkimage.py
@@ -18,7 +18,7 @@  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,
@@ -66,15 +66,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