summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/ast.py
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: ast/BBHandler: Add inherit_defer supportRichard Purdie2024-01-181-0/+22
| | | | | | | | | | | | | | | | | | | | | | Add support for an inherit_defer statement which works as inherit does but is only evaulated at the end of parsing. This allows conditional expressions to be evaulated 'late' meaning changes to PACKAGECONFIG from bbappends can be applied for example. This addresses a usability/confusion issue users have with the current conditional inherit mechanism since they don't realise the condition has to be expanded immediately with the current model. There is a commented out warning we could enable in future which warns about the use of a conditional inherit that isn't deferred. There is a behaviour difference in the placement of the inherit, particularly around variables set using ?= which means wen swapping from one to the other, caution must be used as values can change. (Bitbake rev: 5c2e840eafeba1f0f754c226b87bfb674f7bea29) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast: Fix EXPORT_FUNCTIONS bugRichard Purdie2024-01-101-4/+5
| | | | | | | | | | | | | | | | If you have two classes, both of which set EXPORT_FUNCTIONS for the same funciton and a standard funciton definition for the function that is exported, the export function can sometimes overwrite the standard one. The issue is that the internal flag the code uses isn't ovweritten if the variable is giving a new value. Fix the issue by using a comment in the code that is injected so that we know if it is ours or not. Also add some testing for EXPORT_FUNCTIONS, not perfect but a start. (Bitbake rev: 66306d5151acb0a26a171c338d8f60eb9eb16c6b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: fetch2: Add autorev warning when it is set too lateRichard Purdie2023-03-221-0/+3
| | | | | | | | | | | | | | | | | | | | Bitbake expects a consistent metadata environment when it parses. There are plenty of ways you can set a recipe to autorev at a point where parts of the fetcher have already been triggered leading to obsure bugs which I struggled to debug, let alone anyone not familar with the code. If anyone is running into the message from the commit, the issue is likely one of timing. Keep in mind that the anonymous python code in base.bbclass will expand variables like FILESPATH, WORKDIR and others which contain PV. The recipe needs to be set to AUTOREV before that anonymous python runs. In particular, that means you can't set SRCREV = "${AUTOREV}" in other anonymous python, it needs to happen earlier. (Bitbake rev: 4d9ec332d5bfc8b60b54f8ec2a17d34e35aa903a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast/data/codeparser: Add dependencies from python module functionsRichard Purdie2022-12-171-0/+12
| | | | | | | | | | | | | | | | | | | | 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: parse: Add support for addpylib conf file directive and ↵Richard Purdie2022-12-081-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BB_GLOBAL_PYMODULES For many years OE-Core has injected it's own python modules into the python namespace using an immediate expansion of a variable in base.bbclass. It also added all entries from BBPATH to sys.path. We really need this to become a first class citizen of the langauge, this new addpylib directive allows that. Usage is of the form: addpylib <directory> <namespace> The namespace is imported and if there is an attribute BBIMPORT, that list of names is iterated and imported too. This mirrors what OE-Core has done for a long time with one difference in implmentation, sys.path is only appended to. This means later imported namespaces can't overwrite an earlier one and can't overwrite the main python module space. In practice we've never done that and it isn't something we should encourage or support. The new directive is only applied for .conf files and not other filetypes as it only makes sense in that context. It is also only allowed in the "base configuration" context of cookerdata since adding it at the recipe level wouldn't work properly due to the way it changes the global namespace. At the same time, move the list of modules to place in the global namespace into a BB_GLOBAL_PYMODULES variable. It is intended that only the core layer should touch this and it is meant to be a very small list, usually os and sys. BB_GLOBAL_PYMODULES is expected to be set before the first addpylib directive. Layers adding a lib directory will now need to use this directive as BBPATH is not going to be added automatically by OE-Core in future. The directives are immediate operations so it does make modules available sooner than the current OE-Core approach. The new code appends to sys.path rather than prepends as core did, as overwriting python standard library modules would be a bad idea and naturally encouraging people to collaborate around our own core modules is desireable. (Bitbake rev: afb8478d3853f6edf3669b93588314627d617d6b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast: Improve function flags handling for EXPORT_FUNCTIONSRichard Purdie2022-04-141-1/+1
| | | | | | | | | | | | | | | Currently, if you use one of the functions from EXPORT_FUNCTIONS, the meaning of cleandirs and fakeroot are lost. This leads to the function changing in behaviour depending upon it's caller context. This isn't intended so add mapping for the cleandirs and fakeroot flags too. This does break devtool in OE-Core and there is a separate fix for that. [YOCTO #8621] (Bitbake rev: b074f4aff00923acc5bf6649d204d541a79fd2b6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb: fix exit when found renamed variablesMarta Rybczynska2022-02-211-0/+4
| | | | | | | | | | | | | | | | Until now, if a renamed variable was found, bitbake exited immediately if it was in a class, but continued after an error message if the variable was in a recipe. This was caused by cookerdata.py CookerDataBuilder::parseBaseConfiguration checking a different DataSmart instance than the variable was set in. To solve the issue, add a special variable and set it when we find a renamed variable. Check for it in ast.py and bail out if needed. (Bitbake rev: d12400600e30549c88dc9e7883dc3d63b1dc1117) Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast: Show warnings for append/prepend/remove operators ↵Richard Purdie2021-11-101-0/+4
| | | | | | | | | | | | combined with +=/.= Operations like XXX:append += "YYY" are almost always wrong and this is a common mistake made in the metadata. Show warnings for these usages with a view to making it a fatal error eventually. (Bitbake rev: 8c31e75557dc6a8d8f407b5d24d6327889a3e3b1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Switch to using new override syntaxRichard Purdie2021-08-021-2/+0
| | | | | | | | | | | | | | | | | This change updates the datastore to use the new override syntax using colons instead of underscores exclusively. It is expected layers would have to be converted to work with bitbake after this change. Supporting mixed syntax isn't possible, it is only feasible to have one internal representation of overrides. Whilst we can't warn for every possible override that may be set in the old format, show errors for _append/_prepend/_remove since those should never be present. (Bitbake rev: 7dcf317cc141dc980634f8c18bfa84f83e57206a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast: Substitute '~' when naming anonymous functionsPaul Barker2021-07-291-1/+1
| | | | | | | | | | | | | When parsing an anonymous python function, bitbake generates a name for the function based on the full path to the file in which it was found. As not all characters which are valid in file paths are valid in Python function names we have a translation table. However, this translation table was missing an entry for '~'. (Bitbake rev: b201c0b284e25c20685d9d206797c4cc650eeca0) Signed-off-by: Paul Barker <paul@pbarker.dev> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data_smart/parse: Allow ':' characters in variable/function namesRichard Purdie2021-07-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is becomming increasingly clear we need to find a way to show what is/is not an override in our syntax. We need to do this in a way which is clear to users, readable and in a way we can transition to. The most effective way I've found to this is to use the ":" charater to directly replace "_" where an override is being specified. This includes "append", "prepend" and "remove" which are effectively special override directives. This patch simply adds the character to the parser so bitbake accepts the value but maps it back to "_" internally so there is no behaviour change. This change is simple enough it could potentially be backported to older version of bitbake meaning layers using the new syntax/markup could work with older releases. Even if other no other changes are accepted at this time and we don't backport, it does set us on a path where at some point in future we could require a more explict syntax. I've tested this patch by converting oe-core/meta-yocto to the new syntax for overrides (9000+ changes) and then seeing that builds continue to work with this patch. (Bitbake rev: 0dbbb4547cb2570d2ce607e9a53459df3c0ac284) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: event: Prevent bitbake from executing event handler for wrong ↵Tomasz Dziendzielski2021-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | multiconfig target When multiconfig is used bitbake might try to run events that don't exist for specific mc target. In cooker.py we pass `self.databuilder.mcdata[mc]` data that contains names of events' handlers per mc target, but fire_class_handlers uses global _handlers variable that is created during parsing of all the targets. This leads to a problem where bitbake runs event handler that don't exist for a target or even overrides them - if multiple targets use event handler with the same name but different code then only one version will be executed for all targets. See [YOCTO #13071] for detailed bug information. Add mc target name as a prefix to event handler name so there won't be two different handlers with the same name. Add internal __BBHANDLERS_MC variable to have the handlers lists per machine. (Bitbake rev: 5f7fdf7b2d8c59805c8ef4dae84f536baa5e172b) Signed-off-by: Tomasz Dziendzielski <tomasz.dziendzielski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: logging: Make bitbake logger compatible with python loggerJoshua Watt2021-02-101-2/+2
| | | | | | | | | | | | | | | | | The bitbake logger overrode the definition of the debug() logging call to include a debug level, but this causes problems with code that may be using standard python logging, since the extra argument is interpreted differently. Instead, change the bitbake loggers debug() call to match the python logger call and add a debug2() and debug3() API to replace calls that were logging to a different debug level. [RP: Small fix to ensure bb.debug calls bbdebug()] (Bitbake rev: f68682a79d83e6399eb403f30a1f113516575f51) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: build: Allow deltask to take multiple tasknamesRichard Purdie2020-07-211-4/+6
| | | | | | | | | | | | | | | | | | | deltask currently supports only one task to delete but it would be useful if it could support a variable which gets expanded to allow flexibility in the metadata. This is simple to support in bitbake and is how other directives such as inherit operate so adjust the parser/code to handle that. It means that syntax like: EXTRA_NOPACKAGE_DELTASKS = "" deltask ${EXTRA_NOPACKAGE_DELTASKS} is now allowed. (Bitbake rev: 883d926120833c85a16dcf60425dd7af7699046a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: event/ast: Add RecipePostKeyExpansion eventRichard Purdie2020-05-271-0/+3
| | | | | | (Bitbake rev: 5c30cbe35e921f118e7da6b804af281627329d77) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib: amend code to use proper singleton comparisons where possibleFrazer Clews2020-01-191-10/+10
| | | | | | | | | | | amend the code to handle singleton comparisons properly so it only checks if they only refer to the same object or not, and not bother comparing the values. (Bitbake rev: b809a6812aa15a8a9af97bc382cc4b19571e6bfc) Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib: remove unused importsFrazer Clews2020-01-191-4/+0
| | | | | | | | | | removed unused imports which made the code harder to read, and slightly but less efficient (Bitbake rev: 4367692a932ac135c5aa4f9f2a4e4f0150f76697) Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk> 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: parse/ast: fix line number for anonymous functionRobert Yang2018-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: - Define an error anonymous function in base.bbclass: 15 16 python() { 17 Compile error 18 } $ bitbake -p ERROR: Error in compiling python function in /buildarea1/lyang1/poky/meta/classes/base.bbclass, line 18: The code lines resulting in this error were: 0001:def __anon_18__buildarea1_lyang1_poky_meta_classes_base_bbclass(d): *** 0002: Compile error 0003: SyntaxError: invalid syntax (base.bbclass, line 18) The lineno should be 17, but it reported 18, this would mislead people a lot when there more lines. - Now fix it to: ERROR: Error in compiling python function in /buildarea1/lyang1/poky/meta/classes/base.bbclass, line 17: The code lines resulting in this error were: 0001:def __anon_18__buildarea1_lyang1_poky_meta_classes_base_bbclass(d): *** 0002: Compile error 0003: SyntaxError: invalid syntax (base.bbclass, line 17) This is because the anonymous function is constructed by: text = "def %s(d):\n" % (funcname) + text The len(self.body) doesn't include the "def " line, the length of the function should be "len(self.body) + 1", so we need pass "self.lineno - (len(self.body) + 1)" which is the same as 'self.lineno - len(self.body) - 1' to bb.methodpool.insert_method() as we already had done to named function. Otherwise, the lineno is wrong, and would cause other problems such as report which line is wrong, but the line is not what we want since it reports incorrect line. (Bitbake rev: 7466c8765fcc792e5ea3daefda3c5895e782d6c4) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast: ensure saved event handlers really do get restoredPaul Eggleton2018-08-241-18/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In finalize() we save event handlers, register the ones relevant to the recipe being finalised, trigger events, and then restore the handlers so that one recipe's custom handlers (actually implemented within a class inherited by the recipe) do not affect other recipes. However, if an exception occurs during parsing, the saved handlers were not being restored. Use a try...finally block to ensure that the handlers are always restored. This issue became apparent since in OpenEmbedded-Core we have recently introduced a find_intercepts() handler for the bb.event.RecipePreFinalise event in image-postinst-intercepts.bbclass that images and old-style SDK recipes will end up inheriting. So far it doesn't seem that the the error has manifested itself in normal builds, but when parsing OE-Core recipes in the OE layer index it has: core-image-rt-* image recipes were parsed which in the default configuration raise SkipRecipe. The next non-image recipe that is parsed will trigger a real exception, because the find_intercepts() handler is still registered and gets fired, but in the context of the new recipe the POSTINST_INTERCEPTS_PATHS variable is not set, and the code in find_intercepts() is written with the reasonable assumption that that isn't possible given that the class itself sets a default, and thus it fails. (Bitbake rev: e5f1f8fa201774e0c3c554d59b277baa2128708f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast: Abstract anonymous function execution into a functionRichard Purdie2018-03-041-4/+7
| | | | | | | | | This allows us to call this code from other contexts without duplicating it. (Bitbake rev: c6be487f9bd5d95915f2495d555b9f539adb1d44) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib: Drop now unneeded update_data callsRichard Purdie2017-02-151-3/+0
| | | | | | | | | | 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>
* bitbake: event/ast: Add RecipeTaskPreProcess event before task finalisationRichard Purdie2017-01-201-0/+1
| | | | | | | | | | | There are various pieces of code which need to run after the tasks are finalised but before bitbake locks in on the task dependencies. This adds such an event so dependency changes in anonymous python can be accounted for and acted upon by these specific event handlers. (Bitbake rev: 4dcd0e53f5ff4bf4f2d6cbdc51ff33a5f5f206af) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast: remove BBVERSIONS supportRoss Burton2016-11-301-67/+0
| | | | | | | | | | BBVERSIONS is moderately horrible and it doesn't appear to be actually used by anyone, so remove it to simplify the finalise codepaths. (Bitbake rev: 0bb188f01e396052b127e170a25246d79a6d6741) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: remove True option to getVarFlag callsJoshua Lock2016-11-301-1/+1
| | | | | | | | | | | | | | getVarFlag() now defaults to expanding by default, thus remove the True option from getVarFlag() calls with a regex search and replace. Search made with the following regex: getVarFlag ?\(( ?[^,()]*, ?[^,()]*), True\) (Bitbake rev: c19baa8c19ea8ab9b9b64fd30298d8764c6fd2cd) 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: cookerdata/ast: Fail gracefully if event handler function is not foundMarkus Lehtonen2016-09-021-0/+2
| | | | | | | | | [YOCTO #10186] (Bitbake rev: 107c47c4e6de6a596cf1aeca5c18dbc1c5b44dc4) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast/ConfHandler: Add a syntax to clear variableJérémy Rosen2016-08-181-0/+33
| | | | | | | | | | | | unset VAR will clear variable VAR unset VAR[flag] will clear flag "flag" from var VAR (Bitbake rev: bedbd46ece8d1285b5cd2ea07dc64b4875b479aa) Signed-off-by: Jérémy Rosen <jeremy.rosen@openwide.fr> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cache/ast: Move __VARIANTS handling to parse cache functionRichard Purdie2016-08-181-4/+0
| | | | | | | | Simple refactoring to allow for multiconfig support. (Bitbake rev: 266b848da40904446eb1d084bbdc5307a9b45197) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast, event: Ensure we reset registered handlers during parsingRichard Purdie2016-06-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When parsing, we should reset the event handlers we registered when done. If we don't do this, parse order may change the build, depending on what the parse handlers do to the metadata. This issue showed up as a basehash change: ERROR: Bitbake's cached basehash does not match the one we just generated ( /media/build1/poky/meta/recipes-core/meta/nativesdk-buildtools-perl-dummy.bb.do_unpack)! This is due to the eventhandler in nativesdk.bbclass being run, despite this .bb file not inheriting nativesdk.bbclass. The parse order was different between the signature generation and the main multithreaded parse. Diffsigs showed: bitbake-diffsigs 1.0-r2.do_unpack.sigbasedata.* basehash changed from 887d1c25962156cae859c1542e69a8d7 to cb84fcfafe15fc92fb7ab8c6d97014ca Variable PN value changed from 'nativesdk-buildtools-perl-dummy' to '${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}' with PN being set by the event handler. (Bitbake rev: 0219271d4130c1f4cf071c7577a4101c54c04921) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Convert to python 3Richard Purdie2016-06-021-9/+9
| | | | | | | | | 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: bitbake: Drop futures usage since we're python 3Richard Purdie2016-06-021-2/+1
| | | | | | (Bitbake rev: bf25f05ce4db11466e62f134f9a6916f886a93d9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: BBHandler/ast: Merge handMethod and handleMethodFlagsRichard Purdie2016-02-101-28/+15
| | | | | | | | | | The functionality overlap between these two functions is significant and its clearer to handle both things together since they are intimately linked. There should be no behaviour change, just clearer code. (Bitbake rev: 391aa4afc91be90d8d3ee47e1bf797d6ebe61a71) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast: Mark anonymous functions as python functionsRichard Purdie2016-02-041-2/+2
| | | | | | | | | | Anonymous functions are python functions, set the variable flags as such so we can detect them and avoid expansion where needed. (Bitbake rev: 1b303785c578bbae3a89be8d751d80fba860f62e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: lib/bb: Add expansion parameter to getVarFlagRichard Purdie2016-02-041-7/+7
| | | | | | | | | | | | | | | 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>
* bitbake: ast: Add filename/lineno to mapped functionsRichard Purdie2016-01-061-0/+2
| | | | | | | | | | Where we add in mappings for EXPORT_FUNCTIONS, add dummy filename and lineno data so ensure the assumption that all python functions have this is correct. (Bitbake rev: 547128731e62b36d2271c4390b3fee2b16c535dc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast/event/utils: Improve tracebacks to include file and line ↵Richard Purdie2015-12-181-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | numbers more correctly Currently bitbake tracebacks can have places where the line numbers are inaccurate and filenames may be missing. These changes start to try and correct this. The only way I could find to correct line numbers was to compile as a python ast, tweak the line numbers then compile to bytecode. I'm open to better ways of doing this if anyone knows of any. This does mean passing a few more parameters into functions, and putting more data into the data store about functions (i.e. their filenames and line numbers) but the improvement in debugging is more than worthwhile). Before: ---------------- ERROR: Execution of event handler 'run_buildstats' failed Traceback (most recent call last): File "run_buildstats(e)", line 43, in run_buildstats(e=<bb.build.TaskStarted object at 0x7f7b7c57a590>) NameError: global name 'notexist' is not defined ERROR: Build of do_patch failed ERROR: Traceback (most recent call last): File "/media/build1/poky/bitbake/lib/bb/build.py", line 560, in exec_task return _exec_task(fn, task, d, quieterr) File "/media/build1/poky/bitbake/lib/bb/build.py", line 497, in _exec_task event.fire(TaskStarted(task, logfn, flags, localdata), localdata) File "/media/build1/poky/bitbake/lib/bb/event.py", line 170, in fire fire_class_handlers(event, d) File "/media/build1/poky/bitbake/lib/bb/event.py", line 109, in fire_class_handlers execute_handler(name, handler, event, d) File "/media/build1/poky/bitbake/lib/bb/event.py", line 81, in execute_handler ret = handler(event) File "run_buildstats(e)", line 43, in run_buildstats NameError: global name 'notexist' is not defined ---------------- After: ---------------- ERROR: Execution of event handler 'run_buildstats' failed Traceback (most recent call last): File "/media/build1/poky/meta/classes/buildstats.bbclass", line 143, in run_buildstats(e=<bb.build.TaskStarted object at 0x7efe89284e10>): if isinstance(e, bb.build.TaskStarted): > trigger = notexist pn = d.getVar("PN", True) NameError: global name 'notexist' is not defined ERROR: Build of do_package failed ERROR: Traceback (most recent call last): File "/media/build1/poky/bitbake/lib/bb/build.py", line 560, in exec_task return _exec_task(fn, task, d, quieterr) File "/media/build1/poky/bitbake/lib/bb/build.py", line 497, in _exec_task event.fire(TaskStarted(task, logfn, flags, localdata), localdata) File "/media/build1/poky/bitbake/lib/bb/event.py", line 170, in fire fire_class_handlers(event, d) File "/media/build1/poky/bitbake/lib/bb/event.py", line 109, in fire_class_handlers execute_handler(name, handler, event, d) File "/media/build1/poky/bitbake/lib/bb/event.py", line 81, in execute_handler ret = handler(event) File "/media/build1/poky/meta/classes/buildstats.bbclass", line 143, in run_buildstats trigger = notexist NameError: global name 'notexist' is not defined ---------------- (Bitbake rev: 1ff860960919ff6f8097138bc68de85bcb5f88b0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: build: delete tasks thoroughlyChristopher Larson2015-09-031-2/+1
| | | | | | | | | | | | | | | We want addtask to be able to bring back a deleted task, but we don't want its previous dependencies to come back with it, so rather than marking a task as deleted and then skipping tasks marked as such, actually delete the task and its dependency information in deltask. While we're in that part of the code, also fix a couple 'not foo in bar' instances to 'foo not in bar', which is preferred in python. (Bitbake rev: 94b3f3d6bdfbfa47f7eb3c3de64940a145b2ddd1) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast/data_smart: Add parsing flag to getVar/setVarRichard Purdie2015-07-121-7/+7
| | | | | | | | | | | | | When parsing we find problems if we clear prepends/appends when setting variables during the initial parsing phases. Later, we actively want to do this (in what would be post finalisation previously). To handle this, pass a parsing flag to the operations to control the correct behaviour for the context. (Bitbake rev: ae87f5b8bf16191b3201cfb445062938eab992a0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Add explict getVar param for (non) expansionRichard Purdie2015-06-231-11/+11
| | | | | | | | | | | | | | 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>
* bitbake: parse/ast: Fix issue if path contains '&'Pascal Bach2015-01-291-1/+1
| | | | | | | (Bitbake rev: 4fea138f7cef53626a40decb96207dbaf9284020) Signed-off-by: Pascal Bach <pascal.bach@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast: Add error when trying to use dash in sh function namesRichard Purdie2015-01-081-0/+2
| | | | | | | | | | | | | | | A dash character is illegal in function names in sh (but not bash). Since our shell tasks run under sh and the shell parser is sh based, EXPORT_FUNCTIONS won't work with class names containing a dash. We can't change sh, we can ensure the user is warned about the problem straight away though. [YOCTO #7006] (Bitbake rev: 86704281b79e524dccccc88cbf996b299b33bae2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: data: rename defaultval to _defaultvalRoss Burton2014-12-031-1/+1
| | | | | | | | | | | | | The defaultval field is intended to be internal and the only use of that field outside of data.py is to skip over it when iterating over a value's flags. For clarity and convenience, rename the field to _defaultval so that it is considered internal and not exposed through the data API. (Bitbake rev: 2800958dadaa5c055ba21d52c98d842d360f0785) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: event: Add SkipRecipe event to replace SkipPackageRichard Purdie2014-06-011-3/+3
| | | | | | | | | | | | In the depths of time we were rather confused about naming. bb files are recipes, the event to skip parsing them should be SkipRecipe, not SkipPackage. This changes bitbake to use the better name but leaves the other around for now. We can therefore start removing references to it from the metadata. (Bitbake rev: 98d9e6e0f514a7cb7da1d99bf4bd5602b89426d6) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast: Show append logging at lower log levelRichard Purdie2014-05-111-1/+1
| | | | | | | | | | | | It was reported that bitbake -D made no mention of which append files it was using. bitbake -DD does but it makes sense to increase the log level of this piece of debug information. [YOCTO #6262] (Bitbake rev: 5824bf9c6feea05567d155911f4ab2e371911d34) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: parse/ast: Optimise data finalisationRichard Purdie2014-04-231-3/+5
| | | | | | | | | | | | | | The optimisation where only the data we're interested in was finalised was good but it turns out we can do better. In the case where a class-extension is to be targeted, we can skip the other targets. This change does that and speeds up parsing at the bitbake-worker execution time. Specifically, you can see an improvement in the speed of bitbake X -n. (Bitbake rev: b56918c7ef7913e84356c69ee9b269844a446728) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ast: Fix support for anonymous methods in wildcard .bbappend filesJacob Kroon2014-02-241-1/+3
| | | | | | | | | | | | | | | | | | | When using wildcard .bbappend files with anonymous methods in them, bitbake/python fails to parse the generated code since the '%' is encoded in the generated method name. Fix this by including '%' in the convert-to-underscore list during method name mangling. While we're at it, move the method name mangling translation table to a class variable, as suggested by Chris Larson. [YOCTO #5864] (Bitbake rev: 537f1f9bbe110acc9848ef95f43468c07d87af79) Signed-off-by: Jacob Kroon <jacob.kroon@mikrodidakt.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: build/ast: Create strong task add/del API in bb.buildRichard Purdie2013-12-181-31/+2
| | | | | | | | | | | | | | | Currently its near impossible to control task addition/deletion from metadata context. This adds stong add/deltask API to bb.build which is traditionally where it resided. The rather broken remove_tasks function was removed, it didn't appear to do anything useful or have any users. This allows us to clean up hacks currently in use in metadata and use standard API for it instead. (Bitbake rev: bf7138dd38fc1f8efca80891198e3422fef64093) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>