diff options
author | Cristiana Voicu <cristiana.voicu@intel.com> | 2013-06-20 13:19:41 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-06-20 13:26:56 +0100 |
commit | 64eda3e058860ce5f152b2d31bb855d7614e92d1 (patch) | |
tree | 8c0ad65a1962171268d360f87106ca79e1e9de64 /bitbake/lib/bb/ui/crumbs/builder.py | |
parent | 801fbe5a0c1316ac54a3e8ea61c42a74e28bb0ed (diff) | |
download | poky-64eda3e058860ce5f152b2d31bb855d7614e92d1.tar.gz |
bitbake: hob: remove the rest of the old template functionality
Until now, some configuration settings was saved in a hob specific
directory. From now on, it will be saved in conf directory through bitbake.
(Bitbake rev: c53e902b010d1c3f1550f7e60e744f40120f73c2)
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.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 | 125 |
1 files changed, 18 insertions, 107 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index b5cfd9e917..2f7c496fea 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -30,7 +30,6 @@ import shlex | |||
30 | import re | 30 | import re |
31 | import logging | 31 | import logging |
32 | import sys | 32 | import sys |
33 | from bb.ui.crumbs.template import TemplateMgr | ||
34 | from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage | 33 | from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage |
35 | from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage | 34 | from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage |
36 | from bb.ui.crumbs.packageselectionpage import PackageSelectionPage | 35 | from bb.ui.crumbs.packageselectionpage import PackageSelectionPage |
@@ -192,36 +191,7 @@ class Configuration: | |||
192 | self.split_proxy("socks", params["socks_proxy"]) | 191 | self.split_proxy("socks", params["socks_proxy"]) |
193 | self.split_proxy("cvs", params["cvs_proxy_host"] + ":" + params["cvs_proxy_port"]) | 192 | self.split_proxy("cvs", params["cvs_proxy_host"] + ":" + params["cvs_proxy_port"]) |
194 | 193 | ||
195 | def load(self, template): | ||
196 | try: | ||
197 | self.image_rootfs_size = int(template.getVar("IMAGE_ROOTFS_SIZE")) | ||
198 | except: | ||
199 | pass | ||
200 | try: | ||
201 | self.image_extra_size = int(template.getVar("IMAGE_EXTRA_SPACE")) | ||
202 | except: | ||
203 | pass | ||
204 | # image_overhead_factor is read-only. | ||
205 | self.incompat_license = template.getVar("INCOMPATIBLE_LICENSE") | ||
206 | self.curr_sdk_machine = template.getVar("SDKMACHINE") | ||
207 | self.extra_setting = eval(template.getVar("EXTRA_SETTING")) | ||
208 | self.toolchain_build = eval(template.getVar("TOOLCHAIN_BUILD")) | ||
209 | self.image_fstypes = template.getVar("IMAGE_FSTYPES") | ||
210 | # image/recipes/packages | ||
211 | self.selected_image = template.getVar("__SELECTED_IMAGE__") | ||
212 | self.selected_recipes = template.getVar("DEPENDS").split() | ||
213 | self.selected_packages = template.getVar("IMAGE_INSTALL").split() | ||
214 | # proxy | ||
215 | self.enable_proxy = eval(template.getVar("enable_proxy")) | ||
216 | self.same_proxy = eval(template.getVar("use_same_proxy")) | ||
217 | self.split_proxy("http", template.getVar("http_proxy")) | ||
218 | self.split_proxy("https", template.getVar("https_proxy")) | ||
219 | self.split_proxy("ftp", template.getVar("ftp_proxy")) | ||
220 | self.split_proxy("socks", template.getVar("all_proxy")) | ||
221 | self.split_proxy("cvs", template.getVar("CVS_PROXY_HOST") + ":" + template.getVar("CVS_PROXY_PORT")) | ||
222 | |||
223 | def save(self, handler, template, defaults=False): | 194 | def save(self, handler, template, defaults=False): |
224 | template.setVar("VERSION", "%s" % hobVer) | ||
225 | # bblayers.conf | 195 | # bblayers.conf |
226 | handler.set_var_in_file("BBLAYERS", self.layers, "bblayers.conf") | 196 | handler.set_var_in_file("BBLAYERS", self.layers, "bblayers.conf") |
227 | # local.conf | 197 | # local.conf |
@@ -240,29 +210,29 @@ class Configuration: | |||
240 | handler.set_var_in_file("PARALLEL_MAKE", "-j %s" % self.pmake, "local.conf") | 210 | handler.set_var_in_file("PARALLEL_MAKE", "-j %s" % self.pmake, "local.conf") |
241 | handler.set_var_in_file("BB_NUMBER_THREADS", self.bbthread, "local.conf") | 211 | handler.set_var_in_file("BB_NUMBER_THREADS", self.bbthread, "local.conf") |
242 | handler.set_var_in_file("PACKAGE_CLASSES", " ".join(["package_" + i for i in self.curr_package_format.split()]), "local.conf") | 212 | handler.set_var_in_file("PACKAGE_CLASSES", " ".join(["package_" + i for i in self.curr_package_format.split()]), "local.conf") |
243 | template.setVar("IMAGE_ROOTFS_SIZE", self.image_rootfs_size) | 213 | handler.set_var_in_file("IMAGE_ROOTFS_SIZE", self.image_rootfs_size, "local.conf") |
244 | template.setVar("IMAGE_EXTRA_SPACE", self.image_extra_size) | 214 | handler.set_var_in_file("IMAGE_EXTRA_SPACE", self.image_extra_size, "local.conf") |
245 | template.setVar("INCOMPATIBLE_LICENSE", self.incompat_license) | 215 | handler.set_var_in_file("INCOMPATIBLE_LICENSE", self.incompat_license, "local.conf") |
246 | template.setVar("SDKMACHINE", self.curr_sdk_machine) | 216 | handler.set_var_in_file("SDKMACHINE", self.curr_sdk_machine, "local.conf") |
247 | handler.set_var_in_file("CONF_VERSION", self.conf_version, "local.conf") | 217 | handler.set_var_in_file("CONF_VERSION", self.conf_version, "local.conf") |
248 | handler.set_var_in_file("LCONF_VERSION", self.lconf_version, "bblayers.conf") | 218 | handler.set_var_in_file("LCONF_VERSION", self.lconf_version, "bblayers.conf") |
249 | template.setVar("EXTRA_SETTING", self.extra_setting) | 219 | handler.set_var_in_file("EXTRA_SETTING", self.extra_setting, "local.conf") |
250 | template.setVar("TOOLCHAIN_BUILD", self.toolchain_build) | 220 | handler.set_var_in_file("TOOLCHAIN_BUILD", self.toolchain_build, "local.conf") |
251 | template.setVar("IMAGE_FSTYPES", self.image_fstypes) | 221 | handler.set_var_in_file("IMAGE_FSTYPES", self.image_fstypes, "local.conf") |
252 | if not defaults: | 222 | if not defaults: |
253 | # image/recipes/packages | 223 | # image/recipes/packages |
254 | template.setVar("__SELECTED_IMAGE__", self.selected_image) | 224 | handler.set_var_in_file("__SELECTED_IMAGE__", self.selected_image, "local.conf") |
255 | template.setVar("DEPENDS", self.selected_recipes) | 225 | handler.set_var_in_file("DEPENDS", self.selected_recipes, "local.conf") |
256 | template.setVar("IMAGE_INSTALL", self.user_selected_packages) | 226 | handler.set_var_in_file("IMAGE_INSTALL", self.user_selected_packages, "local.conf") |
257 | # proxy | 227 | # proxy |
258 | template.setVar("enable_proxy", self.enable_proxy) | 228 | handler.set_var_in_file("enable_proxy", self.enable_proxy, "local.conf") |
259 | template.setVar("use_same_proxy", self.same_proxy) | 229 | handler.set_var_in_file("use_same_proxy", self.same_proxy, "local.conf") |
260 | template.setVar("http_proxy", self.combine_proxy("http")) | 230 | handler.set_var_in_file("http_proxy", self.combine_proxy("http"), "local.conf") |
261 | template.setVar("https_proxy", self.combine_proxy("https")) | 231 | handler.set_var_in_file("https_proxy", self.combine_proxy("https"), "local.conf") |
262 | template.setVar("ftp_proxy", self.combine_proxy("ftp")) | 232 | handler.set_var_in_file("ftp_proxy", self.combine_proxy("ftp"), "local.conf") |
263 | template.setVar("all_proxy", self.combine_proxy("socks")) | 233 | handler.set_var_in_file("all_proxy", self.combine_proxy("socks"), "local.conf") |
264 | template.setVar("CVS_PROXY_HOST", self.combine_host_only("cvs")) | 234 | handler.set_var_in_file("CVS_PROXY_HOST", self.combine_host_only("cvs"), "local.conf") |
265 | template.setVar("CVS_PROXY_PORT", self.combine_port_only("cvs")) | 235 | handler.set_var_in_file("CVS_PROXY_PORT", self.combine_port_only("cvs"), "local.conf") |
266 | 236 | ||
267 | def __str__(self): | 237 | def __str__(self): |
268 | s = "VERSION: '%s', BBLAYERS: '%s', MACHINE: '%s', DISTRO: '%s', DL_DIR: '%s'," % \ | 238 | s = "VERSION: '%s', BBLAYERS: '%s', MACHINE: '%s', DISTRO: '%s', DL_DIR: '%s'," % \ |
@@ -407,8 +377,6 @@ class Builder(gtk.Window): | |||
407 | # handler | 377 | # handler |
408 | self.handler = hobHandler | 378 | self.handler = hobHandler |
409 | 379 | ||
410 | self.template = None | ||
411 | |||
412 | # logger | 380 | # logger |
413 | self.logger = logging.getLogger("BitBake") | 381 | self.logger = logging.getLogger("BitBake") |
414 | self.consolelog = None | 382 | self.consolelog = None |
@@ -552,7 +520,6 @@ class Builder(gtk.Window): | |||
552 | self.handler.init_cooker() | 520 | self.handler.init_cooker() |
553 | self.handler.set_extra_inherit("image_types") | 521 | self.handler.set_extra_inherit("image_types") |
554 | self.generate_configuration() | 522 | self.generate_configuration() |
555 | self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/")) | ||
556 | 523 | ||
557 | def update_config_async(self): | 524 | def update_config_async(self): |
558 | self.switch_page(self.MACHINE_SELECTION) | 525 | self.switch_page(self.MACHINE_SELECTION) |
@@ -635,61 +602,6 @@ class Builder(gtk.Window): | |||
635 | def cancel_parse_sync(self): | 602 | def cancel_parse_sync(self): |
636 | self.handler.cancel_parse() | 603 | self.handler.cancel_parse() |
637 | 604 | ||
638 | def load_template(self, path): | ||
639 | if not os.path.isfile(path): | ||
640 | return False | ||
641 | |||
642 | self.template = TemplateMgr() | ||
643 | # check compatibility | ||
644 | tempVer = self.template.getVersion(path) | ||
645 | if not tempVer or int(tempVer) < hobVer: | ||
646 | self.template.destroy() | ||
647 | self.template = None | ||
648 | return False | ||
649 | |||
650 | try: | ||
651 | self.template.load(path) | ||
652 | self.configuration.load(self.template) | ||
653 | except Exception as e: | ||
654 | self.show_error_dialog("Hob Exception - %s" % (str(e))) | ||
655 | self.reset() | ||
656 | finally: | ||
657 | self.template.destroy() | ||
658 | self.template = None | ||
659 | |||
660 | for layer in self.configuration.layers: | ||
661 | if not os.path.exists(layer+'/conf/layer.conf'): | ||
662 | return False | ||
663 | |||
664 | self.set_user_config_extra() | ||
665 | return True | ||
666 | |||
667 | def save_template(self, path, defaults=False): | ||
668 | if path.rfind("/") == -1: | ||
669 | filename = "default" | ||
670 | path = "." | ||
671 | else: | ||
672 | filename = path[path.rfind("/") + 1:len(path)] | ||
673 | path = path[0:path.rfind("/")] | ||
674 | |||
675 | self.template = TemplateMgr() | ||
676 | try: | ||
677 | self.template.open(filename, path) | ||
678 | self.configuration.save(self.handler, self.template, defaults) | ||
679 | |||
680 | self.template.save() | ||
681 | except Exception as e: | ||
682 | self.show_error_dialog("Hob Exception - %s" % (str(e))) | ||
683 | self.reset() | ||
684 | finally: | ||
685 | self.template.destroy() | ||
686 | self.template = None | ||
687 | |||
688 | def save_defaults(self): | ||
689 | if not os.path.exists(".hob/"): | ||
690 | os.mkdir(".hob/") | ||
691 | self.save_template(".hob/default", True) | ||
692 | |||
693 | def switch_page(self, next_step): | 605 | def switch_page(self, next_step): |
694 | # Main Workflow (Business Logic) | 606 | # Main Workflow (Business Logic) |
695 | self.nb.set_current_page(self.__step2page__[next_step]) | 607 | self.nb.set_current_page(self.__step2page__[next_step]) |
@@ -1255,7 +1167,6 @@ class Builder(gtk.Window): | |||
1255 | response = dialog.run() | 1167 | response = dialog.run() |
1256 | if response == gtk.RESPONSE_YES: | 1168 | if response == gtk.RESPONSE_YES: |
1257 | self.configuration.layers = dialog.layers | 1169 | self.configuration.layers = dialog.layers |
1258 | self.save_defaults() # remember layers | ||
1259 | # DO refresh layers | 1170 | # DO refresh layers |
1260 | if dialog.layers_changed: | 1171 | if dialog.layers_changed: |
1261 | self.update_config_async() | 1172 | self.update_config_async() |