summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-07-28 15:21:14 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-02 22:31:42 +0100
commit15689067a45f7d9eb30c379ad2c83c92f2067c9d (patch)
treeb2323ef4d989b66790cfb633f27de89df454bb9b /bitbake
parentade2a27179c2036e87a38fa619cb17b6b2ff1f52 (diff)
downloadpoky-15689067a45f7d9eb30c379ad2c83c92f2067c9d.tar.gz
ui/crumbs/hobeventhandler: emit a signal when there's a fatal-error
If the cooker encounters an error we're unable to proceed so emit a signal so that UI's can notify the user and exit. (Bitbake rev: b6f6edd5090e933ac97a65f93ea9d1b255fca811) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index cccb8ad86c..1163cba5b0 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -19,6 +19,7 @@
19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 20
21import gobject 21import gobject
22import logging
22 23
23progress_total = 0 24progress_total = 0
24 25
@@ -49,8 +50,10 @@ class HobHandler(gobject.GObject):
49 "data-generated" : (gobject.SIGNAL_RUN_LAST, 50 "data-generated" : (gobject.SIGNAL_RUN_LAST,
50 gobject.TYPE_NONE, 51 gobject.TYPE_NONE,
51 ()), 52 ()),
52 "error" : (gobject.SIGNAL_RUN_LAST, 53 "fatal-error" : (gobject.SIGNAL_RUN_LAST,
53 gobject.TYPE_NONE, 54 gobject.TYPE_NONE,
55 (gobject.TYPE_STRING,
56 gobject.TYPE_STRING,)),
54 (gobject.TYPE_STRING,)), 57 (gobject.TYPE_STRING,)),
55 "reload-triggered" : (gobject.SIGNAL_RUN_LAST, 58 "reload-triggered" : (gobject.SIGNAL_RUN_LAST,
56 gobject.TYPE_NONE, 59 gobject.TYPE_NONE,
@@ -69,6 +72,7 @@ class HobHandler(gobject.GObject):
69 self.build_toolchain_headers = False 72 self.build_toolchain_headers = False
70 self.generating = False 73 self.generating = False
71 self.build_queue = [] 74 self.build_queue = []
75 self.current_phase = None
72 76
73 self.model = taskmodel 77 self.model = taskmodel
74 self.server = server 78 self.server = server
@@ -127,11 +131,14 @@ class HobHandler(gobject.GObject):
127 131
128 # If we're running a build, use the RunningBuild event handler 132 # If we're running a build, use the RunningBuild event handler
129 if self.building: 133 if self.building:
134 self.current_phase = "building"
130 running_build.handle_event(event) 135 running_build.handle_event(event)
131 elif isinstance(event, bb.event.TargetsTreeGenerated): 136 elif isinstance(event, bb.event.TargetsTreeGenerated):
137 self.current_phase = "data generation"
132 if event._model: 138 if event._model:
133 self.model.populate(event._model) 139 self.model.populate(event._model)
134 elif isinstance(event, bb.event.ConfigFilesFound): 140 elif isinstance(event, bb.event.ConfigFilesFound):
141 self.current_phase = "configuration lookup"
135 var = event._variable 142 var = event._variable
136 if var == "distro": 143 if var == "distro":
137 distros = event._values 144 distros = event._values
@@ -146,9 +153,11 @@ class HobHandler(gobject.GObject):
146 sdk_machines.sort() 153 sdk_machines.sort()
147 self.emit("sdk-machines-updated", sdk_machines) 154 self.emit("sdk-machines-updated", sdk_machines)
148 elif isinstance(event, bb.event.ConfigFilePathFound): 155 elif isinstance(event, bb.event.ConfigFilePathFound):
156 self.current_phase = "configuration lookup"
149 path = event._path 157 path = event._path
150 self.emit("config-found", path) 158 self.emit("config-found", path)
151 elif isinstance(event, bb.event.FilesMatchingFound): 159 elif isinstance(event, bb.event.FilesMatchingFound):
160 self.current_phase = "configuration lookup"
152 # FIXME: hard coding, should at least be a variable shared between 161 # FIXME: hard coding, should at least be a variable shared between
153 # here and the caller 162 # here and the caller
154 if event._pattern == "rootfs_": 163 if event._pattern == "rootfs_":
@@ -160,25 +169,35 @@ class HobHandler(gobject.GObject):
160 formats.sort() 169 formats.sort()
161 self.emit("package-formats-found", formats) 170 self.emit("package-formats-found", formats)
162 elif isinstance(event, bb.command.CommandCompleted): 171 elif isinstance(event, bb.command.CommandCompleted):
172 self.current_phase = None
163 self.run_next_command() 173 self.run_next_command()
164 elif isinstance(event, bb.command.CommandFailed): 174 elif isinstance(event, bb.command.CommandFailed):
165 self.emit("error", event.error)
166 elif isinstance(event, bb.event.CacheLoadStarted): 175 elif isinstance(event, bb.event.CacheLoadStarted):
176 self.current_phase = "cache loading"
167 bb.ui.crumbs.hobeventhandler.progress_total = event.total 177 bb.ui.crumbs.hobeventhandler.progress_total = event.total
168 pbar.set_text("Loading cache: %s/%s" % (0, bb.ui.crumbs.hobeventhandler.progress_total)) 178 pbar.set_text("Loading cache: %s/%s" % (0, bb.ui.crumbs.hobeventhandler.progress_total))
169 elif isinstance(event, bb.event.CacheLoadProgress): 179 elif isinstance(event, bb.event.CacheLoadProgress):
180 self.current_phase = "cache loading"
170 pbar.set_text("Loading cache: %s/%s" % (event.current, bb.ui.crumbs.hobeventhandler.progress_total)) 181 pbar.set_text("Loading cache: %s/%s" % (event.current, bb.ui.crumbs.hobeventhandler.progress_total))
171 elif isinstance(event, bb.event.CacheLoadCompleted): 182 elif isinstance(event, bb.event.CacheLoadCompleted):
183 self.current_phase = None
172 pbar.set_text("Loading cache: %s/%s" % (bb.ui.crumbs.hobeventhandler.progress_total, bb.ui.crumbs.hobeventhandler.progress_total)) 184 pbar.set_text("Loading cache: %s/%s" % (bb.ui.crumbs.hobeventhandler.progress_total, bb.ui.crumbs.hobeventhandler.progress_total))
173 elif isinstance(event, bb.event.ParseStarted): 185 elif isinstance(event, bb.event.ParseStarted):
186 self.current_phase = "recipe parsing"
174 if event.total == 0: 187 if event.total == 0:
175 return 188 return
176 bb.ui.crumbs.hobeventhandler.progress_total = event.total 189 bb.ui.crumbs.hobeventhandler.progress_total = event.total
177 pbar.set_text("Processing recipes: %s/%s" % (0, bb.ui.crumbs.hobeventhandler.progress_total)) 190 pbar.set_text("Processing recipes: %s/%s" % (0, bb.ui.crumbs.hobeventhandler.progress_total))
178 elif isinstance(event, bb.event.ParseProgress): 191 elif isinstance(event, bb.event.ParseProgress):
192 self.current_phase = "recipe parsing"
179 pbar.set_text("Processing recipes: %s/%s" % (event.current, bb.ui.crumbs.hobeventhandler.progress_total)) 193 pbar.set_text("Processing recipes: %s/%s" % (event.current, bb.ui.crumbs.hobeventhandler.progress_total))
180 elif isinstance(event, bb.event.ParseCompleted): 194 elif isinstance(event, bb.event.ParseCompleted):
195 self.current_phase = None
181 pbar.set_fraction(1.0) 196 pbar.set_fraction(1.0)
197 elif isinstance(event, logging.LogRecord):
198 format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
199 if event.levelno >= format.CRITICAL:
200 self.emit("fatal-error", event.getMessage(), self.current_phase)
182 return 201 return
183 202
184 def event_handle_idle_func (self, eventHandler, running_build, pbar): 203 def event_handle_idle_func (self, eventHandler, running_build, pbar):