[bitbake-devel] [PATCH 3/7] Hob: Make layers define in bblayers.conf as default
Joshua Lock
josh at linux.intel.com
Fri Mar 30 16:10:04 UTC 2012
On 30/03/12 05:01, Dongxiao Xu wrote:
> For layers defined in bblayers.conf, we treat them as default layers
> and users are not allowed to remove them.
Can you explain the rationale behind this change? I see what you're
doing but it's not entirely clear why.
I think this is a bad idea. Early on in the design of Hob we decided we
didn't want configuration made for non-Hob builds to affect builds made
with Hob, and vice versa.
Thanks,
Joshua
>
> Signed-off-by: Dongxiao Xu<dongxiao.xu at intel.com>
> ---
> lib/bb/ui/crumbs/builder.py | 4 ++--
> lib/bb/ui/crumbs/hig.py | 23 +++++++++--------------
> 2 files changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
> index 44b208a..3be799c 100755
> --- a/lib/bb/ui/crumbs/builder.py
> +++ b/lib/bb/ui/crumbs/builder.py
> @@ -178,7 +178,7 @@ class Parameters:
> self.all_distros = []
> self.all_sdk_machines = []
> self.max_threads = params["max_threads"]
> - self.all_layers = []
> + self.layers_default = params["layer"].split()
> self.core_base = params["core_base"]
> self.image_names = []
> self.image_addr = params["image_addr"]
> @@ -764,7 +764,7 @@ class Builder(gtk.Window):
> def show_layer_selection_dialog(self):
> dialog = LayerSelectionDialog(title = "Layers",
> layers = copy.deepcopy(self.configuration.layers),
> - all_layers = self.parameters.all_layers,
> + layers_default = self.parameters.layers_default,
> parent = self,
> flags = gtk.DIALOG_MODAL
> | gtk.DIALOG_DESTROY_WITH_PARENT
> diff --git a/lib/bb/ui/crumbs/hig.py b/lib/bb/ui/crumbs/hig.py
> index 9adb281..9a38bc0 100644
> --- a/lib/bb/ui/crumbs/hig.py
> +++ b/lib/bb/ui/crumbs/hig.py
> @@ -850,7 +850,7 @@ class LayerSelectionDialog (CrumbsDialog):
> layer_store.remove(iter)
>
>
> - def gen_layer_widget(self, layers, layers_avail, window, tooltip=""):
> + def gen_layer_widget(self, layers, layers_default, window, tooltip=""):
> hbox = gtk.HBox(False, 6)
>
> layer_tv = gtk.TreeView()
> @@ -881,8 +881,8 @@ class LayerSelectionDialog (CrumbsDialog):
> 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])
> + elif layer in layers_default:
> + core_iter = layer_store.insert_after(core_iter, [layer])
> else:
> layer_store.append([layer])
>
> @@ -924,12 +924,12 @@ class LayerSelectionDialog (CrumbsDialog):
> def add_leave_cb(self, button, event):
> self.im.set_from_file(hic.ICON_INDI_ADD_FILE)
>
> - def __init__(self, title, layers, all_layers, parent, flags, buttons=None):
> + def __init__(self, title, layers, layers_default, parent, flags, buttons=None):
> super(LayerSelectionDialog, self).__init__(title, parent, flags, buttons)
>
> # class members from other objects
> self.layers = layers
> - self.all_layers = all_layers
> + self.layers_default = layers_default
> self.layers_changed = False
>
> # icon for remove button in TreeView
> @@ -945,7 +945,7 @@ class LayerSelectionDialog (CrumbsDialog):
> self.connect("response", self.response_cb)
>
> def create_visual_elements(self):
> - layer_widget, self.layer_store = self.gen_layer_widget(self.layers, self.all_layers, self, None)
> + layer_widget, self.layer_store = self.gen_layer_widget(self.layers, self.layers_default, self, None)
> layer_widget.set_size_request(450, 250)
> self.vbox.pack_start(layer_widget, expand=True, fill=True)
> self.show_all()
> @@ -972,9 +972,7 @@ class LayerSelectionDialog (CrumbsDialog):
> def draw_delete_button_cb(self, col, cell, model, it, tv):
> path = model.get_value(it, 0)
> # Trailing slashes are uncommon in bblayers.conf but confuse os.path.basename
> - path.rstrip('/')
> - name = os.path.basename(path)
> - if name == "meta" or name == "meta-hob":
> + if path in self.layers_default:
> cell.set_sensitive(False)
> cell.set_property('pixbuf', None)
> cell.set_property('mode', gtk.CELL_RENDERER_MODE_INERT)
> @@ -992,11 +990,8 @@ class LayerSelectionDialog (CrumbsDialog):
> """
> def draw_layer_path_cb(self, col, cell, model, it):
> path = model.get_value(it, 0)
> - name = os.path.basename(path)
> - if name == "meta":
> - cell.set_property('markup', "<b>Core layer for images: it cannot be removed</b>\n%s" % path)
> - elif name == "meta-hob":
> - cell.set_property('markup', "<b>Core layer for Hob: it cannot be removed</b>\n%s" % path)
> + if path in self.layers_default:
> + cell.set_property('markup', "<b>Core layer: it cannot be removed</b>\n%s" % path)
> else:
> cell.set_property('text', path)
>
--
Joshua '贾詡' Lock
Yocto Project "Johannes factotum"
Intel Open Source Technology Centre
More information about the bitbake-devel
mailing list