summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/builder.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/builder.py')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py158
1 files changed, 99 insertions, 59 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index de9685dd26..5dd2b13a50 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -42,28 +42,23 @@ import bb.ui.crumbs.utils
42class Configuration: 42class Configuration:
43 '''Represents the data structure of configuration.''' 43 '''Represents the data structure of configuration.'''
44 44
45 def __init__(self, params): 45 def __init__(self):
46 # Settings
47 self.curr_mach = "" 46 self.curr_mach = ""
48 self.curr_distro = params["distro"] 47 # settings
49 self.dldir = params["dldir"] 48 self.curr_distro = ""
50 self.sstatedir = params["sstatedir"] 49 self.dldir = self.sstatedir = self.sstatemirror = ""
51 self.sstatemirror = params["sstatemirror"] 50 self.pmake = self.bbthread = 0
52 self.pmake = int(params["pmake"].split()[1]) 51 self.curr_package_format = ""
53 self.bbthread = params["bbthread"] 52 self.image_rootfs_size = self.image_extra_size = 0
54 self.curr_package_format = " ".join(params["pclass"].split("package_")).strip() 53 self.image_overhead_factor = 1
55 self.image_rootfs_size = params["image_rootfs_size"] 54 self.incompat_license = ""
56 self.image_extra_size = params["image_extra_size"] 55 self.curr_sdk_machine = ""
57 self.image_overhead_factor = params['image_overhead_factor'] 56 self.conf_version = self.lconf_version = ""
58 self.incompat_license = params["incompat_license"]
59 self.curr_sdk_machine = params["sdk_machine"]
60 self.conf_version = params["conf_version"]
61 self.lconf_version = params["lconf_version"]
62 self.extra_setting = {} 57 self.extra_setting = {}
63 self.toolchain_build = False 58 self.toolchain_build = False
64 self.image_fstypes = params["image_fstypes"] 59 self.image_fstypes = ""
65 # bblayers.conf 60 # bblayers.conf
66 self.layers = params["layer"].split() 61 self.layers = []
67 # image/recipes/packages 62 # image/recipes/packages
68 self.selected_image = None 63 self.selected_image = None
69 self.selected_recipes = [] 64 self.selected_recipes = []
@@ -71,19 +66,15 @@ class Configuration:
71 66
72 self.user_selected_packages = [] 67 self.user_selected_packages = []
73 68
74 self.default_task = params["default_task"] 69 self.default_task = "build"
75 70
76 # proxy settings 71 # proxy settings
77 self.all_proxy = params["all_proxy"] 72 self.all_proxy = self.http_proxy = self.ftp_proxy = self.https_proxy = ""
78 self.http_proxy = params["http_proxy"] 73 self.git_proxy_host = self.git_proxy_port = ""
79 self.ftp_proxy = params["ftp_proxy"] 74 self.cvs_proxy_host = self.cvs_proxy_port = ""
80 self.https_proxy = params["https_proxy"]
81 self.git_proxy_host = params["git_proxy_host"]
82 self.git_proxy_port = params["git_proxy_port"]
83 self.cvs_proxy_host = params["cvs_proxy_host"]
84 self.cvs_proxy_port = params["cvs_proxy_port"]
85 75
86 def update(self, params): 76 def update(self, params):
77 # settings
87 self.curr_distro = params["distro"] 78 self.curr_distro = params["distro"]
88 self.dldir = params["dldir"] 79 self.dldir = params["dldir"]
89 self.sstatedir = params["sstatedir"] 80 self.sstatedir = params["sstatedir"]
@@ -99,16 +90,21 @@ class Configuration:
99 self.conf_version = params["conf_version"] 90 self.conf_version = params["conf_version"]
100 self.lconf_version = params["lconf_version"] 91 self.lconf_version = params["lconf_version"]
101 self.image_fstypes = params["image_fstypes"] 92 self.image_fstypes = params["image_fstypes"]
102 self.tune_arch = params["tune_arch"] 93 # self.extra_setting/self.toolchain_build
103 self.bb_version = params["bb_version"]
104 self.target_arch = params["target_arch"]
105 self.target_os = params["target_os"]
106 self.distro_version = params["distro_version"]
107 self.tune_pkgarch = params["tune_pkgarch"]
108 # bblayers.conf 94 # bblayers.conf
109 self.layers = params["layer"].split() 95 self.layers = params["layer"].split()
110 self.default_task = params["default_task"] 96 self.default_task = params["default_task"]
111 97
98 # proxy settings
99 self.all_proxy = params["all_proxy"]
100 self.http_proxy = params["http_proxy"]
101 self.ftp_proxy = params["ftp_proxy"]
102 self.https_proxy = params["https_proxy"]
103 self.git_proxy_host = params["git_proxy_host"]
104 self.git_proxy_port = params["git_proxy_port"]
105 self.cvs_proxy_host = params["cvs_proxy_host"]
106 self.cvs_proxy_port = params["cvs_proxy_port"]
107
112 def load(self, template): 108 def load(self, template):
113 self.curr_mach = template.getVar("MACHINE") 109 self.curr_mach = template.getVar("MACHINE")
114 self.curr_package_format = " ".join(template.getVar("PACKAGE_CLASSES").split("package_")).strip() 110 self.curr_package_format = " ".join(template.getVar("PACKAGE_CLASSES").split("package_")).strip()
@@ -156,11 +152,12 @@ class Configuration:
156 self.cvs_proxy_host = template.getVar("CVS_PROXY_HOST") 152 self.cvs_proxy_host = template.getVar("CVS_PROXY_HOST")
157 self.cvs_proxy_port = template.getVar("CVS_PROXY_PORT") 153 self.cvs_proxy_port = template.getVar("CVS_PROXY_PORT")
158 154
159 def save(self, template): 155 def save(self, template, defaults=False):
160 # bblayers.conf 156 # bblayers.conf
161 template.setVar("BBLAYERS", " ".join(self.layers)) 157 template.setVar("BBLAYERS", " ".join(self.layers))
162 # local.conf 158 # local.conf
163 template.setVar("MACHINE", self.curr_mach) 159 if not defaults:
160 template.setVar("MACHINE", self.curr_mach)
164 template.setVar("DISTRO", self.curr_distro) 161 template.setVar("DISTRO", self.curr_distro)
165 template.setVar("DL_DIR", self.dldir) 162 template.setVar("DL_DIR", self.dldir)
166 template.setVar("SSTATE_DIR", self.sstatedir) 163 template.setVar("SSTATE_DIR", self.sstatedir)
@@ -177,10 +174,11 @@ class Configuration:
177 template.setVar("EXTRA_SETTING", self.extra_setting) 174 template.setVar("EXTRA_SETTING", self.extra_setting)
178 template.setVar("TOOLCHAIN_BUILD", self.toolchain_build) 175 template.setVar("TOOLCHAIN_BUILD", self.toolchain_build)
179 template.setVar("IMAGE_FSTYPES", self.image_fstypes) 176 template.setVar("IMAGE_FSTYPES", self.image_fstypes)
180 # image/recipes/packages 177 if not defaults:
181 template.setVar("__SELECTED_IMAGE__", self.selected_image) 178 # image/recipes/packages
182 template.setVar("DEPENDS", self.selected_recipes) 179 template.setVar("__SELECTED_IMAGE__", self.selected_image)
183 template.setVar("IMAGE_INSTALL", self.user_selected_packages) 180 template.setVar("DEPENDS", self.selected_recipes)
181 template.setVar("IMAGE_INSTALL", self.user_selected_packages)
184 # proxy 182 # proxy
185 template.setVar("all_proxy", self.all_proxy) 183 template.setVar("all_proxy", self.all_proxy)
186 template.setVar("http_proxy", self.http_proxy) 184 template.setVar("http_proxy", self.http_proxy)
@@ -194,23 +192,47 @@ class Configuration:
194class Parameters: 192class Parameters:
195 '''Represents other variables like available machines, etc.''' 193 '''Represents other variables like available machines, etc.'''
196 194
197 def __init__(self, params): 195 def __init__(self):
198 # Variables 196 # Variables
197 self.max_threads = 65535
198 self.core_base = ""
199 self.image_addr = ""
200 self.image_types = []
201 self.runnable_image_types = []
202 self.runnable_machine_patterns = []
203 self.deployable_image_types = []
204 self.tmpdir = ""
205
199 self.all_machines = [] 206 self.all_machines = []
200 self.all_package_formats = [] 207 self.all_package_formats = []
201 self.all_distros = [] 208 self.all_distros = []
202 self.all_sdk_machines = [] 209 self.all_sdk_machines = []
203 self.max_threads = params["max_threads"]
204 self.all_layers = [] 210 self.all_layers = []
205 self.core_base = params["core_base"]
206 self.image_names = [] 211 self.image_names = []
212 self.enable_proxy = False
213
214 # for build log to show
215 self.bb_version = ""
216 self.target_arch = ""
217 self.target_os = ""
218 self.distro_version = ""
219 self.tune_pkgarch = ""
220
221 def update(self, params):
222 self.max_threads = params["max_threads"]
223 self.core_base = params["core_base"]
207 self.image_addr = params["image_addr"] 224 self.image_addr = params["image_addr"]
208 self.image_types = params["image_types"].split() 225 self.image_types = params["image_types"].split()
209 self.runnable_image_types = params["runnable_image_types"].split() 226 self.runnable_image_types = params["runnable_image_types"].split()
210 self.runnable_machine_patterns = params["runnable_machine_patterns"].split() 227 self.runnable_machine_patterns = params["runnable_machine_patterns"].split()
211 self.deployable_image_types = params["deployable_image_types"].split() 228 self.deployable_image_types = params["deployable_image_types"].split()
212 self.tmpdir = params["tmpdir"] 229 self.tmpdir = params["tmpdir"]
213 self.enable_proxy = False 230 # for build log to show
231 self.bb_version = params["bb_version"]
232 self.target_arch = params["target_arch"]
233 self.target_os = params["target_os"]
234 self.distro_version = params["distro_version"]
235 self.tune_pkgarch = params["tune_pkgarch"]
214 236
215def hob_conf_filter(fn, data): 237def hob_conf_filter(fn, data):
216 if fn.endswith("/local.conf"): 238 if fn.endswith("/local.conf"):
@@ -287,6 +309,10 @@ class Builder(gtk.Window):
287 309
288 self.template = None 310 self.template = None
289 311
312 # configuration and parameters
313 self.configuration = Configuration()
314 self.parameters = Parameters()
315
290 # build step 316 # build step
291 self.current_step = None 317 self.current_step = None
292 self.previous_step = None 318 self.previous_step = None
@@ -365,9 +391,10 @@ class Builder(gtk.Window):
365 391
366 def initiate_new_build_async(self): 392 def initiate_new_build_async(self):
367 self.switch_page(self.MACHINE_SELECTION) 393 self.switch_page(self.MACHINE_SELECTION)
368 self.handler.init_cooker() 394 if self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/")) == None:
369 self.handler.set_extra_inherit("image_types") 395 self.handler.init_cooker()
370 self.handler.parse_config() 396 self.handler.set_extra_inherit("image_types")
397 self.handler.parse_config()
371 398
372 def update_config_async(self): 399 def update_config_async(self):
373 self.switch_page(self.MACHINE_SELECTION) 400 self.switch_page(self.MACHINE_SELECTION)
@@ -432,20 +459,25 @@ class Builder(gtk.Window):
432 self.handler.cancel_parse() 459 self.handler.cancel_parse()
433 460
434 def load_template(self, path): 461 def load_template(self, path):
462 if not os.path.isfile(path):
463 return None
464
435 self.template = TemplateMgr() 465 self.template = TemplateMgr()
436 self.template.load(path) 466 self.template.load(path)
437 self.configuration.load(self.template) 467 self.configuration.load(self.template)
438 468
469 self.template.destroy()
470 self.template = None
471
439 for layer in self.configuration.layers: 472 for layer in self.configuration.layers:
440 if not os.path.exists(layer+'/conf/layer.conf'): 473 if not os.path.exists(layer+'/conf/layer.conf'):
441 return False 474 return False
442 475
476 self.save_defaults() # remember layers and settings
443 self.update_config_async() 477 self.update_config_async()
478 return True
444 479
445 self.template.destroy() 480 def save_template(self, path, defaults=False):
446 self.template = None
447
448 def save_template(self, path):
449 if path.rfind("/") == -1: 481 if path.rfind("/") == -1:
450 filename = "default" 482 filename = "default"
451 path = "." 483 path = "."
@@ -455,12 +487,17 @@ class Builder(gtk.Window):
455 487
456 self.template = TemplateMgr() 488 self.template = TemplateMgr()
457 self.template.open(filename, path) 489 self.template.open(filename, path)
458 self.configuration.save(self.template) 490 self.configuration.save(self.template, defaults)
459 491
460 self.template.save() 492 self.template.save()
461 self.template.destroy() 493 self.template.destroy()
462 self.template = None 494 self.template = None
463 495
496 def save_defaults(self):
497 if not os.path.exists(".hob/"):
498 os.mkdir(".hob/")
499 self.save_template(".hob/default", True)
500
464 def switch_page(self, next_step): 501 def switch_page(self, next_step):
465 # Main Workflow (Business Logic) 502 # Main Workflow (Business Logic)
466 self.nb.set_current_page(self.__step2page__[next_step]) 503 self.nb.set_current_page(self.__step2page__[next_step])
@@ -544,6 +581,11 @@ class Builder(gtk.Window):
544 left = self.package_model.set_selected_packages(selected_packages) 581 left = self.package_model.set_selected_packages(selected_packages)
545 self.configuration.selected_packages += left 582 self.configuration.selected_packages += left
546 583
584 def update_configuration_parameters(self, params):
585 if params:
586 self.configuration.update(params)
587 self.parameters.update(params)
588
547 # Callback Functions 589 # Callback Functions
548 def handler_config_updated_cb(self, handler, which, values): 590 def handler_config_updated_cb(self, handler, which, values):
549 if which == "distro": 591 if which == "distro":
@@ -560,19 +602,15 @@ class Builder(gtk.Window):
560 def handler_command_succeeded_cb(self, handler, initcmd): 602 def handler_command_succeeded_cb(self, handler, initcmd):
561 if initcmd == self.handler.PARSE_CONFIG: 603 if initcmd == self.handler.PARSE_CONFIG:
562 # settings 604 # settings
563 params = self.get_parameters_sync() 605 self.update_configuration_parameters(self.get_parameters_sync())
564 self.configuration = Configuration(params)
565 self.parameters = Parameters(params)
566 self.generate_configuration_async() 606 self.generate_configuration_async()
567 elif initcmd == self.handler.GENERATE_CONFIGURATION: 607 elif initcmd == self.handler.GENERATE_CONFIGURATION:
568 params = self.get_parameters_sync() 608 self.update_configuration_parameters(self.get_parameters_sync())
569 self.configuration.update(params)
570 self.image_configuration_page.switch_machine_combo() 609 self.image_configuration_page.switch_machine_combo()
571 elif initcmd in [self.handler.GENERATE_RECIPES, 610 elif initcmd in [self.handler.GENERATE_RECIPES,
572 self.handler.GENERATE_PACKAGES, 611 self.handler.GENERATE_PACKAGES,
573 self.handler.GENERATE_IMAGE]: 612 self.handler.GENERATE_IMAGE]:
574 params = self.get_parameters_sync() 613 self.update_configuration_parameters(self.get_parameters_sync())
575 self.configuration.update(params)
576 self.request_package_info_async() 614 self.request_package_info_async()
577 elif initcmd == self.handler.POPULATE_PACKAGEINFO: 615 elif initcmd == self.handler.POPULATE_PACKAGEINFO:
578 if self.current_step == self.RCPPKGINFO_POPULATING: 616 if self.current_step == self.RCPPKGINFO_POPULATING:
@@ -691,7 +729,7 @@ class Builder(gtk.Window):
691 elif self.current_step == self.PACKAGE_GENERATING: 729 elif self.current_step == self.PACKAGE_GENERATING:
692 fraction = 0 730 fraction = 0
693 self.build_details_page.update_progress_bar("Build Started: ", fraction) 731 self.build_details_page.update_progress_bar("Build Started: ", fraction)
694 self.build_details_page.show_configurations(self.configuration) 732 self.build_details_page.show_configurations(self.configuration, self.parameters)
695 733
696 def build_succeeded(self): 734 def build_succeeded(self):
697 if self.current_step == self.FAST_IMAGE_GENERATING: 735 if self.current_step == self.FAST_IMAGE_GENERATING:
@@ -857,6 +895,7 @@ class Builder(gtk.Window):
857 response = dialog.run() 895 response = dialog.run()
858 if response == gtk.RESPONSE_YES: 896 if response == gtk.RESPONSE_YES:
859 self.configuration.layers = dialog.layers 897 self.configuration.layers = dialog.layers
898 self.save_defaults() # remember layers
860 # DO refresh layers 899 # DO refresh layers
861 if dialog.layers_changed: 900 if dialog.layers_changed:
862 self.update_config_async() 901 self.update_config_async()
@@ -943,6 +982,7 @@ class Builder(gtk.Window):
943 if response == gtk.RESPONSE_YES: 982 if response == gtk.RESPONSE_YES:
944 self.parameters.enable_proxy = dialog.enable_proxy 983 self.parameters.enable_proxy = dialog.enable_proxy
945 self.configuration = dialog.configuration 984 self.configuration = dialog.configuration
985 self.save_defaults() # remember settings
946 settings_changed = dialog.settings_changed 986 settings_changed = dialog.settings_changed
947 dialog.destroy() 987 dialog.destroy()
948 return response == gtk.RESPONSE_YES, settings_changed 988 return response == gtk.RESPONSE_YES, settings_changed