All of lore.kernel.org
 help / color / mirror / Atom feed
From: ChenQi <Qi.Chen@windriver.com>
To: Alexander Kanavin <alex.kanavin@gmail.com>
Cc: bitbake-devel@lists.openembedded.org, richard.purdie@linuxfoundation.org
Subject: Re: [bitbake-devel][PATCH V2] lib/bb/parse/ast.py: error out for internal fragment in case of a previous value
Date: Fri, 14 Nov 2025 14:20:45 +0800	[thread overview]
Message-ID: <a0e64b88-cb5b-4dcc-8b6f-147765f373e0@windriver.com> (raw)
In-Reply-To: <CANNYZj_J6oJOpdYsX7Rnz8ViL4==q4ktLhfx5MZHQNe1s9SF-g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4786 bytes --]

On 11/14/25 14:15, Alexander Kanavin wrote:
> You need to explain the difference between v1 and v2 and why v2 is 
> needed. What was wrong with v1?
>
> The environment pass through hack is horrible.
>
> Alex

Hi Alex,

V1 to fix YOCTO #16060 is to use default value for internal fragment.

V2 is to error out in case of a previous value. See Richard's comments 
in https://bugzilla.yoctoproject.org/show_bug.cgi?id=16060

I know that the env method is a horrible hack. I looked around but could 
not find any other choice. Do you have any suggestion?

Regards,
Qi

>
> On Fri 14. Nov 2025 at 7.02, <Qi.Chen@windriver.com> wrote:
>
>     From: Chen Qi <Qi.Chen@windriver.com>
>
>     When an internal fragment is enabled, and there's already a value
>     for the corresponding variable, we should error out to avoid any
>     confusion.
>
>     For example, when 'machine/qemux86-64' fragement is enabled, and
>     we get some "MACHINE = xxx" in local.conf or env, we should error
>     out and recomment users to use 'bitbake-config-build
>     disable-fragment'.
>
>     We should be tolerating weak assignments. For example, DISTRO defaults
>     to "nodistro", and when 'distro/poky" fragment is enabled, there
>     should
>     be no confusion.
>
>     The implementation hacks the environment variable as a way to tell
>     bitbake that we're using 'bitbake-config-build'. Because we recommend
>     users to use bitbake-config-build, then it should not error out.
>
>     Fixes [YOCTO #16060]
>
>     Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>     ---
>      bin/bitbake-layers  | 3 +++
>      lib/bb/parse/ast.py
>     <https://urldefense.com/v3/__http://ast.py__;!!AjveYdw8EvQ!ZSR5THHxswHSbWGyBGxON8N8yJ_VhCA5M36eDazemj6ot6xLm281YkTXH7rtSU6j-Jad4Pl6r20d3jZ-lxN1l8c$>
>     | 7 +++++++
>      2 files changed, 10 insertions(+)
>
>     diff --git a/bin/bitbake-layers b/bin/bitbake-layers
>     index 341ecbcd9..c4569c6c3 100755
>     --- a/bin/bitbake-layers
>     +++ b/bin/bitbake-layers
>     @@ -64,6 +64,9 @@ def main():
>              if global_args.force > 1:
>                  bbpaths = []
>              else:
>     +            if toolname == "bitbake-config-build":
>     +                os.environ["BB_ENV_PASSTHROUGH_ADDITIONS"] =
>     os.getenv("BB_ENV_PASSTHROUGH_ADDITIONS") + "
>     _BB_INTERNAL_RUN_BITBAKE_CONFIG_BUILD_"
>     + os.environ["_BB_INTERNAL_RUN_BITBAKE_CONFIG_BUILD_"] = "1"
>                  tinfoil.prepare(True)
>                  bbpaths = tinfoil.config_data.getVar('BBPATH').split(':')
>
>     diff --git a/lib/bb/parse/ast.py
>     <https://urldefense.com/v3/__http://ast.py__;!!AjveYdw8EvQ!ZSR5THHxswHSbWGyBGxON8N8yJ_VhCA5M36eDazemj6ot6xLm281YkTXH7rtSU6j-Jad4Pl6r20d3jZ-lxN1l8c$>
>     b/lib/bb/parse/ast.py
>     <https://urldefense.com/v3/__http://ast.py__;!!AjveYdw8EvQ!ZSR5THHxswHSbWGyBGxON8N8yJ_VhCA5M36eDazemj6ot6xLm281YkTXH7rtSU6j-Jad4Pl6r20d3jZ-lxN1l8c$>
>     index e6ff1ff76..70a2a37a6 100644
>     --- a/lib/bb/parse/ast.py
>     <https://urldefense.com/v3/__http://ast.py__;!!AjveYdw8EvQ!ZSR5THHxswHSbWGyBGxON8N8yJ_VhCA5M36eDazemj6ot6xLm281YkTXH7rtSU6j-Jad4Pl6r20d3jZ-lxN1l8c$>
>     +++ b/lib/bb/parse/ast.py
>     <https://urldefense.com/v3/__http://ast.py__;!!AjveYdw8EvQ!ZSR5THHxswHSbWGyBGxON8N8yJ_VhCA5M36eDazemj6ot6xLm281YkTXH7rtSU6j-Jad4Pl6r20d3jZ-lxN1l8c$>
>     @@ -364,6 +364,13 @@ class AddFragmentsNode(AstNode):
>              def check_and_set_builtin_fragment(fragment, data,
>     builtin_fragments):
>                  prefix, value = fragment.split('/', 1)
>                  if prefix in builtin_fragments.keys():
>     +                if data.getVar(builtin_fragments[prefix],
>     noweakdefault=True) != None:
>     +                    if not
>     os.getenv("_BB_INTERNAL_RUN_BITBAKE_CONFIG_BUILD_"):
>     +                        bb.fatal(
>     +                            ("A builtin fragment '%s' is used
>     while %s has already got an assignment.\n"
>     +                             "Please either disable the fragment
>     or remove the value assignment.\n"
>     +                             "To disable the fragment, use
>     'bitbake-config-build disable-fragment %s'."
>     +                             ) % (fragment,
>     builtin_fragments[prefix], fragment))
>                      fragment_history =
>     data.varhistory.variable(self.fragments_variable)
>                      loginfo={}
>                      for fh in fragment_history[::-1]:
>     -- 
>     2.34.1
>

[-- Attachment #2: Type: text/html, Size: 8113 bytes --]

  reply	other threads:[~2025-11-14  6:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14  6:02 [bitbake-devel][PATCH V2] lib/bb/parse/ast.py: error out for internal fragment in case of a previous value Qi.Chen
2025-11-14  6:15 ` Alexander Kanavin
2025-11-14  6:20   ` ChenQi [this message]
2025-11-14  6:28     ` Alexander Kanavin
2025-11-14  6:37       ` ChenQi
2025-11-14  6:49         ` Alexander Kanavin
2025-11-14  7:12           ` ChenQi
2025-11-14  7:17             ` ChenQi
2025-11-14 11:50               ` Alexander Kanavin
2025-11-14 12:14 ` Richard Purdie
     [not found] ` <1877DE8BA2A633E6.930811@lists.openembedded.org>
2025-11-14 12:17   ` Richard Purdie
2025-11-17  2:37     ` ChenQi

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=a0e64b88-cb5b-4dcc-8b6f-147765f373e0@windriver.com \
    --to=qi.chen@windriver.com \
    --cc=alex.kanavin@gmail.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.