* [PATCH 1/6] Hob: handle exceptions in get_parameters() from the bitbake
2012-04-02 8:29 [PATCH 0/6][Resend] Hob fixes Shane Wang
@ 2012-04-02 8:29 ` Shane Wang
2012-04-02 8:29 ` [PATCH 2/6] Hob: handle exceptions when loading templates Shane Wang
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Shane Wang @ 2012-04-02 8:29 UTC (permalink / raw)
To: bitbake-devel
Handle exceptions during type conversion into integers.
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 33 +++++++++++++++++++++-----
1 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index a329380..c1afa0b 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -401,15 +401,22 @@ class HobHandler(gobject.GObject):
num_threads = 1
max_threads = 65536
else:
- num_threads = int(num_threads)
- max_threads = 16 * num_threads
+ try:
+ num_threads = int(num_threads)
+ max_threads = 16 * num_threads
+ except:
+ num_threads = 1
+ max_threads = 65536
params["max_threads"] = max_threads
bbthread = self.server.runCommand(["getVariable", "BB_NUMBER_THREADS"])
if not bbthread:
bbthread = num_threads
else:
- bbthread = int(bbthread)
+ try:
+ bbthread = int(bbthread)
+ except:
+ bbthread = num_threads
params["bbthread"] = bbthread
pmake = self.server.runCommand(["getVariable", "PARALLEL_MAKE"])
@@ -418,7 +425,10 @@ class HobHandler(gobject.GObject):
elif isinstance(pmake, int):
pass
else:
- pmake = int(pmake.lstrip("-j "))
+ try:
+ pmake = int(pmake.lstrip("-j "))
+ except:
+ pmake = num_threads
params["pmake"] = pmake
params["image_addr"] = self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"]) or ""
@@ -427,21 +437,30 @@ class HobHandler(gobject.GObject):
if not image_extra_size:
image_extra_size = 0
else:
- image_extra_size = int(image_extra_size)
+ try:
+ image_extra_size = int(image_extra_size)
+ except:
+ image_extra_size = 0
params["image_extra_size"] = image_extra_size
image_rootfs_size = self.server.runCommand(["getVariable", "IMAGE_ROOTFS_SIZE"])
if not image_rootfs_size:
image_rootfs_size = 0
else:
- image_rootfs_size = int(image_rootfs_size)
+ try:
+ image_rootfs_size = int(image_rootfs_size)
+ except:
+ image_rootfs_size = 0
params["image_rootfs_size"] = image_rootfs_size
image_overhead_factor = self.server.runCommand(["getVariable", "IMAGE_OVERHEAD_FACTOR"])
if not image_overhead_factor:
image_overhead_factor = 1
else:
- image_overhead_factor = float(image_overhead_factor)
+ try:
+ image_overhead_factor = float(image_overhead_factor)
+ except:
+ image_overhead_factor = 1
params['image_overhead_factor'] = image_overhead_factor
params["incompat_license"] = self.server.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"]) or ""
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/6] Hob: handle exceptions when loading templates
2012-04-02 8:29 [PATCH 0/6][Resend] Hob fixes Shane Wang
2012-04-02 8:29 ` [PATCH 1/6] Hob: handle exceptions in get_parameters() from the bitbake Shane Wang
@ 2012-04-02 8:29 ` Shane Wang
2012-04-02 8:29 ` [PATCH 3/6] Hob: unify _size_to_string() and _string_to_size() Shane Wang
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Shane Wang @ 2012-04-02 8:29 UTC (permalink / raw)
To: bitbake-devel
Handle exceptions during type conversion to integers.
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/crumbs/builder.py | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index c1a75bd..151bec4 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -104,10 +104,22 @@ class Configuration:
self.dldir = template.getVar("DL_DIR")
self.sstatedir = template.getVar("SSTATE_DIR")
self.sstatemirror = template.getVar("SSTATE_MIRROR")
- self.pmake = int(template.getVar("PARALLEL_MAKE").split()[1])
- self.bbthread = int(template.getVar("BB_NUMBER_THREADS"))
- self.image_rootfs_size = int(template.getVar("IMAGE_ROOTFS_SIZE"))
- self.image_extra_size = int(template.getVar("IMAGE_EXTRA_SPACE"))
+ try:
+ self.pmake = int(template.getVar("PARALLEL_MAKE").split()[1])
+ except:
+ pass
+ try:
+ self.bbthread = int(template.getVar("BB_NUMBER_THREADS"))
+ except:
+ pass
+ try:
+ self.image_rootfs_size = int(template.getVar("IMAGE_ROOTFS_SIZE"))
+ except:
+ pass
+ try:
+ self.image_extra_size = int(template.getVar("IMAGE_EXTRA_SPACE"))
+ except:
+ pass
# image_overhead_factor is read-only.
self.incompat_license = template.getVar("INCOMPATIBLE_LICENSE")
self.curr_sdk_machine = template.getVar("SDKMACHINE")
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/6] Hob: unify _size_to_string() and _string_to_size()
2012-04-02 8:29 [PATCH 0/6][Resend] Hob fixes Shane Wang
2012-04-02 8:29 ` [PATCH 1/6] Hob: handle exceptions in get_parameters() from the bitbake Shane Wang
2012-04-02 8:29 ` [PATCH 2/6] Hob: handle exceptions when loading templates Shane Wang
@ 2012-04-02 8:29 ` Shane Wang
2012-04-02 8:29 ` [PATCH 4/6] Hob: avoid the empty white space appearing on top of the gtk.ComboBox Shane Wang
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Shane Wang @ 2012-04-02 8:29 UTC (permalink / raw)
To: bitbake-devel
We call intsize_to_string (and string_to_intsize) in 3 different places.
We unify the implementations into one place.
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/crumbs/hoblistmodel.py | 18 +++-------
bitbake/lib/bb/ui/crumbs/hobpages.py | 39 ++++++++++++++++++++++
bitbake/lib/bb/ui/crumbs/imagedetailspage.py | 11 +-----
bitbake/lib/bb/ui/crumbs/packageselectionpage.py | 21 +++---------
4 files changed, 51 insertions(+), 38 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index a09c7c7..7587adc 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -22,6 +22,7 @@
import gtk
import gobject
+from bb.ui.crumbs.hobpages import HobPage
#
# PackageListModel
@@ -175,10 +176,8 @@ class PackageListModel(gtk.TreeStore):
if pkgsize == "0" and not allow_empty:
continue
- if len(pkgsize) > 3:
- size = '%.1f' % (int(pkgsize)*1.0/1024) + ' MB'
- else:
- size = pkgsize + ' KB'
+ # pkgsize is in KB
+ size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB'))
it = self.append(pniter)
self.pkg_path[pkg] = self.get_path(it)
@@ -358,7 +357,7 @@ class PackageListModel(gtk.TreeStore):
return packagelist
"""
- Return the selected package size, unit is KB.
+ Return the selected package size, unit is B.
"""
def get_packages_size(self):
packages_size = 0
@@ -371,16 +370,11 @@ class PackageListModel(gtk.TreeStore):
if not str_size:
continue
- unit = str_size.split()
- if unit[1] == 'MB':
- size = float(unit[0])*1024
- else:
- size = float(unit[0])
- packages_size += size
+ packages_size += HobPage._string_to_size(str_size)
child_it = self.iter_next(child_it)
it = self.iter_next(it)
- return "%f" % packages_size
+ return packages_size
"""
Empty self.contents by setting the include of each entry to None
diff --git a/bitbake/lib/bb/ui/crumbs/hobpages.py b/bitbake/lib/bb/ui/crumbs/hobpages.py
index d8e59c4..5045ea2 100755
--- a/bitbake/lib/bb/ui/crumbs/hobpages.py
+++ b/bitbake/lib/bb/ui/crumbs/hobpages.py
@@ -83,3 +83,42 @@ class HobPage (gtk.VBox):
tip_text = tip
button = toolbar.append_item(buttonname, tip, None, icon, cb)
return button
+
+ @staticmethod
+ def _size_to_string(size):
+ try:
+ if not size:
+ size_str = "0 B"
+ else:
+ if len(str(int(size))) > 6:
+ size_str = '%.1f' % (size*1.0/(1024*1024)) + ' MB'
+ elif len(str(int(size))) > 3:
+ size_str = '%.1f' % (size*1.0/1024) + ' KB'
+ else:
+ size_str = str(size) + ' B'
+ except:
+ size_str = "0 B"
+ return size_str
+
+ @staticmethod
+ def _string_to_size(str_size):
+ try:
+ if not str_size:
+ size = 0
+ else:
+ unit = str_size.split()
+ if len(unit) > 1:
+ if unit[1] == 'MB':
+ size = float(unit[0])*1024*1024
+ elif unit[1] == 'KB':
+ size = float(unit[0])*1024
+ elif unit[1] == 'B':
+ size = float(unit[0])
+ else:
+ size = 0
+ else:
+ size = float(unit[0])
+ except:
+ size = 0
+ return size
+
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index b70440d..a5d0ad8 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -151,15 +151,6 @@ class ImageDetailsPage (HobPage):
for child in children:
self.box_group_area.remove(child)
- def _size_to_string(self, size):
- if len(str(int(size))) > 6:
- size_str = '%.1f' % (size*1.0/(1024*1024)) + ' MB'
- elif len(str(int(size))) > 3:
- size_str = '%.1f' % (size*1.0/1024) + ' KB'
- else:
- size_str = str(size) + ' B'
- return size_str
-
def show_page(self, step):
build_succeeded = (step == self.builder.IMAGE_GENERATED)
image_addr = self.builder.parameters.image_addr
@@ -200,7 +191,7 @@ class ImageDetailsPage (HobPage):
default_toggled = False
default_image_size = 0
for image_name in image_names:
- image_size = self._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size)
+ image_size = HobPage._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size)
if not default_toggled:
default_toggled = (self.test_type_runnable(image_name) and self.test_mach_runnable(image_name)) \
or self.test_deployable(image_name)
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
index d855e58..0bb7fe3 100755
--- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
@@ -161,31 +161,20 @@ class PackageSelectionPage (HobPage):
self.builder.configuration.selected_packages = self.package_model.get_selected_packages()
selected_packages_num = len(self.builder.configuration.selected_packages)
- selected_packages_size = float(self.package_model.get_packages_size())
- selected_packages_size_str = self._size_to_string(selected_packages_size)
+ selected_packages_size = self.package_model.get_packages_size()
+ selected_packages_size_str = HobPage._size_to_string(selected_packages_size)
image_overhead_factor = self.builder.configuration.image_overhead_factor
- image_rootfs_size = self.builder.configuration.image_rootfs_size
- image_extra_size = self.builder.configuration.image_extra_size
+ image_rootfs_size = self.builder.configuration.image_rootfs_size * 1024 # image_rootfs_size is KB
+ image_extra_size = self.builder.configuration.image_extra_size * 1024 # image_extra_size is KB
base_size = image_overhead_factor * selected_packages_size
image_total_size = max(base_size, image_rootfs_size) + image_extra_size
- image_total_size_str = self._size_to_string(image_total_size)
+ image_total_size_str = HobPage._size_to_string(image_total_size)
self.label.set_text("Packages included: %s\nSelected packages size: %s\nTotal image size: %s" %
(selected_packages_num, selected_packages_size_str, image_total_size_str))
self.ins.show_indicator_icon("Included", selected_packages_num)
- """
- Helper function to convert the package size to string format.
- The unit of size is KB
- """
- def _size_to_string(self, size):
- if len(str(int(size))) > 3:
- size_str = '%.1f' % (size*1.0/1024) + ' MB'
- else:
- size_str = str(size) + ' KB'
- return size_str
-
def toggle_item_idle_cb(self, path):
if not self.package_model.path_included(path):
self.package_model.include_item(item_path=path, binb="User Selected")
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/6] Hob: avoid the empty white space appearing on top of the gtk.ComboBox
2012-04-02 8:29 [PATCH 0/6][Resend] Hob fixes Shane Wang
` (2 preceding siblings ...)
2012-04-02 8:29 ` [PATCH 3/6] Hob: unify _size_to_string() and _string_to_size() Shane Wang
@ 2012-04-02 8:29 ` Shane Wang
2012-04-02 8:29 ` [PATCH 5/6] Hob: a minor fix on image_fstypes Shane Wang
2012-04-02 8:29 ` [PATCH 6/6] Hob: a minor fix on pmake Shane Wang
5 siblings, 0 replies; 7+ messages in thread
From: Shane Wang @ 2012-04-02 8:29 UTC (permalink / raw)
To: bitbake-devel
Avoid the empty white space appearing on top of the machine selection combo
box and the image selection combo box in the "Image configuration" screen
[Yocto #2166]
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index 30f8979..8e9452e 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -143,6 +143,7 @@ class ImageConfigurationPage (HobPage):
self.machine_title_desc.set_markup(mark)
self.machine_combo = gtk.combo_box_new_text()
+ self.machine_combo.set_wrap_width(1)
self.machine_combo.connect("changed", self.machine_combo_changed_cb)
icon_file = hic.ICON_LAYERS_DISPLAY_FILE
@@ -191,6 +192,7 @@ class ImageConfigurationPage (HobPage):
self.image_title_desc.set_markup(mark)
self.image_combo = gtk.combo_box_new_text()
+ self.image_combo.set_wrap_width(1)
self.image_combo_id = self.image_combo.connect("changed", self.image_combo_changed_cb)
self.image_desc = gtk.Label()
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/6] Hob: a minor fix on image_fstypes
2012-04-02 8:29 [PATCH 0/6][Resend] Hob fixes Shane Wang
` (3 preceding siblings ...)
2012-04-02 8:29 ` [PATCH 4/6] Hob: avoid the empty white space appearing on top of the gtk.ComboBox Shane Wang
@ 2012-04-02 8:29 ` Shane Wang
2012-04-02 8:29 ` [PATCH 6/6] Hob: a minor fix on pmake Shane Wang
5 siblings, 0 replies; 7+ messages in thread
From: Shane Wang @ 2012-04-02 8:29 UTC (permalink / raw)
To: bitbake-devel
image_fstypes in the configuration has been changed into a string rather than
a list. Here we correct it in __init__() of class Configuration. At other places,
image_fstypes are all strings.
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/crumbs/builder.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 151bec4..7a786a9 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -60,7 +60,7 @@ class Configuration:
self.lconf_version = params["lconf_version"]
self.extra_setting = {}
self.toolchain_build = False
- self.image_fstypes = params["image_fstypes"].split()
+ self.image_fstypes = params["image_fstypes"]
# bblayers.conf
self.layers = params["layer"].split()
# image/recipes/packages
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 6/6] Hob: a minor fix on pmake
2012-04-02 8:29 [PATCH 0/6][Resend] Hob fixes Shane Wang
` (4 preceding siblings ...)
2012-04-02 8:29 ` [PATCH 5/6] Hob: a minor fix on image_fstypes Shane Wang
@ 2012-04-02 8:29 ` Shane Wang
5 siblings, 0 replies; 7+ messages in thread
From: Shane Wang @ 2012-04-02 8:29 UTC (permalink / raw)
To: bitbake-devel
params["pmake"] should be in the format "-j int".
When loading/saving "PARALLEL_MAKE" into templates, configuration.pmake will be
converted into "-j int", as "PACKAGE_CLASSES" and "BBLAYERS" do.
For "PACKAGE_CLASSES" and "BBLAYERS", params["pclass"] and params["layer"] are
also strings rather than the types of configuration.curr_package_format and
configuration.layers.
Signed-off-by: Shane Wang <shane.wang@intel.com>
---
bitbake/lib/bb/ui/crumbs/builder.py | 4 ++--
bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 7a786a9..6587734 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -48,7 +48,7 @@ class Configuration:
self.dldir = params["dldir"]
self.sstatedir = params["sstatedir"]
self.sstatemirror = params["sstatemirror"]
- self.pmake = params["pmake"]
+ self.pmake = int(params["pmake"].split()[1])
self.bbthread = params["bbthread"]
self.curr_package_format = " ".join(params["pclass"].split("package_")).strip()
self.image_rootfs_size = params["image_rootfs_size"]
@@ -83,7 +83,7 @@ class Configuration:
self.dldir = params["dldir"]
self.sstatedir = params["sstatedir"]
self.sstatemirror = params["sstatemirror"]
- self.pmake = params["pmake"]
+ self.pmake = int(params["pmake"].split()[1])
self.bbthread = params["bbthread"]
self.curr_package_format = " ".join(params["pclass"].split("package_")).strip()
self.image_rootfs_size = params["image_rootfs_size"]
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index c1afa0b..61af131 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -429,7 +429,7 @@ class HobHandler(gobject.GObject):
pmake = int(pmake.lstrip("-j "))
except:
pmake = num_threads
- params["pmake"] = pmake
+ params["pmake"] = "-j %s" % pmake
params["image_addr"] = self.server.runCommand(["getVariable", "DEPLOY_DIR_IMAGE"]) or ""
--
1.7.6
^ permalink raw reply related [flat|nested] 7+ messages in thread