Patchwork [bitbake-devel,05/32] Hob: include hddimg and iso into image types.

login
register
mail settings
Submitter Shane Wang
Date Feb. 29, 2012, 2:15 p.m.
Message ID <ae624884c7f563ab23e901900659676f2112cc43.1330523904.git.shane.wang@intel.com>
Download mbox | patch
Permalink /patch/22427/
State New
Headers show

Comments

Shane Wang - Feb. 29, 2012, 2:15 p.m.
For image types, so far we don't include hddimg and iso. Then those files can not be deployed because they are filtered out in the image selection dialog.
This patch is to include hddimg and iso (which are "live" in image types).

Again, we have a TODO in the code for the future, that is to retrieve image types from the bitbake server instead of to use the walkaround.

Signed-off-by: Shane Wang <shane.wang@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py         |    4 ++--
 bitbake/lib/bb/ui/crumbs/hig.py             |    9 +++++----
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    9 ++++-----
 bitbake/lib/bb/ui/crumbs/hobwidget.py       |   27 +++++++++++++++++++++++++++
 4 files changed, 38 insertions(+), 11 deletions(-)
Joshua Lock - Feb. 29, 2012, 9:27 p.m.
On 29/02/12 06:15, Shane Wang wrote:
> For image types, so far we don't include hddimg and iso. Then those files can not be deployed because they are filtered out in the image selection dialog.
> This patch is to include hddimg and iso (which are "live" in image types).
>
> Again, we have a TODO in the code for the future, that is to retrieve image types from the bitbake server instead of to use the walkaround.
>
> Signed-off-by: Shane Wang<shane.wang@intel.com>

Could use a more useful comment in the code, see below, but other than that:

Signed-off-by: Joshua Lock <josh@linux.intel.com>

