diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-08-04 16:32:33 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-11 00:09:27 +0100 |
commit | f6261da9c003a5f571b2cb5c1347fdf8c8d13547 (patch) | |
tree | 5732ac1e45cebca0bb2ecf91269531d4e7f6d562 /bitbake/lib/bb/ui/toasterui.py | |
parent | f17ab95c799734a3effa61b9c2b5dfd40d81eb7c (diff) | |
download | poky-f6261da9c003a5f571b2cb5c1347fdf8c8d13547.tar.gz |
bitbake: toasterui: ensure that the Build object is always available
Many of the methods in toasterui and buildinfohelper rely
on the internal state of the buildinfohelper; in particular, they
need a Build object to have been created on the buildinfohelper.
If the creation of this Build object is tied to an event which
may or may not occur, there's no guarantee that it will exist.
This then causes assertion errors in those methods.
To prevent this from happening, add an _ensure_build() method
to buildinfohelper. This ensures that a minimal Build object
is always available whenever it is needed, either by retrieving
it from the BuildRequest or creating it; it also ensures that
the Build object is up to date with whatever data is available
on the bitbake server (DISTRO, MACHINE etc.).
This method is then called by any other method which relies on
a Build object being in the internal state, ensuring that the
object is either available, or creating it.
(Bitbake rev: 0990b4c73f194ec0be1762e4e48b1a525d8349fb)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/toasterui.py')
-rw-r--r-- | bitbake/lib/bb/ui/toasterui.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index 7d670bef6f..c9213cc89e 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py | |||
@@ -237,14 +237,19 @@ def main(server, eventHandler, params): | |||
237 | if not (build_log and build_log_file_path): | 237 | if not (build_log and build_log_file_path): |
238 | build_log, build_log_file_path = _open_build_log(log_dir) | 238 | build_log, build_log_file_path = _open_build_log(log_dir) |
239 | 239 | ||
240 | buildinfohelper.store_started_build(build_log_file_path) | 240 | buildinfohelper.store_started_build() |
241 | buildinfohelper.save_build_log_file_path(build_log_file_path) | ||
241 | buildinfohelper.set_recipes_to_parse(event.total) | 242 | buildinfohelper.set_recipes_to_parse(event.total) |
242 | continue | 243 | continue |
243 | 244 | ||
244 | # create a build object in buildinfohelper from either BuildInit | 245 | # create a build object in buildinfohelper from either BuildInit |
245 | # (if available) or BuildStarted (for jethro and previous versions) | 246 | # (if available) or BuildStarted (for jethro and previous versions) |
246 | if isinstance(event, (bb.event.BuildStarted, bb.event.BuildInit)): | 247 | if isinstance(event, (bb.event.BuildStarted, bb.event.BuildInit)): |
247 | buildinfohelper.save_build_name_and_targets(event) | 248 | if not (build_log and build_log_file_path): |
249 | build_log, build_log_file_path = _open_build_log(log_dir) | ||
250 | |||
251 | buildinfohelper.save_build_targets(event) | ||
252 | buildinfohelper.save_build_log_file_path(build_log_file_path) | ||
248 | 253 | ||
249 | # get additional data from BuildStarted | 254 | # get additional data from BuildStarted |
250 | if isinstance(event, bb.event.BuildStarted): | 255 | if isinstance(event, bb.event.BuildStarted): |