Patchwork [bitbake-devel,4/4] hob: assure consistency for image size label

login
register
mail settings
Submitter Cristiana Voicu
Date May 7, 2013, 8:07 a.m.
Message ID <1367914076-4863-5-git-send-email-cristiana.voicu@intel.com>
Download mbox | patch
Permalink /patch/49389/
State New
Headers show

Comments

Cristiana Voicu - May 7, 2013, 8:07 a.m.
After the image was build, update the image size in the packagelistpage.

[YOCTO #4388]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py              |    2 ++
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py     |    2 ++
 bitbake/lib/bb/ui/crumbs/packageselectionpage.py |   20 ++++++++++++--------
 3 files changed, 16 insertions(+), 8 deletions(-)

Patch

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index b347f6d..07118aa 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -108,6 +108,8 @@  class Configuration:
         self.extra_setting = {}
         self.toolchain_build = False
         self.image_fstypes = ""
+        self.image_size = None
+        self.image_packages = []
         # bblayers.conf
         self.layers = []
         # image/recipes/packages
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index d586413..268ac68 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -369,6 +369,8 @@  class ImageDetailsPage (HobPage):
         vallist = []
         vallist.append(pkg_num)
         vallist.append(default_image_size)
+        self.builder.configuration.image_size = default_image_size
+        self.builder.configuration.image_packages = self.builder.configuration.selected_packages
         if self.build_succeeded:
             edit_packages_button = HobAltButton("Edit packages")
             edit_packages_button.set_tooltip_text("Edit the packages included in your image")
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
index a4d86bd..0cac92f 100755
--- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
@@ -270,14 +270,17 @@  class PackageSelectionPage (HobPage):
         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 / 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
-        if "zypper" in self.builder.configuration.selected_packages:
-            image_total_size += (51200 * 1024)
-        image_total_size_str = HobPage._size_to_string(image_total_size)
+        if self.builder.configuration.image_packages == self.builder.configuration.selected_packages:
+            image_total_size_str = self.builder.configuration.image_size
+        else:
+            image_overhead_factor = self.builder.configuration.image_overhead_factor
+            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
+            if "zypper" in self.builder.configuration.selected_packages:
+                image_total_size += (51200 * 1024)
+            image_total_size_str = HobPage._size_to_string(image_total_size)
 
         self.label.set_label("Packages included: %s\nSelected packages size: %s\nTotal image size: %s" %
                             (selected_packages_num, selected_packages_size_str, image_total_size_str))
@@ -297,6 +300,7 @@  class PackageSelectionPage (HobPage):
         self.refresh_selection()
         if not self.builder.customized:
             self.builder.customized = True
+            self.builder.configuration.initial_selected_image = self.builder.configuration.selected_image
             self.builder.configuration.selected_image = self.recipe_model.__custom_image__
             self.builder.rcppkglist_populated()