aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/tinfoil.py
AgeCommit message (Collapse)Author
2021-03-11tinfoil: Honor quiet when parsing recipesManuel Leonhardt
When using parse_recipes, honor quiet so that scripts and custom plugins for recipetool are able to mute progress bars from bitbake that would otherwise print to STDOUT. Signed-off-by: Manuel Leonhardt <mleonhardt@arri.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-09tinfoil: When sending commands we need to process eventsRichard Purdie
The server may be displaying useful information for the user through log messages so we should display anything that has been sent. Its either this or expecting every UI to implement this code around every command call which isn't good API. [YOCTO #14054] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-12tinfoil: Ensure sockets don't leak even when exceptions occurRichard Purdie
We're seeing leaking open socket connections when errors occur and tinfoil is in use. Improve the exception handling so the sockets are closed even if exceptions occur, allowing more robust behaviour when things go wrong. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-25lib: fix most undefined code picked up by pylintFrazer Clews
Correctly import, and inherit functions, and variables. Also fix some typos and remove some Python 2 code that isn't recognised. Signed-off-by: Frazer Clews <frazerleslieclews@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-24main/server/process: Drop configuration object passingRichard Purdie
The first thing the UIs do is update the server config from the UI. We can just rely upon that and start the server with a standard config, removing the need to pass the confusing configuration object around as well as configParams, which contains a similar copy of some of the data. This makes memory resident bitbake work the same way as the normal mode, removing the opportunity for some class of bugs. The xmlrpcinterface and server_timeout values are passed in at server startup time now and there no longer a second option in the configuration which is effective ignored once the server starts. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-06bitbake: cooker: Split file collections per multiconfigJoshua Watt
Splits the cooker to track a collection per multiconfig instead of a single collection for all multiconfigs. Practically speaking, this allows each multiconfigs to each have different BBMASKs that apply to it instead of each one using the mask specified in the base configuration. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-24tinfoil: fix config_data mess up insane check while parsing multiple recipesHongxu Jia
Since commit [tinfoil: Simplify remote datastore connections][1] and [tinfoil: Add back ability to parse on top of a datastore][2] applied, bitbake run command parseRecipeFile with param config_data.dsindex rather than config_data. While calling tinfoil.parse_recipe_file() with one config_data (with the same config_data.dsindex) to parse multiple recipes, it will mess up insane check. It broke update_layer.py on layerindex, here are the simplified steps: [snip] t= bb.tinfoil.Tinfoil() t.prepare() data = bb.data.createCopy(t.config_data) fn = "path_to/oe-core/meta/recipes-graphics/images/core-image-clutter.bb" t.parse_recipe_file(fn, appends=False, config_data=data) fn = "path_to/oe-core/meta/recipes-graphics/packagegroups/packagegroup-core-x11-base.bb" t.parse_recipe_file(fn, appends=False, config_data=data) | File "path_to/oe-core/meta/classes/insane.bbclass", line 1303, in __anon_1304__path_to_oe_core_meta_classes_insane_bbclass | bb.fatal("Fatal QA errors found, failing task.") [snip] In above failure, RDEPENDS is assigned `${PACKAGE_INSTALL} ${LINGUAS_INSTALL} ${IMAGE_INSTALL_DEBUGFS}' in core-image-clutter.bb, but it broke insane check on packagegroup-core-x11-base.bb >From commit [remotedata: enable transporting datastore from the client to the server][3], it create a new DataSmart to save receive_datastore's remote_data Similarly, make a copy of config_data(with different config_data.dsindex) could fix the issue. [1] http://git.openembedded.org/bitbake/commit/?id=85e03a64dd0a4ebe71009ec4bdf4192c04a9786e [2] http://git.openembedded.org/bitbake/commit/?id=4618da2094189e4d814b7d65672cb65c86c0626a [3] http://git.openembedded.org/bitbake/commit/?id=784d2f1a024efe632fc9049ce5b78692d419d938 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-06tinfoil: Add back ability to parse on top of a datastoreyocto-3.12020-04-dunfell1.46.0Richard Purdie
This option was removed recently as we didn't realise the layerindex relies upon it. Add back the API which it turns out can be supported as long as we assume the datastore passed in is a remote datastore which it usually would be unless created locally. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-24tinfoil: Add iterator support for DataStoreConnectorRichard Purdie
Some usages need to iterate the datastore. This is slow and not recommended but support this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-24tinfoil: Simplify remote datastore connectionsRichard Purdie
The current approach to remote datastores used in tinfoil is breaking. For example, adding a devupstream extension to a recipe with a git upstream, making it the preferred version and then running "devtool modify" on it causes get_srcrev() circular dependency issues. The problem is the override handling in the datastore is broken. This gets broken since remotedata:recieve_datastore() sets d.dict but doesn't update d.overridedata (or d.inchistory or d.varhistory). We could play whack-a-mole but the current implementation seems to be flawed to me. It also doesn't cover, or only partially covers some datastore operations and each needs new dedicated command API. Instead, step back and reimplement the way the datastore connector works. With this change, the datastore is either remote or local but the data is not spread on two sides of the connection. All the API is proxied over the connection by a single function for the datastore (and two to support variable history and include history). This code does not support using the datastore as a parameter to any data store functions. We did have one case of that but its just bad code and can be replaced. The result is something which is much simpler and less invasive to the datastore code itself, meaning its behaviour should be much more consistent. The existing tests for the remote data no longer make any sense and are removed. The one bug this code would have is if key/value pairs are returned over the IPC and those values contained a DataSmart object since we don't recurse into return values to find such things. Nothing appears to do that currently so lets worry about it if its ever an issue. This change should simplfy a ton of other issues and avoid a ton of other bugs so is a huge net gain. Tested with bitbake's and OE's selftests. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-23tinfoil: Drop parse_recipe_file custom datastore supportRichard Purdie
This parameter is unused except for a single selftest and is problematic with regard to fixing some other bugs. Remove it for now, if really needed we could re-implement it in some other way in the future. Experience tells us we likely don't want to support this kind of change to the metadata anyway as its not as useful as it first sounds/appears. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-13tinfoil: Update to match recent knotty console changesRichard Purdie
This updates tinfoil to match recent changes to the logging code in knotty. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-12knotty: Remove dependency on format variableJoshua Watt
Passing around the log formatter variable was unnecessary since the log levels of interest can be accesses as class members of bb.msg.BBLogFormatter. Switching to do this will make using the structured python logging much easier, since it can be difficult to extract out the formatter for a specific handler. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-06tinfoil: Add multiconfig supportJoshua Watt
Adds support for the Tinfoil cache adaptor to be bound to a specific multiconfig and invoke the appropriate commands for that multiconfig instead of the default. The cooker adapter now creates a cache adapter for each multiconfig specified in BBMULTICONFIG so that each multiconfig is present. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-01-19lib: remove unused importsFrazer Clews
removed unused imports which made the code harder to read, and slightly but less efficient Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Drop duplicate license boilerplace textRichard Purdie
With the introduction of SPDX-License-Identifier headers, we don't need a ton of header boilerplate in every file. Simplify the files and rely on the top level for the full licence text. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie
This adds the SPDX-License-Identifier license headers to the majority of our source files to make it clearer exactly which license files are under. The bulk of the files are under GPL v2.0 with one found to be under V2.0 or later, some under MIT and some have dual license. There are some files which are potentially harder to classify where we've imported upstream code and those can be handled specifically in later commits. The COPYING file is replaced with LICENSE.X files which contain the full license texts. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11tinfoil: ensure get_recipe_info() returns Null if recipe not foundPaul Eggleton
If a matching recipe is not found then return Null instead of raising KeyError because we were blindly using None as a key for pkg_fn. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-08tinfoil: Ensure we clean up loggersRichard Purdie
This is primarily paranoid but ensure we remove any loggers we setup either directly or indirectly so the initial state is restored after we exit. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31tinfoil: ensure variable history tracking works when parsing a recipePaul Eggleton
If you set tracking=True when creating the tinfoil object, that ensures history is collected for the main datastore, but at the end of parsing the configuration, history tracking gets turned off to save time with the result that we don't collect history for any recipes we parse. Enable tracking when we parse a recipe (and disable it afterwards if we enabled it) in order to fix this. This fixes functionality in OE's devtool that relies upon variable history (such as devtool upgrade updating PV when it's set within a recipe). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31tinfoil: ensure log lines get printed when tasks failPaul Eggleton
If a task fails during build_targets(), we need to print out the log lines as knotty does or the user will be missing information about the failure. (This should get some deeper refactoring, but now isn't the time for that.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31tinfoil: fix log message doubling when config_only=FalsePaul Eggleton
With config_only=False we launch the UI and it sets up a logger, whereas when config_only=True we don't, with the result that with True we are seeing log messages from both our logger and the one set up by the UI. Suppress our loggers with config_only=True to avoid this. Fixes [YOCTO #11275] (again). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-08Revert "tinfoil: fix duplication of log messages"Paul Eggleton
In combination with the recent server reworking, this change actually prevents messages sent from tasks from being logged properly. This will of course give us the duplicated messages back, and I really hate to do that effectively a second time, but that's better than seeing no error at all in the case of a failure - we'll have to find the proper way of avoiding the duplication that doesn't result in some messages going missing. This reverts commit 8a5bae76f91f2411187c638a42fa3c762052cf11. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: add more doc commentsPaul Eggleton
We want this API to be easier to use, so add missing function documentation to help with that. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: add simple API for getting cached recipe informationPaul Eggleton
A common task for tinfoil-using scripts is to iterate over all recipes. This isn't too difficult with the current API, but the pkg_* variables are a little awkward and are really designed for bitbake's internal usage - and it gets a bit more difficult when you want to access some of the other information such as packages and rprovides. To resolve this, create a new recipe info class and add an all_recipes() function to generate this for all recipes. Also add a get_recipe_info() function to get the information for a specific recipe (by PN). (It might perhaps be suggested that we already have a structure similar to this in the cache, however the one we add here is designed for external use and allows the internal structures to change if needed without affecting the API). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: enable access to additional cached itemsPaul Eggleton
Add access to fn_provides, packages, packages_dynamic and rproviders on the recipecache object. This requires an additional corresponding command plumbing to be added. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: add functionality for running full buildsPaul Eggleton
Up to this point, if you wanted to run build tasks in the normal way they get run from a python script, there was no other way than to shell out to bitbake. Worse than that, you couldn't have tinfoil active during that because only one bitbake instance could be running at once. As long as we're prepared to handle the events produced, we can create a wrapper around calling the buildTargets command. Borrow code from knotty to do this in such a way that we get the expected running task display (courtesy of TermFilter) and Ctrl+C handling. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: set a flag when recipes have been parsedPaul Eggleton
Make it easy to determine if recipes are parsed (and thus information about available recipes is in memory). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: add a parse_recipes() functionPaul Eggleton
Python style recommends underscore based naming rather than camelCase, and thus the former has been used for most of tinfoil's functions. Add an underscored version of parseRecipes() for consistency and change the one place we call it to use the new version. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21tinfoil: add internal mode to build_file() functionPaul Eggleton
In OE's devtool we want to repeatedly run build_file() without showing unnecessary messages and triggering buildhistory for each call. build_file() is just a wrapper around the buildFile command. Change the final "hidewarning" parameter of the buildFile command to "internal" and have this call a new buildFileInternal() function without triggering any of the normal build events, silencing the normal info messages from the runqueue ("Executing RunQueue Tasks", "Tasks Summary" etc.) and avoiding calling parseConfiguration() which we've already done at this point. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21server: Rework the server API so process and xmlrpc servers coexistRichard Purdie
This changes the way bitbake server works quite radically. Now, the server is always a process based server with the option of starting an XMLRPC listener on a specific inferface/port. Behind the scenes this is done with a "bitbake.sock" file alongside the bitbake.lock file. If we can obtain the lock, we know we need to start a server. The server always listens on the socket and UIs can then connect to this. UIs connect by sending a set of three file descriptors over the domain socket, one for sending commands, one for receiving command results and the other for receiving events. These changes meant we can throw away all the horrid server abstraction code, the plugable transport option to bitbake and the code becomes much more readable and debuggable. It also likely removes a ton of ways you could hang the UI/cooker in weird ways due to all the race conditions that existed with previous processes. Changes: * The foreground option for bitbake-server was dropped. Just tail the log if you really want this, the codepaths were complicated enough without adding one for this. * BBSERVER="autodetect" was dropped. The server will autostart and autoconnect in process mode. You have to specify an xmlrpc server address since that can't be autodetected. I can't see a use case for autodetect now. * The transport/servetype option to bitbake was dropped. * A BB_SERVER_TIMEOUT variable is added which allows the server to stay resident for a period of time after the last client disconnects before unloading. This is used if the -T/--idle-timeout option is not passed to bitbake. This change is invasive and may well introduce new issues however I believe the codebase is in a much better position for further development and debugging. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-09tinfoil: fix duplication of log messagesPaul Eggleton
Adding an additional logger in setup_bitbake() interacts poorly with the logger we have added by default in tinfoil's constructor, with the result that messages may be doubled or even tripled in tinfoil-using scripts. Disable adding this one when calling setup_bitbake() from tinfoil to avoid this problem. Part of the fix for [YOCTO #11275]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-06-04tinfoil: allow extra features to be passed to prepareAndy Voltz
Signed-off-by: Andy Voltz <andy.voltz@timesys.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-30tinfoil: improve get_recipe_file() exception textPaul Eggleton
* Turn reasons from a list into a string (usually there will be only one reason, but the interface provides for more than one) and state up front that the recipe is unavailable for clarity * Use quotes around invalid recipe name Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-30tinfoil: fix get_recipe_file() to return an error on invalid recipePaul Eggleton
This function calls cooker.findBestProvider() but didn't handle the fact that that function returns a tuple (None, None, None, None) when there is no matching recipe. (This fixes devtool in OpenEmbedded showing a traceback when an invalid recipe is specified instead of a proper error message.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-27tinfoil: enable client-side logger handling by defaultPaul Eggleton
If you had a script that uses tinfoil and it failed to connect to the BitBake server, you did't see any of the expected messages - this was because client-side logging wasn't being handled at all. Since you'll almost always want this when using tinfoil, have it use the new bb.msg.logger_create() function to enable client-side logging by default. Relates to [YOCTO #11185]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-21data_smart: implement missing remote datastore operationsPaul Eggleton
Enable the following operations from a remote datastore to affect the other end: * setVarFlag() * delVar() * delVarFlag() * renameVar() In practice I don't expect these to be used much, but they should be present so that the implementation is at least reasonably filled out and that the tests pass. Also add tests for the interface, mostly by subclassing the existing local test classes so that they are using a remote datastore. (These don't actually test remote usage via tinfoil, just that the datastore's interface can be used.) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-21tinfoil: fix override handling in remote datastoresPaul Eggleton
There was a huge gap in the remote datastore code introduced in the tinfoil2 rework - we weren't handling overrides at all, since these are stored separately from the actual data in the DataSmart object. Thus, when a datastore actually represents a remote datastore we need to go back to that remote datastore to get the override data as well, so introduce code to do that. To avoid a second round-trip I had to modify the _findVar() function to return the override data as well. This will increase the overhead a little when that data is superfluous, but without making the function even uglier I don't think there's a way to avoid that. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-19tinfoil: ensure PATH includes bitbake's bin directoryPaul Eggleton
The runqueue expects to be able to run 'bitbake-worker' from PATH, but for example in the OE extensible SDK, tinfoil is used within devtool where this isn't the case (we're not exposing bitbake to the user, thus bitbake's bin directory isn't in PATH). This fixes devtool modify usage within the extensible SDK which has apparently been broken since the tinfoil2 changes went in. Fixes [YOCTO #11034]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14cooker: allow buildFile warning to be hidden programmaticallyPaul Eggleton
If we want to use this function/command internally, we don't want this warning shown. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14tinfoil: pass datastore to server when expanding python referencesPaul Eggleton
If you're expanding a value that refers to the value of a variable in python code, we need to ensure that the datastore that gets used to get the value of that variable is the client-side datastore and not just the part of it that's on the server side. For example, suppose you are in client code doing the following: d.setVar('HELLO', 'there') result = d.expand('${@d.getVar("HELLO", True)}') result should be "there" but if the client part wasn't taken into account, it would be whatever value HELLO had in the server portion of the datastore (if any). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14tinfoil: implement server-side recipe parsingPaul Eggleton
It's not really practical for us to parse recipes on the client side, we need to do it on the server because that's where we have the full python environment (including any "pure" python functions defined in classes). Thus, add some functions to tinfoil do this including a few shortcut functions. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14tinfoil: rewrite as a wrapper around the UIPaul Eggleton
Rewrite tinfoil as a wrapper around the UI, instead of the earlier approach of starting up just enough of cooker to do what we want. This has several advantages: * It now works when bitbake is memory-resident instead of failing with "ERROR: Only one copy of bitbake should be run against a build directory". * We can now connect an actual UI, thus you get things like the recipe parsing / cache loading progress bar and parse error handling for free * We can now handle events generated by the server if we wish to do so * We can potentially extend this to do more stuff, e.g. actually running build operations - this needs to be made more practical before we can use it though (since you effectively have to become the UI yourself for this at the moment.) The downside is that tinfoil no longer has direct access to cooker, the global datastore, or the cache. To mitigate this I have extended data_smart to provide remote access capability for the datastore, and created "fake" cooker and cooker.recipecache / cooker.collection adapter objects in order to avoid breaking too many tinfoil-using scripts that might be out there (we've never officially documented tinfoil or BitBake's internal code, but we can still make accommodations where practical). I've at least gone far enough to support all of the utilities that use tinfoil in OE-Core with some changes, but I know there are scripts such as Chris Larson's "bb" out there that do make other calls into BitBake code that I'm not currently providing access to through the adapters. Part of the fix for [YOCTO #5470]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-02tinfoil: 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]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-09-02tinfoil: 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) ... Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
2016-08-17bitbake: 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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-23tinfoil: 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(). Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-31cooker: 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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-23tinfoil: 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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-24bin/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. Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>