diff options
| -rw-r--r-- | meta/classes/toaster.bbclass | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass index bbda2f8433..fba9067f0a 100644 --- a/meta/classes/toaster.bbclass +++ b/meta/classes/toaster.bbclass | |||
| @@ -147,31 +147,43 @@ python toaster_image_dumpdata() { | |||
| 147 | 147 | ||
| 148 | deploy_dir_image = d.getVar('DEPLOY_DIR_IMAGE', True); | 148 | deploy_dir_image = d.getVar('DEPLOY_DIR_IMAGE', True); |
| 149 | image_name = d.getVar('IMAGE_NAME', True); | 149 | image_name = d.getVar('IMAGE_NAME', True); |
| 150 | |||
| 151 | image_info_data = {} | 150 | image_info_data = {} |
| 152 | artifact_info_data = {} | ||
| 153 | 151 | ||
| 154 | # collect all artifacts | 152 | # collect all images |
| 155 | for dirpath, dirnames, filenames in os.walk(deploy_dir_image): | 153 | for dirpath, dirnames, filenames in os.walk(deploy_dir_image): |
| 156 | for fn in filenames: | 154 | for fn in filenames: |
| 157 | try: | 155 | try: |
| 158 | if fn.startswith(image_name): | 156 | if fn.startswith(image_name): |
| 159 | image_output = os.path.join(dirpath, fn) | 157 | image_output = os.path.join(dirpath, fn) |
| 160 | image_info_data[image_output] = os.stat(image_output).st_size | 158 | image_info_data[image_output] = os.stat(image_output).st_size |
| 161 | else: | ||
| 162 | import stat | ||
| 163 | artifact_path = os.path.join(dirpath, fn) | ||
| 164 | filestat = os.stat(artifact_path) | ||
| 165 | if not os.path.islink(artifact_path): | ||
| 166 | artifact_info_data[artifact_path] = filestat.st_size | ||
| 167 | except OSError as e: | 159 | except OSError as e: |
| 168 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) | 160 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) |
| 169 | 161 | ||
| 170 | bb.event.fire(bb.event.MetadataEvent("ImageFileSize",image_info_data), d) | 162 | bb.event.fire(bb.event.MetadataEvent("ImageFileSize",image_info_data), d) |
| 171 | bb.event.fire(bb.event.MetadataEvent("ArtifactFileSize",artifact_info_data), d) | ||
| 172 | } | 163 | } |
| 173 | 164 | ||
| 165 | python toaster_artifact_dumpdata() { | ||
| 166 | """ | ||
| 167 | Dump data about artifacts in the SDK_DEPLOY directory | ||
| 168 | """ | ||
| 169 | |||
| 170 | artifact_dir = d.getVar("SDK_DEPLOY", True) | ||
| 171 | artifact_info_data = {} | ||
| 172 | |||
| 173 | # collect all artifacts | ||
| 174 | for dirpath, dirnames, filenames in os.walk(artifact_dir): | ||
| 175 | for fn in filenames: | ||
| 176 | try: | ||
| 177 | artifact_path = os.path.join(dirpath, fn) | ||
| 178 | filestat = os.stat(artifact_path) | ||
| 179 | if not os.path.islink(artifact_path): | ||
| 180 | artifact_info_data[artifact_path] = filestat.st_size | ||
| 181 | except OSError as e: | ||
| 182 | import sys | ||
| 183 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) | ||
| 174 | 184 | ||
| 185 | bb.event.fire(bb.event.MetadataEvent("ArtifactFileSize",artifact_info_data), d) | ||
| 186 | } | ||
| 175 | 187 | ||
| 176 | # collect list of buildstats files based on fired events; when the build completes, collect all stats and fire an event with collected data | 188 | # collect list of buildstats files based on fired events; when the build completes, collect all stats and fire an event with collected data |
| 177 | 189 | ||
| @@ -341,9 +353,13 @@ toaster_collect_task_stats[eventmask] = "bb.event.BuildCompleted bb.build.TaskSu | |||
| 341 | 353 | ||
| 342 | addhandler toaster_buildhistory_dump | 354 | addhandler toaster_buildhistory_dump |
| 343 | toaster_buildhistory_dump[eventmask] = "bb.event.BuildCompleted" | 355 | toaster_buildhistory_dump[eventmask] = "bb.event.BuildCompleted" |
| 356 | |||
| 344 | do_package[postfuncs] += "toaster_package_dumpdata " | 357 | do_package[postfuncs] += "toaster_package_dumpdata " |
| 345 | do_package[vardepsexclude] += "toaster_package_dumpdata " | 358 | do_package[vardepsexclude] += "toaster_package_dumpdata " |
| 346 | 359 | ||
| 347 | do_rootfs[postfuncs] += "toaster_image_dumpdata " | 360 | do_rootfs[postfuncs] += "toaster_image_dumpdata " |
| 348 | do_rootfs[postfuncs] += "toaster_licensemanifest_dump " | 361 | do_rootfs[postfuncs] += "toaster_licensemanifest_dump " |
| 349 | do_rootfs[vardepsexclude] += "toaster_image_dumpdata toaster_licensemanifest_dump" | 362 | do_rootfs[vardepsexclude] += "toaster_image_dumpdata toaster_licensemanifest_dump " |
| 363 | |||
| 364 | do_populate_sdk[postfuncs] += "toaster_artifact_dumpdata " | ||
| 365 | do_populate_sdk[vardepsexclude] += "toaster_artifact_dumpdata " | ||
