Bug 12016

Summary: Values for path variables in bitbake hello world tutorial make it harder to build upon it
Product: [Documentation] BitBake User Manual Reporter: Paul Eggleton <bluelightning>
Component: bitbake-manualAssignee: Kristi <kristi>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: caio.oliveira, kristi, srifenbark
Version: unspecified   
Target Milestone: 2.5 M2   
Hardware: x86   
OS: Multiple   
Whiteboard: 22 DECEMBER 2017: RESOLVED
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)

Description Paul Eggleton 2017-08-31 06:01:28 UTC
I just debugged a user's strange issue with tasks not executing in a very basic bare bitbake setup, and we realised that the "BitBake hello world" tutorial in the bitbake manual sets values for WORKDIR and STAMP that do not allow for more than one recipe to build, and that was the cause of the issue.

It tells you to set this in conf/bitbake.conf:

     TMPDIR  = "${TOPDIR}/tmp"
     CACHE   = "${TMPDIR}/cache"
     STAMP   = "${TMPDIR}/stamps"
     T       = "${TMPDIR}/work"
     B       = "${TMPDIR}"

TMPDIR and CACHE are fine, but B, T and STAMP will prevent more than one recipe from working. Now, in order to fix this one has to have a value for at least PN, and since there isn't a default that means you have to either set it in the recipe or set a value similar to what OE or bitbake's default bitbake.conf does in order to pick it up from the file name; then you need to include ${PN} in the value set for STAMP, T, and B. I appreciate that complicates the example but it prevents users from stumbling over odd behaviour when they attempt to build on the example by adding additional recipes.
Comment 1 Kristi 2017-09-13 23:38:40 UTC
Taking ownership of this one - Paul, this is the proposed solution to updating this example: 

From within the conf directory, use some editor to create the bitbake.conf so that it contains the following:

     PN  = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"

     TMPDIR  = "${TOPDIR}/tmp"
     CACHE   = "${TMPDIR}/cache"
     STAMP   = "${PN}/${TMPDIR}/stamps"
     T       = "${PN}/${TMPDIR}/work"
     B       = "${PN}/${TMPDIR}"
             
NOTE: Without a value for PN, the variables STAMP, T, and B, prevent more than one recipe from working. You can fix this by setting PN to have a value similar to what OpenEmbedded and bitbake set in the default bitbake.conf file and prefacing STAMP, T, and B with PN.

Let me know if this fixes the problem, or if not, please update as necessary.  Thanks! 

Kristi
Comment 2 Paul Eggleton 2017-09-13 23:49:18 UTC
Either set PN like that as OE does, yes, or each recipe has to manually set PN; either works.

Note that you have several references to "${PN}/${TMPDIR}" where I think you mean "${TMPDIR}/${PN}". So it's "including ${PN} in the value" rather than prefacing it.
Comment 3 Kristi 2017-09-13 23:58:11 UTC
Thanks Paul! I've updated based on Comment 2 to the following: 

From within the conf directory, use some editor to create the bitbake.conf so that it contains the following:

     PN  = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"

     TMPDIR  = "${TOPDIR}/tmp"
     CACHE   = "${TMPDIR}/cache"
     STAMP   = "${TMPDIR}/${PN}/stamps"
     T       = "${TMPDIR}/${PN}/work"
     B       = "${TMPDIR}/${PN}"

NOTE: Without a value for PN, the variables STAMP, T, and B, prevent more than one recipe from working. You can fix this by either setting PN to have a value similar to what OpenEmbedded and bitbake use in the default bitbake.conf file (see previous exmaple). Or, by manually updating each recipe to set PN. You will also need to include PN as part of the STAMP, T, and B variable definitions in the local.conf file.

Does this work?
Comment 4 Kristi 2017-09-19 23:33:33 UTC
I've updated this section based on Paul's review in Comment 2. You can see the changes in step 5 here; http://www.yoctoproject.org/docs/2.4/bitbake-user-manual/bitbake-user-manual.html#hello-world-example

Please let me know if further edits are necessary, or if this is okay. 

Thanks!
Comment 5 Kristi 2017-09-25 23:07:58 UTC
Moving to Milestone 2.5 M1
Comment 6 Paul Eggleton 2017-12-19 20:52:22 UTC
Looks good to me. One minor thing though in this section - " (other than the cached information used by the Setscene process" is missing a closing parenthesis.
Comment 7 Kristi 2017-12-22 19:40:33 UTC
Thanks Paul. Setting to RESOLVED / Done.