All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3][PULL] Hob: Bug fixes
@ 2012-04-12 15:46 Dongxiao Xu
  2012-04-12 15:46 ` [PATCH 1/3] command.py: Add a hook for config parsing Dongxiao Xu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dongxiao Xu @ 2012-04-12 15:46 UTC (permalink / raw)
  To: bitbake-devel

Hi Richard,

This pull request integrates your PoC into Hob. Please help to review and pull.

Thanks,
Dongxiao

The following changes since commit 3c2808b67384e92601cbd66877c36ca40df7c7ba:

  Hob: fix the missing functions (2012-04-12 15:56:42 +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 (3):
  command.py: Add a hook for config parsing
  Hob: Implement Hob config parse hook
  Hob: A minor fix on tooltip

 lib/bb/command.py                    |    7 +++++++
 lib/bb/parse/parse_py/ConfHandler.py |    5 +++++
 lib/bb/ui/crumbs/builder.py          |   26 ++++++++++++++++++++++++++
 lib/bb/ui/crumbs/hig.py              |    2 +-
 lib/bb/ui/crumbs/hobeventhandler.py  |   26 ++++++++++++++------------
 5 files changed, 53 insertions(+), 13 deletions(-)

-- 
1.7.4.1




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

* [PATCH 1/3] command.py: Add a hook for config parsing
  2012-04-12 15:46 [PATCH 0/3][PULL] Hob: Bug fixes Dongxiao Xu
@ 2012-04-12 15:46 ` Dongxiao Xu
  2012-04-13 10:54   ` Richard Purdie
  2012-04-12 15:46 ` [PATCH 2/3] Hob: Implement Hob config parse hook Dongxiao Xu
  2012-04-12 15:46 ` [PATCH 3/3] Hob: A minor fix on tooltip Dongxiao Xu
  2 siblings, 1 reply; 6+ messages in thread
From: Dongxiao Xu @ 2012-04-12 15:46 UTC (permalink / raw)
  To: bitbake-devel

To make the UI settings take effect, we need to hook at the end of each
config file parsing and set UI specific values.

Signed-off-by: Richar Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 lib/bb/command.py                    |    7 +++++++
 lib/bb/parse/parse_py/ConfHandler.py |    5 +++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/lib/bb/command.py b/lib/bb/command.py
index 73aaca0..fd8912a 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -179,6 +179,13 @@ class CommandsSync:
         """
         return bb.utils.cpu_count()
 
+    def setConfFilter(self, command, params):
+        """
+        Set the configuration file parsing filter
+        """
+        filterfunc = params[0]
+        bb.parse.parse_py.ConfHandler.confFilters.append(filterfunc)
+
 class CommandsAsync:
     """
     A class of asynchronous commands
diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py
index fa811f3..f108c24 100644
--- a/lib/bb/parse/parse_py/ConfHandler.py
+++ b/lib/bb/parse/parse_py/ConfHandler.py
@@ -71,6 +71,8 @@ def include(oldfn, fn, lineno, data, error_out):
             raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
         logger.debug(2, "CONF file '%s' not found", fn)
 
+confFilters = []
+
 def handle(fn, data, include):
     init(data)
 
@@ -107,6 +109,9 @@ def handle(fn, data, include):
     if oldfile:
         data.setVar('FILE', oldfile)
 
+    for f in confFilters:
+        f(fn, data)
+
     return data
 
 def feeder(lineno, s, fn, statements):
-- 
1.7.4.1




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

* [PATCH 2/3] Hob: Implement Hob config parse hook
  2012-04-12 15:46 [PATCH 0/3][PULL] Hob: Bug fixes Dongxiao Xu
  2012-04-12 15:46 ` [PATCH 1/3] command.py: Add a hook for config parsing Dongxiao Xu
@ 2012-04-12 15:46 ` Dongxiao Xu
  2012-04-12 15:46 ` [PATCH 3/3] Hob: A minor fix on tooltip Dongxiao Xu
  2 siblings, 0 replies; 6+ messages in thread
From: Dongxiao Xu @ 2012-04-12 15:46 UTC (permalink / raw)
  To: bitbake-devel

