All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongxiao Xu <dongxiao.xu@intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 1/2] Hob: Add filter for images listed in image combo
Date: Tue, 15 May 2012 13:52:14 +0800	[thread overview]
Message-ID: <00949d15d6a5109294db49986497ac19df93f73b.1337060999.git.dongxiao.xu@intel.com> (raw)
In-Reply-To: <cover.1337060999.git.dongxiao.xu@intel.com>
In-Reply-To: <cover.1337060999.git.dongxiao.xu@intel.com>

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




  reply	other threads:[~2012-05-15  6:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2012-05-21  7:55   ` [PATCH 1/2] Hob: Add filter for images listed in image combo Richard Purdie
2012-05-15  5:52 ` [PATCH 2/2] Hob: Get image name internally when updating the image description Dongxiao Xu
2012-05-21  0:47 ` [PATCH 0/2][PULL] Hob: Add white/black pattern to filter images Xu, Dongxiao
2012-05-22  3:08 [PATCH 0/2 v2][PULL] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00949d15d6a5109294db49986497ac19df93f73b.1337060999.git.dongxiao.xu@intel.com \
    --to=dongxiao.xu@intel.com \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.