All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] More Hob fixes
@ 2012-09-11 16:51 Paul Eggleton
  2012-09-11 16:51 ` [PATCH 1/3] hob: don't reorder layers list Paul Eggleton
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Paul Eggleton @ 2012-09-11 16:51 UTC (permalink / raw)
  To: bitbake-devel

The following changes (against Poky, but apply cleanly with -p2 against
bitbake master) are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib paule/hob-fixes
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/hob-fixes

Paul Eggleton (3):
  hob: don't reorder layers list
  lib/bb/command.py: ensure setVariable only sets values as strings
  hob: sort base image drop-down list

 bitbake/lib/bb/command.py                          |    2 +-
 bitbake/lib/bb/ui/crumbs/hig.py                    |   13 ++-----------
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    1 +
 3 files changed, 4 insertions(+), 12 deletions(-)

-- 
1.7.9.5




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

* [PATCH 1/3] hob: don't reorder layers list
  2012-09-11 16:51 [PATCH 0/3] More Hob fixes Paul Eggleton
@ 2012-09-11 16:51 ` Paul Eggleton
  2012-09-11 16:52 ` [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings Paul Eggleton
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Paul Eggleton @ 2012-09-11 16:51 UTC (permalink / raw)
  To: bitbake-devel

We cannot reorder this list - it must stay in the order shown in the
dialog (which may in future be configurable by the user).

Fixes [YOCTO #2649].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/ui/crumbs/hig.py |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 3695fa0..d41a6b5 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -1029,14 +1029,8 @@ class LayerSelectionDialog (CrumbsDialog):
         table_layer.attach(scroll, 0, 10, 0, 1)
 
         layer_store = gtk.ListStore(gobject.TYPE_STRING)
-        core_iter = None
         for layer in layers:
-            if layer.endswith("/meta"):
-                core_iter = layer_store.prepend([layer])
-            elif layer.endswith("/meta-hob") and core_iter:
-                layer_store.insert_after(core_iter, [layer])
-            else:
-                layer_store.append([layer])
+            layer_store.append([layer])
 
         col1 = gtk.TreeViewColumn('Enabled')
         layer_tv.append_column(col1)
@@ -1110,10 +1104,7 @@ class LayerSelectionDialog (CrumbsDialog):
             layers.append(model.get_value(it, 0))
             it = model.iter_next(it)
 
-        orig_layers = sorted(self.layers)
-        layers.sort()
-
-        self.layers_changed = (orig_layers != layers)
+        self.layers_changed = (self.layers != layers)
         self.layers = layers
 
     """
-- 
1.7.9.5




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

* [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings
  2012-09-11 16:51 [PATCH 0/3] More Hob fixes Paul Eggleton
  2012-09-11 16:51 ` [PATCH 1/3] hob: don't reorder layers list Paul Eggleton
@ 2012-09-11 16:52 ` Paul Eggleton
  2012-09-11 22:57   ` Chris Larson
  2012-09-11 16:52 ` [PATCH 3/3] hob: sort base image drop-down list Paul Eggleton
  2012-09-14  8:27 ` [PATCH 0/3] More Hob fixes Richard Purdie
  3 siblings, 1 reply; 8+ messages in thread
From: Paul Eggleton @ 2012-09-11 16:52 UTC (permalink / raw)
  To: bitbake-devel

This is the interface Hob uses to set variable values in many instances,
and at the moment it is possible that some of the values it passes are
not strings. If a non-string value gets into the datastore it can
trigger exceptions during parsing when we attempt to expand the variable
and substitute in the non-string value.

This fixes using the meta-ti layer within Hob - it currently has a
reference to BB_NUMBER_THREADS within a shell function and since this
is a variable that Hob was setting from its configuration as an integer,
due to the above this was triggering an ExpansionError.

