Bug 5227

Summary: [webhob-poky/master] in 'variables' API, the 'file' field returns no data
Product: [Build System, Metadata & Runtime] Toaster Reporter: Belen Barros Pena <belen.barros.pena>
Component: toasterAssignee: Alexandru Damian <alexandru.damian>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: alexandru.damian, belen.barros.pena, bluelightning, jessica.zhang, richard.purdie
Version: 1.5   
Target Milestone: 1.6 M1   
Hardware: All   
OS: Multiple   
Whiteboard: bitbake, toasterui
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Belen Barros Pena 2013-09-18 10:13:12 UTC
We should aim to provide this information on the first release. We agreed it would be the path to the last file touching the variable.
Comment 1 Alexandru Damian 2013-09-26 14:15:53 UTC
Bitbake does not record locations where the variables are changed.

Fixing this would require an important change in Bitbake, which could severely impact the performance; setVar needs to record the backtrace of where it is called and save it in a var flag.

Propose delay for 1.5.X
Comment 2 Belen Barros Pena 2013-10-02 15:09:47 UTC
moved to 1.5.1
Comment 3 Alexandru Damian 2013-10-10 14:07:38 UTC
I would propose modifying bitbake to keep track in a variable flag the current file:line of code where a variable is modified. 

Opinions ?
Comment 4 Paul Eggleton 2013-10-10 14:28:35 UTC
When history tracking is turned on it definitely does record this information. You can see it in the bitbake -e output.
Comment 5 Alexandru Damian 2013-10-10 14:58:38 UTC
I got this info on bitbake -e. 

#
# $B_pn-xcb-util-image
#   [no history recorded]
#
#   "${SEPB}"
B_pn-xcb-util-image="/home/ddalex/ssd/yocto/build/tmp/work/x86_64-poky-linux/bblayers/1.0-r0/build"
#
# $localstatedir
#   [no history recorded]
#
#   "${base_prefix}/var"
export localstatedir="/var"


Am I doing something wrong ?
Comment 6 Paul Eggleton 2013-10-10 15:11:49 UTC
Something is going wrong there because my equivalent here is:

#
# $B_pn-xcb-util-image
#   set /home/paul/poky/poky/meta/conf/distro/include/seperatebuilddir.inc:706
#     "${SEPB}"
B_pn-xcb-util-image="/home/paul/poky/poky/build/tmp/work/i586-poky-linux/bblayers/1.0-r0/build"
#
# $localstatedir [2 operations]
#   exported conf/bitbake.conf:31
#     [export] "1"
#   set conf/bitbake.conf:31
#     "${base_prefix}/var"
# computed:
#   "${base_prefix}/var"
export localstatedir="/var"
Comment 7 Alexandru Damian 2013-11-18 11:53:59 UTC
Fix merged in origin/master and origin/dora-toaster. 

The file field is deleted.

There is a new table, orm_variablehistory, that tracks all changes for a variable. The REST API page have been modified to document the API change, but the patchset for the API change was not merged yet.
Comment 8 Belen Barros Pena 2013-11-18 17:56:24 UTC
Verified in

master:b0281b3a190dec6502b4abc6a5b14ae46243f913 

dora-toaster:1182665de0da9a6e5fc77107f32a7fc1515029d0