diff options
author | Oyvind Repvik <nail@nslu2-linux.org> | 2005-07-30 20:03:26 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-07-30 20:03:26 +0000 |
commit | e9b856c853e7ca1558b7223d919a033f59cc4ad1 (patch) | |
tree | 45f9ed00e3de8b41ea7ced1031ad42443a418026 | |
parent | 22d73880c4233315af2b8c1459cd1e01d720648f (diff) | |
parent | 3f059d678183af258fcfab00d4c44c0fa1631aa9 (diff) |
propagate from branch 'org.openembedded.dev' (head 8f021c5761ffd10b30d30c5b1470ee277e242699)
to branch 'org.openembedded.nslu2-linux' (head 4c74e687006ab8b1f38e5234e2a4db4debbdbfef)
-rw-r--r-- | classes/tinderclient.bbclass | 40 | ||||
-rw-r--r-- | conf/tinder.conf | 5 |
2 files changed, 34 insertions, 11 deletions
diff --git a/classes/tinderclient.bbclass b/classes/tinderclient.bbclass index 5de9b8755a..5b55589ec0 100644 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@ -1,6 +1,26 @@ -def tinder_tinder_time(): - import time - return time.strftime('%m/%d/%Y %H:%M:%S', time.localtime()) +def tinder_tz_offset(off): + # get the offset. Either it is a number like + # +200 or -300 + try: + return int(off) + except ValueError: + if off == "Europe/Berlin": + return 200 + else: + return 0 + +def tinder_tinder_time(offset): + import datetime + td = datetime.timedelta(tinder_tz_offset(offset)) + time = datetime.datetime.utcnow() + td + return time.strftime('%m/%d/%Y %H:%M:%S') + +def tinder_tinder_start(date,offset): + import datetime, time + td = datetime.timedelta(tinder_tz_offset(offset)) + ti = time.strptime(date, "%m/%d/%Y %H:%M:%S") + ti = datetime.datetime(*ti[0:7])-td + return time.strftime('%m/%d/%Y %H:%M:%S') def tinder_send_email(da, header, log): import smtplib @@ -21,8 +41,8 @@ def tinder_send_http(da, header, log): from bb import data import httplib, urllib cont = "\n%s\n%s" % ( header, log) - headers = {"Content-type": "multipart/form-data" } - + headers = {"Content-type": "multipart/form-data" } + conn = httplib.HTTPConnection(data.getVar('TINDER_HOST',da, True)) conn.request("POST", data.getVar('TINDER_URL',da,True), cont, headers) conn.close() @@ -33,11 +53,11 @@ def tinder_prepare_mail_header(da, status): from bb import data 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: starttime: %s\n" % tinder_tinder_start(data.getVar('TINDER_START', da, True) or data.getVar('BUILDSTART', da, True), data.getVar('TINDER_TZ', 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: timenow: %s\n" % tinder_tinder_time(data.getVar('TINDER_TZ', da, True)) str += "tinderbox: tree: %s\n" % data.getVar('TINDER_TREE', da, True) str += "tinderbox: buildfamily: %s\n" % "unix" str += "tinderbox: END" @@ -76,8 +96,8 @@ def tinder_do_tinder_report(event): if name == "PkgFailed" or name == "BuildCompleted": status = 'build_failed' - if name == "BuildCompleted": - status = "success" + if name == "BuildCompleted": + status = "success" header = tinder_prepare_mail_header(event.data, status) # append the log log_file = data.getVar('TINDER_LOG', event.data, True) @@ -120,7 +140,7 @@ def tinder_do_tinder_report(event): log_post_method = tinder_send_email if data.getVar('TINDER_SENDLOG', event.data, True) == "http": - log_post_method = tinder_send_http + log_post_method = tinder_send_http log_post_method(event.data, header, log) diff --git a/conf/tinder.conf b/conf/tinder.conf index 3d65dcb51b..2c50b62a17 100644 --- a/conf/tinder.conf +++ b/conf/tinder.conf @@ -12,7 +12,7 @@ INHERIT += "tinderclient" #One mail/post per task #TINDER_VERBOSE_REPORT = "1" -#TINDER_LOG = "${TMPDIR}/tinder.log" +#TINDER_LOG = "${TMPbDIR}/tinder.log" #TINDER_TREE = "OpenEmbeddedBuild" @@ -30,6 +30,9 @@ INHERIT += "tinderclient" #TINDER_SENDLOG = "http" +# TimeZone handling +#TINDER_TZ = "+0200" + # Do a report at all #TINDER_REPORT = "1" |