diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-07-12 15:54:27 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-19 09:03:32 +0100 |
commit | ac339ece209b7c6b4fbe9a55233599f3cd112fbe (patch) | |
tree | 23df3826980bc84101f82a78ff064c82b0015b10 /meta/classes | |
parent | 8d08a73225ca665189fa922b87618638f86ca0f9 (diff) | |
download | poky-ac339ece209b7c6b4fbe9a55233599f3cd112fbe.tar.gz |
toaster.bbclass: remove directory scan logic for detecting artifacts
toaster.bbclass does a scan of the image deploy and SDK directories
when a build finishes. However, this brings no benefit and could be
better managed and made easier to modify if moved to toasterui and
carried out when the BuildCompleted event occurs.
Remove the image scan code from toaster.bbclass, prior to moving it
to toasterui and buildinfohelper.
Also remove the license manifest update code, as this can also be
done from toasterui.
The postfuncs for do_populate_sdk are retained, but no longer
do the directory scan for SDK artifacts. Instead, they fire
an event with the value of the TOOLCHAIN_OUTPUTNAME variable,
as this is only accessible at the point when the do_populate_sdk
and do_populate_sdk_ext tasks are run. The value of this can then
be used by buildinfohelper to find the SDK artifacts produced by a
target.
[YOCTO #9002]
(From OE-Core rev: 67ebb5406c0fcdd1b28bf446249aa6fe34a741a8)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: bavery <brian.avery@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/toaster.bbclass | 74 |
1 files changed, 8 insertions, 66 deletions
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass index 1878fe095d..90ea563809 100644 --- a/meta/classes/toaster.bbclass +++ b/meta/classes/toaster.bbclass | |||
@@ -136,60 +136,16 @@ python toaster_package_dumpdata() { | |||
136 | 136 | ||
137 | # 2. Dump output image files information | 137 | # 2. Dump output image files information |
138 | 138 | ||
139 | python toaster_image_dumpdata() { | ||
140 | """ | ||
141 | Image filename for output images is not standardized. | ||
142 | image_types.bbclass will spell out IMAGE_CMD_xxx variables that actually | ||
143 | have hardcoded ways to create image file names in them. | ||
144 | So we look for files starting with the set name. | ||
145 | |||
146 | We also look for other files in the images/ directory which don't | ||
147 | match IMAGE_NAME, such as the kernel bzImage, modules tarball etc. | ||
148 | """ | ||
149 | |||
150 | dir_to_walk = d.getVar('DEPLOY_DIR_IMAGE', True); | ||
151 | image_name = d.getVar('IMAGE_NAME', True); | ||
152 | image_info_data = {} | ||
153 | artifact_info_data = {} | ||
154 | |||
155 | # collect all images and artifacts in the images directory | ||
156 | for dirpath, dirnames, filenames in os.walk(dir_to_walk): | ||
157 | for filename in filenames: | ||
158 | full_path = os.path.join(dirpath, filename) | ||
159 | try: | ||
160 | if filename.startswith(image_name): | ||
161 | # image | ||
162 | image_info_data[full_path] = os.stat(full_path).st_size | ||
163 | else: | ||
164 | # other non-image artifact | ||
165 | if not os.path.islink(full_path): | ||
166 | artifact_info_data[full_path] = os.stat(full_path).st_size | ||
167 | except OSError as e: | ||
168 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) | ||
169 | |||
170 | bb.event.fire(bb.event.MetadataEvent("ImageFileSize", image_info_data), d) | ||
171 | bb.event.fire(bb.event.MetadataEvent("ArtifactFileSize", artifact_info_data), d) | ||
172 | } | ||
173 | |||
174 | python toaster_artifact_dumpdata() { | 139 | python toaster_artifact_dumpdata() { |
175 | """ | 140 | """ |
176 | Dump data about artifacts in the SDK_DEPLOY directory | 141 | Dump data about SDK variables |
177 | """ | 142 | """ |
178 | 143 | ||
179 | dir_to_walk = d.getVar("SDK_DEPLOY", True) | 144 | event_data = { |
180 | artifact_info_data = {} | 145 | "TOOLCHAIN_OUTPUTNAME": d.getVar("TOOLCHAIN_OUTPUTNAME", True) |
181 | 146 | } | |
182 | # collect all artifacts in the sdk directory | ||
183 | for dirpath, dirnames, filenames in os.walk(dir_to_walk): | ||
184 | for filename in filenames: | ||
185 | full_path = os.path.join(dirpath, filename) | ||
186 | try: | ||
187 | if not os.path.islink(full_path): | ||
188 | artifact_info_data[full_path] = os.stat(full_path).st_size | ||
189 | except OSError as e: | ||
190 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) | ||
191 | 147 | ||
192 | bb.event.fire(bb.event.MetadataEvent("ArtifactFileSize", artifact_info_data), d) | 148 | bb.event.fire(bb.event.MetadataEvent("SDKArtifactInfo", event_data), d) |
193 | } | 149 | } |
194 | 150 | ||
195 | # collect list of buildstats files based on fired events; when the build completes, collect all stats and fire an event with collected data | 151 | # collect list of buildstats files based on fired events; when the build completes, collect all stats and fire an event with collected data |
@@ -361,17 +317,6 @@ python toaster_buildhistory_dump() { | |||
361 | 317 | ||
362 | } | 318 | } |
363 | 319 | ||
364 | # dump information related to license manifest path | ||
365 | |||
366 | python toaster_licensemanifest_dump() { | ||
367 | deploy_dir = d.getVar('DEPLOY_DIR', True); | ||
368 | image_name = d.getVar('IMAGE_NAME', True); | ||
369 | |||
370 | data = { 'deploy_dir' : deploy_dir, 'image_name' : image_name } | ||
371 | |||
372 | bb.event.fire(bb.event.MetadataEvent("LicenseManifestPath", data), d) | ||
373 | } | ||
374 | |||
375 | # set event handlers | 320 | # set event handlers |
376 | addhandler toaster_layerinfo_dumpdata | 321 | addhandler toaster_layerinfo_dumpdata |
377 | toaster_layerinfo_dumpdata[eventmask] = "bb.event.TreeDataPreparationCompleted" | 322 | toaster_layerinfo_dumpdata[eventmask] = "bb.event.TreeDataPreparationCompleted" |
@@ -388,11 +333,8 @@ do_packagedata_setscene[vardepsexclude] += "toaster_package_dumpdata " | |||
388 | do_package[postfuncs] += "toaster_package_dumpdata " | 333 | do_package[postfuncs] += "toaster_package_dumpdata " |
389 | do_package[vardepsexclude] += "toaster_package_dumpdata " | 334 | do_package[vardepsexclude] += "toaster_package_dumpdata " |
390 | 335 | ||
391 | do_image_complete[postfuncs] += "toaster_image_dumpdata " | ||
392 | do_image_complete[vardepsexclude] += "toaster_image_dumpdata " | ||
393 | |||
394 | do_rootfs[postfuncs] += "toaster_licensemanifest_dump " | ||
395 | do_rootfs[vardepsexclude] += "toaster_licensemanifest_dump " | ||
396 | |||
397 | do_populate_sdk[postfuncs] += "toaster_artifact_dumpdata " | 336 | do_populate_sdk[postfuncs] += "toaster_artifact_dumpdata " |
398 | do_populate_sdk[vardepsexclude] += "toaster_artifact_dumpdata " | 337 | do_populate_sdk[vardepsexclude] += "toaster_artifact_dumpdata " |
338 | |||
339 | do_populate_sdk_ext[postfuncs] += "toaster_artifact_dumpdata " | ||
340 | do_populate_sdk_ext[vardepsexclude] += "toaster_artifact_dumpdata " \ No newline at end of file | ||