From 9331135432b75a22fde6a63e255207ac90226f92 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Thu, 17 Aug 2006 13:44:31 +0000 Subject: classes/tinderclient.bbclass: Add workaround for bitbake -k and save the status Using the continue option of BitBake can lead to some issues with the Tinderbox. Even if one build failed the color of the result will be green as the BuildCompleted event will be send by BitBake. As a workaround we will store the failure in a tinder-status file in case of failure (e.g. no Provider or PkgFailed) and will reread on the start. When the build starts we will truncate the file and remove 'the' error --- classes/tinderclient.bbclass | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index f544c203fe..58b4e540d0 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -255,6 +255,14 @@ def tinder_do_tinder_report(event): information immediately. The caching/queuing needs to be implemented. Also sending more or less information is not implemented yet. + + We have two temporary files stored in the TMP directory. One file + contains the assigned machine id for the tinderclient. This id gets + assigned when we connect the box and start the build process the second + file is used to workaround an EventHandler limitation. If BitBake is ran + with the continue option we want the Build to fail even if we get the + BuildCompleted Event. In this case we have to look up the status and + send it instead of 100/success. """ from bb.event import getName from bb import data, mkdirhier, build @@ -264,7 +272,6 @@ def tinder_do_tinder_report(event): name = getName(event) log = "" status = 1 - #print asd # Check what we need to do Build* shows we start or are done if name == "BuildStarted": tinder_build_start(event.data) @@ -275,6 +282,12 @@ def tinder_do_tinder_report(event): f = file(data.getVar('TINDER_LOG', event.data, True), 'rw+') f.truncate(0) f.close() + + # write a status to the file. This is needed for the -k option + # of BitBake + g = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'rw+') + g.truncate(0) + g.close() except IOError: pass @@ -302,9 +315,20 @@ def tinder_do_tinder_report(event): build.exec_task('do_clean', event.data) log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True) status = 200 + # remember the failure for the -k case + h = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') + h.write("200") elif name == "BuildCompleted": log += "Build Completed\n" status = 100 + # Check if we have a old status... + try: + h = file(data.getVar('TMPDIR',event.data,True)+'/tinder-status', 'r') + status = int(h.read()) + print "New status %d" % status + except: + pass + elif name == "MultipleProviders": log += "---> TINDERBOX Multiple Providers\n" log += "multiple providers are available (%s);\n" % ", ".join(event.getCandidates()) @@ -315,6 +339,9 @@ def tinder_do_tinder_report(event): log += "Error: No Provider for: %s\n" % event.getItem() log += "Error:Was Runtime: %d\n" % event.isRuntime() status = 200 + # remember the failure for the -k case + h = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') + h.write("200") # now post the log if len(log) == 0: -- cgit v1.2.3 From be18b92133b1326202241c23613baaa34ccd2c7a Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Thu, 17 Aug 2006 14:40:54 +0000 Subject: classes/tinderclient.bbclass: Fixes. truncate does not work this way... Fixup truncate to forget the the status of previous runs. We will simply write("") to the file and empty it this way. int(f.read()) will fail then --- classes/tinderclient.bbclass | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'classes') diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index 58b4e540d0..0cfa9c7ea0 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -279,14 +279,17 @@ def tinder_do_tinder_report(event): try: # truncate the tinder log file - f = file(data.getVar('TINDER_LOG', event.data, True), 'rw+') - f.truncate(0) + f = file(data.getVar('TINDER_LOG', event.data, True), 'w') + f.write("") f.close() + except: + pass + try: # write a status to the file. This is needed for the -k option # of BitBake - g = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'rw+') - g.truncate(0) + g = file(data.getVar('TMPDIR', event.data, True)+"/tinder-status", 'w') + g.write("") g.close() except IOError: pass @@ -325,7 +328,6 @@ def tinder_do_tinder_report(event): try: h = file(data.getVar('TMPDIR',event.data,True)+'/tinder-status', 'r') status = int(h.read()) - print "New status %d" % status except: pass -- cgit v1.2.3 From 87f266da9cda903b845ab18941d41d6ecb98b28c Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Thu, 17 Aug 2006 14:48:27 +0000 Subject: classes/tinderclient.bbclass: TINDER_AUTOBUILD=0 to disable running do_clean --- classes/tinderclient.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index 0cfa9c7ea0..2f4d62b789 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -315,7 +315,8 @@ def tinder_do_tinder_report(event): elif name == "PkgSucceeded": log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('P', event.data, True) elif name == "PkgFailed": - build.exec_task('do_clean', event.data) + if not data.getVar('TINDER_AUTOBUILD') == 0: + build.exec_task('do_clean', event.data) log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True) status = 200 # remember the failure for the -k case -- cgit v1.2.3