summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/data.py
AgeCommit message (Collapse)Author
2020-08-25bitbake: lib: 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. (Bitbake rev: b0c807be5c2170c9481c1a04d4c11972135d7dc5) Signed-off-by: Frazer Clews <frazerleslieclews@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-04-06bitbake: data/siggen: Don't expand ignored variablesRichard Purdie
If a variable is in the signature whitelist, we'd currently expand it, then later ignore the data. This is problemtic for code which has effects when expanded, recently source date epoch in OE-Core for example. We don't actually need to do this, if we pass the whitelist into the earlier function it can avoid the expansion. This also also give a small performance boost since we avoid running code in some cases. [YOCTO #13581] (Bitbake rev: f483ee4a869fb1dafbe4bdf2da228cdaa40b38bd) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-03-24bitbake: tinfoil: 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. (Bitbake rev: 85e03a64dd0a4ebe71009ec4bdf4192c04a9786e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-09-27bitbake: tests/data: Test combinations of _append together with overrideJacob Kroon
(Bitbake rev: f31f35e8527c60a95931a4a8311a4cd237770b42) Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-08-06bitbake: siggen: Clean up task reference formatsRichard Purdie
Currently siggen uses the format "<filename>.<taskname>" for referencing tasks whilst runqueue uses "<filename>:<taskname>". This converts to use ":" as the separator everywhere. This is an API breaking change since the cache is affected, as are siginfo files and any custom signature handlers such as those in OE-Core. Ultimately this will let us clean up and the accessor functions from runqueue, removing all the ".rsplit(".", 1)[0]" type code currently all over the place. Once a standard is used everwhere we can update the code over time to be more optimal. (Bitbake rev: 07e539e1c566ca3434901e1a00335cb76c69d496) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: bitbake: Strip old editor directives from file headersRichard Purdie
There are much better ways to handle this and most editors shouldn't need this in modern times, drop the noise from the files. Its not consitently applied anyway. (Bitbake rev: 5e43070e3087d09aea2f459b033d035c5ef747d0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: bitbake: 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. (Bitbake rev: 695d84397b68cc003186e22f395caa378b06bc75) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-04bitbake: bitbake: 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. (Bitbake rev: ff237c33337f4da2ca06c3a2c49699bc26608a6b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-01-08bitbake: tests.data: Add underscore+numeric in overrides datastore testRichard Purdie
Add a test for x86_64 in overrides where is was being incorrectly handled. There was a previous fix (3a3be518536acc868c7eeb3c1111ad1b321480b7) but this ensures we don't regress. (Bitbake rev: 08c314eac231ac9292c8c95f1c5a6fc2023fe749) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-20bitbake: data_smart: Fix removal handling interaction issue with overridesRichard Purdie
If a variable has a _remove applied to it but that variable is in turn 'renamed' through OVERRIDES, the removal gets lost with the current code. TEST = "foo" TEST_someval = "bar" TEST_someval_remove = "bar" OVERRIDES = "someval" currently gives "bar" for TEST but should give "". This fixes the code to track the removal and adds a test case to ensure this doesn't regress again. (Bitbake rev: 8f55010c18057be040f073d8bcb4c5c2c311d809) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18bitbake: test/data: Add new tests for task checksum changing/not changingRichard Purdie
This adds some basic tests for task checksums to ensure that the checksums: * change when variables change * change when active _remove operators are present * don't change when the _remove operators are not active * change when an active contains() expression is present * dont' change a contains() expression isn't active There is a lot of other functionality which should be added to this test but its a start. (Bitbake rev: 5463c16e3619d324aed137f47f93f0997a227d29) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-10-18bitbake: data: Fix whitespace on _remove operationsRichard Purdie
We have some slightly odd behaviours with the current implementation of _remove operations. For example: TEST = " A B" TEST_remove = "C" would trigger TEST to become "A B" even thought it doesn't contain "C". In particular, this means that an inactive remove operator added in a bbappend could change the task checksum which is not desireable. Fix the operation to preserve whitespace, adding new tests to make this explict and test further corner cases. Also update the manual to match. (Bitbake rev: c0a23dd9155c50a6b7df796980bc7b612cac7994) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-12bitbake: data_smart: Ensure _remove operations on newly set variables are ↵Richard Purdie
cleared We clear append/prepend on newly set variables, we should also clear remove operations. If we don't do this, there is no way we can actually delete a remove operation. Bitbake internally uses parsing=True to avoid these side effects when making its own internal calls. Also add a testcase to bitbake-selftest to ensure we remain consistent going forward from here. (Bitbake rev: 3a319f079d699c870d8531e051ab65e6278d1fa5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-22bitbake: data_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.) (Bitbake rev: 282dc0719d22a39df746eea762ebe05c66aa8f8a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-22bitbake: tinfoil: 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. (Bitbake rev: 4f9d6f060ed247fb6fa2f45668a892a1788d3f91) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-16bitbake: tests/data: Add inactive remove override testRichard Purdie
In 2bc4d35fb32defc59cd6ed1fc87e35924c201a5c we fixed cases where an inactive remove override was influecing the value of a variable. This adds a test case for this issue. (Bitbake rev: 1ff9b3c669fa187f152de7b8b57d14c2468d926c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15bitbake: lib: Drop now unneeded update_data callsRichard Purdie
Now that the datastore works dynamically we don't need the update_data calls so we can just remove them. They're not actually done anything at all for a while. (Bitbake rev: 2300beb50333bb620013b058a7309e7f2042101d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16bitbake: bitbake: remove True option to getVar calls (take 2)Joshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) (a follow on patch to fix up a few recent introductions) (Bitbake rev: f9961fd5beb31d5ab9656a5be59f7ab3effef2f0) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14bitbake: data_smart: support serialisationPaul Eggleton
The COW object used within VariableHistory can't be serialised itself, but we can convert it to a dict when serializing and then back when deserialising. This finally allows DataSmart objects to be serialized. NOTE: "serialisation" here means pickling, not over XMLRPC or any other transport. (Bitbake rev: bbbb2a53d5decf3b613a92c4ff77c84bfc5d4903) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14bitbake: tinfoil: 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). (Bitbake rev: cbc22a0a9aadc8606b927dbac0f1407ec2736b35) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-14bitbake: data_smart: implement remote datastore functionalityPaul Eggleton
This allows you to maintain a local reference to a remote datastore. The actual implementation of the remote connection is delegated to a connector object that the caller must define and supply. There is support for getting variable values and expanding python references (i.e. ${@...} remotely, however setting variables remotely is not supported - any variable setting is done locally as if the datastore were a copy (which it kind of is). Loosely based on an earlier prototype implementation by Qing He. (Bitbake rev: a3edc3eefa2d03c4ad5d12187b32fa4dc495082a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-30bitbake: bitbake: remove True option to getVar callsJoshua Lock
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) (Bitbake rev: 3b45c479de8640f92dd1d9f147b02e1eecfaadc8) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02bitbake: bitbake: Convert to python 3Richard Purdie
Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. (Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-04bitbake: lib/bb: Add expansion parameter to getVarFlagRichard Purdie
This sets the scene for removing the default False for expansion from getVarFlag. This would later allow True to become the expand default. On the most part this is an automatic translation with: sed -e 's:\(\.getVarFlag([^,()]*, [^,()]*\)):\1, False):g' -i `grep -ril getVar *` There should be no functional change from this patch. (Bitbake rev: 7c3b99c6a716095af3ffce0b15110e91fb49c913) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-22bitbake: data_smart: Don't show exceptions for EOL literalsRichard Purdie
If variables are unset, the code simply doesn't expand them, there aren't errors. If the code is a python expression, this can get a bit messy, see the attached test case. The python expansion code sees the } of the unexpanded value rather than the close of the python expression and then raises a SyntaxError exception. Ideally, we'd update the code to match pairs of brackets. I don't know how to do that with the current regex and this is unfortunately a performance sensitive piece of code. We also run the risk of breaking existing code in OE-Core where there are "{" characters but not "}" to close them (PKGE and PE). Rather than raising the exception, matching the existing "just return the expression" behaviour seems more consistent with the standard variable behaviour. This addresses an issue found in the recent image.bbclass code where there are some variables we choose not to expand (TMPDIR/DATETIME). This patch also adds a test case for this behaviour. It wouldn't preclude improved bracket matching code in the future either. (Bitbake rev: d80d39e73223a50fda0090784303d2c57167bb4c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-12bitbake: tests/data: Add new data testsRichard Purdie
Add a variety of tests which were found to be useful when working on the data store recently. (Bitbake rev: 5c5f8da509f6bbc1fad263462142519ef3d54a35) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-23bitbake: bitbake: Add explict getVar param for (non) expansionRichard Purdie
Rather than just use d.getVar(X), use the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that. This patch was mostly made using the command: sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *` (Bitbake rev: 659ef95c9b8aced3c4ded81c48bcc0fbde4d429f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-29bitbake: tests/data: Add key expansion unit testRichard Purdie
This ensures basic key expansion works and that overlapping keys generate a log message. (Bitbake rev: ed5a8954ac923eda9750a636c5bb5b95ffce664f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-29bitbake: tests/data: Add log parsing test codeRichard Purdie
This allows us to write tests which ensure a particular action generates a particular log message. (Bitbake rev: b30ee0aba51a35a194a4338b988f93ece1ed281c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-02-03bitbake: tests/data: add test for incorrect remove behaviourRoss Burton
The _remove operator isn't working correctly when used with a variable that expands to several items, so add a test case to exercise this path. (Bitbake rev: cb2a62a5fbffb358528a85b46c1fc6383286cb9d) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-25bitbake: tests/data: Add a key deletion testRichard Purdie
If you copy the datastore, then delete a key, it should not exist in d.keys(). This adds a test to cover the recently found data store bug. (Bitbake rev: 16d5f40ad20fd08bf7a4d0e36200c739b5a9f59e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-13bitbake: data_smart: Fix remove operator and its interaction with data expansionRichard Purdie
If you have: FOO = "${bindir}/X Y" FOO_remove = "${bindir}/X" the expected result is "Y". Currently this doesn't work since the removed expressions are not expanded first. This patch adjusts things so the expressions are expanded before being processed for removal. Also add a test to ensure this case continues to work. [YOCTO #6624] (Bitbake rev: 72a1ca4a104ccab73d6abcbd44db9c2636a58572) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-06-12bitbake: bb/tests/data.py: add tests for contains() and contains_any()Ross Burton
contains_any is buggy so write a test case to demonstrate this. (Bitbake rev: 25d10c349aab77bf99745c0a90dd8f9b90abccac) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-21bitbake: data_smart: Fix an unusual variable reference bugRichard Purdie
If you try: Y = "" Y_remove = "X" in OE-Core, bitbake will crash with a KeyError during expansion. The reason is that no expansion of the empty value is attempted but removal from is it and hence no varparse data is present for it in the expand_cache. If the value is empty, there is nothing to remove so the best fix is simply not to check for None but check it has any value. Also add a test for this error so it doesn't get reintroduced. (Bitbake rev: af3ce0fc0280e6642fa35de400f75fdbabf329b1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-25bitbake: test/data: Add in test for append/prepend/remove override operationsRichard Purdie
We currently don't have test cases for _append, _prepend and _remove. This patch adds some basic tests and includes a test case for a recently reported issue with the _remove operator. (Bitbake rev: 93291bd90e18808c7a1c8c692949396bbc7e4348) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-28bitbake: tests: add missing importPaul Eggleton
This was found when trying to run the data tests individually. (Bitbake rev: e4bf4ad4b99978483541a719105c98ea124e8a34) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-09-22bitbake: tests/data: Whitespace in key names is a really bad ideaRichard Purdie
The parser never has supported it, the datastore API did happen to work but whitespace in key names is a really bad idea and not something I think we should encourage or support. Fix test case failures after excplitly ignoring it for variable expansion purposes. (Bitbake rev: a2074ddaba6f53962d6caf34dbd27bdbc259935b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17bitbake: fetch2: Add editor modelines for bb.tests.*Olof Johansson
(Bitbake rev: 230e00948ba093958e8e89e9ee380444b3dad307) Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-05-04bitbake: Add start of bitbake regression/self testingRichard Purdie
This adds some basic unit testing for the codeparser and data store code. Many of the actual test cases were taken from work by Chris Larson's OE-Signatures work but with changes to adapt to the current bitbake APIs we need to test. I also imported CoW tests written by Holger Freyther from the original bitbake-test codebase: http://svn.berlios.de/wsvn/bitbake/trunk/bitbake-tests/tests/ and some tests from the doctests that were removed in commit: http://git.openembedded.org/bitbake/commit?id=3a11c2807972bbbddffde2fa67fc380d159da467 (Bitbake rev: ae4a95780e3e08cf73c854efa8cd93379e00c4e5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>