From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com>
To: Simon Glass <sjg@chromium.org>, Quentin Schulz <foss+uboot@0leil.net>
Cc: Alper Nebi Yasak <alpernebiyasak@gmail.com>,
Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>,
U-Boot Mailing List <u-boot@lists.denx.de>,
Quentin Schulz <quentin.schulz@theobroma-systems.com>
Subject: Re: [PATCH v2 4/7] binman: bintool: parametrize parameter to pass to binary for returning version
Date: Thu, 1 Sep 2022 08:20:47 +0200 [thread overview]
Message-ID: <e92b9eec-7962-e970-d29c-40026d17c8fa@weidmueller.com> (raw)
In-Reply-To: <CAPnjgZ375vh5pQ14SqgdKF_zJszMbMyOVVPN_nAtcRoM-ZwPuw@mail.gmail.com>
Hi,
Am 01.09.2022 um 04:27 schrieb Simon Glass:
> Hi Quentin,
>
> Fix spelling for parametrize
>
> On Wed, 31 Aug 2022 at 11:39, Quentin Schulz <foss+uboot@0leil.net> wrote:
>>
>> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>>
>> The code to check the version is very similar between binaries, the most
>> likely only needed variables are the regex to find the version (already
>> supported) and the parameter to pass to the binary so that it prints
>> this version (e.g. --version, -V or similar).
>>
>> Let's make it a parameter of Bintool so that code duplication can be
>> avoided for simple changes.
>>
>> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>> ---
>>
>> added in v2
>>
>> tools/binman/bintool.py | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/binman/bintool.py b/tools/binman/bintool.py
>> index a156ffb550..77608cec23 100644
>> --- a/tools/binman/bintool.py
>> +++ b/tools/binman/bintool.py
>> @@ -53,10 +53,11 @@ class Bintool:
>> # List of bintools to regard as missing
>> missing_list = []
>>
>> - def __init__(self, name, desc, version_regex=None):
>> + def __init__(self, name, desc, version_regex=None, version_parameters='-V'):
>
> version_args?
>
> It is shorter
And it will be consistent to the compress_args and decompress_args of
the BintoolPacker class.
>
>> self.name = name
>> self.desc = desc
>> self.version_regex = version_regex
>> + self.version_parameters = version_parameters
>>
>> @staticmethod
>> def find_bintool_class(btype):
>> @@ -476,7 +477,7 @@ binaries. It is fairly easy to create new bintools. Just add a new file to the
>>
>> import re
>>
>> - result = self.run_cmd_result('-V')
>> + result = self.run_cmd_result(self.version_parameters)
>> out = result.stdout.strip()
>> if not out:
>> out = result.stderr.strip()
>> @@ -507,9 +508,9 @@ class BintoolPacker(Bintool):
>> """
>> def __init__(self, name, compression=None, compress_args=None,
>> decompress_args=None, fetch_package=None,
>> - version_regex=r'(v[0-9.]+)'):
>> + version_regex=r'(v[0-9.]+)', version_parameters='-V'):
>> desc = '%s compression' % (compression if compression else name)
>> - super().__init__(name, desc, version_regex)
>> + super().__init__(name, desc, version_regex, version_parameters)
>> if compress_args is None:
>> compress_args = ['--compress']
>> self.compress_args = compress_args
Regards
Stefan
next prev parent reply other threads:[~2022-09-01 6:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 17:39 [PATCH v2 1/7] binman: bintool: move version check implementation into bintool class Quentin Schulz
2022-08-31 17:39 ` [PATCH v2 2/7] binman: btool: lz4: use Bintool.version Quentin Schulz
2022-09-01 2:27 ` Simon Glass
2022-08-31 17:39 ` [PATCH v2 3/7] binman: btool: mkimage: " Quentin Schulz
2022-09-01 2:27 ` Simon Glass
2022-08-31 17:39 ` [PATCH v2 4/7] binman: bintool: parametrize parameter to pass to binary for returning version Quentin Schulz
2022-09-01 2:27 ` Simon Glass
2022-09-01 6:20 ` Stefan Herbrechtsmeier [this message]
2022-08-31 17:39 ` [PATCH v2 5/7] binman: btool: fiptool: use Bintool.version Quentin Schulz
2022-09-01 2:27 ` Simon Glass
2022-08-31 17:39 ` [PATCH v2 6/7] binman: btool: futility: " Quentin Schulz
2022-09-01 2:27 ` Simon Glass
2022-08-31 17:39 ` [PATCH v2 7/7] binman: bintool: bzip2: fix version function on non-Debian-based systems Quentin Schulz
2022-09-01 2:27 ` Simon Glass
2022-09-01 2:27 ` [PATCH v2 1/7] binman: bintool: move version check implementation into bintool class Simon Glass
2022-09-01 6:17 ` Stefan Herbrechtsmeier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e92b9eec-7962-e970-d29c-40026d17c8fa@weidmueller.com \
--to=stefan.herbrechtsmeier-oss@weidmueller.com \
--cc=alpernebiyasak@gmail.com \
--cc=foss+uboot@0leil.net \
--cc=quentin.schulz@theobroma-systems.com \
--cc=sjg@chromium.org \
--cc=stefan.herbrechtsmeier@weidmueller.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox