bitbake: data_smart.py and friends: Track file inclusions for bitbake -e
PATCH 1/1 bitbake: data_smart.py and friends: Track file inclusions for bitbake -e
From: Peter Seebach <[email protected]>
This code adds inclusion history to bitbake -e output, showing which files were included, in what order. This doesn't completely resolve timing questions, because it doesn't show you which lines of a file were processed before or after a given include, but it does let you figure out what the path was by which a particular file ended up in your build at all.
How it works: data_smart acquires a .history member, which is an IncludeHistory; this represents the inclusion of a file and all its inclusions, recursively. It provides methods for including files, for finishing inclusion (done as an __exit__), and for dumping the whole tree.
The parser is modified to run includes inside a with() to push and pop the include filename.
RP Modifications:
a) Split Include and Variable tracking
b) Replace deepcopy usage with dedicated copy function
c) Simplify some variable and usage
---
bitbake/lib/bb/cooker.py +5 -0
@@ -338,6 +338,11 @@ class BBCooker: parselog.exception("Unable to read %s", fn) raise + # Display history + with closing(StringIO()) as env: + self.configuration.data.inchistory.emit(env) + logger.plain(env.getvalue()) + # emit variables and shell functions data.update_data(envdata) with closing(StringIO()) as env:
bitbake/lib/bb/data_smart.py +46 -0
62 lines not on this page · raw message
bitbake/lib/bb/parse/__init__.py +2 -1
@@ -87,7 +87,8 @@ def handle(fn, data, include = 0): """Call the handler that is appropriate for this file""" for h in handlers: if h['supports'](fn, data): - return h['handle'](fn, data, include) + with data.inchistory.include(fn): + return h['handle'](fn, data, include) raise ParseError("not a BitBake file", fn) def init(fn, data):