# build headers
headers = {
- "User-agent": "oestats-client/0.3",
+ "User-agent": "oestats-client/0.5",
"Content-type": "multipart/form-data; boundary=%s" % bound,
"Content-length": str(len(body))}
try:
data = oestats_send(server, "/builds/", {
'builder': builder,
- 'revision': bb.data.getVar('METADATA_REVISION', d, True),
+ 'build_arch': bb.data.getVar('BUILD_ARCH', d, True),
+ 'metadata_branch': bb.data.getVar('METADATA_BRANCH', d, True),
+ 'metadata_revision': bb.data.getVar('METADATA_REVISION', d, True),
'machine': bb.data.getVar('MACHINE', d, True),
'distro': bb.data.getVar('DISTRO', d, True),
})
response = oestats_send(server, "/builds/%s/" % id, {
'status': status,
})
+ if status == 'Failed':
+ bb.note("oestats: build failed, see http://%s%s" % (server,response))
except:
bb.note("oestats: error stopping build")
def oestats_task(server, d, task, status):
import bb
import glob
+ import os.path
import time
# retrieve build id
except:
elapsed = 0
- # send the log for failures
+ # prepare files
files = {}
if status == 'Failed':
logs = glob.glob("%s/log.%s.*" % (bb.data.getVar('T', d, True), task))
if len(logs) > 0:
log = logs[0]
- bb.note("oestats: sending log file : %s" % log)
files['log'] = {
'filename': 'log.txt',
'content': file(log).read(),
'content-type': 'text/plain'}
+ if task == 'do_package':
+ qalog = "%s/log.qa_package" % bb.data.getVar('T', d, True)
+ if os.path.exists(qalog):
+ files['qalog'] = {
+ 'filename': 'qalog.txt',
+ 'content': file(qalog).read(),
+ 'content-type': 'text/plain'}
+ # prepare report
+ vars = {
+ 'build': id,
+ 'package': bb.data.getVar('PN', d, True),
+ 'version': bb.data.getVar('PV', d, True),
+ 'revision': bb.data.getVar('PR', d, True),
+ 'depends': bb.data.getVar('DEPENDS', d, True),
+ 'task': task,
+ 'status': status,
+ 'time': str(elapsed)}
+ bug_number = bb.data.getVar('OESTATS_BUG_NUMBER', d, True)
+ bug_tracker = bb.data.getVar('OESTATS_BUG_TRACKER', d, True)
+ if bug_number and bug_tracker:
+ vars['bug_number'] = bug_number
+ vars['bug_tracker'] = bug_tracker
+
# send report
try:
- response = oestats_send(server, "/tasks/", {
- 'build': id,
- 'package': bb.data.getVar('PN', d, True),
- 'version': bb.data.getVar('PV', d, True),
- 'revision': bb.data.getVar('PR', d, True),
- 'depends': bb.data.getVar('DEPENDS', d, True),
- 'task': task,
- 'status': status,
- 'time': str(elapsed),
- }, files)
+ response = oestats_send(server, "/tasks/", vars, files)
+ if status == 'Failed':
+ bb.note("oestats: task failed, see http://%s%s" % (server, response))
except:
bb.note("oestats: error sending task, disabling stats")
oestats_setid(d, "")