diff options
author | Elliot Smith <elliot.smith@intel.com> | 2016-02-02 10:25:03 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-04 23:39:01 +0000 |
commit | 8dc600f14420226143f8797e7ba98001f017c26f (patch) | |
tree | f115d501d6ef568ad71e9eec4d7e150191adde44 | |
parent | eee675bd7190d0953dfb760d8a1cacd192e3ddac (diff) | |
download | poky-8dc600f14420226143f8797e7ba98001f017c26f.tar.gz |
toaster.bbclass: reinstate scan for artifacts in the sdk directory
During refactoring of the SDK/artifact scan code in toaster.bbclass,
the code to find other non-image artifacts in the images/ directory
was incorrectly removed.
Reinstate that code and clean it up so it's clearer what's happening
and so that non-image artifacts are correctly reported.
[YOCTO #8956]
(From OE-Core rev: 4899041d59f3537c46eb79ba3471ca2b72caad89)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/toaster.bbclass | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass index e307014a6a..51a4c74e5b 100644 --- a/meta/classes/toaster.bbclass +++ b/meta/classes/toaster.bbclass | |||
@@ -143,23 +143,33 @@ python toaster_image_dumpdata() { | |||
143 | image_types.bbclass will spell out IMAGE_CMD_xxx variables that actually | 143 | image_types.bbclass will spell out IMAGE_CMD_xxx variables that actually |
144 | have hardcoded ways to create image file names in them. | 144 | have hardcoded ways to create image file names in them. |
145 | So we look for files starting with the set name. | 145 | So we look for files starting with the set name. |
146 | |||
147 | We also look for other files in the images/ directory which don't | ||
148 | match IMAGE_NAME, such as the kernel bzImage, modules tarball etc. | ||
146 | """ | 149 | """ |
147 | 150 | ||
148 | deploy_dir_image = d.getVar('DEPLOY_DIR_IMAGE', True); | 151 | dir_to_walk = d.getVar('DEPLOY_DIR_IMAGE', True); |
149 | image_name = d.getVar('IMAGE_NAME', True); | 152 | image_name = d.getVar('IMAGE_NAME', True); |
150 | image_info_data = {} | 153 | image_info_data = {} |
154 | artifact_info_data = {} | ||
151 | 155 | ||
152 | # collect all images | 156 | # collect all images and artifacts in the images directory |
153 | for dirpath, dirnames, filenames in os.walk(deploy_dir_image): | 157 | for dirpath, dirnames, filenames in os.walk(dir_to_walk): |
154 | for fn in filenames: | 158 | for filename in filenames: |
159 | full_path = os.path.join(dirpath, filename) | ||
155 | try: | 160 | try: |
156 | if fn.startswith(image_name): | 161 | if filename.startswith(image_name): |
157 | image_output = os.path.join(dirpath, fn) | 162 | # image |
158 | image_info_data[image_output] = os.stat(image_output).st_size | 163 | image_info_data[full_path] = os.stat(full_path).st_size |
164 | else: | ||
165 | # other non-image artifact | ||
166 | if not os.path.islink(full_path): | ||
167 | artifact_info_data[full_path] = os.stat(full_path).st_size | ||
159 | except OSError as e: | 168 | except OSError as e: |
160 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) | 169 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) |
161 | 170 | ||
162 | bb.event.fire(bb.event.MetadataEvent("ImageFileSize", image_info_data), d) | 171 | bb.event.fire(bb.event.MetadataEvent("ImageFileSize", image_info_data), d) |
172 | bb.event.fire(bb.event.MetadataEvent("ArtifactFileSize", artifact_info_data), d) | ||
163 | } | 173 | } |
164 | 174 | ||
165 | python toaster_artifact_dumpdata() { | 175 | python toaster_artifact_dumpdata() { |
@@ -167,16 +177,16 @@ python toaster_artifact_dumpdata() { | |||
167 | Dump data about artifacts in the SDK_DEPLOY directory | 177 | Dump data about artifacts in the SDK_DEPLOY directory |
168 | """ | 178 | """ |
169 | 179 | ||
170 | artifact_dir = d.getVar("SDK_DEPLOY", True) | 180 | dir_to_walk = d.getVar("SDK_DEPLOY", True) |
171 | artifact_info_data = {} | 181 | artifact_info_data = {} |
172 | 182 | ||
173 | # collect all artifacts | 183 | # collect all artifacts in the sdk directory |
174 | for dirpath, dirnames, filenames in os.walk(artifact_dir): | 184 | for dirpath, dirnames, filenames in os.walk(dir_to_walk): |
175 | for fn in filenames: | 185 | for filename in filenames: |
186 | full_path = os.path.join(dirpath, filename) | ||
176 | try: | 187 | try: |
177 | artifact_path = os.path.join(dirpath, fn) | 188 | if not os.path.islink(full_path): |
178 | if not os.path.islink(artifact_path): | 189 | artifact_info_data[full_path] = os.stat(full_path).st_size |
179 | artifact_info_data[artifact_path] = os.stat(artifact_path).st_size | ||
180 | except OSError as e: | 190 | except OSError as e: |
181 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) | 191 | bb.event.fire(bb.event.MetadataEvent("OSErrorException", e), d) |
182 | 192 | ||