BitBake 中的“:=”和“.=”赋值有什么区别?

What is the difference between ":=" and ".=" assignment in BitBake?

我在 BitBake.conf 文件中看到:

BBPATH := "${TOPDIR}"  

BBPATH .= ":${LAYERDIR}"  

:=.=有什么区别?

根据 BitBake manual:

The := operator results in a variable's contents being expanded immediately.
If you want to append or prepend values without an inserted space, use the .= and =. operators.

正如人们所指出的,Bitbake 配置文件不使用常规 shell 脚本语法。 Bitbake 有自己的配置语言。 (它被描述为“类似于其他几种语言”,但差异大到你无法从(比如)Bash 推断出 Bitbake 语义。)

有关详细信息,请阅读 Bitbake 用户手册。相关部分是 Section 3.1 - Basic Syntax.

它解释说:

  • := 在 RHS 上执行立即(配置解析时间)变量扩展。相比之下,在 = 中,扩展被延迟。

  • .= 执行追加,现有值和附加值之间没有 space。这也是立即完成的。