diff options
Diffstat (limited to 'meta/classes/report-error.bbclass')
-rw-r--r-- | meta/classes/report-error.bbclass | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass index 9cb6b0bd31..1452513a66 100644 --- a/meta/classes/report-error.bbclass +++ b/meta/classes/report-error.bbclass | |||
@@ -4,9 +4,8 @@ | |||
4 | # Copyright (C) 2013 Intel Corporation | 4 | # Copyright (C) 2013 Intel Corporation |
5 | # Author: Andreea Brandusa Proca <andreea.b.proca@intel.com> | 5 | # Author: Andreea Brandusa Proca <andreea.b.proca@intel.com> |
6 | # | 6 | # |
7 | # Licensed under the MIT license, see COPYING.MIT for details | 7 | # SPDX-License-Identifier: MIT |
8 | 8 | # | |
9 | inherit base | ||
10 | 9 | ||
11 | ERR_REPORT_DIR ?= "${LOG_DIR}/error-report" | 10 | ERR_REPORT_DIR ?= "${LOG_DIR}/error-report" |
12 | 11 | ||
@@ -40,6 +39,19 @@ def get_conf_data(e, filename): | |||
40 | jsonstring=jsonstring + line | 39 | jsonstring=jsonstring + line |
41 | return jsonstring | 40 | return jsonstring |
42 | 41 | ||
42 | def 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 | |||
43 | python errorreport_handler () { | 55 | python errorreport_handler () { |
44 | import json | 56 | import json |
45 | import codecs | 57 | import codecs |
@@ -57,19 +69,10 @@ python errorreport_handler () { | |||
57 | if isinstance(e, bb.event.BuildStarted): | 69 | if isinstance(e, bb.event.BuildStarted): |
58 | bb.utils.mkdirhier(logpath) | 70 | bb.utils.mkdirhier(logpath) |
59 | data = {} | 71 | data = {} |
60 | machine = e.data.getVar("MACHINE") | 72 | data = get_common_data(e) |
61 | data['machine'] = machine | ||
62 | data['build_sys'] = e.data.getVar("BUILD_SYS") | ||
63 | data['nativelsb'] = nativelsb() | 73 | data['nativelsb'] = nativelsb() |
64 | data['distro'] = e.data.getVar("DISTRO") | ||
65 | data['target_sys'] = e.data.getVar("TARGET_SYS") | ||
66 | data['failures'] = [] | 74 | data['failures'] = [] |
67 | data['component'] = " ".join(e.getPkgs()) | 75 | data['component'] = " ".join(e.getPkgs()) |
68 | data['branch_commit'] = str(base_detect_branch(e.data)) + ": " + str(base_detect_revision(e.data)) | ||
69 | data['bitbake_version'] = e.data.getVar("BB_VERSION") | ||
70 | data['layer_version'] = get_layers_branch_rev(e.data) | ||
71 | data['local_conf'] = get_conf_data(e, 'local.conf') | ||
72 | data['auto_conf'] = get_conf_data(e, 'auto.conf') | ||
73 | lock = bb.utils.lockfile(datafile + '.lock') | 76 | lock = bb.utils.lockfile(datafile + '.lock') |
74 | errorreport_savedata(e, data, "error-report.txt") | 77 | errorreport_savedata(e, data, "error-report.txt") |
75 | bb.utils.unlockfile(lock) | 78 | bb.utils.unlockfile(lock) |
@@ -108,6 +111,37 @@ python errorreport_handler () { | |||
108 | errorreport_savedata(e, jsondata, "error-report.txt") | 111 | errorreport_savedata(e, jsondata, "error-report.txt") |
109 | bb.utils.unlockfile(lock) | 112 | bb.utils.unlockfile(lock) |
110 | 113 | ||
114 | elif isinstance(e, bb.event.NoProvider): | ||
115 | bb.utils.mkdirhier(logpath) | ||
116 | data = {} | ||
117 | data = get_common_data(e) | ||
118 | data['nativelsb'] = nativelsb() | ||
119 | data['failures'] = [] | ||
120 | data['component'] = str(e._item) | ||
121 | taskdata={} | ||
122 | taskdata['log'] = str(e) | ||
123 | taskdata['package'] = str(e._item) | ||
124 | taskdata['task'] = "Nothing provides " + "'" + str(e._item) + "'" | ||
125 | data['failures'].append(taskdata) | ||
126 | lock = bb.utils.lockfile(datafile + '.lock') | ||
127 | errorreport_savedata(e, data, "error-report.txt") | ||
128 | bb.utils.unlockfile(lock) | ||
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 | |||
111 | elif isinstance(e, bb.event.BuildCompleted): | 145 | elif isinstance(e, bb.event.BuildCompleted): |
112 | lock = bb.utils.lockfile(datafile + '.lock') | 146 | lock = bb.utils.lockfile(datafile + '.lock') |
113 | jsondata = json.loads(errorreport_getdata(e)) | 147 | jsondata = json.loads(errorreport_getdata(e)) |
@@ -121,4 +155,4 @@ python errorreport_handler () { | |||
121 | } | 155 | } |
122 | 156 | ||
123 | addhandler errorreport_handler | 157 | addhandler errorreport_handler |
124 | errorreport_handler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.build.TaskFailed" | 158 | errorreport_handler[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.build.TaskFailed bb.event.NoProvider bb.event.ParseError" |