summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse
Commit message (Collapse)AuthorAgeFilesLines
* bitbake: bitbake: Drop duplicate license boilerplace textRichard Purdie2019-06-195-64/+2
| | | | | | | | | | | | 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: 34ed28a412af642a993642c14bd8b95d5ef22cd8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Add initial pass of SPDX license headers to source codeRichard Purdie2019-06-195-0/+10
| | | | | | | | | | | | | | | | | | | 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: ac556588fac55e91b7ce4839a975eb9ebb5aa192) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: ConfHandler: Don't strip leading spacesRobert Yang2019-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: - Add the following lines to conf/local.conf: FOO = "BAR1" FOO_append = "\ BAR2" $ bitbake -e | grep '^FOO' FOO="BAR1BAR2" The leading spaces in the second line have been removed. - But if add the previous two lines to base.bbclass: $ bitbake -e | grep '^FOO' FOO="BAR1 BAR2" The leading spaces in the second line are preserved, this is inconsistent, now fix ConfHandler to preserve leading spaces. [YOCTO #12380] (Bitbake rev: 8c3bc15a7b5e0a81d7b6c9d3fe43fbff63207156) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Fix Deprecated warnings from regexsRichard Purdie2019-01-161-9/+9
| | | | | | | | | Fix handling of escape characters in regexs and hence fix python Deprecation warnings which will be problematic in python 3.8. (Bitbake rev: c1fcc46e2498ddd41425d8756754f814d682aba3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: BBHandler: Check tab indentation for python codeRobert Yang2018-12-051-0/+11
| | | | | | | | | | | | | | | | | | The previous check was in data.py which only can check code like "python funcname()" in the dependency chain, but there are 3 kinds of python functions: - python() - def py_funcname() - python funcname() Add the checking to BBHandler to check and warn for all of them. The warning looks like: WARNING: /path/to/recipes-core/busybox/busybox_1.29.2.bb: python should use 4 spaces indentation, but found tabs in busybox.inc, line 75 (Bitbake rev: 0cdc5b81fc1f5e5281a525a657e420ebc3bb9e90) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: BBHandler: Fix __python_func_regexp__ for comment linesRobert Yang2018-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed: - Add a comment in base.bbclass: def oe_import(d): import sys # Comment bbpath = d.getVar("BBPATH").split(":") [snip] Note, '# Comment' is started with '#', it is legal in python's syntax (though maybe not a good style), but bitbake reported errors: $ bitbake -p ERROR: ParseError at /path/to/base.bbclass:20: unparsed line: ' bbpath = d.getVar("BBPATH").split(":")' This error report would mislead people, the real problem is that '# Comment' is not supported, but it reports the next line, this may make it hard to debug the code are complicated. We can make __python_func_regexp__ handle '^#' to fix the problem, since it already can handle blank line "^$" in a python function, so it would be pretty safe to handle "^#" as well. (Bitbake rev: 79e62eef1c93f742bf71e9f25db57fdd2ffedd02) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> 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: bitbake: parse: fixes for resolve_file()Robert Yang2018-02-143-7/+2
| | | | | | | | | | The resolve_file() calls mark_dependency(), so the one which calls resolve_file() doesn't need call mark_dependency() again. (Bitbake rev: 4682571107323a39b42cd9ec8ee67419e7f15acc) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker: Improve inotify overflow handlingRichard Purdie2017-08-131-0/+4
| | | | | | | | | | Add a proper function for clearing the mtime cache. Clean up the inotify event overflow case to err on the side of caution and clear any potentially now out of sync caches. (Bitbake rev: ec60459fe2ba16966544eebff43b061abb7ed3ba) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: BBHandler: Remove old style bb.data.setVar() syntax usageEnrico Scholz2017-07-081-1/+1
| | | | | | | | | | | | | | Fixes except bb.parse.SkipRecipe: > bb.data.setVar("__SKIPPED", True, d) if include == 0: AttributeError: module 'bb.data' has no attribute 'setVar' (Bitbake rev: d43e97226dc7f53592c06a528f20390b68dc854f) Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ConfHandler.py: allow require or include with multiple parametersPatrick Ohly2017-06-131-8/+12
| | | | | | | | | | | | | "inherit" already allows inheriting more than one class in a single statement. The same also makes sense for "include" and "require", because then one can generate a list of files to be included dynamically also for the case that more than one file needs to be included. (Bitbake rev: 8d0a76f5a595dddf16b7268bae2c00ef5f568316) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ConfHandler.py: allow require or include without parameterPatrick Ohly2017-06-131-0/+4
| | | | | | | | | | | | | | | | Writing .bbappends that only have an effect when some configuration variable like DISTRO_FEATURES is changed becomes easier when allowing "include" or "require" without a parameter. The same was already allowed for "inherit". Then one can write in a .bbappend: require ${@bb.utils.contains('DISTRO_FEATURES', 'foo', 'bar.inc', '', d)} (Bitbake rev: 8b39c6361758b96fce50a53a6dba8008cd7e6433) Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ConfHandler: Require whitespace between export and variable nameOla x Nilsson2017-06-051-1/+1
| | | | | | | (Bitbake rev: 22bb7c9270f02ddae72e13d849375feee5f4a98b) Signed-off-by: Ola x Nilsson <olani@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ConfHandler: Use the same regular expression for all variable namesPeter Kjellerstedt2017-03-131-4/+4
| | | | | | | | | | | | | | | | | When the regular expression for matching a variable name was amended with allowing the ~ character as part of the variable name, this was never done to the regular expression that matches export lines. Similarly, the regular expression that was used for matching unset variables also used the one without support for the ~ character. This unifies the regular expressions. For good measures it also corrects the regular expression used to match a variable flag name for the unset command to match the one used when setting a variable flag. (Bitbake rev: acd2fd74ed467dc85ec75d5d0815f43e493f29bf) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> 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: BBHandler: use with instead of open/close2.3_M1Ross Burton2016-12-161-11/+11
| | | | | | | | | | This is more pythonic and can handle unclosed file warnings better than the previous code structure. (Bitbake rev: 50633012a64a3b5f0662145e29ff426374fb7683) Signed-off-by: Ross Burton <ross.burton@intel.com> 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-304-11/+11
| | | | | | | | | | | | 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-182-0/+45
| | | | | | | | | | | | 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-022-3/+2
| | | | | | (Bitbake rev: bf25f05ce4db11466e62f134f9a6916f886a93d9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bitbake: Update logger.warn() -> logger.warning()Richard Purdie2016-05-111-2/+2
| | | | | | | | | | python deprecated logger.warn() in favour of logger.warning(). This is only used in bitbake code so we may as well just translate everything to avoid warnings under python 3. Its safe for python 2.7. (Bitbake rev: 676a5f592e8507e81b8f748d58acfea7572f8796) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: BBHandler/ast: Merge handMethod and handleMethodFlagsRichard Purdie2016-02-102-31/+17
| | | | | | | | | | 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: BBHandler: Improve IN_PYTHON_EOF handlingRichard Purdie2015-12-221-14/+4
| | | | | | | | | | | | | | | | Now we're actively using the line numbers for other thins, having magic values like IN_PYTHON_EOF causes problems, in particular, 32 bit overflow on 32 bit machines. There is a neater way to signal eof to feeder(), just using an extra parameter so use this instead and drop the IN_PYTHON_EOF magic values. This has the added bonus that line numbers are then correct for python functions at the end of files. (Bitbake rev: e0f05871c2a6f1e86ae19ad343c7c6f822ddb67e) 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: parse: Don't try to expand __base_depends/__dependsRichard Purdie2015-11-161-2/+2
| | | | | | | | Trying to expand a variable which isn't a string doesn't make sense. (Bitbake rev: 62367cca1f1793eb9827406bcdd5980fdeb80a60) 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: lib/bb/parse: properly handle OSError when updating mtime cachePaul Eggleton2015-08-191-1/+6
| | | | | | | | | | | If a file no longer exists, drop it from the cache silently instead of generating a traceback. This was visible in some cases when a recipe was deleted when bitbake was resident in memory. (Bitbake rev: fe105b9042bdac4afd9f38fcf92bfdc2c04ec23f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: bb.parse: properly error out on filesystem errorsChristopher Larson2015-08-012-10/+18
| | | | | | | | | | | | | | | We've had a long-standing bug where a legitimate error reading a file (IOError or OSError) is always suppressed as though it was a 'file not found' case. As a concrete example, if you do a `chmod 000 conf/local.conf`, it'll silently not parse local.conf, rather than erroring to let the user know about the problem. Fix this by handling the ENOENT case specifically. (Bitbake rev: e691312a3add222b04e7b2f52f8df6abcb9068bf) 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-234-19/+19
| | | | | | | | | | | | | | 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/BBHandler: Avoid repeatedly resetting FILERichard Purdie2015-06-051-2/+2
| | | | | | | | | | | | If we're not going to change the value of FILE, or we know it isn't going to have changed (ext == bbclass), don't set FILE. This avoids messy looking history of the variable as well as optimises parsing speed slightly. (Bitbake rev: 88e4600aa66dda2e6c807f9d97af8982bcd8817b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ConfHandler: Fix bogus dependency problemsRichard Purdie2015-05-291-1/+0
| | | | | | | | | | | | | | | | Adding a dependency when errors occur accessing a file when calling handle() is not the correct thing to do. THe handle() code calls resolve_file() which can raise an exception without ever touching "fn" itself, it has also already marked all the dependencies correctly. This leads to bogus files being resolved to the local cwd and hence triggers reparses for no good reason. The solution is to simply remove the bogus dependency. (Bitbake rev: 366af3be1cffd64e4a79c15990c1e05869022c14) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: BBHandler: Drop cwd from search pathRichard Purdie2015-05-291-2/+1
| | | | | | | | | | | | | | | | Whilst bitbake has done this for a long time, the behaviour of resolving class files against cwd is not desirable. This can be seen during base configuration parsing when looking for base.bbclass where a dependency on cwd is added. If cwd then changes, the cache is invalid and triggers a re-parse. The only real option is to drop this entry and if files can't be found, we fix BBPATH in the cases where it needs fixing. I didn't find any in the random selection of layers I tested parsing locally. (Bitbake rev: 508aad9d5db7e51328b1fd6ee53b4bc3720a30b7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: BBHandler: Error for incomplete function definitionsRichard Purdie2015-05-151-7/+12
| | | | | | | | | | | | | | | | | | | | | Add some sanity checks on the parsing state engine when returning data so that incomplete functions raise parse errors. This means a recipe doing: do_somefunction { echo 1 VAR = "1" will now raise a ParseError. To get the right file/line information, __infunc__ was changed to a list. [YOCTO #7633] (Bitbake rev: 6b54a72638f57882d4fd5aab96b2752a09e065af) 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: ConfHandler: Clean up bogus importsRichard Purdie2015-01-161-6/+4
| | | | | | | | | | The import statements here are plain bizarre. Remove them, tweaking some of the function calls to match current practices. I can't find any reason these old imports are as they are. (Bitbake rev: 4c2f1fe51a13ddc97e518327714292af46b9e1ab) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: ConfHandler: Rename oldfn to parentfn to be clearerRichard Purdie2015-01-161-5/+5
| | | | | | | | | | Looking at this function I had no idea what oldfn was, I doubt anyone else would either without looking up what the caller does. "parentfn" would seem a more appropriate name so rename it. (Bitbake rev: fc70ed596703a1aa954223b169d4ad51193a6ec1) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* bitbake: cooker/cache/parse: Implement pyinofity based reconfigureRichard Purdie2015-01-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Memory resident bitbake has one current flaw, changes in the base configuration are not noticed by bitbake. The parsing cache is also refreshed on each invocation of bitbake (although the mtime cache is not cleared so its pointless). This change adds in pyinotify support and adds two different watchers, one for the base configuration and one for the parsed recipes. Changes in the latter will trigger a reparse (and an update of the mtime cache). The former will trigger a complete reload of the configuration. Note that this code will also correctly handle creation of new configuration files since the __depends and __base_depends variables already track these for cache correctness purposes. We could be a little more clever about parsing cache invalidation, right now we just invalidate the whole thing and recheck. For now, its better than what we have and doesn't seem to perform that badly though. For education and QA purposes I can document a workflow that illustrates this: $ source oe-init-build-env-memres $ time bitbake bash [base configuration is loaded, recipes are parsed, bash builds] $ time bitbake bash [command returns quickly since all caches are valid] $ touch ../meta/classes/gettext.bbclass $ time bitbake bash [reparse is triggered, time is longer than above] $ echo 'FOO = "1"' >> conf/local.conf $ time bitbake bash [reparse is triggered, but with a base configuration reload too] As far as changes go, I like this one a lot, it makes memory resident bitbake truly usable and may be the tweak we need to make it the default. The new pyinotify dependency is covered in the previous commit. (Bitbake rev: 0557d03c170fba8d7efe82be1b9641d0eb229213) 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>