Bug 9683

Summary: 3.10 says d.getVar("X", expand=False) but that's wrong for 2.1
Product: [Documentation] BitBake User Manual Reporter: Harald Achitz <harald.achitz>
Component: bitbake-manualAssignee: Scott Rifenbark <srifenbark>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: bluelightning, richard.purdie, srifenbark
Version: 2.1   
Target Milestone: 2.2 M2   
Hardware: x86   
OS: Multiple   
Whiteboard: 9 June 2016: IN PROGRESS REVIEW
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)

Description Harald Achitz 2016-05-28 10:06:56 UTC
d.getVar("X", expand=False) is not correct anymore, 
the default value has been removed and running bitbake will resutl in an error.

the current latest online docuementation
http://www.yoctoproject.org/docs/2.1/bitbake-user-manual/bitbake-user-manual.html#accessing-datastore-variables-using-python
does not mention this, even if it should since the bitbake version shipped with 
YP Core - Krogoth 2.1 does not have the default anymore.

this caused some confusion for me when I was looking for the reason why the samples to my bitbake tutorial (http://a4z.bitbucket.org/docs/BitBake/guide.html) stopped working
Comment 1 Paul Eggleton 2016-05-29 20:40:56 UTC
Right, this needs to be corrected.
Comment 2 Scott Rifenbark 2016-06-08 01:41:19 UTC
Hi, 

Tell me what I need for that line for it to be correct.  

Thanks,
Scott
Comment 3 Paul Eggleton 2016-06-08 02:14:54 UTC
There is no default for the expand parameter anymore, so replace 'expand=True' with 'expand'. We'll want to do the same for getVarFlag() as well.
Comment 4 Scott Rifenbark 2016-06-09 16:15:47 UTC
Hi, 

I took out the "=True" part for both of these in the table.  There still is an "expand=False" piece for them.  Does that matter?  Can you look this change over?

http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#accessing-datastore-variables-using-python

Thanks, 
Scott
Comment 5 Harald Achitz 2016-06-09 16:42:02 UTC
the operation column need to be changed, 
I can see no change in the link you posted

d.getVar("X", expand=False) 
should be
d.getVar("X", expand)

it seems that this 
d.getVarFlag("X", flag, expand=False)
needs the same change ans should become
d.getVarFlag("X", flag, expand)


btw, the whole story motivated me to write a blog where I refer to documents that talk about changing user interfaces and flags in functions, 
possible interesting for Paul (should be)
http://a4z.bitbucket.org/blog/2016/05/28/A-broken-interface-or-why-ZMQ-C4-is-worth-reading.html
Comment 6 Scott Rifenbark 2016-06-09 16:58:28 UTC
I was basing my changes on Comment 3, which seemed to not really address any defaults.  Thanks for clearing that up.  If you look at the two areas I changed, I did change "exand=True" to "expand" in each of the latter parts of those pieces - see d.getVar and d.getVarFlag in http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#accessing-datastore-variables-using-python.  You will see the last part of the description for each of those now says " Using "expand" expands the value." and "Using "expand" expands the named flag.", respectively.  They used to say ".... expand=True ..." in both cases. 

So you are saying I need to restore those particular pieces and remove the "expand=False" part for them both?

Scott
Comment 7 Harald Achitz 2016-06-09 17:08:03 UTC
yes, it should be

Operation: 
d.getVar("X", expand)	

Description: 
Returns the value of variable "X". Using "expand=True" expands the value.


comment 3 talked already about some future state of the function where the function default value might be true, seems that is the plan, and was therefore not correct.

imho just an other sing that my blog post about flags in functions targets some truths :-) 
(just kidding, but I mean it serious)
Comment 9 Harald Achitz 2016-06-09 17:22:55 UTC
looks good for me.
this would have told me immediately that there is no default any more, so  I thinks it's fine.

Thanks for you effort Scott!
Comment 10 Scott Rifenbark 2016-06-09 17:30:19 UTC
No problem Harald... thanks for taking the time to note it here. 

Best, 
Scott

Setting to RESOLVED and moving the doc flag to done.