bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Ola x Nilsson <ola.x.nilsson@axis.com>
To: <bitbake-devel@lists.openembedded.org>
Subject: Re: [bitbake-devel] [PATCH] bitbake: ConfHandler: Allow variable flag name with a single character
Date: Tue, 11 Apr 2023 10:44:27 +0200	[thread overview]
Message-ID: <jwqile2q00y.fsf@axis.com> (raw)
In-Reply-To: <20230411060654.19442-1-kai.kang@windriver.com>


On Tue, Apr 11 2023, Kai Kang wrote:

> From: Kai Kang <kai.kang@windriver.com>
>
> Update regex pattern to allow variable flag name with a single character.
>
> Regression tests have also been updated in `bb.parse` and
> `bin/bitbake-selftest -k ParseTest` has been successfully executed.
>
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
>  bitbake/lib/bb/parse/parse_py/ConfHandler.py | 2 +-
>  bitbake/lib/bb/tests/parse.py                | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
> index 05c627ec8b..0bfe357012 100644
> --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
> +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
> @@ -21,7 +21,7 @@ __config_regexp__  = re.compile( r"""
>      ^
>      (?P<exp>export\s+)?
>      (?P<var>[a-zA-Z0-9\-_+.${}/~:]+?)
> -    (\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]+)\])?
> +    (\[(?P<flag>[a-zA-Z0-9\-_+.]([a-zA-Z0-9\-_+.@]+)?)\])?

It would be better to use the simpler expression
(\[(?P<flag>[a-zA-Z0-9\-_+.][a-zA-Z0-9\-_+.@]*)\])?


/Ola


>      \s* (
>          (?P<colon>:=) |
> diff --git a/bitbake/lib/bb/tests/parse.py b/bitbake/lib/bb/tests/parse.py
> index d27c7c6f15..a3165d95bd 100644
> --- a/bitbake/lib/bb/tests/parse.py
> +++ b/bitbake/lib/bb/tests/parse.py
> @@ -222,6 +222,7 @@ VAR = " \\
>      at_sign_in_var_flag = """
>  A[flag@.service] = "nonet"
>  B[flag@.target] = "ntb"
> +C[f] = "flag"
>  
>  unset A[flag@.service]
>  """
> @@ -232,6 +233,7 @@ unset A[flag@.service]
>          self.assertEqual(d.getVar("B"), None)
>          self.assertEqual(d.getVarFlag("A","flag@.service"), None)
>          self.assertEqual(d.getVarFlag("B","flag@.target"), "ntb")
> +        self.assertEqual(d.getVarFlag("C","f"), "flag")
>  
>      def test_parse_invalid_at_sign_in_var_flag(self):
>          invalid_at_sign = self.at_sign_in_var_flag.replace("B[f", "B[@f")



  reply	other threads:[~2023-04-11  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11  6:06 [PATCH] bitbake: ConfHandler: Allow variable flag name with a single character kai.kang
2023-04-11  8:44 ` Ola x Nilsson [this message]
2023-04-11  9:00   ` [bitbake-devel] " Kai

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=jwqile2q00y.fsf@axis.com \
    --to=ola.x.nilsson@axis.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /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;
as well as URLs for NNTP newsgroup(s).