aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/methodpool.py
AgeCommit message (Collapse)Author
2015-12-22event/utils/methodpool: Add a cache of compiled code objectsRichard Purdie
With the addition of function line number handling, the overhead of the compile functions is no longer negligible. We tend to compile the same pieces of code over and over again so wrapping a cache around this is beneficial and removes the overhead of line numbered functions. Life cycle of a cache using a global like this is in theory problematic although in reality unlikely to be an issue. It can be dealt with if/as/when we deal with the other global caches. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-15ast/event/utils: Improve tracebacks to include file and line numbers more ↵Richard Purdie
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 ---------------- Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-23methodpool: Retire it, remove global method scopeRichard Purdie
Having a global method scope confuses users and with the introduction of parallel parsing, its not even possible to correctly detect conflicting functions. Rather than try and fix that, its simpler to retire the global method scope and restrict functions to those locations they're defined within. This is more what users actually expect too. If we remove the global function scope, the need for methodpool is reduced to the point we may as well retire it. There is some small loss of caching of parsed functions but timing measurements so the impact to be neglibile in the overall parsing time. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-23methodpool: Conflicting methodnames should be a fatal errorRichard Purdie
When this error occurs, the build should stop, not continue uninterrupted. [YOCTO #4460] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-23methodpool: Clean up the parsed module list handling to be slightly less insaneRichard Purdie
This removes some dubious functions and replaces them with a simpler, cleaner API which better describes what the code is doing. Unused code/variables are removed and comments tweaked. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-23methodpool: Remove unused check_insert_method functionRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-14methodpool: Improve method already seen error messageRichard Purdie
The current error message is confusing, this improves it to explain the problem and the possible ways to resolve it. [YOCTO #2530] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2010-03-30Consolidate the exec/eval bits, switch anonfunc to better_exec, etcChris Larson
The methodpool, ${@} expansions, anonymous python functions, event handlers now all run with the same global context, ensuring a consistent environment for them. Added a bb.utils.better_eval function which does an eval() with the same globals as better_exec. Signed-off-by: Chris Larson <chris_larson@mentor.com>
2006-12-08Add proper GPLv2 headers to all BitBake filesHolger Hans Peter Freyther
BitBake trunk is now GPLv2 only, no mix of MIT,FreeBSD License is left. Update GPL headers to point to the correct address of the FSF Update the list of authors. Uli Luckas, Seb Frankengul and Tim Amsell contributed to the sourcecode as well
2006-11-17Remember that we have compiled and added this file.Holger Hans Peter Freyther
This reduces the time of the new parser from 2:42 to 1:6. The old one takes 1:42 on this macbook here
2006-04-14 bitbake/lib/bb/methodpool.py:Holger Hans Peter Freyther
-Extract the names from the just compiled code -Iterate over each key (leaving out Keys and None) -And see if we have seen the name already. -If we have seen it, raise an error...
2006-04-14 bitbake/lib/bb/methodpool.py:Holger Hans Peter Freyther
-Document the usage of the three variables
2006-04-14 bitbake/lib/bb/methodpool.bb:Holger Hans Peter Freyther
-Revert the last change. We have no method names available which makes tracking of replacing not possible...
2006-04-14 bitbake/lib/bb/methodpool.py:Holger Hans Peter Freyther
-Add sanity check to the methodpool. If the same method is registered by two differen files then we will throw an error
2006-03-23bitbake/lib/bb/cache:Holger Hans Peter Freyther
-Fix the method invocation in methodpool to use the right amount of arguments -Update data_smart to the new cache layout of the file functions
2006-03-23bitbake/method pool:Holger Hans Peter Freyther
Create a common implementation of the global method handling. It will be shared by the parsers and the cache. This commit breaks the cache again