diff mbox series

[v3,2/7] binman: btool: lz4: use Bintool.version

Message ID 20220901155143.1868735-2-foss+uboot@0leil.net
State Accepted
Commit f17219ad42b47921864bef25d9e058959ef87265
Delegated to: Simon Glass
Headers show
Series [v3,1/7] binman: bintool: move version check implementation into bintool class | expand

Commit Message

Quentin Schulz Sept. 1, 2022, 3:51 p.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

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

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

v3:
 - added Rb,

added in v2

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

Comments

Simon Glass Sept. 7, 2022, 12:30 p.m. UTC | #1
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

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

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

v3:
 - added Rb,

added in v2

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

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/btool/lz4.py b/tools/binman/btool/lz4.py
index f09c5c8904..dc9e37921a 100644
--- a/tools/binman/btool/lz4.py
+++ b/tools/binman/btool/lz4.py
@@ -76,7 +76,7 @@  class Bintoollz4(bintool.Bintool):
         man lz4
     """
     def __init__(self, name):
-        super().__init__(name, 'lz4 compression')
+        super().__init__(name, 'lz4 compression', r'.* (v[0-9.]*),.*')
 
     def compress(self, indata):
         """Compress data with lz4
@@ -126,15 +126,3 @@  class Bintoollz4(bintool.Bintool):
         if method != bintool.FETCH_BIN:
             return None
         return self.apt_install('lz4')
-
-    def version(self):
-        """Version handler
-
-        Returns:
-            str: Version number of lz4
-        """
-        out = self.run_cmd('-V').strip()
-        if not out:
-            return super().version()
-        m_version = re.match(r'.* (v[0-9.]*),.*', out)
-        return m_version.group(1) if m_version else out