diff options
author | Kang Kai <kai.kang@windriver.com> | 2012-08-28 10:47:19 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-07 12:10:40 +0100 |
commit | da98eddd02118f4330d05a1262617ba84029a13a (patch) | |
tree | 4b83207a134eb375acd2ba126148ab1853bb0439 /bitbake/lib/bb/ui/crumbs/builder.py | |
parent | 15abf2571ceca8634580538b8635487dbc7c0dd5 (diff) | |
download | poky-da98eddd02118f4330d05a1262617ba84029a13a.tar.gz |
bitbake: hob2: remove the hard-coded images map
[Yocto #2795]
When a new image type added, the hob will crash because the new type is
not in the hard-coded image dictionary.
For most of the image types, they are same with the image file's
extension name. So use variable "IMAGE_EXTENSION_difftype" to map the
image type which is diff with the image file extension name, such as
type "live". And the variable(s) will be set in image_types.bbclass.
(Bitbake rev: e7c84f056af9c613920d5adcd078a011e0387193)
Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/builder.py')
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/builder.py | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index 7de47986bb..5421fb6d12 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -893,8 +893,13 @@ class Builder(gtk.Window): | |||
893 | linkname = 'hob-image-' + self.configuration.curr_mach | 893 | linkname = 'hob-image-' + self.configuration.curr_mach |
894 | else: | 894 | else: |
895 | linkname = selected_image + '-' + self.configuration.curr_mach | 895 | linkname = selected_image + '-' + self.configuration.curr_mach |
896 | image_extension = self.get_image_extension() | ||
896 | for image_type in self.parameters.image_types: | 897 | for image_type in self.parameters.image_types: |
897 | for real_image_type in hcc.SUPPORTED_IMAGE_TYPES[image_type]: | 898 | if image_type in image_extension: |
899 | real_types = image_extension[image_type] | ||
900 | else: | ||
901 | real_types = [image_type] | ||
902 | for real_image_type in real_types: | ||
898 | linkpath = self.parameters.image_addr + '/' + linkname + '.' + real_image_type | 903 | linkpath = self.parameters.image_addr + '/' + linkname + '.' + real_image_type |
899 | if os.path.exists(linkpath): | 904 | if os.path.exists(linkpath): |
900 | self.parameters.image_names.append(os.readlink(linkpath)) | 905 | self.parameters.image_names.append(os.readlink(linkpath)) |
@@ -1114,10 +1119,21 @@ class Builder(gtk.Window): | |||
1114 | self.save_template(path) | 1119 | self.save_template(path) |
1115 | dialog.destroy() | 1120 | dialog.destroy() |
1116 | 1121 | ||
1122 | def get_image_extension(self): | ||
1123 | image_extension = {} | ||
1124 | for type in self.parameters.image_types: | ||
1125 | ext = self.handler.runCommand(["getVariable", "IMAGE_EXTENSION_%s" % type]) | ||
1126 | if ext: | ||
1127 | image_extension[type] = ext.split(' ') | ||
1128 | |||
1129 | return image_extension | ||
1130 | |||
1117 | def show_load_my_images_dialog(self): | 1131 | def show_load_my_images_dialog(self): |
1132 | image_extension = self.get_image_extension() | ||
1118 | dialog = ImageSelectionDialog(self.parameters.image_addr, self.parameters.image_types, | 1133 | dialog = ImageSelectionDialog(self.parameters.image_addr, self.parameters.image_types, |
1119 | "Open My Images", self, | 1134 | "Open My Images", self, |
1120 | gtk.FILE_CHOOSER_ACTION_SAVE) | 1135 | gtk.FILE_CHOOSER_ACTION_SAVE, None, |
1136 | image_extension) | ||
1121 | button = dialog.add_button("Cancel", gtk.RESPONSE_NO) | 1137 | button = dialog.add_button("Cancel", gtk.RESPONSE_NO) |
1122 | HobAltButton.style_button(button) | 1138 | HobAltButton.style_button(button) |
1123 | button = dialog.add_button("Open", gtk.RESPONSE_YES) | 1139 | button = dialog.add_button("Open", gtk.RESPONSE_YES) |
@@ -1334,4 +1350,4 @@ class Builder(gtk.Window): | |||
1334 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") | 1350 | format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") |
1335 | self.consolelog.setFormatter(format) | 1351 | self.consolelog.setFormatter(format) |
1336 | 1352 | ||
1337 | self.logger.addHandler(self.consolelog) \ No newline at end of file | 1353 | self.logger.addHandler(self.consolelog) |