summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-07-22 21:47:00 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-25 12:54:16 +0100
commit9adf01d7be1c2fedfb71975619af60e8af2fe3f2 (patch)
tree53400442ad225eda2e3ce80544b89100014f13fc
parent1f4e6d62f2002faf57c2f273707141d0192dc5cd (diff)
downloadpoky-9adf01d7be1c2fedfb71975619af60e8af2fe3f2.tar.gz
hob: rework image output type setting
The preferences UI to set the image output type only supported setting a single value whereas it's common practice, particularly for those making use of the ADT, to set multiple values. This is also the default in Poky. This reworked preferences UI dynamically generates check boxes for each available image type and sets an appropriate string representing all image types when checkboxes are toggled. Includes fixes for [YOCTO #1273] (Bitbake rev: f7f68847dd165f2ad0f39011db4ebfef3ae73f42) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/crumbs/configurator.py6
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py21
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobprefs.py50
-rw-r--r--bitbake/lib/bb/ui/hob.py5
4 files changed, 56 insertions, 26 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/configurator.py b/bitbake/lib/bb/ui/crumbs/configurator.py
index e7c524afce..6481608483 100644
--- a/bitbake/lib/bb/ui/crumbs/configurator.py
+++ b/bitbake/lib/bb/ui/crumbs/configurator.py
@@ -90,12 +90,14 @@ class Configurator(gobject.GObject):
90 pclass = getString('PACKAGE_CLASSES') 90 pclass = getString('PACKAGE_CLASSES')
91 if pclass and pclass != self.config.get('PACKAGE_CLASSES', ''): 91 if pclass and pclass != self.config.get('PACKAGE_CLASSES', ''):
92 self.config['PACKAGE_CLASSES'] = pclass 92 self.config['PACKAGE_CLASSES'] = pclass
93 fstypes = getString('IMAGE_FSTYPES')
94 if fstypes and fstypes != self.config.get('IMAGE_FSTYPES', ''):
95 self.config['IMAGE_FSTYPES'] = fstypes
93 96
94 self.orig_config = copy.deepcopy(self.config) 97 self.orig_config = copy.deepcopy(self.config)
95 98
96 def setLocalConfVar(self, var, val): 99 def setLocalConfVar(self, var, val):
97 if var in self.config: 100 self.config[var] = val
98 self.config[var] = val
99 101
100 def _loadLayerConf(self, path): 102 def _loadLayerConf(self, path):
101 self.bblayers = path 103 self.bblayers = path
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index fa79e0c7a2..2f45350c32 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -74,6 +74,8 @@ class HobHandler(gobject.GObject):
74 self.model = taskmodel 74 self.model = taskmodel
75 self.server = server 75 self.server = server
76 76
77 self.image_output_types = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"]).split(" ")
78
77 self.command_map = { 79 self.command_map = {
78 "findConfigFilePathLocal" : ("findConfigFilePath", ["hob.local.conf"], "findConfigFilePathHobLocal"), 80 "findConfigFilePathLocal" : ("findConfigFilePath", ["hob.local.conf"], "findConfigFilePathHobLocal"),
79 "findConfigFilePathHobLocal" : ("findConfigFilePath", ["bblayers.conf"], "findConfigFilePathLayers"), 81 "findConfigFilePathHobLocal" : ("findConfigFilePath", ["bblayers.conf"], "findConfigFilePathLayers"),
@@ -258,8 +260,23 @@ class HobHandler(gobject.GObject):
258 self.building = None 260 self.building = None
259 self.emit("build-complete") 261 self.emit("build-complete")
260 262
261 def set_image_output_type(self, output_type): 263 def set_fstypes(self, fstypes):
262 self.server.runCommand(["setVariable", "IMAGE_FSTYPES", output_type]) 264 self.server.runCommand(["setVariable", "IMAGE_FSTYPES", fstypes])
265
266 def add_image_output_type(self, output_type):
267 if output_type not in self.image_output_types:
268 self.image_output_types.append(output_type)
269 fstypes = " ".join(self.image_output_types)
270 self.set_fstypes(fstypes)
271 return fstypes
272
273 def remove_image_output_type(self, output_type):
274 if output_type in self.image_output_types:
275 ind = self.image_output_types.index(output_type)
276 self.image_output_types.pop(ind)
277 fstypes = " ".join(self.image_output_types)
278 self.set_fstypes(fstypes)
279 return fstypes
263 280
264 def get_image_deploy_dir(self): 281 def get_image_deploy_dir(self):
265 return self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"]) 282 return self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"])
diff --git a/bitbake/lib/bb/ui/crumbs/hobprefs.py b/bitbake/lib/bb/ui/crumbs/hobprefs.py
index ab2f0d87fe..1e6c78b435 100644
--- a/bitbake/lib/bb/ui/crumbs/hobprefs.py
+++ b/bitbake/lib/bb/ui/crumbs/hobprefs.py
@@ -30,11 +30,15 @@ class HobPrefs(gtk.Dialog):
30 if model: 30 if model:
31 model.clear() 31 model.clear()
32 32
33 def output_type_changed_cb(self, combo, handler): 33 def output_type_toggled_cb(self, check, handler):
34 ot = combo.get_active_text() 34 ot = check.get_label()
35 if ot != self.curr_output_type: 35 enabled = check.get_active()
36 self.curr_output_type = ot 36 if enabled:
37 handler.set_image_output_type(ot) 37 self.selected_image_types = handler.add_image_output_type(ot)
38 else:
39 self.selected_image_types = handler.remove_image_output_type(ot)
40
41 self.configurator.setLocalConfVar('IMAGE_FSTYPES', "%s" % self.selected_image_types)
38 42
39 def sdk_machine_combo_changed_cb(self, combo, handler): 43 def sdk_machine_combo_changed_cb(self, combo, handler):
40 sdk_mach = combo.get_active_text() 44 sdk_mach = combo.get_active_text()
@@ -144,7 +148,7 @@ class HobPrefs(gtk.Dialog):
144 glib.idle_add(self.handler.reload_data) 148 glib.idle_add(self.handler.reload_data)
145 149
146 def __init__(self, configurator, handler, curr_sdk_mach, curr_distro, pclass, 150 def __init__(self, configurator, handler, curr_sdk_mach, curr_distro, pclass,
147 cpu_cnt, pmake, bbthread, image_types): 151 cpu_cnt, pmake, bbthread, selected_image_types, all_image_types):
148 """ 152 """
149 """ 153 """
150 gtk.Dialog.__init__(self, "Preferences", None, 154 gtk.Dialog.__init__(self, "Preferences", None,
@@ -162,7 +166,6 @@ class HobPrefs(gtk.Dialog):
162 self.curr_sdk_mach = curr_sdk_mach 166 self.curr_sdk_mach = curr_sdk_mach
163 self.curr_distro = curr_distro 167 self.curr_distro = curr_distro
164 self.curr_package_format = pclass 168 self.curr_package_format = pclass
165 self.curr_output_type = None
166 self.cpu_cnt = cpu_cnt 169 self.cpu_cnt = cpu_cnt
167 self.pmake = pmake 170 self.pmake = pmake
168 self.bbthread = bbthread 171 self.bbthread = bbthread
@@ -170,6 +173,7 @@ class HobPrefs(gtk.Dialog):
170 self.distro_handler_id = None 173 self.distro_handler_id = None
171 self.sdk_machine_handler_id = None 174 self.sdk_machine_handler_id = None
172 self.package_handler_id = None 175 self.package_handler_id = None
176 self.selected_image_types = selected_image_types.split(" ")
173 177
174 left = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) 178 left = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
175 right = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) 179 right = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL)
@@ -214,19 +218,25 @@ class HobPrefs(gtk.Dialog):
214 of the root filesystem and also dictates the package manager used in your image""") 218 of the root filesystem and also dictates the package manager used in your image""")
215 self.package_combo.show() 219 self.package_combo.show()
216 hbox.pack_start(self.package_combo, expand=False, fill=False, padding=6) 220 hbox.pack_start(self.package_combo, expand=False, fill=False, padding=6)
217 # Image output type selector 221 if all_image_types:
218 label = gtk.Label("Image output type:") 222 # Image output type selector
219 label.show() 223 label = gtk.Label("Image output types:")
220 hbox.pack_start(label, expand=False, fill=False, padding=6) 224 label.show()
221 output_combo = gtk.combo_box_new_text() 225 hbox.pack_start(label, expand=False, fill=False, padding=6)
222 if image_types: 226 chk_cnt = 3
223 for it in image_types.split(" "): 227 for it in all_image_types.split(" "):
224 output_combo.append_text(it) 228 chk_cnt = chk_cnt + 1
225 output_combo.connect("changed", self.output_type_changed_cb, handler) 229 if chk_cnt % 6 == 0:
226 else: 230 hbox = gtk.HBox(False, 12)
227 output_combo.set_sensitive(False) 231 hbox.show()
228 output_combo.show() 232 pbox.pack_start(hbox, expand=False, fill=False, padding=6)
229 hbox.pack_start(output_combo) 233 chk = gtk.CheckButton(it)
234 if it in self.selected_image_types:
235 chk.set_active(True)
236 chk.set_tooltip_text("Build an %s image" % it)
237 chk.connect("toggled", self.output_type_toggled_cb, handler)
238 chk.show()
239 hbox.pack_start(chk, expand=False, fill=False, padding=3)
230 # BitBake 240 # BitBake
231 label = gtk.Label() 241 label = gtk.Label()
232 label.set_markup("<b>BitBake</b>") 242 label.set_markup("<b>BitBake</b>")
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py
index 8e3e7bccef..09a63c6717 100644
--- a/bitbake/lib/bb/ui/hob.py
+++ b/bitbake/lib/bb/ui/hob.py
@@ -900,7 +900,8 @@ def main (server, eventHandler):
900 # up to and including the space 900 # up to and including the space
901 pmake = int(pmake.lstrip("-j ")) 901 pmake = int(pmake.lstrip("-j "))
902 902
903 image_types = server.runCommand(["getVariable", "IMAGE_TYPES"]) 903 selected_image_types = server.runCommand(["getVariable", "IMAGE_FSTYPES"])
904 all_image_types = server.runCommand(["getVariable", "IMAGE_TYPES"])
904 905
905 pclasses = server.runCommand(["getVariable", "PACKAGE_CLASSES"]).split(" ") 906 pclasses = server.runCommand(["getVariable", "PACKAGE_CLASSES"]).split(" ")
906 # NOTE: we're only supporting one value for PACKAGE_CLASSES being set 907 # NOTE: we're only supporting one value for PACKAGE_CLASSES being set
@@ -909,7 +910,7 @@ def main (server, eventHandler):
909 pkg, sep, pclass = pclasses[0].rpartition("_") 910 pkg, sep, pclass = pclasses[0].rpartition("_")
910 911
911 prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass, cpu_cnt, 912 prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass, cpu_cnt,
912 pmake, bbthread, image_types) 913 pmake, bbthread, selected_image_types, all_image_types)
913 layers = LayerEditor(configurator, None) 914 layers = LayerEditor(configurator, None)
914 window = MainWindow(taskmodel, handler, configurator, prefs, layers, mach) 915 window = MainWindow(taskmodel, handler, configurator, prefs, layers, mach)
915 prefs.set_parent_window(window) 916 prefs.set_parent_window(window)