diff options
author | Holger Freyther <zecke@selfish.org> | 2006-05-26 14:39:11 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2006-05-26 14:39:11 +0000 |
commit | 15a7bcd11f3224a320813e9921e8de682a337827 (patch) | |
tree | 8f171690e2fae6e4203054b2374924a714ca8233 /classes/tinderclient.bbclass | |
parent | a47134e5ac4d3f00323aaa599b157dc0edf8258e (diff) |
classes/tinderclient.bbclass: Retry sending, Clean package when failing
Retry to connect the tinderbox a couple of times. This is needed
on machines behind broken routers.
When a package is broken (PackageFailed/TaskFailed) we will clean
the package so we can retry the next time.
Diffstat (limited to 'classes/tinderclient.bbclass')
-rw-r--r-- | classes/tinderclient.bbclass | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index f9243f7108..fdd16d9113 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -1,3 +1,21 @@ +def tinder_http_post(server, selector, content_type, body): + import httplib + # now post it + for i in range(0,5): + try: + h = httplib.HTTP(server) + h.putrequest('POST', selector) + h.putheader('content-type', content_type) + h.putheader('content-length', str(len(body))) + h.endheaders() + h.send(body) + errcode, errmsg, headers = h.getreply() + #print errcode, errmsg, headers + return (errcode,errmsg, headers, h.file) + except: + # try again + pass + def tinder_form_data(bound, dict, log): output = [] #br @@ -29,7 +47,7 @@ def tinder_format_http_post(d,status,log): for the tinderbox to be happy. """ - from bb import data + from bb import data, build import os,random # the variables we will need to send on this form post @@ -72,7 +90,6 @@ def tinder_build_start(d): on the server. """ from bb import data - import httplib # get the body and type content_type, body = tinder_format_http_post(d,None,None) @@ -84,15 +101,9 @@ def tinder_build_start(d): #print "selector %s and url %s" % (selector, url) # now post it - h = httplib.HTTP(server) - h.putrequest('POST', selector) - h.putheader('content-type', content_type) - h.putheader('content-length', str(len(body))) - h.endheaders() - h.send(body) - errcode, errmsg, headers = h.getreply() + errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) #print errcode, errmsg, headers - report = h.file.read() + report = h_file.read() # now let us find the machine id that was assigned to us search = "<machine id='" @@ -113,7 +124,6 @@ def tinder_send_http(d, status, log): Send this log as build status """ from bb import data - import httplib # get the body and type @@ -124,13 +134,7 @@ def tinder_send_http(d, status, log): selector = url + "/xml/build_status.pl" # now post it - h = httplib.HTTP(server) - h.putrequest('POST', selector) - h.putheader('content-type', content_type) - h.putheader('content-length', str(len(body))) - h.endheaders() - h.send(body) - errcode, errmsg, headers = h.getreply() + errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) #print errcode, errmsg, headers #print h.file.read() @@ -247,7 +251,7 @@ def tinder_do_tinder_report(event): implemented yet. """ from bb.event import getName - from bb import data, mkdirhier + from bb import data, mkdirhier, build import os, glob # variables @@ -289,6 +293,7 @@ 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) log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True) status = 200 elif name == "BuildCompleted": |