More Hob fixes
cover More Hob fixes
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(-)
Signature · 1 line
1.7.9.5
PATCH 1/3 hob: don't reorder layers list
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].
--- bitbake/lib/bb/ui/crumbs/hig.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
bitbake/lib/bb/ui/crumbs/hig.py +2 -11
@@ -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 """
Signature · 1 line
1.7.9.5
PATCH 2/3 lib/bb/command.py: ensure setVariable only sets values as strings
In reply to Paul EggletonThis 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].
--- bitbake/lib/bb/command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/command.py +1 -1
@@ -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):
Signature · 1 line
1.7.9.5
PATCH 3/3 hob: sort base image drop-down list
In reply to Paul EggletonSort 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.
--- bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py | 1 + 1 file changed, 1 insertion(+)
bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py +1 -0
@@ -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
Signature · 1 line
1.7.9.5
Re: [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings
In reply to Paul EggletonQuoted 10 lines · Paul Eggleton
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_THREADSwithin 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
Signature · 1 line
Christopher Larson
Re: [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings
Quoted 13 lines · On Tuesday 11 September 2012 15:57:24 Chris Larson wrote:
Quoted 10 lines · Paul Eggleton
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_THREADSwithin 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.
Quoted 5 lines
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 callstr()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
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Re: [PATCH 2/3] lib/bb/command.py: ensure setVariable only sets values as strings
Quoted 20 lines · Paul Eggleton
Quoted 13 lines · On Tuesday 11 September 2012 15:57:24 Chris Larson wrote:
Quoted 10 lines · Paul Eggleton
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_THREADSwithin 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.Quoted 5 lines
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 callstr()to get your string
Quoted 5 lines
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
Richard Purdie
AppliedQuoted 10 lines · Paul Eggleton
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-contribpaule/hob-fixes
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=paule/hob-fixesPaul 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