aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tinfoil.py
AgeCommit message (Collapse)Author
2017-02-03bitbake: tinfoil: clean environment when starting up cookerPaul Eggleton
During normal bitbake execution, the environment is cleaned of variables not on a whitelist while starting up cooker, and then restored afterwards. Prior to the tinfoil2 rework in master we were taking a number of shortcuts within tinfoil and one of those was not doing this environment cleaning. However, prior to OE-Core rev 3d39ca5c91dbb62fb43199f916bd390cd6212e3d we didn't have any code (as far as I'm aware) that was affected by this shortcut, hence why this wasn't an issue up to now. The result is the following error when attempting to run "devtool build" in the eSDK, as CCACHE_PATH is allowed through from the eSDK's environment setup script: ----------- snip ----------- ccache: error: Could not find compiler "gcc" in PATH ... subprocess.CalledProcessError: Command 'gcc --version' returned non-zero exit status 1 ----------- snip ----------- We can fix this by simply doing the environment filtering while we are starting up cooker, thus the environment when uninative.bbclass comes to do the gcc version check it is not affected by CCACHE_PATH or other variables in the external environment that should be filtered out. For clarity, this patch is only applicable to the bitbake 1.32 branch as used for the OE-Core morty branch - master uses the reworked tinfoil2 and doesn't need this fix. Fixes [YOCTO #10961]. (Bitbake rev: a240f5ff71092cb209c44a071cd6fa07756ccfa0) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-02bitbake: tinfoil: add a parse_recipe_file functionPaul Eggleton
Parsing a recipe is such a common task for tinfoil-using scripts, and is a little awkward to do properly, so add an API function to do it. This should also isolate scripts a little from future changes to the internal code. The first user of this will be the OpenEmbedded layer index update script. Part of the fix for [YOCTO #10192]. (Bitbake rev: 39780b1ccbd76579db0fc6fb9369c848a3bafa9d) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-02bitbake: tinfoil: add context manager functionsPaul Eggleton
Since calling the shutdown() function is highly recommended, make tinfoil objects a little easier to deal with by adding context manager support - so you can do the following: with bb.tinfoil.Tinfoil() as tinfoil: tinfoil.prepare(True) ... (Bitbake rev: f59bc6be2b4af1acdcf6a1b184956b5ffd297743) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-08-18bitbake: bitbake: Initial multi-config supportRichard Purdie
This patch adds the notion of supporting multiple configurations within a single build. To enable it, set a line in local.conf like: BBMULTICONFIG = "configA configB configC" This would tell bitbake that before it parses the base configuration, it should load conf/configA.conf and so on for each different configuration. These would contain lines like: MACHINE = "A" or other variables which can be set which can be built in the same build directory (or change TMPDIR not to conflict). One downside I've already discovered is that if we want to inherit this file right at the start of parsing, the only place you can put the configurations is in "cwd", since BBPATH isn't constructed until the layers are parsed and therefore using it as a preconf file isn't possible unless its located there. Execution of these targets takes the form "bitbake multiconfig:configA:core-image-minimal core-image-sato" so similar to our virtclass approach for native/nativesdk/multilib using BBCLASSEXTEND. Implementation wise, the implication is that instead of tasks being uniquely referenced with "recipename/fn:task" it now needs to be "configuration:recipename:task". We already started using "virtual" filenames for recipes when we implemented BBCLASSEXTEND and this patch adds a new prefix to these, "multiconfig:<configname>:" and hence avoid changes to a large part of the codebase thanks to this. databuilder has an internal array of data stores and uses the right one depending on the supplied virtual filename. That trick allows us to use the existing parsing code including the multithreading mostly unchanged as well as most of the cache code. For recipecache, we end up with a dict of these accessed by multiconfig (mc). taskdata and runqueue can only cope with one recipecache so for taskdata, we pass in each recipecache and have it compute the result and end up with an array of taskdatas. We can only have one runqueue so there extensive changes there. This initial implementation has some drawbacks: a) There are no inter-multi-configuration dependencies as yet b) There are no sstate optimisations. This means if the build uses the same object twice in say two different TMPDIRs, it will either load from an existing sstate cache at the start or build it twice. We can then in due course look at ways in which it would only build it once and then reuse it. This will likely need significant changes to the way sstate currently works to make that possible. (Bitbake rev: 5287991691578825c847bac2368e9b51c0ede3f0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23bitbake: tinfoil: remove logging handler at shutdownMarkus Lehtonen
Otherwise the logger gets multiple handers (and the user get duplicate logging output) if another tinfoil instance is initialized after one is shut down(). (Bitbake rev: 74d67be7a4b591fab2278f7c184f282d11620c62) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-01bitbake: cooker: properly fix bitbake.lock handlingRichard Purdie
If the PR server or indeed any other child process takes some time to exit (which it sometimes does when saving its database), it can end up holding bitbake.lock after the UI exits, which led to errors if you ran bitbake commands successively - we saw this when running the PR server oe-selftest tests in OE-Core. The recent attempt to fix this wasn't quite right and ended up breaking memory resident bitbake. This time we close the lock file when cooker shuts down (inside the UI process) instead of unlocking it, and this is done in the cooker code rather than the actual UI code so it doesn't matter which UI is in use. Additionally we report that we're waiting for the lock to be released, using lsof or fuser if available to list the processes with the lock open. The 'magic' in the locking is due to all spawned subprocesses of bitbake holding an open file descriptor to the bitbake.lock. It is automatically unlocked when all those fds close the file (as all the processes terminate). We close the UI copy of the lock explicitly, then close the server process copy, any remaining open copy is therefore some proess exiting. (The reproducer for the problem is to set PRSERV_HOST = "localhost:0" and add a call to time.sleep(20) after self.server_close() in lib/prserv/serv.py, then run "bitbake -p; bitbake -p" ). Cleanup work done by Paul Eggleton <paul.eggleton@linux.intel.com>. This reverts bitbake commit 69ecd15aece54753154950c55d7af42f85ad8606 and e97a9f1528d77503b5c93e48e3de9933fbb9f3cd. (Bitbake rev: a29780bd43f74b7326fe788dbd65177b86806fcf) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-24bitbake: tinfoil: Add shutdown methodRichard Purdie
One drawback to tinfoil is that once a cooker is created, it will hold the cooker lock and stop any other bitbake execution against a directory. Add a shutdown method to tinfoil, allowing other users to use the build directory after the tinfoil usage is no longer needed. (Bitbake rev: e44ce85fe551677fc0dcc1da4f789a0c13093ff1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-25bitbake: bin/bitbake: Create bitbake_main APIEd Bartosh
Moved most of functionality of bin/bitbake to lib/bb/main.py to be able to call bitbake from python code. (Bitbake rev: d377f7f88d73f4e5d2dffef03d6acee809827ac6) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-05bitbake: tinfoil: add a means of enabling variable history trackingPaul Eggleton
Unfortunately it seems like the external use of the cooker enableDataTracking() function broke at some point since the code that reads it now runs within BBCooker's constructor. Since this now has to be done early, add a parameter to Tinfoil's constructor to allow enabling variable history tracking. Fixes [YOCTO #6676]. (Bitbake rev: a9439b136f55f3f0e80ff053cd3b159da69ba362) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-10bitbake: tinfoil: fix for move of data attribute to cookerPaul Eggleton
(Bitbake rev: c400fe36f7609d53fb413484dc03bbce307f31f9) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-24bitbake: cooker/cookerdata: Improve configuration object handlingRichard Purdie
Originally it seemed like a good idea to keep the parameters around. Having seen this in real life use, its incorrect, we should pull all the data we need into the cooker's configuguration and then use this to build the datastore. Being able to just build the datastore from the parameters seemed like a good idea but having a dummy cooker configuration object is now looking like the better option. This also fixes failures in hob since the parseFiles command can call into cooker directly now and reset the configuration prefiles and postfiles at will, rather than the indirect calls before which were breaking the datastore (e.g. BBPATH wasn't set). The cleanup this allows in tinfoil illustrates how this change makes more sense. (Bitbake rev: f50df5b891bf318f12fc61c74adfcc626cc6f836) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-22bitbake: tinfoil: fix for changes to cooker config structurePaul Eggleton
Fix the code here for recent changes to the initialisation of configuration objects for cooker. (Bitbake rev: 9d3ca9aa73a448b0594f03ac8e8317403ec0dc8d) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-13bitbake: cooker/bitbake-layers/tinfoil: Fix recipecache typoRichard Purdie
(Bitbake rev: 0f5eee689992f84d263cb817dc2ce755a9a075f7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-12bitbake: bitbake-layers/tinfoil: Catch up with status -> recpiecache renameRichard Purdie
(Bitbake rev: 0a9cbe7a6a17c5df38cd442ee8650097d6bbf502) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-31bitbake: tinfoil: support other fds, enable color supportChristopher Larson
Rather than only handling sys.stdout, also support any arbitrary file object, and enable color for the formatter if that file is a tty. (Bitbake rev: c46db4be4cc4dc53376ed3f574b2f1c868730f2a) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-10bitbake: tinfoil: Add file inadvertently not committedRichard Purdie
(Bitbake rev: 44a3fb49e817be641090d5d1bce7b586af407d71) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>