All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2 v2][PULL] Hob: Add white/black pattern to filter images
@ 2012-05-22  3:08 Dongxiao Xu
  2012-05-22  3:08 ` [PATCH 1/2] Hob: Add filter for images listed in image combo Dongxiao Xu
  2012-05-22  3:08 ` [PATCH 2/2] Hob: Get image name internally when updating the image description Dongxiao Xu
  0 siblings, 2 replies; 6+ messages in thread
From: Dongxiao Xu @ 2012-05-22  3:08 UTC (permalink / raw)
  To: bitbake-devel

Hi Richard,

This pull request adds white/black pattern to filter images listed in image combobox.

Besides, it fixes a small issue on update_image_desc() function.

Please help to review and pull.

Changes from v1:
 - Rename IMAGE_WHITE_PATTERN and IMAGE_BLACK_PATTERN to BBUI_IMAGE_WHITE_PATTERN
and BBUI_IMAGE_BLACK_PATTERN.

Thanks,
Dongxiao

The following changes since commit 39adb5741d9eee0879d3181be505400dffc60804:

  bb/fetch2/__init__.py: Don't try to compute checksums for directories (2012-05-21 09:24:17 +0100)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib dxu4/hob-bugfix
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dxu4/hob-bugfix

Dongxiao Xu (2):
  Hob: Add filter for images listed in image combo
  Hob: Get image name internally when updating the image description

 lib/bb/ui/crumbs/builder.py                |    6 +++-
 lib/bb/ui/crumbs/hobeventhandler.py        |    2 +
 lib/bb/ui/crumbs/imageconfigurationpage.py |   42 ++++++++++++++++++++++++----
 3 files changed, 43 insertions(+), 7 deletions(-)

-- 
1.7.4.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] Hob: Add filter for images listed in image combo
  2012-05-22  3:08 [PATCH 0/2 v2][PULL] Hob: Add white/black pattern to filter images Dongxiao Xu
