[bitbake-devel] [PATCH 3/7] Hob: Make layers define in bblayers.conf as default
Xu, Dongxiao
dongxiao.xu at intel.com
Sat Mar 31 05:29:50 UTC 2012
On Sat, 2012-03-31 at 08:32 +0800, Xu, Dongxiao wrote:
> On Fri, 2012-03-30 at 09:10 -0700, Joshua Lock wrote:
> >
> > 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.
>
> The issue I am going to solve is that, with current local.conf
> (DISTRO="poky") and bblayers.conf (bblayers="meta meta-yocto"), we are
> not able to delete the meta-yocto layer in Hob since it will meet
> local.conf parsing error since it could not find where "poky" is
> defined.
>
> This patch is to set those layers define in bblayers.conf as default
> layers and they could not be removed. For example, in Yocto Project,
> "meta", "meta-yocto", and "meta-hob" are not removable. For pure OE-Core
> environment, "meta" and "meta-hob" are not removable.
>
Just discussed with Josh on this problem.
He suggested that meta-yocto should be still removable. If user met the
error after deleting the meta-yocto layer, he/she should change the
DISTRO setting in "Setting" dialog to "defaultsetup".
Current code to handle the distro setting is:
def set_distro(self, distro):
if distro != "defaultsetup":
self.server.runCommand(["setVariable", "DISTRO", distro])
Therefore even if user has selected defaultsetup, it will not set any
value to bitbake server, and then DISTRO ?= "poky" will take effect
while parsing local.conf.
To make DISTRO ?= "poky" doesn't take effect, we need to change the code
to be:
def set_distro(self, distro):
if distro == "defaultsetup":
distro = ""
self.server.runCommand(["setVariable", "DISTRO", distro])
However Richard ever worried about this approach.
See:
http://lists.linuxtogo.org/pipermail/bitbake-devel/2012-March/002438.html
In summary, there are two solutions now:
1) Set those layers defined in bblayers.conf as default, and don't allow
users to delete them, like this [PATCH 3/7] does.
2) Use the empty string "" as the value of DISTRO variable for
"defaultsetup", and set this value before parsing configuration files,
making the DISTRO ?= "poky" in local.conf doesn't take effect.
Welcome for comments on this issue.
Thanks,
Dongxiao
> Thanks,
> Dongxiao
>
> >
> > 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)
> > >
> >
>
>
>
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel
More information about the bitbake-devel
mailing list