diff options
Diffstat (limited to 'openembedded/classes/tinderclient.bbclass')
-rw-r--r-- | openembedded/classes/tinderclient.bbclass | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/openembedded/classes/tinderclient.bbclass b/openembedded/classes/tinderclient.bbclass index f9243f7108..6e10d0f34b 100644 --- a/openembedded/classes/tinderclient.bbclass +++ b/openembedded/classes/tinderclient.bbclass | |||
@@ -1,3 +1,21 @@ | |||
1 | def tinder_http_post(server, selector, content_type, body): | ||
2 | import httplib | ||
3 | # now post it | ||
4 | for i in range(0,5): | ||
5 | try: | ||
6 | h = httplib.HTTP(server) | ||
7 | h.putrequest('POST', selector) | ||
8 | h.putheader('content-type', content_type) | ||
9 | h.putheader('content-length', str(len(body))) | ||
10 | h.endheaders() | ||
11 | h.send(body) | ||
12 | errcode, errmsg, headers = h.getreply() | ||
13 | #print errcode, errmsg, headers | ||
14 | return (errcode,errmsg, headers, h.file) | ||
15 | except: | ||
16 | # try again | ||
17 | pass | ||
18 | |||
1 | def tinder_form_data(bound, dict, log): | 19 | def tinder_form_data(bound, dict, log): |
2 | output = [] | 20 | output = [] |
3 | #br | 21 | #br |
@@ -29,7 +47,7 @@ def tinder_format_http_post(d,status,log): | |||
29 | for the tinderbox to be happy. | 47 | for the tinderbox to be happy. |
30 | """ | 48 | """ |
31 | 49 | ||
32 | from bb import data | 50 | from bb import data, build |
33 | import os,random | 51 | import os,random |
34 | 52 | ||
35 | # the variables we will need to send on this form post | 53 | # the variables we will need to send on this form post |
@@ -72,7 +90,6 @@ def tinder_build_start(d): | |||
72 | on the server. | 90 | on the server. |
73 | """ | 91 | """ |
74 | from bb import data | 92 | from bb import data |
75 | import httplib | ||
76 | 93 | ||
77 | # get the body and type | 94 | # get the body and type |
78 | content_type, body = tinder_format_http_post(d,None,None) | 95 | content_type, body = tinder_format_http_post(d,None,None) |
@@ -84,15 +101,9 @@ def tinder_build_start(d): | |||
84 | #print "selector %s and url %s" % (selector, url) | 101 | #print "selector %s and url %s" % (selector, url) |
85 | 102 | ||
86 | # now post it | 103 | # now post it |
87 | h = httplib.HTTP(server) | 104 | errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) |
88 | h.putrequest('POST', selector) | ||
89 | h.putheader('content-type', content_type) | ||
90 | h.putheader('content-length', str(len(body))) | ||
91 | h.endheaders() | ||
92 | h.send(body) | ||
93 | errcode, errmsg, headers = h.getreply() | ||
94 | #print errcode, errmsg, headers | 105 | #print errcode, errmsg, headers |
95 | report = h.file.read() | 106 | report = h_file.read() |
96 | 107 | ||
97 | # now let us find the machine id that was assigned to us | 108 | # now let us find the machine id that was assigned to us |
98 | search = "<machine id='" | 109 | search = "<machine id='" |
@@ -113,7 +124,6 @@ def tinder_send_http(d, status, log): | |||
113 | Send this log as build status | 124 | Send this log as build status |
114 | """ | 125 | """ |
115 | from bb import data | 126 | from bb import data |
116 | import httplib | ||
117 | 127 | ||
118 | 128 | ||
119 | # get the body and type | 129 | # get the body and type |
@@ -124,13 +134,7 @@ def tinder_send_http(d, status, log): | |||
124 | selector = url + "/xml/build_status.pl" | 134 | selector = url + "/xml/build_status.pl" |
125 | 135 | ||
126 | # now post it | 136 | # now post it |
127 | h = httplib.HTTP(server) | 137 | errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) |
128 | h.putrequest('POST', selector) | ||
129 | h.putheader('content-type', content_type) | ||
130 | h.putheader('content-length', str(len(body))) | ||
131 | h.endheaders() | ||
132 | h.send(body) | ||
133 | errcode, errmsg, headers = h.getreply() | ||
134 | #print errcode, errmsg, headers | 138 | #print errcode, errmsg, headers |
135 | #print h.file.read() | 139 | #print h.file.read() |
136 | 140 | ||
@@ -247,7 +251,7 @@ def tinder_do_tinder_report(event): | |||
247 | implemented yet. | 251 | implemented yet. |
248 | """ | 252 | """ |
249 | from bb.event import getName | 253 | from bb.event import getName |
250 | from bb import data, mkdirhier | 254 | from bb import data, mkdirhier, build |
251 | import os, glob | 255 | import os, glob |
252 | 256 | ||
253 | # variables | 257 | # variables |
@@ -289,6 +293,7 @@ def tinder_do_tinder_report(event): | |||
289 | elif name == "PkgSucceeded": | 293 | elif name == "PkgSucceeded": |
290 | log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('P', event.data, True) | 294 | log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('P', event.data, True) |
291 | elif name == "PkgFailed": | 295 | elif name == "PkgFailed": |
296 | build.exec_task('do_clean', event.data) | ||
292 | log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True) | 297 | log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True) |
293 | status = 200 | 298 | status = 200 |
294 | elif name == "BuildCompleted": | 299 | elif name == "BuildCompleted": |