@ 2012-05-22  3:08 ` Dongxiao Xu
  2012-05-22 13:39   ` Richard Purdie
  2012-05-22  3:08 ` [PATCH 2/2] Hob: Get image name internally when updating the image description Dongxiao Xu
  1 sibling, 1 reply; 6+ messages in thread
From: Dongxiao Xu @ 2012-05-22  3:08 UTC (permalink / raw)
  To: bitbake-devel

Define BBUI_IMAGE_WHITE_PATTERN variable to indicate which image is
allowed to be displayed in image combobox.

Define BBUI_IMAGE_BLACK_PATTERN variable to indicate which image is NOT
allowed to be displayed in image combobox.

This fixes [YOCTO #1581]

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 lib/bb/ui/crumbs/builder.py                |    4 +++
 lib/bb/ui/crumbs/hobeventhandler.py        |    2 +
 lib/bb/ui/crumbs/imageconfigurationpage.py |   37 +++++++++++++++++++++++++---
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 42d0f2c..a4fb5eb 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -213,6 +213,8 @@ class Parameters:
         self.all_layers = []
         self.image_names = []
         self.enable_proxy = False
+        self.image_white_pattern = ""
+        self.image_black_pattern = ""
 
         # for build log to show
         self.bb_version = ""
@@ -230,6 +232,8 @@ class Parameters:
         self.runnable_machine_patterns = params["runnable_machine_patterns"].split()
         self.deployable_image_types = params["deployable_image_types"].split()
         self.tmpdir = params["tmpdir"]
+        self.image_white_pattern = params["image_white_pattern"]
+        self.image_black_pattern = params["image_black_pattern"]
         # for build log to show
         self.bb_version = params["bb_version"]
         self.target_arch = params["target_arch"]
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 624d7b5..5d6593e 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -501,4 +501,6 @@ class HobHandler(gobject.GObject):
         params["cvs_proxy_host"] = self.runCommand(["getVariable", "CVS_PROXY_HOST"]) or ""
         params["cvs_proxy_port"] = self.runCommand(["getVariable", "CVS_PROXY_PORT"]) or ""
 
+        params["image_white_pattern"] = self.runCommand(["getVariable", "BBUI_IMAGE_WHITE_PATTERN"]) or ""
+        params["image_black_pattern"] = self.runCommand(["getVariable", "BBUI_IMAGE_BLACK_PATTERN"]) or ""
         return params
diff --git a/lib/bb/ui/crumbs/imageconfigurationpage.py b/lib/bb/ui/crumbs/imageconfigurationpage.py
index 95d48b9..20a398c 100644
--- a/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -22,6 +22,7 @@
 
 import gtk
 import glib
+import re
 from bb.ui.crumbs.progressbar import HobProgressBar
 from bb.ui.crumbs.hobcolor import HobColors
 from bb.ui.crumbs.hobwidget import hic, HobImageButton, HobInfoButton, HobAltButton, HobButton
@@ -345,6 +346,16 @@ class ImageConfigurationPage (HobPage):
         active = -1
         cnt = 0
 
+        white_pattern = []
+        if self.builder.parameters.image_white_pattern:
+            for i in self.builder.parameters.image_white_pattern.split():
+                white_pattern.append(re.compile(i))
+
+        black_pattern = []
+        if self.builder.parameters.image_black_pattern:
+            for i in self.builder.parameters.image_black_pattern.split():
+                black_pattern.append(re.compile(i))
+
         it = image_model.get_iter_first()
         self._image_combo_disconnect_signal()
         model = self.image_combo.get_model()
@@ -356,10 +367,28 @@ class ImageConfigurationPage (HobPage):
             image_name = image_model[path][recipe_model.COL_NAME]
             if image_name == self.builder.recipe_model.__dummy_image__:
                 continue
-            self.image_combo.append_text(image_name)
-            if image_name == selected_image:
-                active = cnt
-            cnt = cnt + 1
+
+            if black_pattern:
+                allow = True
+                for pattern in black_pattern:
+                    if pattern.search(image_name):
+                        allow = False
+                        break
+            elif white_pattern:
+                allow = False
+                for pattern in white_pattern:
+                    if pattern.search(image_name):
+                        allow = True
+                        break
+            else:
+                allow = True
+
+            if allow:
+                self.image_combo.append_text(image_name)
+                if image_name == selected_image:
+                    active = cnt
+                cnt = cnt + 1
+
         self.image_combo.append_text(self.builder.recipe_model.__dummy_image__)
         if selected_image == self.builder.recipe_model.__dummy_image__:
             active = cnt
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] Hob: Get image name internally when updating the image description
  2012-05-22  3:08 [PATCH 0/2 v2][PULL] Hob: Add white/black pattern to filter images Dongxiao Xu
  2012-05-22  3:08 ` [PATCH 1/2] Hob: Add filter for images listed in image combo Dongxiao Xu
@ 2012-05-22  3:08 ` Dongxiao Xu
  1 sibling, 0 replies; 6+ messages in thread
From: Dongxiao Xu @ 2012-05-22  3:08 UTC (permalink / raw)
  To: bitbake-devel

The image name shouldn't be passed from outside caller, since the image
name may not in the combobox list. Getting the name from
update_image_desc() internally.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 lib/bb/ui/crumbs/builder.py                |    2 +-
 lib/bb/ui/crumbs/imageconfigurationpage.py |    5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index a4fb5eb..d78b17c 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -692,7 +692,7 @@ class Builder(gtk.Window):
         selected_packages = self.configuration.selected_packages[:]
 
         self.image_configuration_page.update_image_combo(self.recipe_model, selected_image)
-        self.image_configuration_page.update_image_desc(selected_image)
+        self.image_configuration_page.update_image_desc()
         self.update_recipe_model(selected_image, selected_recipes)
         self.update_package_model(selected_packages)
 
diff --git a/lib/bb/ui/crumbs/imageconfigurationpage.py b/lib/bb/ui/crumbs/imageconfigurationpage.py
index 20a398c..c33474b 100644
--- a/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -292,8 +292,9 @@ class ImageConfigurationPage (HobPage):
             active += 1
         self.machine_combo.set_active(-1)
 
-    def update_image_desc(self, selected_image):
+    def update_image_desc(self):
         desc = ""
+        selected_image = self.image_combo.get_active_text()
         if selected_image and selected_image in self.builder.recipe_model.pn_path.keys():
             image_path = self.builder.recipe_model.pn_path[selected_image]
             image_iter = self.builder.recipe_model.get_iter(image_path)
@@ -320,7 +321,7 @@ class ImageConfigurationPage (HobPage):
         image_path = self.builder.recipe_model.pn_path[selected_image]
         image_iter = self.builder.recipe_model.get_iter(image_path)
         selected_packages = self.builder.recipe_model.get_value(image_iter, self.builder.recipe_model.COL_INSTALL).split()
-        self.update_image_desc(selected_image)
+        self.update_image_desc()
 
         self.builder.recipe_model.reset()
         self.builder.package_model.reset()
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] Hob: Add filter for images listed in image combo
  2012-05-22  3:08 ` [PATCH 1/2] Hob: Add filter for images listed in image combo Dongxiao Xu
