Get value for datastore variable in Yocto

106 Views Asked by At

I am trying to get a datastore variable.

I know I can do bitbake -e <image-name> | grep ^VARIABLE= to get all the assignments.

This datastore variable, however, contains other variables or datastore variables, so I will have to resolve them recursively in order to get all values.

Is there an easy way to get collected values of a datastore variable for a image??

1

There are 1 best solutions below

1
Talel BELHAJSALEM On

If I understand you correctly:

You have a variable VARIABLE that has other variable names like:

VARIABLE = "OTHER1 OTHER2 OTHER3"

and you want to get all values of OTHER1, OTHER2 and OTHER3 and put them again in the VARIABLE variable.

You can do the following:

VARIABLE = "OTHER1 OTHER2 OTHER3"
VARIABLE_VAL = "${@' '.join([d.getVar(val) for val in d.getVar('VARIABLE').split()])}"

Example:

OTHER1 = "other1"
OTHER2 = "other2"
OTHER3 = "other3"

VARIABLE = "OTHER1 OTHER2 OTHER3"
VARIABLE_VAL = "${@' '.join([d.getVar(val) for val in d.getVar('VARIABLE').split()])}"

OTHER1:append = " other1_1"
OTHER1:append := " ${OTHER2}"
OTHER2:prepend = "other2_2 "

If you meant something else, feel free to add a comment and I will edit this reponse accordingly.