From aca193101e2db23661f2a49ba6c18e3192d93229 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Sun, 19 Feb 2006 18:43:26 +0000 Subject: classes/tinderclient.bbclass: -Save the assigned machine id to a file and restore it when needed. BitBake does not have a 'persistent' cache one could use across files... -Post the configuration directly to the server --- classes/tinderclient.bbclass | 94 +++++++++++++++++++++++++++++++++----------- 1 file changed, 71 insertions(+), 23 deletions(-) (limited to 'classes') diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index a50cdda297..67762faba8 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -20,18 +20,13 @@ def tinder_form_data(bound, dict, log): return "\r\n".join(output) -def tinder_send_http(d, log): - """ - Send the log via HTTP... - """ - def tinder_time_string(): """ Return the time as GMT """ return "" -def tinder_format_http_post(d,log): +def tinder_format_http_post(d,status,log): """ Format the Tinderbox HTTP post with the data needed for the tinderbox to be happy. @@ -50,6 +45,20 @@ def tinder_format_http_post(d,log): "clobber" : data.getVar('TINDER_CLOBBER', d, True) } + # optionally add the status + if status: + variables["status"] = str(status) + + # try to load the machine id + # we only need on build_status.pl but sending it + # always does not hurt + try: + f = file(data.getVar('TMPDIR',d,True)+'/tinder-machine.id', 'r') + id = f.read() + variables['machine_id'] = id + except: + pass + # the boundary we will need boundary = "----------------------------------%d" % int(random.random()*1000000000000) @@ -69,7 +78,7 @@ def tinder_build_start(d): import httplib # get the body and type - content_type, body = tinder_format_http_post(d,None) + content_type, body = tinder_format_http_post(d,None,None) server = data.getVar('TINDER_HOST', d, True ) url = data.getVar('TINDER_URL', d, True ) @@ -77,6 +86,46 @@ 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() + print errcode, errmsg, headers + report = h.file.read() + + # now let us find the machine id that was assigned to us + search = "