Bug 689

Summary: BB_ENV_EXTRAWHITE does not respect CCACHE_DIR
Product: [Documentation] Reference Reporter: Wolfgang Denk <wd>
Component: handbookAssignee: Scott Rifenbark <srifenbark>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: Medium CC: poky.bs.watcher, poky.doc.watcher, poky.watcher, richard.purdie, sgw
Version: 1.0   
Target Milestone: 1.0 M4   
Hardware: All   
OS: Multiple   
URL: 182aa61693c2c7de8331569c30cbb8f41dad2315
Whiteboard: 14-dec-2011: Resolved/fixed
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Wolfgang Denk 2011-01-31 13:06:05 UTC
I am trying to stop poky builds from accessing my $HOME/.ccache directory (which i NFS mounted and thus slower than local disk accesses could be). I set env export CCACHE_DIR to point to the chosen directory, and "ccache -s" confirms that it picks up my new setting. Also, manual runs of ccache show that it works as expected.

Then I added CCACHE_DIR to the list of variables in BB_ENV_EXTRAWHITE:
$ export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE CCACHE_DIR"

I verified (by peeking at BitBaker's /proc/<id>/environ) that this setting gets really used for the build - but BitBaker continues tro access my $HOME/.ccache file.
Comment 1 Richard Purdie 2011-01-31 13:38:57 UTC
Try adding "export CCACHE_DIR" to local.conf. You're only added it to bitbake's internal datastore with what you've described so far as far as I can tell.
Comment 2 Wolfgang Denk 2011-02-01 11:16:31 UTC
Confirmed, this works.  Thanks a lot!

Where can I find such information in the documentation?
Comment 3 Scott Rifenbark 2011-02-08 11:19:47 UTC
We could document CCACHE_DIR in the variables appendix. 

Is CCACHE_DIR a Poky variable?  

Also, BB_ENV_EXTRAWHITE is not documented in the Poky Reference Manual.
Comment 4 Scott Rifenbark 2011-02-24 05:38:49 UTC
No response to question "Is CCACHE_DIR a poky variable?"  I need more information on this bug.
Comment 5 Richard Purdie 2011-11-25 09:02:26 UTC
CCACHE_DIR is not a Poky variable. I'd suggest somewhere in a manual we
document the following:

"""
Bitbake tightly controls the execution environment of the build tasks to
ensure that unwanted contamination from the build machine can't
influence the build. This means that if you do want something to get
passed into the build task's environment there are a few steps.

Firstly, you need to tell bitbake to load something from the environment
into the data store. This is done by a command like the following to add
your variable (CCACHE_DIR in thie example) to BB_ENV_WHITELIST:

export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE CCACHE_DIR"

You then need to tell bitbake to export this to the task environment of
every running task as the above only makes this available in the
datastore. You can do this with the following somewhere in the
configuration (local.conf, distro config etc.):

export CCACHE_DIR

The downside of doing this is that bitbake will now record this variable
as a dependency of the build process in things like the sstate
checksums. If this isn't something that is required, it can be
whitelisted as a variable to ignore by adding it to the list of
variables in BB_HASHBASE_WHITELIST.
"""
Comment 6 Scott Rifenbark 2011-12-14 15:50:53 UTC
Updated the "Running a Task" section in the BitBake Appendix of the YP Reference Manual.  Previously, this section had a general description of what happens when a task is run and how environment variables are handled.  I updated the section to talk specifically about the issue noted in this bug report.  I documented the steps the user would need to do to actually move an environment variable's effects from the BB data store into the actual task execution environment.  I also included a note at the end of the section warning of the potential downside that could occur during the checksum generation since the variable moved to the task execution environment would now be considered a build dependency.

To see the new section look at 

http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#ref-bitbake-tasklist