Fixes [YOCTO #2875].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/command.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index fd8912a..27b5171 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -157,7 +157,7 @@ class CommandsSync:
         Set the value of variable in configuration.data
         """
         varname = params[0]
-        value = params[1]
+        value = str(params[1])
         command.cooker.configuration.data.setVar(varname, value)
 
     def initCooker(self, command, params):
-- 
1.7.9.5




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

* [PATCH 3/3] hob: sort base image drop-down list
  2012-09-11 16:51 [PATCH 0/3] More Hob fixes Paul Eggleton
  2012-09-11 16:51 ` [PATCH 1/3] hob: don't reorder layers list Paul Eggleton
  2012-09-11 16:52 ` [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings Paul Eggleton
@ 2012-09-11 16:52 ` Paul Eggleton
  2012-09-14  8:27 ` [PATCH 0/3] More Hob fixes Richard Purdie
  3 siblings, 0 replies; 8+ messages in thread
From: Paul Eggleton @ 2012-09-11 16:52 UTC (permalink / raw)
  To: bitbake-devel

Sort the list of base images to make it easier to find a specific image
in the list. Note that "Create your own image" still remains the last
item in the list.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    1 +
 1 file changed, 1 insertion(+)

diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index 65c88cd..0cf9ebe 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -345,6 +345,7 @@ class ImageConfigurationPage (HobPage):
         # populate image combo
         filter = {RecipeListModel.COL_TYPE : ['image']}
         image_model = recipe_model.tree_model(filter)
+        image_model.set_sort_column_id(recipe_model.COL_NAME, gtk.SORT_ASCENDING)
         active = 0
         cnt = 1
 
-- 
1.7.9.5




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

* Re: [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings
  2012-09-11 16:52 ` [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings Paul Eggleton
@ 2012-09-11 22:57   ` Chris Larson
  2012-09-12 12:29     ` Paul Eggleton
  0 siblings, 1 reply; 8+ messages in thread
From: Chris Larson @ 2012-09-11 22:57 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: bitbake-devel

On Tue, Sep 11, 2012 at 9:52 AM, Paul Eggleton
<paul.eggleton@linux.intel.com> wrote:
> This is the interface Hob uses to set variable values in many instances,
> and at the moment it is possible that some of the values it passes are
> not strings. If a non-string value gets into the datastore it can
> trigger exceptions during parsing when we attempt to expand the variable
> and substitute in the non-string value.
>
> This fixes using the meta-ti layer within Hob - it currently has a
> reference to BB_NUMBER_THREADS within a shell function and since this
> is a variable that Hob was setting from its configuration as an integer,
> due to the above this was triggering an ExpansionError.

This is probably a good change, but I think that failing expansion due
to a non-string value is a bad behavior in bitbake. I think it should
call str() on it as appropriate, as that's the most idiomatic
solution: Don't check if something is a string, don't require only
strings, but call str() to get your string
-- 
Christopher Larson



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

* Re: [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings
  2012-09-11 22:57   ` Chris Larson
@ 2012-09-12 12:29     ` Paul Eggleton
  2012-09-12 14:55       ` Richard Purdie
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Eggleton @ 2012-09-12 12:29 UTC (permalink / raw)
  To: Chris Larson; +Cc: bitbake-devel

On Tuesday 11 September 2012 15:57:24 Chris Larson wrote:
> On Tue, Sep 11, 2012 at 9:52 AM, Paul Eggleton
> <paul.eggleton@linux.intel.com> wrote:
> > This is the interface Hob uses to set variable values in many instances,
> > and at the moment it is possible that some of the values it passes are
> > not strings. If a non-string value gets into the datastore it can
> > trigger exceptions during parsing when we attempt to expand the variable
> > and substitute in the non-string value.
> > 
> > This fixes using the meta-ti layer within Hob - it currently has a
> > reference to BB_NUMBER_THREADS within a shell function and since this
> > is a variable that Hob was setting from its configuration as an integer,
> > due to the above this was triggering an ExpansionError.
> 
> This is probably a good change, but I think that failing expansion due
> to a non-string value is a bad behavior in bitbake. I think it should
> call str() on it as appropriate, as that's the most idiomatic
> solution: Don't check if something is a string, don't require only
> strings, but call str() to get your string

Hmm, I suppose so; I do still worry about existing python code assuming the 
result of getVar() is either None or a string though. Richard tells me that we 
have some non-string values mostly internal to BitBake that are considered 
legal, so that obviously isn't always 100% true, but it's a fair assumption to 
have made for most situations.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre



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

* Re: [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings
  2012-09-12 12:29     ` Paul Eggleton
@ 2012-09-12 14:55       ` Richard Purdie
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Purdie @ 2012-09-12 14:55 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: Chris Larson, bitbake-devel

On Wed, 2012-09-12 at 13:29 +0100, Paul Eggleton wrote:
> On Tuesday 11 September 2012 15:57:24 Chris Larson wrote:
> > On Tue, Sep 11, 2012 at 9:52 AM, Paul Eggleton
> > <paul.eggleton@linux.intel.com> wrote:
> > > This is the interface Hob uses to set variable values in many instances,
> > > and at the moment it is possible that some of the values it passes are
> > > not strings. If a non-string value gets into the datastore it can
> > > trigger exceptions during parsing when we attempt to expand the variable
> > > and substitute in the non-string value.
> > > 
> > > This fixes using the meta-ti layer within Hob - it currently has a
> > > reference to BB_NUMBER_THREADS within a shell function and since this
> > > is a variable that Hob was setting from its configuration as an integer,
> > > due to the above this was triggering an ExpansionError.
> > 
> > This is probably a good change, but I think that failing expansion due
> > to a non-string value is a bad behavior in bitbake. I think it should
> > call str() on it as appropriate, as that's the most idiomatic
> > solution: Don't check if something is a string, don't require only
> > strings, but call str() to get your string
> 
> Hmm, I suppose so; I do still worry about existing python code assuming the 
> result of getVar() is either None or a string though. Richard tells me that we 
> have some non-string values mostly internal to BitBake that are considered 
> legal, so that obviously isn't always 100% true, but it's a fair assumption to 
> have made for most situations.

If its being used in variable expansion, it should be a string or
convertible to a string so I have to admit I was thinking we probably
should have a str() conversion in there as well. I'm hoping that doesn't
have much overhead for something that is already a string. I'd also be
concerned about turning None into "None" which is probably the biggest
worry.

Cheers,

Richard






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

* Re: [PATCH 0/3] More Hob fixes
  2012-09-11 16:51 [PATCH 0/3] More Hob fixes Paul Eggleton
                   ` (2 preceding siblings ...)
  2012-09-11 16:52 ` [PATCH 3/3] hob: sort base image drop-down list Paul Eggleton
@ 2012-09-14  8:27 ` Richard Purdie
  3 siblings, 0 replies; 8+ messages in thread
From: Richard Purdie @ 2012-09-14  8:27 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: bitbake-devel

On Tue, 2012-09-11 at 17:51 +0100, Paul Eggleton wrote:
> The following changes (against Poky, but apply cleanly with -p2 against
> bitbake master) are available in the git repository at:
> 
>   git://git.yoctoproject.org/poky-contrib paule/hob-fixes
>   http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/hob-fixes
> 
> Paul Eggleton (3):
>   hob: don't reorder layers list
>   lib/bb/command.py: ensure setVariable only sets values as strings
>   hob: sort base image drop-down list

Merged to master, thanks.

We should keep in mind the strong coercion issue for future improvements
but I'm not going to hold the setVariable patch on that.


Richard




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

end of thread, other threads:[~2012-09-14  8:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 16:51 [PATCH 0/3] More Hob fixes Paul Eggleton
2012-09-11 16:51 ` [PATCH 1/3] hob: don't reorder layers list Paul Eggleton
2012-09-11 16:52 ` [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings Paul Eggleton
2012-09-11 22:57   ` Chris Larson
2012-09-12 12:29     ` Paul Eggleton
2012-09-12 14:55       ` Richard Purdie
2012-09-11 16:52 ` [PATCH 3/3] hob: sort base image drop-down list Paul Eggleton
2012-09-14  8:27 ` [PATCH 0/3] More Hob fixes 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.