summaryrefslogtreecommitdiffstats
path: root/meta/classes/report-error.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/report-error.bbclass')
-rw-r--r--meta/classes/report-error.bbclass52
1 files changed, 31 insertions, 21 deletions
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 2b2ad56514..1452513a66 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -39,6 +39,19 @@ def get_conf_data(e, filename):
39 jsonstring=jsonstring + line 39 jsonstring=jsonstring + line
40 return jsonstring 40 return jsonstring
41 41
42def get_common_data(e):
43 data = {}
44 data['machine'] = e.data.getVar("MACHINE")
45 data['build_sys'] = e.data.getVar("BUILD_SYS")
46 data['distro'] = e.data.getVar("DISTRO")
47 data['target_sys'] = e.data.getVar("TARGET_SYS")
48 data['branch_commit'] = str(oe.buildcfg.detect_branch(e.data)) + ": " + str(oe.buildcfg.detect_revision(e.data))
49 data['bitbake_version'] = e.data.getVar("BB_VERSION")
50 data['layer_version'] = get_layers_branch_rev(e.data)
51 data['local_conf'] = get_conf_data(e, 'local.conf')
52 data['auto_conf'] = get_conf_data(e, 'auto.conf')
53 return data
54
42python errorreport_handler () { 55python errorreport_handler () {
43 import json 56 import json
44 import codecs 57 import codecs
@@ -56,19 +69,10 @@ python errorreport_handler () {
56 if isinstance(e, bb.event.BuildStarted): 69 if isinstance(e, bb.event.BuildStarted):
57 bb.utils.mkdirhier(logpath) 70 bb.utils.mkdirhier(logpath)
58 data = {} 71 data = {}
59 machine = e.data.getVar("MACHINE") 72 data = get_common_data(e)
60 data['machine'] = machine
61 data['build_sys'] = e.data.getVar("BUILD_SYS")
62 data['nativelsb'] = nativelsb() 73 data['nativelsb'] = nativelsb()
63 data['distro'] = e.data.getVar("DISTRO")
64 data['target_sys'] = e.data.getVar("TARGET_SYS")
65 data['failures'] = [] 74 data['failures'] = []
66 data['component'] = " ".join(e.getPkgs()) 75 data['component'] = " ".join(e.getPkgs())
67 data['branch_commit'] = str(oe.buildcfg.detect_branch(e.data)) + ": " + str(oe.buildcfg.detect_revision(e.data))
68 data['bitbake_version'] = e.data.getVar("BB_VERSION")
69 data['layer_version'] = get_layers_branch_rev(e.data)
70 data['local_conf'] = get_conf_data(e, 'local.conf')
71 data['auto_conf'] = get_conf_data(e, 'auto.conf')
72 lock = bb.utils.lockfile(datafile + '.lock') 76 lock = bb.utils.lockfile(datafile + '.lock')
73 errorreport_savedata(e, data, "error-report.txt") 77 errorreport_savedata(e, data, "error-report.txt")
74 bb.utils.unlockfile(lock) 78 bb.utils.unlockfile(lock)
@@ -110,19 +114,10 @@ python errorreport_handler () {
110 elif isinstance(e, bb.event.NoProvider): 114 elif isinstance(e, bb.event.NoProvider):
111 bb.utils.mkdirhier(logpath) 115 bb.utils.mkdirhier(logpath)
112 data = {} 116 data = {}
113 machine = e.data.getVar("MACHINE") 117 data = get_common_data(e)
114 data['machine'] = machine
115 data['build_sys'] = e.data.getVar("BUILD_SYS")
116 data['nativelsb'] = nativelsb() 118 data['nativelsb'] = nativelsb()
117 data['distro'] = e.data.getVar("DISTRO")
118 data['target_sys'] = e.data.getVar("TARGET_SYS")
119 data['failures'] = [] 119 data['failures'] = []
120 data['component'] = str(e._item) 120 data['component'] = str(e._item)
121 data['branch_commit'] = str(oe.buildcfg.detect_branch(e.data)) + ": " + str(oe.buildcfg.detect_revision(e.data))
122 data['bitbake_version'] = e.data.getVar("BB_VERSION")
123 data['layer_version'] = get_layers_branch_rev(e.data)
124 data['local_conf'] = get_conf_data(e, 'local.conf')
125 data['auto_conf'] = get_conf_data(e, 'auto.conf')
126 taskdata={} 121 taskdata={}
127 taskdata['log'] = str(e) 122 taskdata['log'] = str(e)
128 taskdata['package'] = str(e._item) 123 taskdata['package'] = str(e._item)
@@ -132,6 +127,21 @@ python errorreport_handler () {
132 errorreport_savedata(e, data, "error-report.txt") 127 errorreport_savedata(e, data, "error-report.txt")
133 bb.utils.unlockfile(lock) 128 bb.utils.unlockfile(lock)
134 129
130 elif isinstance(e, bb.event.ParseError):
131 bb.utils.mkdirhier(logpath)
132 data = {}
133 data = get_common_data(e)
134 data['nativelsb'] = nativelsb()
135 data['failures'] = []
136 data['component'] = "parse"
137 taskdata={}
138 taskdata['log'] = str(e._msg)
139 taskdata['task'] = str(e._msg)
140 data['failures'].append(taskdata)
141 lock = bb.utils.lockfile(datafile + '.lock')
142 errorreport_savedata(e, data, "error-report.txt")
143 bb.utils.unlockfile(lock)
144
135 elif isinstance(e, bb.event.BuildCompleted): 145 elif isinstance(e, bb.event.BuildCompleted):
136 lock = bb.utils.lockfile(datafile + '.lock') 146 lock = bb.utils.lockfile(datafile + '.lock')
137 jsondata = json.loads(errorreport_getdata(e)) 147 jsondata = json.loads(errorreport_getdata(e))
@@ -145,4 +155,4 @@ python errorreport_handler () {
145} 155}
146 156
147addhandler errorreport_handler 157addhandler errorreport_handler
148errorreport_handler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.build.TaskFailed bb.event.NoProvider" 158errorreport_handler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.build.TaskFailed bb.event.NoProvider bb.event.ParseError"