To make Hob's specific variable settings take effect, we add a Hob
config hook at the end of parsing for each configuration file, and in
the hook function, Hob will set its own variables to the data store.

This fixes:
[YOCTO #2210]
[YOCTO #2254]

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

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 10b9a77..410ff5f 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -210,6 +210,30 @@ class Parameters:
         self.tmpdir = params["tmpdir"]
         self.enable_proxy = False
 
+def hob_conf_filter(fn, data):
+    if fn.endswith("/local.conf"):
+        distro = data.getVar("DISTRO_HOB")
+        if distro:
+            if distro != "defaultsetup":
+                data.setVar("DISTRO", distro)
+            else:
+                data.delVar("DISTRO")
+
+        keys = ["MACHINE_HOB", "SDKMACHINE_HOB", "PACKAGE_CLASSES_HOB", \
+                "BB_NUMBER_THREADS_HOB", "PARALLEL_MAKE_HOB", "DL_DIR_HOB", \
+                "SSTATE_DIR_HOB", "SSTATE_MIRROR_HOB", "INCOMPATIBLE_LICENSE_HOB"]
+        for key in keys:
+            var_hob = data.getVar(key)
+            if var_hob:
+                data.setVar(key.split("_HOB")[0], var_hob)
+        return
+
+    if fn.endswith("/bblayers.conf"):
+        layers = data.getVar("BBLAYERS_HOB")
+        if layers:
+            data.setVar("BBLAYERS", layers)
+        return
+
 class Builder(gtk.Window):
 
     (MACHINE_SELECTION,
@@ -296,6 +320,8 @@ class Builder(gtk.Window):
         self.handler.connect("command-succeeded",        self.handler_command_succeeded_cb)
         self.handler.connect("command-failed",           self.handler_command_failed_cb)
 
+        self.handler.set_config_filter(hob_conf_filter)
+
         self.initiate_new_build_async()
 
     def create_visual_elements(self):
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 1a7427a..292d905 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -253,43 +253,42 @@ class HobHandler(gobject.GObject):
         self.server.runCommand(["setVariable", "INHERIT", inherits])
 
     def set_bblayers(self, bblayers):
-        self.server.runCommand(["setVariable", "BBLAYERS", " ".join(bblayers)])
+        self.server.runCommand(["setVariable", "BBLAYERS_HOB", " ".join(bblayers)])
 
     def set_machine(self, machine):
         if machine:
-            self.server.runCommand(["setVariable", "MACHINE", machine])
+            self.server.runCommand(["setVariable", "MACHINE_HOB", machine])
 
     def set_sdk_machine(self, sdk_machine):
-        self.server.runCommand(["setVariable", "SDKMACHINE", sdk_machine])
+        self.server.runCommand(["setVariable", "SDKMACHINE_HOB", sdk_machine])
 
     def set_image_fstypes(self, image_fstypes):
         self.server.runCommand(["setVariable", "IMAGE_FSTYPES", image_fstypes])
 
     def set_distro(self, distro):
-        if distro != "defaultsetup":
-            self.server.runCommand(["setVariable", "DISTRO", distro])
+        self.server.runCommand(["setVariable", "DISTRO_HOB", distro])
 
     def set_package_format(self, format):
         package_classes = ""
         for pkgfmt in format.split():
             package_classes += ("package_%s" % pkgfmt + " ")
-        self.server.runCommand(["setVariable", "PACKAGE_CLASSES", package_classes])
+        self.server.runCommand(["setVariable", "PACKAGE_CLASSES_HOB", package_classes])
 
     def set_bbthreads(self, threads):
-        self.server.runCommand(["setVariable", "BB_NUMBER_THREADS", threads])
+        self.server.runCommand(["setVariable", "BB_NUMBER_THREADS_HOB", threads])
 
     def set_pmake(self, threads):
         pmake = "-j %s" % threads
-        self.server.runCommand(["setVariable", "PARALLEL_MAKE", pmake])
+        self.server.runCommand(["setVariable", "PARALLEL_MAKE_HOB", pmake])
 
     def set_dl_dir(self, directory):
-        self.server.runCommand(["setVariable", "DL_DIR", directory])
+        self.server.runCommand(["setVariable", "DL_DIR_HOB", directory])
 
     def set_sstate_dir(self, directory):
-        self.server.runCommand(["setVariable", "SSTATE_DIR", directory])
+        self.server.runCommand(["setVariable", "SSTATE_DIR_HOB", directory])
 
     def set_sstate_mirror(self, url):
-        self.server.runCommand(["setVariable", "SSTATE_MIRROR", url])
+        self.server.runCommand(["setVariable", "SSTATE_MIRROR_HOB", url])
 
     def set_extra_size(self, image_extra_size):
         self.server.runCommand(["setVariable", "IMAGE_ROOTFS_EXTRA_SPACE", str(image_extra_size)])
@@ -298,13 +297,16 @@ class HobHandler(gobject.GObject):
         self.server.runCommand(["setVariable", "IMAGE_ROOTFS_SIZE", str(image_rootfs_size)])
 
     def set_incompatible_license(self, incompat_license):
-        self.server.runCommand(["setVariable", "INCOMPATIBLE_LICENSE", incompat_license])
+        self.server.runCommand(["setVariable", "INCOMPATIBLE_LICENSE_HOB", incompat_license])
 
     def set_extra_config(self, extra_setting):
         for key in extra_setting.keys():
             value = extra_setting[key]
             self.server.runCommand(["setVariable", key, value])
 
+    def set_config_filter(self, config_filter):
+        self.server.runCommand(["setConfFilter", config_filter])
+
     def set_http_proxy(self, http_proxy):
         self.server.runCommand(["setVariable", "http_proxy", http_proxy])
 
-- 
1.7.4.1




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

* [PATCH 3/3] Hob: A minor fix on tooltip
  2012-04-12 15:46 [PATCH 0/3][PULL] Hob: Bug fixes Dongxiao Xu
  2012-04-12 15:46 ` [PATCH 1/3] command.py: Add a hook for config parsing Dongxiao Xu
  2012-04-12 15:46 ` [PATCH 2/3] Hob: Implement Hob config parse hook Dongxiao Xu
@ 2012-04-12 15:46 ` Dongxiao Xu
  2012-04-13 10:44   ` Richard Purdie
  2 siblings, 1 reply; 6+ messages in thread
From: Dongxiao Xu @ 2012-04-12 15:46 UTC (permalink / raw)
  To: bitbake-devel

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

diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py
index 5cc8a59..b0cfcaf 100644
--- a/lib/bb/ui/crumbs/hig.py
+++ b/lib/bb/ui/crumbs/hig.py
@@ -392,7 +392,7 @@ class AdvancedSettingDialog (CrumbsDialog):
         j = 1
         for image_type in self.image_types:
             self.image_types_checkbuttons[image_type] = gtk.CheckButton(image_type)
-            self.image_types_checkbuttons[image_type].set_tooltip_text("Build an %s image" % image_type)
+            self.image_types_checkbuttons[image_type].set_tooltip_text("Build a(n) %s image" % image_type)
             table.attach(self.image_types_checkbuttons[image_type], j, j + 4, i, i + 1)
             if image_type in self.configuration.image_fstypes.split():
                 self.image_types_checkbuttons[image_type].set_active(True)
-- 
1.7.4.1




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

* Re: [PATCH 3/3] Hob: A minor fix on tooltip
  2012-04-12 15:46 ` [PATCH 3/3] Hob: A minor fix on tooltip Dongxiao Xu
@ 2012-04-13 10:44   ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2012-04-13 10:44 UTC (permalink / raw)
  To: Dongxiao Xu; +Cc: bitbake-devel

On Thu, 2012-04-12 at 23:46 +0800, Dongxiao Xu wrote:
> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
>  lib/bb/ui/crumbs/hig.py |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py
> index 5cc8a59..b0cfcaf 100644
> --- a/lib/bb/ui/crumbs/hig.py
> +++ b/lib/bb/ui/crumbs/hig.py
> @@ -392,7 +392,7 @@ class AdvancedSettingDialog (CrumbsDialog):
>          j = 1
>          for image_type in self.image_types:
>              self.image_types_checkbuttons[image_type] = gtk.CheckButton(image_type)
> -            self.image_types_checkbuttons[image_type].set_tooltip_text("Build an %s image" % image_type)
> +            self.image_types_checkbuttons[image_type].set_tooltip_text("Build a(n) %s image" % image_type)
>              table.attach(self.image_types_checkbuttons[image_type], j, j + 4, i, i + 1)
>              if image_type in self.configuration.image_fstypes.split():
>                  self.image_types_checkbuttons[image_type].set_active(True)

This change looks rather ugly to me. Whilst we're getting into a
minefield of localisation issues, I'd suggest doing:

article = ""
if image_type.startswith(["a", "e", "i", "o", "h"]):
    article = "n"
self.image_types_checkbuttons[image_type].set_tooltip_text("Build a%s %s image" % (article, image_type))

Whilst this isn't perfect, it should cover our common image types well
enough.

Cheers,

Richard





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

* Re: [PATCH 1/3] command.py: Add a hook for config parsing
  2012-04-12 15:46 ` [PATCH 1/3] command.py: Add a hook for config parsing Dongxiao Xu
@ 2012-04-13 10:54   ` Richard Purdie
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Purdie @ 2012-04-13 10:54 UTC (permalink / raw)
  To: Dongxiao Xu; +Cc: bitbake-devel

On Thu, 2012-04-12 at 23:46 +0800, Dongxiao Xu wrote:
> To make the UI settings take effect, we need to hook at the end of each
> config file parsing and set UI specific values.
> 
> Signed-off-by: Richar Purdie <richard.purdie@linuxfoundation.org>
> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
>  lib/bb/command.py                    |    7 +++++++
>  lib/bb/parse/parse_py/ConfHandler.py |    5 +++++
>  2 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/bb/command.py b/lib/bb/command.py
> index 73aaca0..fd8912a 100644
> --- a/lib/bb/command.py
> +++ b/lib/bb/command.py
> @@ -179,6 +179,13 @@ class CommandsSync:
>          """
>          return bb.utils.cpu_count()
>  
> +    def setConfFilter(self, command, params):
> +        """
> +        Set the configuration file parsing filter
> +        """
> +        filterfunc = params[0]
> +        bb.parse.parse_py.ConfHandler.confFilters.append(filterfunc)
> +
>  class CommandsAsync:
>      """
>      A class of asynchronous commands
> diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py
> index fa811f3..f108c24 100644
> --- a/lib/bb/parse/parse_py/ConfHandler.py
> +++ b/lib/bb/parse/parse_py/ConfHandler.py
> @@ -71,6 +71,8 @@ def include(oldfn, fn, lineno, data, error_out):
>              raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
>          logger.debug(2, "CONF file '%s' not found", fn)
>  
> +confFilters = []
> +
>  def handle(fn, data, include):
>      init(data)
>  
> @@ -107,6 +109,9 @@ def handle(fn, data, include):
>      if oldfile:
>          data.setVar('FILE', oldfile)
>  
> +    for f in confFilters:
> +        f(fn, data)
> +
>      return data
>  
>  def feeder(lineno, s, fn, statements):


I've merged this but I added in a comment block about why we need to do
this since its not immediately clear why we need to do something quite
this nasty.

Cheers,

Richard





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

end of thread, other threads:[~2012-04-13 11:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 15:46 [PATCH 0/3][PULL] Hob: Bug fixes Dongxiao Xu
2012-04-12 15:46 ` [PATCH 1/3] command.py: Add a hook for config parsing Dongxiao Xu
2012-04-13 10:54   ` Richard Purdie
2012-04-12 15:46 ` [PATCH 2/3] Hob: Implement Hob config parse hook Dongxiao Xu
2012-04-12 15:46 ` [PATCH 3/3] Hob: A minor fix on tooltip Dongxiao Xu
2012-04-13 10:44   ` 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.