[Toaster] [PATCH 1/2] cooker: add BuildInit event
Elliot Smith
elliot.smith at intel.com
Mon Apr 25 08:26:08 PDT 2016
In situations where a bitbake run fails before the build
properly starts and BuildStarted is fired, a UI has no way
to get at the targets passed to the build. This makes it
difficult for the UI to report on the targets which failed.
Fire a BuildInit event before running buildTargets() or
buildFile(). This enables a UI to capture targets passed to
buildTargets(), even if the build fails (e.g. the targets
themselves are invalid).
[YOCTO #8440]
Signed-off-by: Elliot Smith <elliot.smith at intel.com>
---
bitbake/lib/bb/cooker.py | 6 ++++++
bitbake/lib/bb/event.py | 6 +++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 9b565fc..2ce0215 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1264,6 +1264,7 @@ class BBCooker:
"""
Build the file matching regexp buildfile
"""
+ bb.event.fire(bb.event.BuildInit(), self.expanded_data)
# Too many people use -b because they think it's how you normally
# specify a target to be built, so show a warning
@@ -1367,6 +1368,11 @@ class BBCooker:
Attempt to build the targets specified
"""
+ # build a list of target:task strings in format
+ # ['zlib:do_build', 'mpfr-native:do_build', ...]
+ packages = map(lambda target: "%s:do_%s" % (target, task), targets)
+ bb.event.fire(bb.event.BuildInit(packages), self.expanded_data)
+
def buildTargetsIdle(server, rq, abort):
msg = None
interrupted = 0
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 5ffe89e..8377e3e 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -373,7 +373,11 @@ class BuildBase(Event):
-
+class BuildInit(BuildBase):
+ """buildFile or buildTargets was invoked"""
+ def __init__(self, p=[]):
+ name = None
+ BuildBase.__init__(self, name, p)
class BuildStarted(BuildBase, OperationStarted):
"""bbmake build run started"""
--
1.9.3
---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the toaster
mailing list