summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2012-03-19 11:08:45 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-22 14:40:39 +0000
commit8683fa2d6302f37c12730ba872da778873939037 (patch)
treebef0cd55b63739f649be326b8de75d745d3bbffc
parente9a9422ec38a096ab64dd0b15382c1a40b7a1fc9 (diff)
downloadpoky-8683fa2d6302f37c12730ba872da778873939037.tar.gz
Hob: Remove split model in GTK Hob
Since the GTK Hob will not use the server/client split model, thus remove it from current Hob code. But we still keep the core mechanism in bitbake server. (From Poky rev: 983ea0265a53e0725dcbf9085ea767ebbc155ae5) (Bitbake rev: 8c129e05a94d457860d883c9b2934a5559de8d9b) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py13
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py103
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py21
-rwxr-xr-xbitbake/lib/bb/ui/hob.py11
4 files changed, 41 insertions, 107 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index b1aad54eed..d3b13c93af 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -260,21 +260,14 @@ class Builder(gtk.Window):
260 self.show_all() 260 self.show_all()
261 self.nb.set_current_page(0) 261 self.nb.set_current_page(0)
262 262
263 def get_split_model(self):
264 return self.handler.split_model
265
266 def load_template(self, path): 263 def load_template(self, path):
267 self.template = TemplateMgr() 264 self.template = TemplateMgr()
268 self.template.load(path) 265 self.template.load(path)
269 self.configuration.load(self.template) 266 self.configuration.load(self.template)
270 267
271 if self.get_split_model(): 268 for layer in self.configuration.layers:
272 if not set(self.configuration.layers) <= set(self.parameters.all_layers): 269 if not os.path.exists(layer+'/conf/layer.conf'):
273 return False 270 return False
274 else:
275 for layer in self.configuration.layers:
276 if not os.path.exists(layer+'/conf/layer.conf'):
277 return False
278 271
279 self.switch_page(self.LAYER_CHANGED) 272 self.switch_page(self.LAYER_CHANGED)
280 273
@@ -674,7 +667,6 @@ class Builder(gtk.Window):
674 dialog = LayerSelectionDialog(title = "Layer Selection", 667 dialog = LayerSelectionDialog(title = "Layer Selection",
675 layers = copy.deepcopy(self.configuration.layers), 668 layers = copy.deepcopy(self.configuration.layers),
676 all_layers = self.parameters.all_layers, 669 all_layers = self.parameters.all_layers,
677 split_model = self.get_split_model(),
678 parent = self, 670 parent = self,
679 flags = gtk.DIALOG_MODAL 671 flags = gtk.DIALOG_MODAL
680 | gtk.DIALOG_DESTROY_WITH_PARENT 672 | gtk.DIALOG_DESTROY_WITH_PARENT
@@ -748,7 +740,6 @@ class Builder(gtk.Window):
748 all_distros = self.parameters.all_distros, 740 all_distros = self.parameters.all_distros,
749 all_sdk_machines = self.parameters.all_sdk_machines, 741 all_sdk_machines = self.parameters.all_sdk_machines,
750 max_threads = self.parameters.max_threads, 742 max_threads = self.parameters.max_threads,
751 split_model = self.get_split_model(),
752 parent = self, 743 parent = self,
753 flags = gtk.DIALOG_MODAL 744 flags = gtk.DIALOG_MODAL
754 | gtk.DIALOG_DESTROY_WITH_PARENT 745 | gtk.DIALOG_DESTROY_WITH_PARENT
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index baad7b8271..bd27375ea5 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -170,23 +170,20 @@ class AdvancedSettingDialog (CrumbsDialog):
170 170
171 dialog.destroy() 171 dialog.destroy()
172 172
173 def gen_entry_widget(self, split_model, content, parent, tooltip=""): 173 def gen_entry_widget(self, content, parent, tooltip=""):
174 hbox = gtk.HBox(False, 12) 174 hbox = gtk.HBox(False, 12)
175 entry = gtk.Entry() 175 entry = gtk.Entry()
176 entry.set_text(content) 176 entry.set_text(content)
177 177
178 if split_model: 178 table = gtk.Table(1, 10, True)
179 hbox.pack_start(entry, expand=True, fill=True) 179 hbox.pack_start(table, expand=True, fill=True)
180 else: 180 table.attach(entry, 0, 9, 0, 1)
181 table = gtk.Table(1, 10, True) 181 image = gtk.Image()
182 hbox.pack_start(table, expand=True, fill=True) 182 image.set_from_stock(gtk.STOCK_OPEN,gtk.ICON_SIZE_BUTTON)
183 table.attach(entry, 0, 9, 0, 1) 183 open_button = gtk.Button()
184 image = gtk.Image() 184 open_button.set_image(image)
185 image.set_from_stock(gtk.STOCK_OPEN,gtk.ICON_SIZE_BUTTON) 185 open_button.connect("clicked", self.entry_widget_select_path_cb, parent, entry)
186 open_button = gtk.Button() 186 table.attach(open_button, 9, 10, 0, 1)
187 open_button.set_image(image)
188 open_button.connect("clicked", self.entry_widget_select_path_cb, parent, entry)
189 table.attach(open_button, 9, 10, 0, 1)
190 187
191 info = HobInfoButton(tooltip, self) 188 info = HobInfoButton(tooltip, self)
192 hbox.pack_start(info, expand=False, fill=False) 189 hbox.pack_start(info, expand=False, fill=False)
@@ -421,7 +418,7 @@ class AdvancedSettingDialog (CrumbsDialog):
421 418
422 def __init__(self, title, configuration, all_image_types, 419 def __init__(self, title, configuration, all_image_types,
423 all_package_formats, all_distros, all_sdk_machines, 420 all_package_formats, all_distros, all_sdk_machines,
424 max_threads, split_model, parent, flags, buttons): 421 max_threads, parent, flags, buttons):
425 super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons) 422 super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons)
426 423
427 # class members from other objects 424 # class members from other objects
@@ -432,7 +429,6 @@ class AdvancedSettingDialog (CrumbsDialog):
432 self.all_distros = all_distros 429 self.all_distros = all_distros
433 self.all_sdk_machines = all_sdk_machines 430 self.all_sdk_machines = all_sdk_machines
434 self.max_threads = max_threads 431 self.max_threads = max_threads
435 self.split_model = split_model
436 432
437 # class members for internal use 433 # class members for internal use
438 self.pkgfmt_store = None 434 self.pkgfmt_store = None
@@ -586,7 +582,7 @@ class AdvancedSettingDialog (CrumbsDialog):
586 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) 582 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
587 label = self.gen_label_widget("<span weight=\"bold\">Set Download Directory:</span>") 583 label = self.gen_label_widget("<span weight=\"bold\">Set Download Directory:</span>")
588 tooltip = "Select a folder that caches the upstream project source code" 584 tooltip = "Select a folder that caches the upstream project source code"
589 dldir_widget, self.dldir_text = self.gen_entry_widget(self.split_model, self.configuration.dldir, self, tooltip) 585 dldir_widget, self.dldir_text = self.gen_entry_widget(self.configuration.dldir, self, tooltip)
590 sub_vbox.pack_start(label, expand=False, fill=False) 586 sub_vbox.pack_start(label, expand=False, fill=False)
591 sub_vbox.pack_start(dldir_widget, expand=False, fill=False) 587 sub_vbox.pack_start(dldir_widget, expand=False, fill=False)
592 588
@@ -594,7 +590,7 @@ class AdvancedSettingDialog (CrumbsDialog):
594 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) 590 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
595 label = self.gen_label_widget("<span weight=\"bold\">Select SSTATE Directory:</span>") 591 label = self.gen_label_widget("<span weight=\"bold\">Select SSTATE Directory:</span>")
596 tooltip = "Select a folder that caches your prebuilt results" 592 tooltip = "Select a folder that caches your prebuilt results"
597 sstatedir_widget, self.sstatedir_text = self.gen_entry_widget(self.split_model, self.configuration.sstatedir, self, tooltip) 593 sstatedir_widget, self.sstatedir_text = self.gen_entry_widget(self.configuration.sstatedir, self, tooltip)
598 sub_vbox.pack_start(label, expand=False, fill=False) 594 sub_vbox.pack_start(label, expand=False, fill=False)
599 sub_vbox.pack_start(sstatedir_widget, expand=False, fill=False) 595 sub_vbox.pack_start(sstatedir_widget, expand=False, fill=False)
600 596
@@ -602,7 +598,7 @@ class AdvancedSettingDialog (CrumbsDialog):
602 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) 598 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
603 label = self.gen_label_widget("<span weight=\"bold\">Select SSTATE Mirror:</span>") 599 label = self.gen_label_widget("<span weight=\"bold\">Select SSTATE Mirror:</span>")
604 tooltip = "Select the prebuilt mirror that will fasten your build speed" 600 tooltip = "Select the prebuilt mirror that will fasten your build speed"
605 sstatemirror_widget, self.sstatemirror_text = self.gen_entry_widget(self.split_model, self.configuration.sstatemirror, self, tooltip) 601 sstatemirror_widget, self.sstatemirror_text = self.gen_entry_widget(self.configuration.sstatemirror, self, tooltip)
606 sub_vbox.pack_start(label, expand=False, fill=False) 602 sub_vbox.pack_start(label, expand=False, fill=False)
607 sub_vbox.pack_start(sstatemirror_widget, expand=False, fill=False) 603 sub_vbox.pack_start(sstatemirror_widget, expand=False, fill=False)
608 604
@@ -850,7 +846,7 @@ class LayerSelectionDialog (CrumbsDialog):
850 layer_store.remove(iter) 846 layer_store.remove(iter)
851 847
852 848
853 def gen_layer_widget(self, split_model, layers, layers_avail, window, tooltip=""): 849 def gen_layer_widget(self, layers, layers_avail, window, tooltip=""):
854 hbox = gtk.HBox(False, 6) 850 hbox = gtk.HBox(False, 6)
855 851
856 layer_tv = gtk.TreeView() 852 layer_tv = gtk.TreeView()
@@ -874,57 +870,36 @@ class LayerSelectionDialog (CrumbsDialog):
874 table_layer = gtk.Table(2, 10, False) 870 table_layer = gtk.Table(2, 10, False)
875 hbox.pack_start(table_layer, expand=True, fill=True) 871 hbox.pack_start(table_layer, expand=True, fill=True)
876 872
877 if split_model: 873 table_layer.attach(scroll, 0, 10, 0, 1)
878 table_layer.attach(scroll, 0, 10, 0, 2)
879 874
880 layer_store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_BOOLEAN) 875 layer_store = gtk.ListStore(gobject.TYPE_STRING)
881 for layer in layers: 876 for layer in layers:
882 layer_store.set(layer_store.append(), 0, layer, 1, True) 877 layer_store.set(layer_store.append(), 0, layer)
883 for layer in layers_avail:
884 if layer not in layers:
885 layer_store.set(layer_store.append(), 0, layer, 1, False)
886 878
887 col1 = gtk.TreeViewColumn('Included') 879 image = gtk.Image()
888 layer_tv.append_column(col1) 880 image.set_from_stock(gtk.STOCK_ADD,gtk.ICON_SIZE_MENU)
889 881 add_button = gtk.Button()
890 cell1 = gtk.CellRendererToggle() 882 add_button.set_image(image)
891 cell1.connect("toggled", self.layer_widget_toggled_cb, layer_store) 883 add_button.connect("clicked", self.layer_widget_add_clicked_cb, layer_store, window)
892 col1.pack_start(cell1, True) 884 table_layer.attach(add_button, 0, 5, 1, 2, gtk.EXPAND | gtk.FILL, 0, 0, 6)
893 col1.set_attributes(cell1, active=1) 885 image = gtk.Image()
894 886 image.set_from_stock(gtk.STOCK_REMOVE,gtk.ICON_SIZE_MENU)
895 else: 887 del_button = gtk.Button()
896 table_layer.attach(scroll, 0, 10, 0, 1) 888 del_button.set_image(image)
897 889 del_button.connect("clicked", self.layer_widget_del_clicked_cb, tree_selection, layer_store)
898 layer_store = gtk.ListStore(gobject.TYPE_STRING) 890 table_layer.attach(del_button, 5, 10, 1, 2, gtk.EXPAND | gtk.FILL, 0, 0, 6)
899 for layer in layers:
900 layer_store.set(layer_store.append(), 0, layer)
901
902 image = gtk.Image()
903 image.set_from_stock(gtk.STOCK_ADD,gtk.ICON_SIZE_MENU)
904 add_button = gtk.Button()
905 add_button.set_image(image)
906 add_button.connect("clicked", self.layer_widget_add_clicked_cb, layer_store, window)
907 table_layer.attach(add_button, 0, 5, 1, 2, gtk.EXPAND | gtk.FILL, 0, 0, 6)
908 image = gtk.Image()
909 image.set_from_stock(gtk.STOCK_REMOVE,gtk.ICON_SIZE_MENU)
910 del_button = gtk.Button()
911 del_button.set_image(image)
912 del_button.connect("clicked", self.layer_widget_del_clicked_cb, tree_selection, layer_store)
913 table_layer.attach(del_button, 5, 10, 1, 2, gtk.EXPAND | gtk.FILL, 0, 0, 6)
914 layer_tv.set_model(layer_store) 891 layer_tv.set_model(layer_store)
915 892
916 hbox.show_all() 893 hbox.show_all()
917 894
918 return hbox, layer_store 895 return hbox, layer_store
919 896
920 def __init__(self, title, layers, all_layers, split_model, 897 def __init__(self, title, layers, all_layers, parent, flags, buttons):
921 parent, flags, buttons):
922 super(LayerSelectionDialog, self).__init__(title, parent, flags, buttons) 898 super(LayerSelectionDialog, self).__init__(title, parent, flags, buttons)
923 899
924 # class members from other objects 900 # class members from other objects
925 self.layers = layers 901 self.layers = layers
926 self.all_layers = all_layers 902 self.all_layers = all_layers
927 self.split_model = split_model
928 self.layers_changed = False 903 self.layers_changed = False
929 904
930 # class members for internal use 905 # class members for internal use
@@ -938,17 +913,14 @@ class LayerSelectionDialog (CrumbsDialog):
938 hbox_top = gtk.HBox() 913 hbox_top = gtk.HBox()
939 self.vbox.pack_start(hbox_top, expand=False, fill=False) 914 self.vbox.pack_start(hbox_top, expand=False, fill=False)
940 915
941 if self.split_model: 916 label = self.gen_label_widget("<b>Select Layers:</b>")
942 label = self.gen_label_widget("<b>Select Layers:</b>\n(Available layers under '${COREBASE}/layers/' directory)")
943 else:
944 label = self.gen_label_widget("<b>Select Layers:</b>")
945 hbox_top.pack_start(label, expand=False, fill=False) 917 hbox_top.pack_start(label, expand=False, fill=False)
946 918
947 tooltip = "Layer is a collection of bb files and conf files" 919 tooltip = "Layer is a collection of bb files and conf files"
948 info = HobInfoButton(tooltip, self) 920 info = HobInfoButton(tooltip, self)
949 hbox_top.pack_end(info, expand=False, fill=False) 921 hbox_top.pack_end(info, expand=False, fill=False)
950 922
951 layer_widget, self.layer_store = self.gen_layer_widget(self.split_model, self.layers, self.all_layers, self, None) 923 layer_widget, self.layer_store = self.gen_layer_widget(self.layers, self.all_layers, self, None)
952 layer_widget.set_size_request(-1, 180) 924 layer_widget.set_size_request(-1, 180)
953 self.vbox.pack_start(layer_widget, expand=True, fill=True) 925 self.vbox.pack_start(layer_widget, expand=True, fill=True)
954 926
@@ -963,12 +935,7 @@ class LayerSelectionDialog (CrumbsDialog):
963 it = model.get_iter_first() 935 it = model.get_iter_first()
964 layers = [] 936 layers = []
965 while it: 937 while it:
966 if self.split_model: 938 layers.append(model.get_value(it, 0))
967 inc = model.get_value(it, 1)
968 if inc:
969 layers.append(model.get_value(it, 0))
970 else:
971 layers.append(model.get_value(it, 0))
972 it = model.iter_next(it) 939 it = model.iter_next(it)
973 940
974 self.layers_changed = (self.layers != layers) 941 self.layers_changed = (self.layers != layers)
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index e24c340126..07cc039371 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -65,7 +65,7 @@ class HobHandler(gobject.GObject):
65 (CFG_AVAIL_LAYERS, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDKMACH, FILES_MATCH_CLASS, PARSE_CONFIG, PARSE_BBFILES, GENERATE_TGTS, GENERATE_PACKAGEINFO, BUILD_TARGET_RECIPES, BUILD_TARGET_IMAGE, CMD_END) = range(13) 65 (CFG_AVAIL_LAYERS, CFG_PATH_LAYERS, CFG_FILES_DISTRO, CFG_FILES_MACH, CFG_FILES_SDKMACH, FILES_MATCH_CLASS, PARSE_CONFIG, PARSE_BBFILES, GENERATE_TGTS, GENERATE_PACKAGEINFO, BUILD_TARGET_RECIPES, BUILD_TARGET_IMAGE, CMD_END) = range(13)
66 (LAYERS_REFRESH, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(5) 66 (LAYERS_REFRESH, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(5)
67 67
68 def __init__(self, server, server_addr, client_addr, recipe_model, package_model): 68 def __init__(self, server, recipe_model, package_model):
69 super(HobHandler, self).__init__() 69 super(HobHandler, self).__init__()
70 70
71 self.build = RunningBuild(sequential=True) 71 self.build = RunningBuild(sequential=True)
@@ -84,20 +84,11 @@ class HobHandler(gobject.GObject):
84 self.error_msg = "" 84 self.error_msg = ""
85 self.initcmd = None 85 self.initcmd = None
86 86
87 self.split_model = False
88 if server_addr and client_addr:
89 self.split_model = (server_addr != client_addr)
90 self.reset_server() # reset server if server was found just now
91 self.server_addr = server_addr
92
93 def kick(self): 87 def kick(self):
94 import xmlrpclib 88 import xmlrpclib
95 try: 89 try:
96 # kick the while thing off 90 # kick the while thing off
97 if self.split_model: 91 self.commands_async.append(self.CFG_PATH_LAYERS)
98 self.commands_async.append(self.CFG_AVAIL_LAYERS)
99 else:
100 self.commands_async.append(self.CFG_PATH_LAYERS)
101 self.commands_async.append(self.CFG_FILES_DISTRO) 92 self.commands_async.append(self.CFG_FILES_DISTRO)
102 self.commands_async.append(self.CFG_FILES_MACH) 93 self.commands_async.append(self.CFG_FILES_MACH)
103 self.commands_async.append(self.CFG_FILES_SDKMACH) 94 self.commands_async.append(self.CFG_FILES_SDKMACH)
@@ -383,9 +374,6 @@ class HobHandler(gobject.GObject):
383 # leave the workdir in a usable state 374 # leave the workdir in a usable state
384 self.server.runCommand(["stateShutdown"]) 375 self.server.runCommand(["stateShutdown"])
385 376
386 def reset_server(self):
387 self.server.runCommand(["resetCooker"])
388
389 def reset_build(self): 377 def reset_build(self):
390 self.build.reset() 378 self.build.reset()
391 379
@@ -427,10 +415,7 @@ class HobHandler(gobject.GObject):
427 pmake = int(pmake.lstrip("-j ")) 415 pmake = int(pmake.lstrip("-j "))
428 params["pmake"] = pmake 416 params["pmake"] = pmake
429 417
430 image_addr = self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"]) or "" 418 params["image_addr"] = self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"]) or ""
431 if self.server_addr:
432 image_addr = "http://" + self.server_addr + ":" + image_addr
433 params["image_addr"] = image_addr
434 419
435 image_extra_size = self.server.runCommand(["getVariable", "IMAGE_ROOTFS_EXTRA_SPACE"]) 420 image_extra_size = self.server.runCommand(["getVariable", "IMAGE_ROOTFS_EXTRA_SPACE"])
436 if not image_extra_size: 421 if not image_extra_size:
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py
index 429bb750dd..daa708b7ef 100755
--- a/bitbake/lib/bb/ui/hob.py
+++ b/bitbake/lib/bb/ui/hob.py
@@ -47,15 +47,6 @@ def event_handle_idle_func(eventHandler, hobHandler):
47 return True 47 return True
48 48
49def main (server = None, eventHandler = None): 49def main (server = None, eventHandler = None):
50 bitbake_server = None
51 client_addr = None
52 server_addr = None
53
54 if not eventHandler:
55 helper = uihelper.BBUIHelper()
56 server, eventHandler, server_addr, client_addr = helper.findServerDetails()
57 bitbake_server = server
58
59 gobject.threads_init() 50 gobject.threads_init()
60 51
61 # That indicates whether the Hob and the bitbake server are 52 # That indicates whether the Hob and the bitbake server are
@@ -64,7 +55,7 @@ def main (server = None, eventHandler = None):
64 recipe_model = RecipeListModel() 55 recipe_model = RecipeListModel()
65 package_model = PackageListModel() 56 package_model = PackageListModel()
66 57
67 hobHandler = HobHandler(bitbake_server, server_addr, client_addr, recipe_model, package_model) 58 hobHandler = HobHandler(server, recipe_model, package_model)
68 if hobHandler.kick() == False: 59 if hobHandler.kick() == False:
69 return 1 60 return 1
70 builder = Builder(hobHandler, recipe_model, package_model) 61 builder = Builder(hobHandler, recipe_model, package_model)