@ 2012-05-22 13:39   ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2012-05-22 13:39 UTC (permalink / raw)
  To: Dongxiao Xu; +Cc: bitbake-devel

On Tue, 2012-05-22 at 11:08 +0800, Dongxiao Xu wrote:
> Define BBUI_IMAGE_WHITE_PATTERN variable to indicate which image is
> allowed to be displayed in image combobox.
> 
> Define BBUI_IMAGE_BLACK_PATTERN variable to indicate which image is NOT
> allowed to be displayed in image combobox.
> 
> This fixes [YOCTO #1581]
> 
> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
>  lib/bb/ui/crumbs/builder.py                |    4 +++
>  lib/bb/ui/crumbs/hobeventhandler.py        |    2 +
>  lib/bb/ui/crumbs/imageconfigurationpage.py |   37 +++++++++++++++++++++++++---
>  3 files changed, 39 insertions(+), 4 deletions(-)

Merged to master, thanks.

Richard




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] Hob: Add filter for images listed in image combo
  2012-05-15  5:52 ` [PATCH 1/2] Hob: Add filter for images listed in image combo Dongxiao Xu
@ 2012-05-21  7:55   ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2012-05-21  7:55 UTC (permalink / raw)
  To: Dongxiao Xu; +Cc: bitbake-devel

On Tue, 2012-05-15 at 13:52 +0800, Dongxiao Xu wrote:
> Define IMAGE_WHITE_PATTERN variable to indicate which image is allowed
> to be displayed in image combobox.
> 
> Define IMAGE_BLACK_PATTERN variable to indicate which image is NOT
> allowed to be displayed in image combobox.
> 
> This fixes [YOCTO #1581]

We need to namespace these with "BB" to indicate they're bitbake
variables, BBUI might be better again.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] Hob: Add filter for images listed in image combo
  2012-05-15  5:52 [PATCH 0/2][PULL] Hob: Add white/black pattern to filter images Dongxiao Xu
@ 2012-05-15  5:52 ` Dongxiao Xu
  2012-05-21  7:55   ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Dongxiao Xu @ 2012-05-15  5:52 UTC (permalink / raw)
  To: bitbake-devel

Define IMAGE_WHITE_PATTERN variable to indicate which image is allowed
to be displayed in image combobox.

Define IMAGE_BLACK_PATTERN variable to indicate which image is NOT
allowed to be displayed in image combobox.