> ---
>   bitbake/lib/bb/ui/crumbs/builder.py         |    4 ++--
>   bitbake/lib/bb/ui/crumbs/hig.py             |    9 +++++----
>   bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    9 ++++-----
>   bitbake/lib/bb/ui/crumbs/hobwidget.py       |   27 +++++++++++++++++++++++++++
>   4 files changed, 38 insertions(+), 11 deletions(-)
>
> diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
> index 0071673..eb38819 100755
> --- a/bitbake/lib/bb/ui/crumbs/builder.py
> +++ b/bitbake/lib/bb/ui/crumbs/builder.py
> @@ -758,8 +758,8 @@ class Builder(gtk.Window):
>               flags = gtk.DIALOG_MODAL
>                       | gtk.DIALOG_DESTROY_WITH_PARENT
>                       | gtk.DIALOG_NO_SEPARATOR,
> -            buttons = ("Close", gtk.RESPONSE_NO,
> -                       "Make usb image", gtk.RESPONSE_YES))
> +            buttons = ("Make usb image", gtk.RESPONSE_YES,
> +                       "Close", gtk.RESPONSE_NO))
>           response = dialog.run()
>           dialog.destroy()
>
> diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
> index 74f4f7b..cbad899 100644
> --- a/bitbake/lib/bb/ui/crumbs/hig.py
> +++ b/bitbake/lib/bb/ui/crumbs/hig.py
> @@ -28,7 +28,7 @@ import re
>   import subprocess
>   import shlex
>   from bb.ui.crumbs.hobcolor import HobColors
> -from bb.ui.crumbs.hobwidget import HobViewTable
> +from bb.ui.crumbs.hobwidget import hcc, HobViewTable
>   from bb.ui.crumbs.progressbar import HobProgressBar
>
>   """
> @@ -1083,9 +1083,10 @@ class ImageSelectionDialog (gtk.Dialog):
>               dirs[:] = []
>               for f in files:
>                   for image_type in self.image_types:
> -                    if f.endswith('.' + image_type):
> -                        imageset.add(f.rsplit('.' + image_type)[0])
> -                        self.image_list.append(f)
> +                    for real_image_type in hcc.SUPPORTED_IMAGE_TYPES[image_type]:
> +                        if f.endswith('.' + real_image_type):
> +                            imageset.add(f.rsplit('.' + real_image_type)[0])
> +                            self.image_list.append(f)
>
>           for image in imageset:
>               self.image_store.set(self.image_store.append(), 0, image, 1, False)
> diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> index b071ad4..2bf4ed8 100644
> --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> @@ -22,6 +22,7 @@
>   import gobject
>   import logging
>   from bb.ui.crumbs.runningbuild import RunningBuild
> +from bb.ui.crumbs.hobwidget import hcc
>
>   class HobHandler(gobject.GObject):
>
> @@ -450,10 +451,8 @@ class HobHandler(gobject.GObject):
>           params["incompat_license"] = self.server.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"]) or ""
>           params["sdk_machine"] = self.server.runCommand(["getVariable", "SDKMACHINE"]) or self.server.runCommand(["getVariable", "SDK_ARCH"]) or ""
>
> -        #params["image_types"] = self.server.runCommand(["getVariable", "IMAGE_TYPES"]) or ""
>           params["image_fstypes"] = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"]) or ""
> -        """
> -        A workaround
> -        """
> -        params["image_types"] = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3 ext3.gz ext2.lzma btrfs live squashfs squashfs-lzma ubi tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma"
> +
> +        # walkaround

It's nice that you point this out but you don't really tell us what 
you're working around.

> +        params["image_types"] = " ".join(hcc.SUPPORTED_IMAGE_TYPES.keys()).lstrip(" ")
>           return params
> diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
> index 664bf25..9afbfdb 100644
> --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
> +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
> @@ -50,6 +50,33 @@ class hic:
>       ICON_INDI_CONFIRM_FILE        = os.path.join(HOB_ICON_BASE_DIR, ('indicators/confirmation.png'))
>       ICON_INDI_ERROR_FILE          = os.path.join(HOB_ICON_BASE_DIR, ('indicators/error.png'))
>
> +class hcc:
> +
> +    SUPPORTED_IMAGE_TYPES = {
> +        "jffs2"         : ["jffs2"],
> +        "sum.jffs2"     : ["sum.jffs2"],
> +        "cramfs"        : ["cramfs"],
> +        "ext2"          : ["ext2"],
> +        "ext2.gz"       : ["ext2.gz"],
> +        "ext2.bz2"      : ["ext2.bz2"],
> +        "ext3"          : ["ext3"],
> +        "ext3.gz"       : ["ext3.gz"],
> +        "ext2.lzma"     : ["ext2.lzma"],
> +        "btrfs"         : ["btrfs"],
> +        "live"          : ["hddimg", "iso"],
> +        "squashfs"      : ["squashfs"],
> +        "squashfs-lzma" : ["squashfs-lzma"],
> +        "ubi"           : ["ubi"],
> +        "tar"           : ["tar"],
> +        "tar.gz"        : ["tar.gz"],
> +        "tar.bz2"       : ["tar.bz2"],
> +        "tar.xz"        : ["tar.xz"],
> +        "cpio"          : ["cpio"],
> +        "cpio.gz"       : ["cpio.gz"],
> +        "cpio.xz"       : ["cpio.xz"],
> +        "cpio.lzma"     : ["cpio.lzma"],
> +    }
> +
>   class HobViewTable (gtk.VBox):
>       """
>       A VBox to contain the table for different recipe views and package view

Patch

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 0071673..eb38819 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -758,8 +758,8 @@  class Builder(gtk.Window):
             flags = gtk.DIALOG_MODAL
                     | gtk.DIALOG_DESTROY_WITH_PARENT
                     | gtk.DIALOG_NO_SEPARATOR,
-            buttons = ("Close", gtk.RESPONSE_NO,
-                       "Make usb image", gtk.RESPONSE_YES))
+            buttons = ("Make usb image", gtk.RESPONSE_YES,
+                       "Close", gtk.RESPONSE_NO))
         response = dialog.run()
         dialog.destroy()
 
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 74f4f7b..cbad899 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -28,7 +28,7 @@  import re
 import subprocess
 import shlex
 from bb.ui.crumbs.hobcolor import HobColors
