diff options
author | Holger Freyther <zecke@selfish.org> | 2005-07-26 21:49:06 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-07-26 21:49:06 +0000 |
commit | a57532969f6c525a2e9b62b5542dcc9b0bb4b8ae (patch) | |
tree | e94964883556ec89b9634f276aef40ac7a2b938d /classes/tinderclient.bbclass | |
parent | 15d0fd9b0eaca68fd6252a6b12ab5328cba7a063 (diff) |
classes/tinderclient.bbclass:
-Make the other part of this class work (finish the bb.data -> data. work)
Diffstat (limited to 'classes/tinderclient.bbclass')
-rw-r--r-- | classes/tinderclient.bbclass | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index e8e9ba7c42..dc92591133 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -2,39 +2,44 @@ def tinder_tinder_time(): import time return time.strftime('%m/%d/%Y %H:%M:%S', time.localtime()) -def tinder_send_email(data, header, log): +def tinder_send_email(da, header, log): import smtplib + from bb import data from email.MIMEText import MIMEText msg = MIMEText(header +'\n' + log) - msg['Subject'] = bb.data.getVar('TINDER_SUBJECT',data, True) or "Tinder-Client build log" - msg['To'] = bb.data.getVar('TINDER_MAILTO' ,data, True) - msg['From'] = bb.data.getVar('TINDER_FROM', data, True) + msg['Subject'] = data.getVar('TINDER_SUBJECT',da, True) or "Tinder-Client build log" + msg['To'] = data.getVar('TINDER_MAILTO' ,da, True) + msg['From'] = data.getVar('TINDER_FROM', da, True) s = smtplib.SMTP() s.connect() - s.sendmail(bb.data.getVar('TINDER_FROM', data, True), [bb.data.getVar('TINDER_MAILTO', data, True)], msg.as_string()) + s.sendmail(data.getVar('TINDER_FROM', da, True), [data.getVar('TINDER_MAILTO', da, True)], msg.as_string()) s.close() -def tinder_send_http(data, header, log): - cont = header + '\n' + log - import httplib - conn = httplib.HTPPConnection(bb.data.getVar('TINDER_HOST',data, True)) - conn.request("POST", bb.data.getVar('TINDER_URL',data,True),body=cont) +def tinder_send_http(da, header, log): + from bb import data + import httplib, urllib + cont = "%s\n%s" % ( header, log) + headers = {"Content-type": "multipart/form-data" } + + print cont + conn = httplib.HTTPConnection(data.getVar('TINDER_HOST',da, True)) + conn.request("POST", data.getVar('TINDER_URL',da,True), cont, headers) conn.close() # Prepare tinderbox mail header -def tinder_prepare_mail_header(data, status): - import bb +def tinder_prepare_mail_header(da, status): + from bb import data - str = "tinderbox: administrator: %s\n" % bb.data.getVar('TINDER_ADMIN', data, True) - str += "tinderbox: starttime: %s\n" % bb.data.getVar('BUILDSTART', data, True) or bb.data.getVar('TINDER_START', data, True) - str += "tinderbox: buildname: %s\n" % bb.data.getVar('TINDER_BUILD', data, True) - str += "tinderbox: errorparser: %s\n" % bb.data.getVar('TINDER_ERROR', data, True) + str = "tinderbox: administrator: %s\n" % data.getVar('TINDER_ADMIN', da, True) + str += "tinderbox: starttime: %s\n" % data.getVar('BUILDSTART', da, True) or data.getVar('TINDER_START', da, True) + str += "tinderbox: buildname: %s\n" % data.getVar('TINDER_BUILD', da, True) + str += "tinderbox: errorparser: %s\n" % data.getVar('TINDER_ERROR', da, True) str += "tinderbox: status: %s\n" % status str += "tinderbox: timenow: %s\n" % tinder_tinder_time() - str += "tinderbox: tree: %s\n" % bb.data.getVar('TINDER_TREE', data, True) + str += "tinderbox: tree: %s\n" % data.getVar('TINDER_TREE', da, True) str += "tinderbox: buildfamily: %s\n" % "unix" str += "tinderbox: END" @@ -115,7 +120,7 @@ def tinder_do_tinder_report(event): return log_post_method = tinder_send_email - if bb.data.getVar('TINDER_SENDLOG', event.data, True) == "http": + if data.getVar('TINDER_SENDLOG', event.data, True) == "http": log_post_method = tinder_send_http log_post_method(event.data, header, log) |