Hob: Add white/black pattern to filter images
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.
Thanks,
Dongxiao
The following changes since commit f8bf4499549f978ce7c93bc088a66f74cd751e2c:
setup.py: fix path for bitbake-selftest (2012-05-13 20:01:59 +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(-)
Signature · 1 line
1.7.4.1
PATCH 1/2 Hob: Add filter for images listed in image combo
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]
--- 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(-)
lib/bb/ui/crumbs/builder.py +4 -0
@@ -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"]
lib/bb/ui/crumbs/hobeventhandler.py +2 -0
@@ -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
lib/bb/ui/crumbs/imageconfigurationpage.py +33 -4
@@ -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
Signature · 1 line
1.7.4.1
Re: [PATCH 1/2] Hob: Add filter for images listed in image combo
Quoted 7 lines · Dongxiao Xu
Define
IMAGE_WHITE_PATTERNvariable to indicate which image is allowed to be displayed in image combobox.Define
IMAGE_BLACK_PATTERNvariable 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
PATCH 2/2 Hob: Get image name internally when updating the image description
In reply to Dongxiao XuThe 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.
--- lib/bb/ui/crumbs/builder.py | 2 +- lib/bb/ui/crumbs/imageconfigurationpage.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-)
lib/bb/ui/crumbs/builder.py +1 -1
@@ -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)
lib/bb/ui/crumbs/imageconfigurationpage.py +3 -2
@@ -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()
Signature · 1 line
1.7.4.1
Hi Richard,
Do you have comments on this one?
Thanks,
Dongxiao
Quoted 48 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Dongxiao Xu
Sent: Tuesday, May 15, 2012 1:52 PM
To: [email protected]
Subject: [bitbake-devel] [PATCH 0/2][PULL] Hob: Add white/black pattern to filter imagesHi 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.
Thanks,
DongxiaoThe following changes since commit
f8bf4499549f978ce7c93bc088a66f74cd751e2c:
setup.py: fix path for bitbake-selftest (2012-05-13 20:01:59 +0100)are available in the git repository at:
git://git.pokylinux.org/poky-contribdxu4/hob-bugfix
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dxu4/hob-bugfixDongxiao Xu (2):
Hob: Add filter for images listed in image combo
Hob: Get image name internally when updating the image descriptionlib/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_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel