From a57532969f6c525a2e9b62b5542dcc9b0bb4b8ae Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Tue, 26 Jul 2005 21:49:06 +0000 Subject: classes/tinderclient.bbclass: -Make the other part of this class work (finish the bb.data -> data. work) --- classes/tinderclient.bbclass | 41 +++++++++++++++++++++++------------------ 1 file 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) -- cgit v1.2.3 From 946e28d1cb847b99b9b8d14450ca22d808f62295 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Tue, 26 Jul 2005 22:20:25 +0000 Subject: openembedded/classes/tinderclient.bbclass: -A beginning new line... makes process_builds... thanks to mithro... --- classes/tinderclient.bbclass | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index dc92591133..0c0c470bb8 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -20,10 +20,9 @@ def tinder_send_email(da, header, log): def tinder_send_http(da, header, log): from bb import data import httplib, urllib - cont = "%s\n%s" % ( header, log) + cont = "\n%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() -- cgit v1.2.3 From c81a691e76610095bef2fea17be153a31fcc8e52 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Tue, 26 Jul 2005 22:29:52 +0000 Subject: openembedded/conf/tinder.conf: -Update the sample config to show using HTTP post as well --- conf/tinder.conf | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/conf/tinder.conf b/conf/tinder.conf index 53ad6457ef..3d65dcb51b 100644 --- a/conf/tinder.conf +++ b/conf/tinder.conf @@ -10,17 +10,26 @@ INHERIT += "tinderclient" #What error parser to use #TINDER_ERROR = "unix" -#One mail per task +#One mail/post per task #TINDER_VERBOSE_REPORT = "1" #TINDER_LOG = "${TMPDIR}/tinder.log" -#TINDER_MAILTO = "tinderbox-oe@gmx.net" +#TINDER_TREE = "OpenEmbeddedBuild" + +# Mail posting #We have fixed procmail rules for the subject #TINDER_SUBJECT = "OpenEmbedded Tinder Log" -#TINDER_TREE = "OpenEmbeddedBuild" - -#the From: of the report mails +#TINDER_MAILTO = "tinderbox-oe@gmx.net" #TINDER_FROM = "you@yourhost" + +# HTTP posting +#TINDER_HOST = "ewi546.ewi.utwente.nl" +#TINDER_URL = "/OE_qa/cgi-bin/process_builds.cgi" + +# Select the submit method http or mail +#TINDER_SENDLOG = "http" + + +# Do a report at all #TINDER_REPORT = "1" -TINDER_START := "${@time.strftime('%m/%d/%Y %H:%M:%S', time.localtime())}" -- cgit v1.2.3