summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/codeparser.py
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: bb/toaster: Fix assertEquals deprecation warningsRichard Purdie2023-12-061-1/+1
| | | | | | | | | Fix: DeprecationWarning: Please use assertEqual instead (Bitbake rev: dd990ea6843685927954101feb729f3faa3a16d9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data: Add missing dependency handling of remove operatorInsu Park2023-09-201-0/+26
| | | | | | | | | | | | | | | | | A recipe variable handles its dependencies even on the "contains" variables within the "inline Python expressions" like bb.utils.filter(). And it also handles those in the append operator correctly, but the problem is that it does not so in the remove operator. Fix it by adding the missing dependencies every time the remove operator has been handled. Also add a test case to check if the override operators handle dependencies correctly. (Bitbake rev: b90520eedb1dbc7f6a3928d089fe74fafb864eb5) Signed-off-by: Insu Park <insu0.park@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests.codeparser: add test for exec of builtin from inline pythonChristopher Larson2023-08-041-0/+6
| | | | | | | | | | This ensures that any change to the presence of builtins in inline python execs will be noticed. (Bitbake rev: ee22d3d51c60db2da97422b2be1e42239b7a2324) Signed-off-by: Christopher Larson <kergoth@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data: Add support for new BB_HASH_CODEPARSER_VALS for cache ↵Richard Purdie2023-01-241-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | optimisation Currently the codeparser cache ends up being extended for every parse run since there are values in the functions such as the result of os.getpid() from LOGFIFO in OE-Core. Digging into that issue, there are also lots of similar but different functions being parsed where the change might just be a path to WORKDIR, a change in PN or PV or something like DATE/TIME. There is no reason we have to use these changing values when computing the dependenies of the functions. Even with a small tweak like: BB_HASH_CODEPARSER_VALS = "LOGFIFO=/ T=/ WORKDIR=/ DATE=1234 TIME=1234 PV=0.0-1 PN=nopn" the cache is reduced from ~4.6MB, increasing by ~300kb for every parse run to around 1.3MB and remaining static for oe-core and meta-oe. In my local build, admittedly heavily experimented with, the cache had grown to 120MB. The benefits of doing this are: * faster load time for bitbake since the cache is smaller to read from disk and load into memory * being able to skip saving the cache upon shutdown * lower memory footprint for bitbake * faster codeparser data lookups (since there is less data to search) We only use these special values when passing code fragments to the codeparser to parse so the real variable values should otherwise be used in the hash data. The overall effect of this change, combined with others to avoid saving unchanged cache files can be ~2s on a ~16s parse on my local system and results in a more responsive feeling bitbake. It also allows parsing performance to be investigated more consistently. (Bitbake rev: f24bbaaddb36f479a59a958e7fc90ef454c19473) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast/data/codeparser: Add dependencies from python module functionsRichard Purdie2022-12-171-7/+7
| | | | | | | | | | | | | | | | | | | | Moving code into python modules is a very effective way to reduce parsing time and overhead in recipes. The downside has always been that any dependency information on which variables those functions access is lost and the hashes can therefore become less reliable. This patch adds parsing of the imported module functions and that dependency information is them injected back into the hash dependency information. Intermodule function references are resolved to the full function call names in our module namespace to ensure interfunction dependencies are correctly handled too. (Bitbake rev: 605c478ce14cdc3c02d6ef6d57146a76d436a83c) (Bitbake rev: 91441e157e495b02db44e19e836afad366ee8924) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data: Ensure vardepsexclude or BB_BASEHASH_IGNORE_VARS covers ↵Richard Purdie2022-04-031-5/+23
| | | | | | | | | | | | | | contains items Adding bb.utils.filter('WARN_QA', 'patch-fuzz', d) when WARN_QA is in BB_BASEHASH_IGNORE_VARS or in vardepsexclude should not add a dependency on WARN_QA. Fix it and add some tests. (Bitbake rev: 6aecc2fe51a52020f6f13be08449e18d42e7a6b5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data_smart: Allow colon in variable expansion regexRichard Purdie2021-07-291-2/+2
| | | | | | | | | Now that ":" is a valid character in variable key names, it needs to be allowed by the variable expansion code too, to match. (Bitbake rev: 019251649a38754d5877759d13b664e28dea77de) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Strip old editor directives from file headersRichard Purdie2019-05-041-2/+0
| | | | | | | | | | 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>
* bitbake: bitbake: Drop duplicate license boilerplace textRichard Purdie2019-05-041-13/+0
| | | | | | | | | | 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>
* bitbake: bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie2019-05-041-0/+2
| | | | | | | | | | | | | | | | | 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>
* bitbake: bb.tests.codeparser: add parameter expansion modifiers testChristopher Larson2019-01-211-0/+7
| | | | | | | | | | | | | We don't want references including shell parameter expansion modifiers (i.e. `:-`, `#`, `%%`, etc) to be added to our vardeps, so add a test to ensure this. YOCTO #12987 (Bitbake rev: be022085fe1ea1b9a9d519f0455883e2da363d2c) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake-selftest: add contains testsPaul Eggleton2017-04-051-0/+48
| | | | | | | | | | | Add some tests to verify that we are extracting "contains" information from python expressions in the code in the bb.data and bb.codeparser modules. (Bitbake rev: 88fda492df875dd79b7aecf1f34b38517fc1eb33) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb/tests/codeparser: update expand syntax in commentJoshua Lock2017-03-221-2/+2
| | | | | | | | | bb.data.expand(x, d) is deprecated API (Bitbake rev: 71185c19205a77d0511fc00baf95a5433e7106d6) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: remove True option to getVar callsJoshua Lock2016-11-301-6/+6
| | | | | | | | | | | | 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>
* bitbake: lib/bb: Don't use deprecated bb.data.getVar/setVar APIRichard Purdie2016-11-231-7/+7
| | | | | | | | | | The old style bb.data.getVar/setVar API is obsolete. Most of bitbake doesn't use it but there were some pieces that escaped conversion. This patch fixes the remaining users mostly in the fetchers. (Bitbake rev: ff7892fa808116acc1ac50effa023a4cb031a5fc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Convert to python 3Richard Purdie2016-06-021-2/+2
| | | | | | | | | 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>
* bitbake: tests: assertEquals -> assertEqualRichard Purdie2016-05-111-4/+4
| | | | | | | | | | | The preferred form is assertEqual, assertEquals is deprecated and not present in python v3. This is v2.7 safe. (Bitbake rev: b60261bf8ade14aca31238b50c243c01adcabc59) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/codeparser.py: Add filename/lineno flags to test variableOlof Johansson2016-01-191-1/+6
| | | | | | | | | | | | | | | | | A recent change in bitbake added filename/lineno information to the parameters of bb.data.build_dependencies(). The codeparser tests required a little adaption to the changes, adding the flags to the FOO variable used in the tests. The error seen when running the tests is a TypeError exception raised in bb.codeparser: TypeError: int() argument must be a string or a number, not 'NoneType' (Bitbake rev: f1fe674397ac5cd355696d5b4cc90b7cfa6c867f) Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: codeparser: Fix var_execs to append to execs, not referencesRichard Purdie2014-03-021-1/+2
| | | | | | | | | | | When using the "execs" information in new code, it became clear that the returned data was incorrect and there were missing exec'd functions. This corrects the error and changes one of the test results to match the correct behaviour. (Bitbake rev: 8a24f2d3b735bbc59ca4a09670cabbadb1868c1a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2: Add editor modelines for bb.tests.*Olof Johansson2013-02-171-0/+2
| | | | | | | (Bitbake rev: 230e00948ba093958e8e89e9ee380444b3dad307) Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: tests/codeparser: Hack around circular inclusion problemRichard Purdie2013-02-151-0/+3
| | | | | | | | | | There is a circular dependency issue where bb.data can't directly depend on bb.parse. The tests were failing due to this issue which is misleading. This patch hacks around it for now. I'd rather that than not running tests at all. (Bitbake rev: a206ae0d7769a41ff3666d0f53ff9cf422dfa518) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: Add start of bitbake regression/self testingRichard Purdie2012-05-041-0/+369
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>