diff options
Diffstat (limited to 'meta/classes/tinderclient.bbclass')
-rw-r--r-- | meta/classes/tinderclient.bbclass | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/meta/classes/tinderclient.bbclass b/meta/classes/tinderclient.bbclass index f544c203fe..d36ef0b343 100644 --- a/meta/classes/tinderclient.bbclass +++ b/meta/classes/tinderclient.bbclass | |||
@@ -240,8 +240,8 @@ def tinder_tinder_start(d, event): | |||
240 | output.append( "---> TINDERBOX BUILDING '%(packages)s'" ) | 240 | output.append( "---> TINDERBOX BUILDING '%(packages)s'" ) |
241 | output.append( "<--- TINDERBOX STARTING BUILD NOW" ) | 241 | output.append( "<--- TINDERBOX STARTING BUILD NOW" ) |
242 | 242 | ||
243 | output.append( "" ) | 243 | output.append( "" ) |
244 | 244 | ||
245 | return "\n".join(output) % vars() | 245 | return "\n".join(output) % vars() |
246 | 246 | ||
247 | def tinder_do_tinder_report(event): | 247 | def tinder_do_tinder_report(event): |
@@ -255,6 +255,14 @@ def tinder_do_tinder_report(event): | |||
255 | information immediately. The caching/queuing needs to be | 255 | information immediately. The caching/queuing needs to be |
256 | implemented. Also sending more or less information is not | 256 | implemented. Also sending more or less information is not |
257 | implemented yet. | 257 | implemented yet. |
258 | |||
259 | We have two temporary files stored in the TMP directory. One file | ||
260 | contains the assigned machine id for the tinderclient. This id gets | ||
261 | assigned when we connect the box and start the build process the second | ||
262 | file is used to workaround an EventHandler limitation. If BitBake is ran | ||
263 | with the continue option we want the Build to fail even if we get the | ||
264 | BuildCompleted Event. In this case we have to look up the status and | ||
265 | send it instead of 100/success. | ||
258 | """ | 266 | """ |
259 | from bb.event import getName | 267 | from bb.event import getName |
260 | from bb import data, mkdirhier, build | 268 | from bb import data, mkdirhier, build |
@@ -264,7 +272,6 @@ def tinder_do_tinder_report(event): | |||
264 | name = getName(event) | 272 | name = getName(event) |
265 | log = "" | 273 | log = "" |
266 | status = 1 | 274 | status = 1 |
267 | #print asd | ||
268 | # Check what we need to do Build* shows we start or are done | 275 | # Check what we need to do Build* shows we start or are done |
269 | if name == "BuildStarted": | 276 | if name == "BuildStarted": |
270 | tinder_build_start(event.data) | 277 | tinder_build_start(event.data) |
@@ -272,9 +279,18 @@ def tinder_do_tinder_report(event): | |||
272 | 279 | ||
273 | try: | 280 | try: |
274 | # truncate the tinder log file | 281 | # truncate the tinder log file |
275 | f = file(data.getVar('TINDER_LOG', event.data, True), 'rw+') | 282 | f = file(data.getVar('TINDER_LOG', event.data, True), 'w') |
276 | f.truncate(0) | 283 | f.write("") |
277 | f.close() | 284 | f.close() |
285 | except: | ||
286 | pass | ||
287 | |||
288 | try: | ||
289 | # write a status to the file. This is needed for the -k option | ||
290 | # of BitBake | ||
291 | g = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') | ||
292 | g.write("") | ||
293 | g.close() | ||
278 | except IOError: | 294 | except IOError: |
279 | pass | 295 | pass |
280 | 296 | ||
@@ -295,16 +311,27 @@ def tinder_do_tinder_report(event): | |||
295 | elif name == "TaskFailed": | 311 | elif name == "TaskFailed": |
296 | log += "<--- TINDERBOX Task %s failed (FAILURE)\n" % event.task | 312 | log += "<--- TINDERBOX Task %s failed (FAILURE)\n" % event.task |
297 | elif name == "PkgStarted": | 313 | elif name == "PkgStarted": |
298 | log += "---> TINDERBOX Package %s started\n" % data.getVar('P', event.data, True) | 314 | log += "---> TINDERBOX Package %s started\n" % data.getVar('PF', event.data, True) |
299 | elif name == "PkgSucceeded": | 315 | elif name == "PkgSucceeded": |
300 | log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('P', event.data, True) | 316 | log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('PF', event.data, True) |
301 | elif name == "PkgFailed": | 317 | elif name == "PkgFailed": |
302 | build.exec_task('do_clean', event.data) | 318 | if not data.getVar('TINDER_AUTOBUILD', event.data, True) == "0": |
303 | log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True) | 319 | build.exec_task('do_clean', event.data) |
320 | log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('PF', event.data, True) | ||
304 | status = 200 | 321 | status = 200 |
322 | # remember the failure for the -k case | ||
323 | h = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') | ||
324 | h.write("200") | ||
305 | elif name == "BuildCompleted": | 325 | elif name == "BuildCompleted": |
306 | log += "Build Completed\n" | 326 | log += "Build Completed\n" |
307 | status = 100 | 327 | status = 100 |
328 | # Check if we have a old status... | ||
329 | try: | ||
330 | h = file(data.getVar('TMPDIR',event.data,True)+'/tinder-status', 'r') | ||
331 | status = int(h.read()) | ||
332 | except: | ||
333 | pass | ||
334 | |||
308 | elif name == "MultipleProviders": | 335 | elif name == "MultipleProviders": |
309 | log += "---> TINDERBOX Multiple Providers\n" | 336 | log += "---> TINDERBOX Multiple Providers\n" |
310 | log += "multiple providers are available (%s);\n" % ", ".join(event.getCandidates()) | 337 | log += "multiple providers are available (%s);\n" % ", ".join(event.getCandidates()) |
@@ -315,6 +342,9 @@ def tinder_do_tinder_report(event): | |||
315 | log += "Error: No Provider for: %s\n" % event.getItem() | 342 | log += "Error: No Provider for: %s\n" % event.getItem() |
316 | log += "Error:Was Runtime: %d\n" % event.isRuntime() | 343 | log += "Error:Was Runtime: %d\n" % event.isRuntime() |
317 | status = 200 | 344 | status = 200 |
345 | # remember the failure for the -k case | ||
346 | h = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') | ||
347 | h.write("200") | ||
318 | 348 | ||
319 | # now post the log | 349 | # now post the log |
320 | if len(log) == 0: | 350 | if len(log) == 0: |