This fixes [YOCTO #1581]

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 lib/bb/ui/crumbs/builder.py                |    4 +++
 lib/bb/ui/crumbs/hobeventhandler.py        |    2 +
 lib/bb/ui/crumbs/imageconfigurationpage.py |   37 +++++++++++++++++++++++++---
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 42d0f2c..a4fb5eb 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -213,6 +213,8 @@ class Parameters:
         self.all_layers = []
         self.image_names = []
         self.enable_proxy = False
+        self.image_white_pattern = ""
+        self.image_black_pattern = ""
 
         # for build log to show
         self.bb_version = ""
@@ -230,6 +232,8 @@ class Parameters:
         self.runnable_machine_patterns = params["runnable_machine_patterns"].split()
         self.deployable_image_types = params["deployable_image_types"].split()
         self.tmpdir = params["tmpdir"]
+        self.image_white_pattern = params["image_white_pattern"]
+        self.image_black_pattern = params["image_black_pattern"]
         # for build log to show
         self.bb_version = params["bb_version"]
         self.target_arch = params["target_arch"]
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 624d7b5..165688a 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -501,4 +501,6 @@ class HobHandler(gobject.GObject):
         params["cvs_proxy_host"] = self.runCommand(["getVariable", "CVS_PROXY_HOST"]) or ""
         params["cvs_proxy_port"] = self.runCommand(["getVariable", "CVS_PROXY_PORT"]) or ""
 
+        params["image_white_pattern"] = self.runCommand(["getVariable", "IMAGE_WHITE_PATTERN"]) or ""
+        params["image_black_pattern"] = self.runCommand(["getVariable", "IMAGE_BLACK_PATTERN"]) or ""
         return params
diff --git a/lib/bb/ui/crumbs/imageconfigurationpage.py b/lib/bb/ui/crumbs/imageconfigurationpage.py
index 0463ee8..1198817 100644
--- a/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -22,6 +22,7 @@
 
 import gtk
 import glib
+import re
 from bb.ui.crumbs.progressbar import HobProgressBar
 from bb.ui.crumbs.hobcolor import HobColors
 from bb.ui.crumbs.hobwidget import hic, HobImageButton, HobInfoButton, HobAltButton, HobButton
@@ -345,6 +346,16 @@ class ImageConfigurationPage (HobPage):
         active = -1
         cnt = 0
 
+        white_pattern = []
+        if self.builder.parameters.image_white_pattern:
+            for i in self.builder.parameters.image_white_pattern.split():
+                white_pattern.append(re.compile(i))
+
+        black_pattern = []
+        if self.builder.parameters.image_black_pattern:
+            for i in self.builder.parameters.image_black_pattern.split():
+                black_pattern.append(re.compile(i))
+
         it = image_model.get_iter_first()
         self._image_combo_disconnect_signal()
         model = self.image_combo.get_model()
@@ -356,10 +367,28 @@ class ImageConfigurationPage (HobPage):
             image_name = image_model[path][recipe_model.COL_NAME]
             if image_name == self.builder.recipe_model.__dummy_image__:
                 continue
-            self.image_combo.append_text(image_name)
-            if image_name == selected_image:
-                active = cnt
-            cnt = cnt + 1
+
+            if black_pattern:
+                allow = True
+                for pattern in black_pattern:
+                    if pattern.search(image_name):
+                        allow = False
+                        break
+            elif white_pattern:
+                allow = False
+                for pattern in white_pattern:
+                    if pattern.search(image_name):
+                        allow = True
+                        break
+            else:
+                allow = True
+
+            if allow:
+                self.image_combo.append_text(image_name)
+                if image_name == selected_image:
+                    active = cnt
+                cnt = cnt + 1
+
         self.image_combo.append_text(self.builder.recipe_model.__dummy_image__)
         if selected_image == self.builder.recipe_model.__dummy_image__:
             active = cnt
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-22 13:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-22  3:08 [PATCH 0/2 v2][PULL] Hob: Add white/black pattern to filter images Dongxiao Xu
2012-05-22  3:08 ` [PATCH 1/2] Hob: Add filter for images listed in image combo Dongxiao Xu
2012-05-22 13:39   ` Richard Purdie
2012-05-22  3:08 ` [PATCH 2/2] Hob: Get image name internally when updating the image description Dongxiao Xu
  -- strict thread matches above, loose matches on Subject: below --
2012-05-15  5:52 [PATCH 0/2][PULL] Hob: Add white/black pattern to filter images Dongxiao Xu
2012-05-15  5:52 ` [PATCH 1/2] Hob: Add filter for images listed in image combo Dongxiao Xu
2012-05-21  7:55   ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.