Chan Kim
Chan Kim

Reputation: 5989

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

I saw in a BitBake .conf file:

BBPATH := "${TOPDIR}"  

and

BBPATH .= ":${LAYERDIR}"  

What is the difference between := and .=?

Upvotes: 1

Views: 708

Answers (2)

Stephen C
Stephen C

Reputation: 719310

As people have pointed out, a Bitbake config file does NOT use regular (i.e. sh, csh, bash, ksh, etc) shell script syntax. Bitbake has its own config language. (It is described as "similar to several other languages", but the differences are large enough that you cannot infer Bitbake semantics from (say) Bash.)

For more info, read the Bitbake User Manual. The relevant section is Section 3.1 - Basic Syntax.

It explains that:

  • := performs an immediate (i.e. at config parse time) variable expansion on the right hand side. By contrast, with =, the variable expansion is deferred until the variable on the left hand side is used.

  • .= performs an append without a space between the existing and appended value. This is also done immediately.

Upvotes: 2

user9706
user9706

Reputation:

According to the 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.

Upvotes: 3

Related Questions