Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # |
| 2 | # Toaster helper class |
| 3 | # |
| 4 | # Copyright (C) 2013 Intel Corporation |
| 5 | # |
| 6 | # Released under the MIT license (see COPYING.MIT) |
| 7 | # |
| 8 | # This bbclass is designed to extract data used by OE-Core during the build process, |
| 9 | # for recording in the Toaster system. |
| 10 | # The data access is synchronous, preserving the build data integrity across |
| 11 | # different builds. |
| 12 | # |
| 13 | # The data is transferred through the event system, using the MetadataEvent objects. |
| 14 | # |
| 15 | # The model is to enable the datadump functions as postfuncs, and have the dump |
| 16 | # executed after the real taskfunc has been executed. This prevents task signature changing |
| 17 | # is toaster is enabled or not. Build performance is not affected if Toaster is not enabled. |
| 18 | # |
| 19 | # To enable, use INHERIT in local.conf: |
| 20 | # |
| 21 | # INHERIT += "toaster" |
| 22 | # |
| 23 | # |
| 24 | # |
| 25 | # |
| 26 | |
| 27 | # Find and dump layer info when we got the layers parsed |
| 28 | |
| 29 | |
| 30 | |
| 31 | python toaster_layerinfo_dumpdata() { |
| 32 | import subprocess |
| 33 | |
| 34 | def _get_git_branch(layer_path): |
| 35 | branch = subprocess.Popen("git symbolic-ref HEAD 2>/dev/null ", cwd=layer_path, shell=True, stdout=subprocess.PIPE).communicate()[0] |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 36 | branch = branch.decode('utf-8') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | branch = branch.replace('refs/heads/', '').rstrip() |
| 38 | return branch |
| 39 | |
| 40 | def _get_git_revision(layer_path): |
| 41 | revision = subprocess.Popen("git rev-parse HEAD 2>/dev/null ", cwd=layer_path, shell=True, stdout=subprocess.PIPE).communicate()[0].rstrip() |
| 42 | return revision |
| 43 | |
| 44 | def _get_url_map_name(layer_name): |
| 45 | """ Some layers have a different name on openembedded.org site, |
| 46 | this method returns the correct name to use in the URL |
| 47 | """ |
| 48 | |
| 49 | url_name = layer_name |
| 50 | url_mapping = {'meta': 'openembedded-core'} |
| 51 | |
| 52 | for key in url_mapping.keys(): |
| 53 | if key == layer_name: |
| 54 | url_name = url_mapping[key] |
| 55 | |
| 56 | return url_name |
| 57 | |
| 58 | def _get_layer_version_information(layer_path): |
| 59 | |
| 60 | layer_version_info = {} |
| 61 | layer_version_info['branch'] = _get_git_branch(layer_path) |
| 62 | layer_version_info['commit'] = _get_git_revision(layer_path) |
| 63 | layer_version_info['priority'] = 0 |
| 64 | |
| 65 | return layer_version_info |
| 66 | |
| 67 | |
| 68 | def _get_layer_dict(layer_path): |
| 69 | |
| 70 | layer_info = {} |
| 71 | layer_name = layer_path.split('/')[-1] |
| 72 | layer_url = 'http://layers.openembedded.org/layerindex/layer/{layer}/' |
| 73 | layer_url_name = _get_url_map_name(layer_name) |
| 74 | |
| 75 | layer_info['name'] = layer_url_name |
| 76 | layer_info['local_path'] = layer_path |
| 77 | layer_info['layer_index_url'] = layer_url.format(layer=layer_url_name) |
| 78 | layer_info['version'] = _get_layer_version_information(layer_path) |
| 79 | |
| 80 | return layer_info |
| 81 | |
| 82 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 83 | bblayers = e.data.getVar("BBLAYERS") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 84 | |
| 85 | llayerinfo = {} |
| 86 | |
| 87 | for layer in { l for l in bblayers.strip().split(" ") if len(l) }: |
| 88 | llayerinfo[layer] = _get_layer_dict(layer) |
| 89 | |
| 90 | |
| 91 | bb.event.fire(bb.event.MetadataEvent("LayerInfo", llayerinfo), e.data) |
| 92 | } |
| 93 | |
| 94 | # Dump package file info data |
| 95 | |
| 96 | def _toaster_load_pkgdatafile(dirpath, filepath): |
| 97 | import json |
| 98 | import re |
| 99 | pkgdata = {} |
| 100 | with open(os.path.join(dirpath, filepath), "r") as fin: |
| 101 | for line in fin: |
| 102 | try: |
| 103 | kn, kv = line.strip().split(": ", 1) |
| 104 | m = re.match(r"^PKG_([^A-Z:]*)", kn) |
| 105 | if m: |
| 106 | pkgdata['OPKGN'] = m.group(1) |
| 107 | kn = "_".join([x for x in kn.split("_") if x.isupper()]) |
| 108 | pkgdata[kn] = kv.strip() |
| 109 | if kn == 'FILES_INFO': |
| 110 | pkgdata[kn] = json.loads(kv) |
| 111 | |
| 112 | except ValueError: |
| 113 | pass # ignore lines without valid key: value pairs |
| 114 | return pkgdata |
| 115 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 116 | python toaster_package_dumpdata() { |
| 117 | """ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 118 | Dumps the data about the packages created by a recipe |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 119 | """ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 120 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 121 | # No need to try and dumpdata if the recipe isn't generating packages |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 122 | if not d.getVar('PACKAGES'): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 123 | return |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 124 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 125 | pkgdatadir = d.getVar('PKGDESTWORK') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 126 | lpkgdata = {} |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 127 | datadir = os.path.join(pkgdatadir, 'runtime') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 128 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 129 | # scan and send data for each generated package |
| 130 | for datafile in os.listdir(datadir): |
| 131 | if not datafile.endswith('.packaged'): |
| 132 | lpkgdata = _toaster_load_pkgdatafile(datadir, datafile) |
| 133 | # Fire an event containing the pkg data |
| 134 | bb.event.fire(bb.event.MetadataEvent("SinglePackageInfo", lpkgdata), d) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | # 2. Dump output image files information |
| 138 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 139 | python toaster_artifact_dumpdata() { |
| 140 | """ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 141 | Dump data about SDK variables |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 142 | """ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 143 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 144 | event_data = { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 145 | "TOOLCHAIN_OUTPUTNAME": d.getVar("TOOLCHAIN_OUTPUTNAME") |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 146 | } |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 147 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 148 | bb.event.fire(bb.event.MetadataEvent("SDKArtifactInfo", event_data), d) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 149 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 150 | |
| 151 | # collect list of buildstats files based on fired events; when the build completes, collect all stats and fire an event with collected data |
| 152 | |
| 153 | python toaster_collect_task_stats() { |
| 154 | import bb.build |
| 155 | import bb.event |
| 156 | import bb.data |
| 157 | import bb.utils |
| 158 | import os |
| 159 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 160 | if not e.data.getVar('BUILDSTATS_BASE'): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 161 | return # if we don't have buildstats, we cannot collect stats |
| 162 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 163 | toaster_statlist_file = os.path.join(e.data.getVar('BUILDSTATS_BASE'), "toasterstatlist") |
| 164 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 165 | def stat_to_float(value): |
| 166 | return float(value.strip('% \n\r')) |
| 167 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 168 | def _append_read_list(v): |
| 169 | lock = bb.utils.lockfile(e.data.expand("${TOPDIR}/toaster.lock"), False, True) |
| 170 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 171 | with open(toaster_statlist_file, "a") as fout: |
| 172 | taskdir = e.data.expand("${BUILDSTATS_BASE}/${BUILDNAME}/${PF}") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 173 | fout.write("%s::%s::%s::%s\n" % (e.taskfile, e.taskname, os.path.join(taskdir, e.task), e.data.expand("${PN}"))) |
| 174 | |
| 175 | bb.utils.unlockfile(lock) |
| 176 | |
| 177 | def _read_stats(filename): |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 178 | # seconds |
| 179 | cpu_time_user = 0 |
| 180 | cpu_time_system = 0 |
| 181 | |
| 182 | # bytes |
| 183 | disk_io_read = 0 |
| 184 | disk_io_write = 0 |
| 185 | |
| 186 | started = 0 |
| 187 | ended = 0 |
| 188 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 189 | taskname = '' |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 190 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 191 | statinfo = {} |
| 192 | |
| 193 | with open(filename, 'r') as task_bs: |
| 194 | for line in task_bs.readlines(): |
| 195 | k,v = line.strip().split(": ", 1) |
| 196 | statinfo[k] = v |
| 197 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 198 | if "Started" in statinfo: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 199 | started = stat_to_float(statinfo["Started"]) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 200 | |
| 201 | if "Ended" in statinfo: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 202 | ended = stat_to_float(statinfo["Ended"]) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 203 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 204 | if "Child rusage ru_utime" in statinfo: |
| 205 | cpu_time_user = cpu_time_user + stat_to_float(statinfo["Child rusage ru_utime"]) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 206 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 207 | if "Child rusage ru_stime" in statinfo: |
| 208 | cpu_time_system = cpu_time_system + stat_to_float(statinfo["Child rusage ru_stime"]) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 209 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 210 | if "IO write_bytes" in statinfo: |
| 211 | write_bytes = int(statinfo["IO write_bytes"].strip('% \n\r')) |
| 212 | disk_io_write = disk_io_write + write_bytes |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 213 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 214 | if "IO read_bytes" in statinfo: |
| 215 | read_bytes = int(statinfo["IO read_bytes"].strip('% \n\r')) |
| 216 | disk_io_read = disk_io_read + read_bytes |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 217 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 218 | return { |
| 219 | 'stat_file': filename, |
| 220 | 'cpu_time_user': cpu_time_user, |
| 221 | 'cpu_time_system': cpu_time_system, |
| 222 | 'disk_io_read': disk_io_read, |
| 223 | 'disk_io_write': disk_io_write, |
| 224 | 'started': started, |
| 225 | 'ended': ended |
| 226 | } |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 227 | |
| 228 | if isinstance(e, (bb.build.TaskSucceeded, bb.build.TaskFailed)): |
| 229 | _append_read_list(e) |
| 230 | pass |
| 231 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 232 | if isinstance(e, bb.event.BuildCompleted) and os.path.exists(toaster_statlist_file): |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 233 | events = [] |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 234 | with open(toaster_statlist_file, "r") as fin: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 235 | for line in fin: |
| 236 | (taskfile, taskname, filename, recipename) = line.strip().split("::") |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 237 | stats = _read_stats(filename) |
| 238 | events.append((taskfile, taskname, stats, recipename)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 239 | bb.event.fire(bb.event.MetadataEvent("BuildStatsList", events), e.data) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 240 | os.unlink(toaster_statlist_file) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | # dump relevant build history data as an event when the build is completed |
| 244 | |
| 245 | python toaster_buildhistory_dump() { |
| 246 | import re |
| 247 | BUILDHISTORY_DIR = e.data.expand("${TOPDIR}/buildhistory") |
| 248 | BUILDHISTORY_DIR_IMAGE_BASE = e.data.expand("%s/images/${MACHINE_ARCH}/${TCLIBC}/"% BUILDHISTORY_DIR) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 249 | pkgdata_dir = e.data.getVar("PKGDATA_DIR") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 250 | |
| 251 | |
| 252 | # scan the build targets for this build |
| 253 | images = {} |
| 254 | allpkgs = {} |
| 255 | files = {} |
| 256 | for target in e._pkgs: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 257 | target = target.split(':')[0] # strip ':<task>' suffix from the target |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 258 | installed_img_path = e.data.expand(os.path.join(BUILDHISTORY_DIR_IMAGE_BASE, target)) |
| 259 | if os.path.exists(installed_img_path): |
| 260 | images[target] = {} |
| 261 | files[target] = {} |
| 262 | files[target]['dirs'] = [] |
| 263 | files[target]['syms'] = [] |
| 264 | files[target]['files'] = [] |
| 265 | with open("%s/installed-package-sizes.txt" % installed_img_path, "r") as fin: |
| 266 | for line in fin: |
| 267 | line = line.rstrip(";") |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 268 | psize, punit, pname = line.split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 269 | # this size is "installed-size" as it measures how much space it takes on disk |
| 270 | images[target][pname.strip()] = {'size':int(psize)*1024, 'depends' : []} |
| 271 | |
| 272 | with open("%s/depends.dot" % installed_img_path, "r") as fin: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 273 | p = re.compile(r'\s*"(?P<name>[^"]+)"\s*->\s*"(?P<dep>[^"]+)"(?P<rec>.*?\[style=dotted\])?') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 274 | for line in fin: |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 275 | m = p.match(line) |
| 276 | if not m: |
| 277 | continue |
| 278 | pname = m.group('name') |
| 279 | dependsname = m.group('dep') |
| 280 | deptype = 'recommends' if m.group('rec') else 'depends' |
| 281 | |
| 282 | # If RPM is used for packaging, then there may be |
| 283 | # dependencies such as "/bin/sh", which will confuse |
| 284 | # _toaster_load_pkgdatafile() later on. While at it, ignore |
| 285 | # any dependencies that contain parentheses, e.g., |
| 286 | # "libc.so.6(GLIBC_2.7)". |
| 287 | if dependsname.startswith('/') or '(' in dependsname: |
| 288 | continue |
| 289 | |
| 290 | if not pname in images[target]: |
| 291 | images[target][pname] = {'size': 0, 'depends' : []} |
| 292 | if not dependsname in images[target]: |
| 293 | images[target][dependsname] = {'size': 0, 'depends' : []} |
| 294 | images[target][pname]['depends'].append((dependsname, deptype)) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 295 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 296 | # files-in-image.txt is only generated if an image file is created, |
| 297 | # so the file entries ('syms', 'dirs', 'files') for a target will be |
| 298 | # empty for rootfs builds and other "image" tasks which don't |
| 299 | # produce image files |
| 300 | # (e.g. "bitbake core-image-minimal -c populate_sdk") |
| 301 | files_in_image_path = "%s/files-in-image.txt" % installed_img_path |
| 302 | if os.path.exists(files_in_image_path): |
| 303 | with open(files_in_image_path, "r") as fin: |
| 304 | for line in fin: |
| 305 | lc = [ x for x in line.strip().split(" ") if len(x) > 0 ] |
| 306 | if lc[0].startswith("l"): |
| 307 | files[target]['syms'].append(lc) |
| 308 | elif lc[0].startswith("d"): |
| 309 | files[target]['dirs'].append(lc) |
| 310 | else: |
| 311 | files[target]['files'].append(lc) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 312 | |
| 313 | for pname in images[target]: |
| 314 | if not pname in allpkgs: |
| 315 | try: |
| 316 | pkgdata = _toaster_load_pkgdatafile("%s/runtime-reverse/" % pkgdata_dir, pname) |
| 317 | except IOError as err: |
| 318 | if err.errno == 2: |
| 319 | # We expect this e.g. for RRECOMMENDS that are unsatisfied at runtime |
| 320 | continue |
| 321 | else: |
| 322 | raise |
| 323 | allpkgs[pname] = pkgdata |
| 324 | |
| 325 | |
| 326 | data = { 'pkgdata' : allpkgs, 'imgdata' : images, 'filedata' : files } |
| 327 | |
| 328 | bb.event.fire(bb.event.MetadataEvent("ImagePkgList", data), e.data) |
| 329 | |
| 330 | } |
| 331 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 332 | # get list of artifacts from sstate manifest |
| 333 | python toaster_artifacts() { |
| 334 | if e.taskname in ["do_deploy", "do_image_complete", "do_populate_sdk", "do_populate_sdk_ext"]: |
| 335 | d2 = d.createCopy() |
| 336 | d2.setVar('FILE', e.taskfile) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 337 | # Use 'stamp-extra-info' if present, else use workaround |
| 338 | # to determine 'SSTATE_MANMACH' |
| 339 | extrainf = d2.getVarFlag(e.taskname, 'stamp-extra-info') |
| 340 | if extrainf: |
| 341 | d2.setVar('SSTATE_MANMACH', extrainf) |
| 342 | else: |
| 343 | if "do_populate_sdk" == e.taskname: |
| 344 | d2.setVar('SSTATE_MANMACH', d2.expand("${MACHINE}${SDKMACHINE}")) |
| 345 | else: |
| 346 | d2.setVar('SSTATE_MANMACH', d2.expand("${MACHINE}")) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 347 | manifest = oe.sstatesig.sstate_get_manifest_filename(e.taskname[3:], d2)[0] |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 348 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 349 | if os.access(manifest, os.R_OK): |
| 350 | with open(manifest) as fmanifest: |
| 351 | artifacts = [fname.strip() for fname in fmanifest] |
| 352 | data = {"task": e.taskid, "artifacts": artifacts} |
| 353 | bb.event.fire(bb.event.MetadataEvent("TaskArtifacts", data), d2) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 354 | } |
| 355 | |
| 356 | # set event handlers |
| 357 | addhandler toaster_layerinfo_dumpdata |
| 358 | toaster_layerinfo_dumpdata[eventmask] = "bb.event.TreeDataPreparationCompleted" |
| 359 | |
| 360 | addhandler toaster_collect_task_stats |
| 361 | toaster_collect_task_stats[eventmask] = "bb.event.BuildCompleted bb.build.TaskSucceeded bb.build.TaskFailed" |
| 362 | |
| 363 | addhandler toaster_buildhistory_dump |
| 364 | toaster_buildhistory_dump[eventmask] = "bb.event.BuildCompleted" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 365 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 366 | addhandler toaster_artifacts |
| 367 | toaster_artifacts[eventmask] = "bb.runqueue.runQueueTaskSkipped bb.runqueue.runQueueTaskCompleted" |
| 368 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 369 | do_packagedata_setscene[postfuncs] += "toaster_package_dumpdata " |
| 370 | do_packagedata_setscene[vardepsexclude] += "toaster_package_dumpdata " |
| 371 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 372 | do_package[postfuncs] += "toaster_package_dumpdata " |
| 373 | do_package[vardepsexclude] += "toaster_package_dumpdata " |
| 374 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 375 | #do_populate_sdk[postfuncs] += "toaster_artifact_dumpdata " |
| 376 | #do_populate_sdk[vardepsexclude] += "toaster_artifact_dumpdata " |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 377 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 378 | #do_populate_sdk_ext[postfuncs] += "toaster_artifact_dumpdata " |
| 379 | #do_populate_sdk_ext[vardepsexclude] += "toaster_artifact_dumpdata " |
| 380 | |