Trace where a variable was set from bitbake -e history
bitbake -e prints every assignment to a variable above its final value, so you can see which file set it, in Scarthgap 5.0 and later.
This is the tip for the moment a variable has the wrong value and you do not know which file wrote it. bitbake -e dumps the whole environment for a recipe, and each variable is preceded by comment lines that record its history: every set, append, prepend and override, with the file and line. Filtering the comment lines with sed keeps the output readable, and the final IMAGE_INSTALL= line is the value BitBake actually uses. This was written for Scarthgap 5.0 with BitBake 2.8.
bitbake -e core-image-minimal | grep -B 8 '^IMAGE_INSTALL=' | sed 's/^# //'$IMAGE_INSTALL [2 operations]
set /build/poky/meta/classes-recipe/image.bbclass:34
"${@bb.utils.contains('IMAGE_FEATURES', 'ssh-server-dropbear', 'dropbear', '', d)}"
append /build/conf/local.conf:61
" htop"
pre-expansion value:
" htop"
IMAGE_INSTALL=" htop"The history is kept by the data store as the parser reads files, so it names the real source even when an include or a bbappend did the work. File paths and line numbers will differ on your tree. The dump is large and slow on a cold parse; for one variable, bitbake-getvar is quicker.