-from bb.ui.crumbs.hobwidget import HobViewTable
+from bb.ui.crumbs.hobwidget import hcc, HobViewTable
 from bb.ui.crumbs.progressbar import HobProgressBar
 
 """
@@ -1083,9 +1083,10 @@  class ImageSelectionDialog (gtk.Dialog):
             dirs[:] = []
             for f in files:
                 for image_type in self.image_types:
-                    if f.endswith('.' + image_type):
-                        imageset.add(f.rsplit('.' + image_type)[0])
-                        self.image_list.append(f)
+                    for real_image_type in hcc.SUPPORTED_IMAGE_TYPES[image_type]:
+                        if f.endswith('.' + real_image_type):
+                            imageset.add(f.rsplit('.' + real_image_type)[0])
+                            self.image_list.append(f)
         
         for image in imageset:
             self.image_store.set(self.image_store.append(), 0, image, 1, False)
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index b071ad4..2bf4ed8 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -22,6 +22,7 @@ 
 import gobject
 import logging
 from bb.ui.crumbs.runningbuild import RunningBuild
+from bb.ui.crumbs.hobwidget import hcc
 
 class HobHandler(gobject.GObject):
 
@@ -450,10 +451,8 @@  class HobHandler(gobject.GObject):
         params["incompat_license"] = self.server.runCommand(["getVariable", "INCOMPATIBLE_LICENSE"]) or ""
         params["sdk_machine"] = self.server.runCommand(["getVariable", "SDKMACHINE"]) or self.server.runCommand(["getVariable", "SDK_ARCH"]) or ""
 
-        #params["image_types"] = self.server.runCommand(["getVariable", "IMAGE_TYPES"]) or ""
         params["image_fstypes"] = self.server.runCommand(["getVariable", "IMAGE_FSTYPES"]) or ""
-        """
-        A workaround
-        """
-        params["image_types"] = "jffs2 sum.jffs2 cramfs ext2 ext2.gz ext2.bz2 ext3 ext3.gz ext2.lzma btrfs live squashfs squashfs-lzma ubi tar tar.gz tar.bz2 tar.xz cpio cpio.gz cpio.xz cpio.lzma"
+
+        # walkaround
+        params["image_types"] = " ".join(hcc.SUPPORTED_IMAGE_TYPES.keys()).lstrip(" ")
         return params
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 664bf25..9afbfdb 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -50,6 +50,33 @@  class hic:
     ICON_INDI_CONFIRM_FILE        = os.path.join(HOB_ICON_BASE_DIR, ('indicators/confirmation.png'))
     ICON_INDI_ERROR_FILE          = os.path.join(HOB_ICON_BASE_DIR, ('indicators/error.png'))
 
+class hcc:
+
+    SUPPORTED_IMAGE_TYPES = {
+        "jffs2"         : ["jffs2"],
+        "sum.jffs2"     : ["sum.jffs2"],
+        "cramfs"        : ["cramfs"],
+        "ext2"          : ["ext2"],
+        "ext2.gz"       : ["ext2.gz"],
+        "ext2.bz2"      : ["ext2.bz2"],
+        "ext3"          : ["ext3"],
+        "ext3.gz"       : ["ext3.gz"],
+        "ext2.lzma"     : ["ext2.lzma"],
+        "btrfs"         : ["btrfs"],
+        "live"          : ["hddimg", "iso"],
+        "squashfs"      : ["squashfs"],
+        "squashfs-lzma" : ["squashfs-lzma"],
+        "ubi"           : ["ubi"],
+        "tar"           : ["tar"],
+        "tar.gz"        : ["tar.gz"],
+        "tar.bz2"       : ["tar.bz2"],
+        "tar.xz"        : ["tar.xz"],
+        "cpio"          : ["cpio"],
+        "cpio.gz"       : ["cpio.gz"],
+        "cpio.xz"       : ["cpio.xz"],
+        "cpio.lzma"     : ["cpio.lzma"],
+    }
+
 class HobViewTable (gtk.VBox):
     """
     A VBox to contain the table for different recipe views and package view