All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] bitbake+hob: templates enhancement
@ 2013-07-17 10:35 Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 01/14] hob: labelling changes in Hob Cristiana Voicu
                   ` (14 more replies)
  0 siblings, 15 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

This set implements the templates functionality in Hob.
There are two new files, with two different dialogs.
The changes are in bitbake and Hob.

Cristiana Voicu (14):
  hob: labelling changes in Hob
  hob: create save image dialog used to save a template
  hob/bitbake: create a template (a .bb file) from hob through bitbake
  hob/bitbake: save the description of a custom image
  hob: make changes in order to permit from UI to edit an image after
    saving it
  hob & bitbake: append a value to a variable from hob throught bitbake
  hob: change the name and description for the saveimagedialog
  hob: the saved image should be editable
  bitbake: when an image is saved, it should require an image from
    layers
  hob: changes to image combo box
  hob: retrieve file name of an image
  hob: implement the "retrieve image dialog" + changes to image combo
    box
  bitbake: save packages in IMAGE_INSTALL instead of PACKAGE_INSTALL
  hob: set focus on entry name when the name is not correct

 bitbake/lib/bb/command.py                          |   12 +-
 bitbake/lib/bb/cooker.py                           |   75 ++++++++--
 bitbake/lib/bb/data.py                             |    4 +
 bitbake/lib/bb/ui/crumbs/builder.py                |   15 ++
 .../lib/bb/ui/crumbs/hig/retrieveimagedialog.py    |   49 +++++++
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py    |  151 ++++++++++++++++++++
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py        |   29 +++-
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py           |   40 ++++--
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   70 +++++++--
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py       |   37 ++++-
 10 files changed, 438 insertions(+), 44 deletions(-)
 create mode 100644 bitbake/lib/bb/ui/crumbs/hig/retrieveimagedialog.py
 create mode 100644 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py

-- 
1.7.9.5



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

* [PATCH 01/14] hob: labelling changes in Hob
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-22 16:44   ` Paul Eggleton
  2013-07-17 10:35 ` [PATCH 02/14] hob: create save image dialog used to save a template Cristiana Voicu
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

When the design document for templates in Hob was created, we've noticed
that some labels need to change.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py        |    2 +-
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py           |    2 +-
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   16 ++++++----------
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py       |    5 +++++
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 8788083..ebcb846 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -174,7 +174,7 @@ class HobHandler(gobject.GObject):
                 targets.append(self.toolchain)
             if targets[0] == "hob-image":
                 hobImage = self.runCommand(["matchFile", "hob-image.bb"])
-                if self.base_image != "Create your own image":
+                if self.base_image != "Create a new base image":
                     baseImage = self.runCommand(["matchFile", self.base_image + ".bb"])
                     version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue])
                     targets[0] += version
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index 7f7d82f..f114419 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -476,7 +476,7 @@ class RecipeListModel(gtk.ListStore):
     (COL_NAME, COL_DESC, COL_LIC, COL_GROUP, COL_DEPS, COL_BINB, COL_TYPE, COL_INC, COL_IMG, COL_INSTALL, COL_PN, COL_FADE_INC, COL_SUMMARY, COL_VERSION,
      COL_REVISION, COL_HOMEPAGE, COL_BUGTRACKER) = range(17)
 
-    __custom_image__ = "Create your own image"
+    __custom_image__ = "Create a new base image"
 
     __gsignals__ = {
         "recipe-selection-changed" : (gobject.SIGNAL_RUN_LAST,
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index 1f7453a..d5fc297 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -200,12 +200,9 @@ class ImageConfigurationPage (HobPage):
         markup += "http://www.yoctoproject.org/docs/current/dev-manual/"
         markup += "dev-manual.html#understanding-and-using-layers\">reference manual</a>."
         self.layer_info_icon = HobInfoButton("<b>Layers</b>" + "*" + markup, self.get_parent())
-#        self.progress_box = gtk.HBox(False, 6)
         self.progress_bar = HobProgressBar()
-#        self.progress_box.pack_start(self.progress_bar, expand=True, fill=True)
         self.stop_button = HobAltButton("Stop")
         self.stop_button.connect("clicked", self.stop_button_clicked_cb)
-#        self.progress_box.pack_end(stop_button, expand=False, fill=False)
         self.machine_separator = gtk.HSeparator()
 
     def set_config_machine_layout(self, show_progress_bar = False):
@@ -234,9 +231,10 @@ class ImageConfigurationPage (HobPage):
 
         self.image_title_desc = gtk.Label()
         self.image_title_desc.set_alignment(0, 0.5)
+
         mark = ("<span %s>Base images are a starting point for the type of image you want. "
                 "You can build them as \n"
-                "they are or customize them to your specific needs.\n</span>") % self.span_tag('medium')
+                "they are or edit them to suit your needs.\n</span>") % self.span_tag('medium')
         self.image_title_desc.set_markup(mark)
 
         self.image_combo = gtk.combo_box_new_text()
@@ -270,16 +268,14 @@ class ImageConfigurationPage (HobPage):
         # Create the "Build packages" and "Build image" buttons at the bottom
         button_box = gtk.HBox(False, 6)
 
-        # create button "Build image"
-        self.just_bake_button = HobButton("Build image")
-        #self.just_bake_button.set_size_request(205, 49)
+        # create button "Build base image"
+        self.just_bake_button = HobButton("Build base image")
         self.just_bake_button.set_tooltip_text("Build target image")
         self.just_bake_button.connect("clicked", self.just_bake_button_clicked_cb)
         button_box.pack_end(self.just_bake_button, expand=False, fill=False)
 
-        # create button "Edit Image"
-        self.edit_image_button = HobAltButton("Edit image")
-        #self.edit_image_button.set_size_request(205, 49)
+        # create button "Edit base image"
+        self.edit_image_button = HobAltButton("Edit base image")
         self.edit_image_button.set_tooltip_text("Edit target image")
         self.edit_image_button.connect("clicked", self.edit_image_button_clicked_cb)
         button_box.pack_end(self.edit_image_button, expand=False, fill=False)
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 268ac68..79ac80b 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -340,6 +340,11 @@ class ImageDetailsPage (HobPage):
         self.setting_detail = None
         if self.build_succeeded:
             vallist.append(machine)
+            if base_image == self.builder.recipe_model.__custom_image__:
+                if self.builder.configuration.initial_selected_image == self.builder.recipe_model.__custom_image__:
+                    base_image ="New base image"
+                else:
+                    base_image = self.builder.configuration.initial_selected_image + " (edited)"
             vallist.append(base_image)
             i = 0
             for layer in layers:
-- 
1.7.9.5



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

* [PATCH 02/14] hob: create save image dialog used to save a template
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 01/14] hob: labelling changes in Hob Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 03/14] hob/bitbake: create a template (a .bb file) from hob through bitbake Cristiana Voicu
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

Implemented a new dialog used by Hob. This dialog was desinged
in order to permit to save only in a particular directory.
Also, it has a field where the user can type a description
for the image.
Implemented in the handler a method to retrieve the topdir variable,
because the changes will be saved in {topdir}/recipes/images directory.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py             |    3 +
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py |  136 +++++++++++++++++++++++
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py     |    3 +
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py        |    3 +
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py    |   20 +++-
 5 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100644 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index a7bd21c..317a2fe 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -1451,3 +1451,6 @@ class Builder(gtk.Window):
             self.consolelog.setFormatter(format)
 
             self.logger.addHandler(self.consolelog)
+
+    def get_topdir(self):
+        return self.handler.get_topdir()
diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
new file mode 100644
index 0000000..85acb87
--- /dev/null
+++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
@@ -0,0 +1,136 @@
+#
+# BitBake Graphical GTK User Interface
+#
+# Copyright (C) 2011-2012   Intel Corporation
+#
+# Authored by Cristiana Voicu <cristiana.voicu@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import gtk
+import glib
+from bb.ui.crumbs.hig.crumbsdialog import CrumbsDialog
+from bb.ui.crumbs.hig.crumbsmessagedialog import CrumbsMessageDialog
+from bb.ui.crumbs.hobwidget import HobButton
+
+class SaveImageDialog (CrumbsDialog):
+    """
+    This class is used to create a dialog that permits to save
+    a custom image in a predefined directory.
+    """
+    def __init__(self, directory, title, parent, flags, buttons=None):
+        super(SaveImageDialog, self).__init__(title, parent, flags, buttons)
+        self.directory = directory
+        self.builder = parent
+
+        # create visual elements on the dialog
+        self.create_visual_elements()
+
+    def create_visual_elements(self):
+        self.set_default_response(gtk.RESPONSE_OK)
+        self.vbox.set_border_width(6)
+
+        sub_vbox = gtk.VBox(False, 12)
+        self.vbox.pack_start(sub_vbox, expand=False, fill=False)
+        label = gtk.Label()
+        label.set_alignment(0, 0)
+        label.set_markup("<b>Name</b>")
+        sub_label = gtk.Label()
+        sub_label.set_alignment(0, 0)
+        content = "Base image names should be all lowercase and include only alphanumeric\n"
+        content += "characters. The only special character you can use is the ASCII hyphen (-)."
+        sub_label.set_markup(content)
+        self.name_entry = gtk.Entry()
+        self.name_entry.set_size_request(350,30)
+        self.name_entry.connect("changed", self.name_entry_changed)
+        sub_vbox.pack_start(label, expand=False, fill=False)
+        sub_vbox.pack_start(sub_label, expand=False, fill=False)
+        sub_vbox.pack_start(self.name_entry, expand=False, fill=False)
+
+        sub_vbox = gtk.VBox(False, 12)
+        self.vbox.pack_start(sub_vbox, expand=False, fill=False)
+        label = gtk.Label()
+        label.set_alignment(0, 0)
+        label.set_markup("<b>Description</b> (optional)")
+        sub_label = gtk.Label()
+        sub_label.set_alignment(0, 0)
+        sub_label.set_markup("The description should be less than 150 characters long.")
+        self.description_entry = gtk.TextView()
+        self.description_entry.set_wrap_mode(gtk.WRAP_WORD)
+        self.description_entry.set_size_request(350,150)
+        sub_vbox.pack_start(label, expand=False, fill=False)
+        sub_vbox.pack_start(sub_label, expand=False, fill=False)
+        sub_vbox.pack_start(self.description_entry, expand=False, fill=False)
+
+        sub_vbox = gtk.VBox(False, 12)
+        self.vbox.pack_start(sub_vbox, expand=False, fill=False)
+        label = gtk.Label()
+        label.set_alignment(0, 0)
+        label.set_markup("Your base image will be saved to:")
+        sub_label = gtk.Label()
+        sub_label.set_alignment(0, 0)
+        sub_label.set_markup(self.directory)
+        sub_vbox.pack_start(label, expand=False, fill=False)
+        sub_vbox.pack_start(sub_label, expand=False, fill=False)
+
+        table = gtk.Table(1, 4, True)
+
+        cancel_button = gtk.Button()
+        cancel_button.set_label("Cancel")
+        cancel_button.connect("clicked", self.cancel_button_cb)
+        cancel_button.set_size_request(110, 30)
+
+        self.save_button = gtk.Button()
+        self.save_button.set_label("Save")
+        self.save_button.connect("clicked", self.save_button_cb)
+        self.save_button.set_size_request(110, 30)
+        self.save_button.set_sensitive(False)
+
+        table.attach(cancel_button, 2, 3, 0, 1)
+        table.attach(self.save_button, 3, 4, 0, 1)
+        self.vbox.pack_end(table, expand=False, fill=False)
+
+        self.show_all()
+
+    def name_entry_changed(self, entry):
+        text = entry.get_text()
+        if text == '':
+            self.save_button.set_sensitive(False)
+        else:
+            self.save_button.set_sensitive(True)
+
+    def cancel_button_cb(self, button):
+        self.destroy()
+
+    def save_button_cb(self, button):
+        text = self.name_entry.get_text()
+        new_text = text.replace("-","")
+        if new_text.islower() and new_text.isalnum():
+            print(text)
+            self.destroy()
+        else:
+            self.show_invalid_input_error_dialog()
+
+    def show_invalid_input_error_dialog(self):
+        lbl = "<b>Invalid characters in base image name</b>\n"
+        msg = "Base image names should be all lowercase and\n"
+        msg += "include only alphanumeric characters. The only\n"
+        msg += "special character you can use is the ASCII hyphen(-)."
+        lbl = lbl + "\n%s\n" % glib.markup_escape_text(msg)
+        dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
+        button = dialog.add_button("Close", gtk.RESPONSE_OK)
+        HobButton.style_button(button)
+
+        res = dialog.run()
+        dialog.destroy()
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index ebcb846..025156a 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -452,6 +452,9 @@ class HobHandler(gobject.GObject):
     def get_logfile(self):
         return self.server.runCommand(["getVariable", "BB_CONSOLELOG"])[0]
 
+    def get_topdir(self):
+        return self.runCommand(["getVariable", "TOPDIR"]) or ""
+
     def _remove_redundant(self, string):
         ret = []
         for i in string.split():
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index f114419..faa4fb5 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -882,3 +882,6 @@ class RecipeListModel(gtk.ListStore):
 
     def get_custom_image_version(self):
         return self.custom_image_version
+
+    def is_custom_image(self):
+        return self.get_selected_image() == self.__custom_image__
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 79ac80b..41e835a 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -27,6 +27,7 @@ from bb.ui.crumbs.hobwidget import hic, HobViewTable, HobAltButton, HobButton
 from bb.ui.crumbs.hobpages import HobPage
 import subprocess
 from bb.ui.crumbs.hig.crumbsdialog import CrumbsDialog
+from bb.ui.crumbs.hig.saveimagedialog import SaveImageDialog
 
 #
 # ImageDetailsPage
@@ -259,7 +260,7 @@ class ImageDetailsPage (HobPage):
             self.build_result = self.BuildDetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color)
             self.box_group_area.pack_start(self.build_result, expand=False, fill=False)
 
-        self.buttonlist = ["Build new image", "Run image", "Deploy image"]
+        self.buttonlist = ["Build new image", "Save base image", "Run image", "Deploy image"]
 
         # Name
         self.image_store = []
@@ -340,7 +341,7 @@ class ImageDetailsPage (HobPage):
         self.setting_detail = None
         if self.build_succeeded:
             vallist.append(machine)
-            if base_image == self.builder.recipe_model.__custom_image__:
+            if self.builder.recipe_model.is_custom_image():
                 if self.builder.configuration.initial_selected_image == self.builder.recipe_model.__custom_image__:
                     base_image ="New base image"
                 else:
@@ -579,6 +580,13 @@ class ImageDetailsPage (HobPage):
             created = True
             is_runnable = True
 
+        name = "Save base image"
+        if name in buttonlist and self.builder.recipe_model.is_custom_image():
+            save_button = HobAltButton("Save base image")
+            button_id = save_button.connect("clicked", self.save_button_clicked_cb)
+            self.button_ids[button_id] = save_button
+            self.details_bottom_buttons.pack_end(save_button, expand=False, fill=False)
+
         name = "Build new image"
         if name in buttonlist:
             # create button "Build new image"
@@ -613,6 +621,14 @@ class ImageDetailsPage (HobPage):
             else:
                 self.builder.runqemu_image(self.toggled_image, self.sel_kernel)
 
+    def save_button_clicked_cb(self, button):
+        topdir = self.builder.get_topdir()
+        images_dir = topdir + "/recipes/images/"
+        dialog = SaveImageDialog(images_dir, "Save base image", self.builder,
+                              gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
+        response = dialog.run()
+        dialog.destroy()
+
     def build_new_button_clicked_cb(self, button):
         self.builder.initiate_new_build_async()
 
-- 
1.7.9.5



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

* [PATCH 03/14] hob/bitbake: create a template (a .bb file) from hob through bitbake
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 01/14] hob: labelling changes in Hob Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 02/14] hob: create save image dialog used to save a template Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 04/14] hob/bitbake: save the description of a custom image Cristiana Voicu
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

Modified generateNewImage function from cooker, in order to be used to
save a template in Hob.
Created a command to ensure that some dirs are created. The templates
(recipes) will be saved in {TOPDIR}/recipes/images folder.
Called these methods from Hob.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/command.py                       |    8 ++++++-
 bitbake/lib/bb/cooker.py                        |   28 +++++++++++++++++------
 bitbake/lib/bb/ui/crumbs/builder.py             |   10 ++++++++
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py |    2 +-
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py     |    9 +++++++-
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py    |    2 ++
 6 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 1727654..9017e49 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -214,7 +214,13 @@ class CommandsSync:
         image = params[0]
         base_image = params[1]
         package_queue = params[2]
-        return command.cooker.generateNewImage(image, base_image, package_queue)
+        timestamp = params[3]
+        return command.cooker.generateNewImage(image, base_image,
+                                 package_queue, timestamp)
+
+    def ensureDir(self, command, params):
+        directory = params[0]
+        command.cooker.ensureDir(directory)
 
     def setVarFile(self, command, params):
         """
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 49e6345..7d54ab1 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1100,16 +1100,29 @@ class BBCooker:
 
         self.configuration.server_register_idlecallback(buildTargetsIdle, rq)
 
-    def generateNewImage(self, image, base_image, package_queue):
+    def ensureDir(self, d):
+        if not os.path.exists(d):
+            os.makedirs(d)
+
+    def generateNewImage(self, image, base_image, package_queue, timestamp):
         '''
-        Create a new image with a "require" base_image statement
+        Create a new image with a "require"/"inherit" base_image statement
         '''
-        image_name = os.path.splitext(image)[0]
-        timestr = time.strftime("-%Y%m%d-%H%M%S")
-        dest = image_name + str(timestr) + ".bb"
+        if timestamp:
+            image_name = os.path.splitext(image)[0]
+            timestr = time.strftime("-%Y%m%d-%H%M%S")
+            dest = image_name + str(timestr) + ".bb"
+        else:
+            if not image.endswith(".bb"):
+                dest = image + ".bb"
+            else:
+                dest = image
 
         with open(dest, "w") as imagefile:
-            imagefile.write("require " + base_image + "\n")
+            if base_image is None:
+                imagefile.write("inherit image\n")
+            else:
+                imagefile.write("require " + base_image + "\n")
             package_install = "PACKAGE_INSTALL_forcevariable = \""
             for package in package_queue:
                 package_install += str(package) + " "
@@ -1117,7 +1130,8 @@ class BBCooker:
             imagefile.write(package_install)
 
         self.state = state.initial
-        return timestr
+        if timestamp:
+            return timestr
 
     def updateCache(self):
         if self.state == state.running:
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 317a2fe..0a04c90 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -593,6 +593,16 @@ class Builder(gtk.Window):
                                     toolchain_packages,
                                     self.configuration.default_task)
 
+    def generate_new_image(self, image):
+        base_image = self.configuration.initial_selected_image
+        if base_image == self.recipe_model.__custom_image__:
+            base_image = None
+        packages = self.package_model.get_selected_packages()
+        self.handler.generate_new_image(image, base_image, packages)
+
+    def ensure_dir(self, directory):
+        self.handler.ensure_dir(directory)
+
     def get_parameters_sync(self):
         return self.handler.get_parameters()
 
diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
index 85acb87..f17f0f1 100644
--- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
+++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
@@ -117,7 +117,7 @@ class SaveImageDialog (CrumbsDialog):
         text = self.name_entry.get_text()
         new_text = text.replace("-","")
         if new_text.islower() and new_text.isalnum():
-            print(text)
+            self.builder.generate_new_image(self.directory+text)
             self.destroy()
         else:
             self.show_invalid_input_error_dialog()
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 025156a..4a67013 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -176,7 +176,7 @@ class HobHandler(gobject.GObject):
                 hobImage = self.runCommand(["matchFile", "hob-image.bb"])
                 if self.base_image != "Create a new base image":
                     baseImage = self.runCommand(["matchFile", self.base_image + ".bb"])
-                    version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue])
+                    version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue, True])
                     targets[0] += version
                     self.recipe_model.set_custom_image_version(version)
 
@@ -426,6 +426,13 @@ class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_BUILD_IMAGE)
         self.run_next_command(self.GENERATE_IMAGE)
 
+    def generate_new_image(self, image, base_image, package_queue):
+        base_image = self.runCommand(["matchFile", self.base_image + ".bb"])
+        self.runCommand(["generateNewImage", image, base_image, package_queue, False])
+
+    def ensure_dir(self, directory):
+        self.runCommand(["ensureDir", directory])
+
     def build_succeeded_async(self):
         self.building = False
 
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 41e835a..bed3f39 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -624,6 +624,8 @@ class ImageDetailsPage (HobPage):
     def save_button_clicked_cb(self, button):
         topdir = self.builder.get_topdir()
         images_dir = topdir + "/recipes/images/"
+        self.builder.ensure_dir(images_dir)
+
         dialog = SaveImageDialog(images_dir, "Save base image", self.builder,
                               gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
         response = dialog.run()
-- 
1.7.9.5



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

* [PATCH 04/14] hob/bitbake: save the description of a custom image
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (2 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 03/14] hob/bitbake: create a template (a .bb file) from hob through bitbake Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 05/14] hob: make changes in order to permit from UI to edit an image after saving it Cristiana Voicu
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

When an new image is saved, the dialog for this action has
a field for the description. Changed how an image is saved, by
appending the DESCRIPTION variable at the end of the .bb file.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/command.py                       |    3 ++-
 bitbake/lib/bb/cooker.py                        |    5 ++++-
 bitbake/lib/bb/ui/crumbs/builder.py             |    4 ++--
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py |    4 +++-
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py     |    6 +++---
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 9017e49..c38eab7 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -215,8 +215,9 @@ class CommandsSync:
         base_image = params[1]
         package_queue = params[2]
         timestamp = params[3]
+        description = params[4]
         return command.cooker.generateNewImage(image, base_image,
-                                 package_queue, timestamp)
+                        package_queue, timestamp, description)
 
     def ensureDir(self, command, params):
         directory = params[0]
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 7d54ab1..096391f 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1104,7 +1104,7 @@ class BBCooker:
         if not os.path.exists(d):
             os.makedirs(d)
 
-    def generateNewImage(self, image, base_image, package_queue, timestamp):
+    def generateNewImage(self, image, base_image, package_queue, timestamp, description):
         '''
         Create a new image with a "require"/"inherit" base_image statement
         '''
@@ -1129,6 +1129,9 @@ class BBCooker:
             package_install += "\"\n"
             imagefile.write(package_install)
 
+            description_var = "DESCRIPTION = \"" + description + "\"\n"
+            imagefile.write(description_var)
+
         self.state = state.initial
         if timestamp:
             return timestr
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 0a04c90..6bf4024 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -593,12 +593,12 @@ class Builder(gtk.Window):
                                     toolchain_packages,
                                     self.configuration.default_task)
 
-    def generate_new_image(self, image):
+    def generate_new_image(self, image, description):
         base_image = self.configuration.initial_selected_image
         if base_image == self.recipe_model.__custom_image__:
             base_image = None
         packages = self.package_model.get_selected_packages()
-        self.handler.generate_new_image(image, base_image, packages)
+        self.handler.generate_new_image(image, base_image, packages, description)
 
     def ensure_dir(self, directory):
         self.handler.ensure_dir(directory)
diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
index f17f0f1..5828996 100644
--- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
+++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
@@ -116,8 +116,10 @@ class SaveImageDialog (CrumbsDialog):
     def save_button_cb(self, button):
         text = self.name_entry.get_text()
         new_text = text.replace("-","")
+        description_buffer = self.description_entry.get_buffer()
+        description = description_buffer.get_text(description_buffer.get_start_iter(),description_buffer.get_end_iter())
         if new_text.islower() and new_text.isalnum():
-            self.builder.generate_new_image(self.directory+text)
+            self.builder.generate_new_image(self.directory+text, description)
             self.destroy()
         else:
             self.show_invalid_input_error_dialog()
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 4a67013..04a9482 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -176,7 +176,7 @@ class HobHandler(gobject.GObject):
                 hobImage = self.runCommand(["matchFile", "hob-image.bb"])
                 if self.base_image != "Create a new base image":
                     baseImage = self.runCommand(["matchFile", self.base_image + ".bb"])
-                    version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue, True])
+                    version = self.runCommand(["generateNewImage", hobImage, baseImage, self.package_queue, True, ""])
                     targets[0] += version
                     self.recipe_model.set_custom_image_version(version)
 
@@ -426,9 +426,9 @@ class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_BUILD_IMAGE)
         self.run_next_command(self.GENERATE_IMAGE)
 
-    def generate_new_image(self, image, base_image, package_queue):
+    def generate_new_image(self, image, base_image, package_queue, description):
         base_image = self.runCommand(["matchFile", self.base_image + ".bb"])
-        self.runCommand(["generateNewImage", image, base_image, package_queue, False])
+        self.runCommand(["generateNewImage", image, base_image, package_queue, False, description])
 
     def ensure_dir(self, directory):
         self.runCommand(["ensureDir", directory])
-- 
1.7.9.5



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

* [PATCH 05/14] hob: make changes in order to permit from UI to edit an image after saving it
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (3 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 04/14] hob/bitbake: save the description of a custom image Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 06/14] hob & bitbake: append a value to a variable from hob throught bitbake Cristiana Voicu
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

Added the image name to the list model, in order to show the image name as
the user named it.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py |    4 ++++
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py        |   28 +++++++++++++++--------
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py    |   10 ++++++--
 3 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
index 5828996..32847a8 100644
--- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
+++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
@@ -119,7 +119,11 @@ class SaveImageDialog (CrumbsDialog):
         description_buffer = self.description_entry.get_buffer()
         description = description_buffer.get_text(description_buffer.get_start_iter(),description_buffer.get_end_iter())
         if new_text.islower() and new_text.isalnum():
+            self.builder.image_details_page.image_saved = True
             self.builder.generate_new_image(self.directory+text, description)
+            self.builder.recipe_model.set_in_list(text, description)
+            self.builder.recipe_model.set_selected_image(text)
+            self.builder.image_details_page.show_page(self.builder.IMAGE_GENERATED)
             self.destroy()
         else:
             self.show_invalid_input_error_dialog()
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index faa4fb5..e371bbd 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -678,15 +678,8 @@ class RecipeListModel(gtk.ListStore):
         self.clear()
 
         # dummy image for prompt
-        self.set(self.append(), self.COL_NAME, self.__custom_image__,
-                 self.COL_DESC, "Use 'Edit image' to customize recipes and packages " \
-                                "to be included in your image ",
-                 self.COL_LIC, "", self.COL_GROUP, "",
-                 self.COL_DEPS, "", self.COL_BINB, "",
-                 self.COL_TYPE, "image", self.COL_INC, False,
-                 self.COL_IMG, False, self.COL_INSTALL, "", self.COL_PN, self.__custom_image__,
-                 self.COL_SUMMARY, "", self.COL_VERSION, "", self.COL_REVISION, "",
-                 self.COL_HOMEPAGE, "", self.COL_BUGTRACKER, "")
+        self.set_in_list(self.__custom_image__,  "Use 'Edit image' to customize recipes and packages " \
+                                "to be included in your image ")
 
         for item in event_model["pn"]:
             name = item
@@ -732,6 +725,23 @@ class RecipeListModel(gtk.ListStore):
             self.pn_path[pn] = path
             it = self.iter_next(it)
 
+    def set_in_list(self, item, desc):
+        self.set(self.append(), self.COL_NAME, item,
+                 self.COL_DESC, desc,
+                 self.COL_LIC, "", self.COL_GROUP, "",
+                 self.COL_DEPS, "", self.COL_BINB, "",
+                 self.COL_TYPE, "image", self.COL_INC, False,
+                 self.COL_IMG, False, self.COL_INSTALL, "", self.COL_PN, item,
+                 self.COL_SUMMARY, "", self.COL_VERSION, "", self.COL_REVISION, "",
+                 self.COL_HOMEPAGE, "", self.COL_BUGTRACKER, "")
+        self.pn_path = {}
+        it = self.get_iter_first()
+        while it:
+            pn = self.get_value(it, self.COL_NAME)
+            path = self.get_path(it)
+            self.pn_path[pn] = path
+            it = self.iter_next(it)
+
     """
     Update the model, send out the notification.
     """
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index bed3f39..3c88cb5 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -189,6 +189,7 @@ class ImageDetailsPage (HobPage):
         self.image_store = []
         self.button_ids = {}
         self.details_bottom_buttons = gtk.HBox(False, 6)
+        self.image_saved = False
         self.create_visual_elements()
 
     def create_visual_elements(self):
@@ -248,7 +249,7 @@ class ImageDetailsPage (HobPage):
         self.pack_start(self.group_align, expand=True, fill=True)
 
         self.build_result = None
-        if self.build_succeeded and self.builder.current_step == self.builder.IMAGE_GENERATING:
+        if self.image_saved or (self.build_succeeded and self.builder.current_step == self.builder.IMAGE_GENERATING):
             # building is the previous step
             icon = gtk.Image()
             pixmap_path = hic.ICON_INDI_CONFIRM_FILE
@@ -256,7 +257,10 @@ class ImageDetailsPage (HobPage):
             pix_buffer = gtk.gdk.pixbuf_new_from_file(pixmap_path)
             icon.set_from_pixbuf(pix_buffer)
             varlist = [""]
-            vallist = ["Your image is ready"]
+            if self.image_saved:
+                vallist = ["Your base image has been saved"]
+            else:
+                vallist = ["Your image is ready"]
             self.build_result = self.BuildDetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color)
             self.box_group_area.pack_start(self.build_result, expand=False, fill=False)
 
@@ -397,6 +401,7 @@ class ImageDetailsPage (HobPage):
         self.show_all()
         if self.kernel_detail and (not is_runnable):
             self.kernel_detail.hide()
+        self.image_saved = False
 
     def view_files_clicked_cb(self, button, image_addr):
         subprocess.call("xdg-open /%s" % image_addr, shell=True)
@@ -583,6 +588,7 @@ class ImageDetailsPage (HobPage):
         name = "Save base image"
         if name in buttonlist and self.builder.recipe_model.is_custom_image():
             save_button = HobAltButton("Save base image")
+            save_button.set_sensitive(not self.image_saved)
             button_id = save_button.connect("clicked", self.save_button_clicked_cb)
             self.button_ids[button_id] = save_button
             self.details_bottom_buttons.pack_end(save_button, expand=False, fill=False)
-- 
1.7.9.5



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

* [PATCH 06/14] hob & bitbake: append a value to a variable from hob throught bitbake
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (4 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 05/14] hob: make changes in order to permit from UI to edit an image after saving it Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 07/14] hob: change the name and description for the saveimagedialog Cristiana Voicu
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

It was necessary to append ${TOPDIR}/recipes/images to BBFILES.
Implemented the mechanism to append a value to a variable: a command and
the method in cooker.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/command.py                   |    3 ++-
 bitbake/lib/bb/cooker.py                    |   29 +++++++++++++++++++++++++++
 bitbake/lib/bb/data.py                      |    4 ++++
 bitbake/lib/bb/ui/crumbs/builder.py         |    1 +
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |   15 +++++++++++++-
 5 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index c38eab7..460b597 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -230,7 +230,8 @@ class CommandsSync:
         var = params[0]
         val = params[1]
         default_file = params[2]
-        command.cooker.saveConfigurationVar(var, val, default_file)
+        op = params[3]
+        command.cooker.modifyConfigurationVar(var, val, default_file, op)
 
     def createConfigFile(self, command, params):
         """
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 096391f..9965417 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -162,6 +162,35 @@ class BBCooker:
         self.data = self.databuilder.data
         self.data_hash = self.databuilder.data_hash
 
+    def modifyConfigurationVar(self, var, val, default_file, op):
+        if op == "append":
+            self.appendConfigurationVar(var, val, default_file)
+        elif op == "set":
+            self.saveConfigurationVar(var, val, default_file)
+
+    def appendConfigurationVar(self, var, val, default_file):
+        #add append var operation to the end of default_file
+        default_file = bb.cookerdata.findConfigFile(default_file)
+
+        with open(default_file, 'r') as f:
+            contents = f.readlines()
+        f.close()
+
+        total = ""
+        for c in contents:
+            total += c
+
+        total += "#added by bitbake"
+        total += "\n%s += \"%s\"\n" % (var, val)
+
+        with open(default_file, 'w') as f:
+            f.write(total)
+        f.close()
+
+        #add to history
+        loginfo = {"op":append, "file":default_file, "line":total.count("\n")}
+        self.data.appendVar(var, val, **loginfo)
+
     def saveConfigurationVar(self, var, val, default_file):
 
         replaced = False
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py
index 87c4808..8c9cb0f 100644
--- a/bitbake/lib/bb/data.py
+++ b/bitbake/lib/bb/data.py
@@ -97,6 +97,10 @@ def delVar(var, d):
     """Removes a variable from the data set"""
     d.delVar(var)
 
+def appendVar(var, value, d):
+    """Append additional value to a variable"""
+    d.appendVar(var, value)
+
 def setVarFlag(var, flag, flagvalue, d):
     """Set a flag for a given variable to a given value"""
     d.setVarFlag(var, flag, flagvalue)
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 6bf4024..7e33f92 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -440,6 +440,7 @@ class Builder(gtk.Window):
         self.handler.connect("recipe-populated",         self.handler_recipe_populated_cb)
         self.handler.connect("package-populated",        self.handler_package_populated_cb)
 
+        self.handler.append_to_bbfiles("${TOPDIR}/recipes/images/*bb")
         self.initiate_new_build_async()
 
         signal.signal(signal.SIGINT, self.event_handle_SIGINT)
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 04a9482..d160c69 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -471,9 +471,22 @@ class HobHandler(gobject.GObject):
 
     def set_var_in_file(self, var, val, default_file=None):
         self.runCommand(["enableDataTracking"])
-        self.server.runCommand(["setVarFile", var, val, default_file])
+        self.server.runCommand(["setVarFile", var, val, default_file, "set"])
         self.runCommand(["disableDataTracking"])
 
+    def append_var_in_file(self, var, val, default_file=None):
+        self.server.runCommand(["setVarFile", var, val, default_file, "append"])
+
+    def append_to_bbfiles(self, val):
+        bbfiles = self.runCommand(["getVariable", "BBFILES"]) or ""
+        bbfiles = bbfiles.split()
+        # replace TOPDIR in val, if necessary
+        if "${TOPDIR}" in val:
+            topdir = self.get_topdir()
+            val = val.replace("${TOPDIR}", topdir)
+        if val not in bbfiles:
+            self.append_var_in_file("BBFILES", "${TOPDIR}/recipes/images/*bb", "local.conf")
+
     def get_parameters(self):
         # retrieve the parameters from bitbake
         params = {}
-- 
1.7.9.5



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

* [PATCH 07/14] hob: change the name and description for the saveimagedialog
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (5 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 06/14] hob & bitbake: append a value to a variable from hob throught bitbake Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 08/14] hob: the saved image should be editable Cristiana Voicu
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

The image name and description should be saved for a future
save.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py |    8 +++++++-
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py    |    6 ++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
index 32847a8..6ebbca6 100644
--- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
+++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
@@ -29,10 +29,12 @@ class SaveImageDialog (CrumbsDialog):
     This class is used to create a dialog that permits to save
     a custom image in a predefined directory.
     """
-    def __init__(self, directory, title, parent, flags, buttons=None):
+    def __init__(self, directory, name, description, title, parent, flags, buttons=None):
         super(SaveImageDialog, self).__init__(title, parent, flags, buttons)
         self.directory = directory
         self.builder = parent
+        self.name_field = name
+        self.description_field = description
 
         # create visual elements on the dialog
         self.create_visual_elements()
@@ -52,6 +54,7 @@ class SaveImageDialog (CrumbsDialog):
         content += "characters. The only special character you can use is the ASCII hyphen (-)."
         sub_label.set_markup(content)
         self.name_entry = gtk.Entry()
+        self.name_entry.set_text(self.name_field)
         self.name_entry.set_size_request(350,30)
         self.name_entry.connect("changed", self.name_entry_changed)
         sub_vbox.pack_start(label, expand=False, fill=False)
@@ -67,6 +70,7 @@ class SaveImageDialog (CrumbsDialog):
         sub_label.set_alignment(0, 0)
         sub_label.set_markup("The description should be less than 150 characters long.")
         self.description_entry = gtk.TextView()
+        self.description_entry.get_buffer().set_text(self.description_field)
         self.description_entry.set_wrap_mode(gtk.WRAP_WORD)
         self.description_entry.set_size_request(350,150)
         sub_vbox.pack_start(label, expand=False, fill=False)
@@ -124,6 +128,8 @@ class SaveImageDialog (CrumbsDialog):
             self.builder.recipe_model.set_in_list(text, description)
             self.builder.recipe_model.set_selected_image(text)
             self.builder.image_details_page.show_page(self.builder.IMAGE_GENERATED)
+            self.builder.image_details_page.name_field_template = text
+            self.builder.image_details_page.description_field_template = description
             self.destroy()
         else:
             self.show_invalid_input_error_dialog()
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 3c88cb5..d96c76a 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -191,6 +191,8 @@ class ImageDetailsPage (HobPage):
         self.details_bottom_buttons = gtk.HBox(False, 6)
         self.image_saved = False
         self.create_visual_elements()
+        self.name_field_template = ""
+        self.description_field_template = ""
 
     def create_visual_elements(self):
         # create visual elements
@@ -632,8 +634,8 @@ class ImageDetailsPage (HobPage):
         images_dir = topdir + "/recipes/images/"
         self.builder.ensure_dir(images_dir)
 
-        dialog = SaveImageDialog(images_dir, "Save base image", self.builder,
-                              gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
+        dialog = SaveImageDialog(images_dir, self.name_field_template, self.description_field_template,
+                "Save base image", self.builder, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
         response = dialog.run()
         dialog.destroy()
 
-- 
1.7.9.5



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

* [PATCH 08/14] hob: the saved image should be editable
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (6 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 07/14] hob: change the name and description for the saveimagedialog Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 09/14] bitbake: when an image is saved, it should require an image from layers Cristiana Voicu
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

Also, the image can be saved when the a name is filled.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
index 6ebbca6..f8bf39f 100644
--- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
+++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
@@ -99,7 +99,8 @@ class SaveImageDialog (CrumbsDialog):
         self.save_button.set_label("Save")
         self.save_button.connect("clicked", self.save_button_cb)
         self.save_button.set_size_request(110, 30)
-        self.save_button.set_sensitive(False)
+        if self.name_entry.get_text() == '':
+            self.save_button.set_sensitive(False)
 
         table.attach(cancel_button, 2, 3, 0, 1)
         table.attach(self.save_button, 3, 4, 0, 1)
@@ -124,6 +125,7 @@ class SaveImageDialog (CrumbsDialog):
         description = description_buffer.get_text(description_buffer.get_start_iter(),description_buffer.get_end_iter())
         if new_text.islower() and new_text.isalnum():
             self.builder.image_details_page.image_saved = True
+            self.builder.customized = False
             self.builder.generate_new_image(self.directory+text, description)
             self.builder.recipe_model.set_in_list(text, description)
             self.builder.recipe_model.set_selected_image(text)
-- 
1.7.9.5



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

* [PATCH 09/14] bitbake: when an image is saved, it should require an image from layers
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (7 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 08/14] hob: the saved image should be editable Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-19 15:18   ` Chris Larson
  2013-07-17 10:35 ` [PATCH 10/14] hob: changes to image combo box Cristiana Voicu
                   ` (5 subsequent siblings)
  14 siblings, 1 reply; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

If the image required is not from the layers and it is removed, when sanity
check is running, Hob will show some errors related to this.
Agreed to "require" only the images from layers.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/cooker.py |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 9965417..ad92dea 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1147,10 +1147,17 @@ class BBCooker:
             else:
                 dest = image
 
+        if base_image:
+            with open(base_image, 'r') as f:
+                require_line = f.readline()
+
         with open(dest, "w") as imagefile:
             if base_image is None:
                 imagefile.write("inherit image\n")
             else:
+                topdir = self.data.getVar("TOPDIR")
+                if topdir in base_image:
+                    base_image = require_line.split()[1]
                 imagefile.write("require " + base_image + "\n")
             package_install = "PACKAGE_INSTALL_forcevariable = \""
             for package in package_queue:
-- 
1.7.9.5



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

* [PATCH 10/14] hob: changes to image combo box
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (8 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 09/14] bitbake: when an image is saved, it should require an image from layers Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 11/14] hob: retrieve file name of an image Cristiana Voicu
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

Added an item for the custom images.
Added a separator in the combo box.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index d5fc297..60d9eba 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -36,6 +36,7 @@ class ImageConfigurationPage (HobPage):
 
     __dummy_machine__ = "--select a machine--"
     __dummy_image__   = "--select a base image--"
+    __custom_image__  = "Select from my base images"
 
     def __init__(self, builder):
         super(ImageConfigurationPage, self).__init__(builder, "Image configuration")
@@ -238,6 +239,7 @@ class ImageConfigurationPage (HobPage):
         self.image_title_desc.set_markup(mark)
 
         self.image_combo = gtk.combo_box_new_text()
+        self.image_combo.set_row_separator_func(self.combo_separator_func, None)
         self.image_combo_id = self.image_combo.connect("changed", self.image_combo_changed_cb)
 
         self.image_desc = gtk.Label()
@@ -256,6 +258,11 @@ class ImageConfigurationPage (HobPage):
 
         self.image_separator = gtk.HSeparator()
 
+    def combo_separator_func(self, model, iter, user_data):
+        name = model.get_value(iter, 0)
+        if name == "--Separator--":
+            return True
+
     def set_config_baseimg_layout(self):
         self.gtable.attach(self.image_title, 0, 40, 15+self.warning_shift, 17+self.warning_shift)
         self.gtable.attach(self.image_title_desc, 0, 40, 18+self.warning_shift, 22+self.warning_shift)
@@ -358,6 +365,8 @@ class ImageConfigurationPage (HobPage):
     def image_combo_changed_cb(self, combo):
         self.builder.window_sensitive(False)
         selected_image = self.image_combo.get_active_text()
+        if selected_image == self.__custom_image__:
+            return
         if not selected_image or (selected_image == self.__dummy_image__):
             return
 
@@ -424,6 +433,10 @@ class ImageConfigurationPage (HobPage):
             self.image_combo.append_text(self.__dummy_image__)
             cnt = cnt + 1
 
+        self.image_combo.append_text(self.__custom_image__)
+        self.image_combo.append_text(self.builder.recipe_model.__custom_image__)
+        self.image_combo.append_text("--Separator--")
+
         # append and set active
         while it:
             path = image_model.get_path(it)
@@ -453,7 +466,6 @@ class ImageConfigurationPage (HobPage):
                     active = cnt
                 cnt = cnt + 1
 
-        self.image_combo.append_text(self.builder.recipe_model.__custom_image__)
         if selected_image == self.builder.recipe_model.__custom_image__:
             active = cnt
 
-- 
1.7.9.5



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

* [PATCH 11/14] hob: retrieve file name of an image
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (9 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 10/14] hob: changes to image combo box Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 12/14] hob: implement the "retrieve image dialog" + changes to image combo box Cristiana Voicu
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

The entire file name (with the path) is needed to know
if the image is located in the "build" directory or it comes
from layers. According to this information, the image is placed
differently in the combobox.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py           |    7 +++++--
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |    5 +++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index e371bbd..1f941c5 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -474,7 +474,7 @@ class RecipeListModel(gtk.ListStore):
     provide filtered views of the data.
     """
     (COL_NAME, COL_DESC, COL_LIC, COL_GROUP, COL_DEPS, COL_BINB, COL_TYPE, COL_INC, COL_IMG, COL_INSTALL, COL_PN, COL_FADE_INC, COL_SUMMARY, COL_VERSION,
-     COL_REVISION, COL_HOMEPAGE, COL_BUGTRACKER) = range(17)
+     COL_REVISION, COL_HOMEPAGE, COL_BUGTRACKER, COL_FILE) = range(18)
 
     __custom_image__ = "Create a new base image"
 
@@ -504,6 +504,7 @@ class RecipeListModel(gtk.ListStore):
                                 gobject.TYPE_STRING,
                                 gobject.TYPE_STRING,
                                 gobject.TYPE_STRING,
+                                gobject.TYPE_STRING,
                                 gobject.TYPE_STRING)
         self.sort_column_id, self.sort_order = RecipeListModel.COL_NAME, gtk.SORT_ASCENDING
 
@@ -692,6 +693,7 @@ class RecipeListModel(gtk.ListStore):
             revision = event_model["pn"][item]["revision"]
             homepage = event_model["pn"][item]["homepage"]
             bugtracker = event_model["pn"][item]["bugtracker"]
+            filename = event_model["pn"][item]["filename"]
             install = []
 
             depends = event_model["depends"].get(item, []) + event_model["rdepends-pn"].get(item, [])
@@ -715,7 +717,8 @@ class RecipeListModel(gtk.ListStore):
                      self.COL_TYPE, atype, self.COL_INC, False,
                      self.COL_IMG, False, self.COL_INSTALL, " ".join(install), self.COL_PN, item,
                      self.COL_SUMMARY, summary, self.COL_VERSION, version, self.COL_REVISION, revision,
-                     self.COL_HOMEPAGE, homepage, self.COL_BUGTRACKER, bugtracker)
+                     self.COL_HOMEPAGE, homepage, self.COL_BUGTRACKER, bugtracker,
+                     self.COL_FILE, filename)
 
         self.pn_path = {}
         it = self.get_iter_first()
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index 60d9eba..b0a5e7a 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -437,6 +437,7 @@ class ImageConfigurationPage (HobPage):
         self.image_combo.append_text(self.builder.recipe_model.__custom_image__)
         self.image_combo.append_text("--Separator--")
 
+        topdir = self.builder.get_topdir()
         # append and set active
         while it:
             path = image_model.get_path(it)
@@ -460,6 +461,10 @@ class ImageConfigurationPage (HobPage):
             else:
                 allow = True
 
+            file_name = image_model[path][recipe_model.COL_FILE]
+            if file_name and topdir in file_name:
+                allow = False
+
             if allow:
                 self.image_combo.append_text(image_name)
                 if image_name == selected_image:
-- 
1.7.9.5



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

* [PATCH 12/14] hob: implement the "retrieve image dialog" + changes to image combo box
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (10 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 11/14] hob: retrieve file name of an image Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 13/14] bitbake: save packages in IMAGE_INSTALL instead of PACKAGE_INSTALL Cristiana Voicu
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

Tha changes related to the image combo box are related to the
action done in the retrieveImageDialog. When the user wants to select
a customize image, but then he cancels the action, the combo box is set to
--select a base image--.
If the user selects an image using the new dialog, a new item with its name
is added to the combo box list and then it is activated.

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py                |    1 +
 .../lib/bb/ui/crumbs/hig/retrieveimagedialog.py    |   49 ++++++++++++++++++++
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   37 +++++++++++++--
 3 files changed, 84 insertions(+), 3 deletions(-)
 create mode 100644 bitbake/lib/bb/ui/crumbs/hig/retrieveimagedialog.py

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 7e33f92..c9c36bc 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -520,6 +520,7 @@ class Builder(gtk.Window):
         self.handler.generate_configuration()
 
     def initiate_new_build_async(self):
+        self.configuration.selected_image = None
         self.switch_page(self.MACHINE_SELECTION)
         self.handler.init_cooker()
         self.handler.set_extra_inherit("image_types")
diff --git a/bitbake/lib/bb/ui/crumbs/hig/retrieveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/retrieveimagedialog.py
new file mode 100644
index 0000000..896c117
--- /dev/null
+++ b/bitbake/lib/bb/ui/crumbs/hig/retrieveimagedialog.py
@@ -0,0 +1,49 @@
+#
+# BitBake Graphical GTK User Interface
+#
+# Copyright (C) 2011-2012   Intel Corporation
+#
+# Authored by Cristiana Voicu <cristiana.voicu@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import gtk
+
+class RetrieveImageDialog (gtk.FileChooserDialog):
+    """
+    This class is used to create a dialog that permits to retrieve
+    a custom image saved previously from Hob.
+    """
+    def __init__(self, directory,title, parent, flags, buttons=None):
+        super(RetrieveImageDialog, self).__init__(title, None, gtk.FILE_CHOOSER_ACTION_OPEN,
+            (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN, gtk.RESPONSE_OK))
+        self.directory = directory
+
+        # create visual elements on the dialog
+        self.create_visual_elements()
+
+    def create_visual_elements(self):
+        self.set_show_hidden(True)
+        self.set_default_response(gtk.RESPONSE_OK)
+        self.set_current_folder(self.directory)
+
+        vbox = self.get_children()[0].get_children()[0].get_children()[0]
+        for child in vbox.get_children()[0].get_children()[0].get_children()[0].get_children():
+            vbox.get_children()[0].get_children()[0].get_children()[0].remove(child)
+
+        label1 = gtk.Label()
+        label1.set_text("File system:  " + self.directory)
+        label1.show()
+        vbox.get_children()[0].get_children()[0].get_children()[0].pack_start(label1, expand=False, fill=False, padding=0)
+        vbox.get_children()[0].get_children()[1].get_children()[0].hide()
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index b0a5e7a..b0a2bd8 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -28,6 +28,7 @@ from bb.ui.crumbs.hobcolor import HobColors
 from bb.ui.crumbs.hobwidget import hic, HobImageButton, HobInfoButton, HobAltButton, HobButton
 from bb.ui.crumbs.hoblistmodel import RecipeListModel
 from bb.ui.crumbs.hobpages import HobPage
+from bb.ui.crumbs.hig.retrieveimagedialog import RetrieveImageDialog
 
 #
 # ImageConfigurationPage
@@ -48,6 +49,7 @@ class ImageConfigurationPage (HobPage):
         self.machine_combo_changed_by_manual = True
         self.stopping = False
         self.warning_shift = 0
+        self.custom_image_selected = None
         self.create_visual_elements()
 
     def create_visual_elements(self):
@@ -366,8 +368,28 @@ class ImageConfigurationPage (HobPage):
         self.builder.window_sensitive(False)
         selected_image = self.image_combo.get_active_text()
         if selected_image == self.__custom_image__:
-            return
+            topdir = self.builder.get_topdir()
+            images_dir = topdir + "/recipes/images/"
+            self.builder.ensure_dir(images_dir)
+
+            dialog = RetrieveImageDialog(images_dir, "Select a base image",
+                            self.builder, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
+            response = dialog.run()
+            if response == gtk.RESPONSE_OK:
+                image_name = dialog.get_filename()
+                head, tail = os.path.split(image_name)
+                selected_image = os.path.splitext(tail)[0]
+                self.custom_image_selected = selected_image
+                self.update_image_combo(self.builder.recipe_model, selected_image)
+            else:
+                selected_image = self.__dummy_image__
+                self.update_image_combo(self.builder.recipe_model, None)
+            dialog.destroy()
+
         if not selected_image or (selected_image == self.__dummy_image__):
+            self.builder.window_sensitive(True)
+            self.just_bake_button.hide()
+            self.edit_image_button.hide()
             return
 
         # remove __dummy_image__ item from the store list after first user selection
@@ -436,6 +458,7 @@ class ImageConfigurationPage (HobPage):
         self.image_combo.append_text(self.__custom_image__)
         self.image_combo.append_text(self.builder.recipe_model.__custom_image__)
         self.image_combo.append_text("--Separator--")
+        cnt = cnt + 3
 
         topdir = self.builder.get_topdir()
         # append and set active
@@ -471,6 +494,14 @@ class ImageConfigurationPage (HobPage):
                     active = cnt
                 cnt = cnt + 1
 
+        if self.custom_image_selected:
+            self.image_combo.append_text("--Separator--")
+            cnt = cnt + 1
+            self.image_combo.append_text(self.custom_image_selected)
+            if self.custom_image_selected == selected_image:
+                active = cnt
+            cnt = cnt + 1
+
         if selected_image == self.builder.recipe_model.__custom_image__:
             active = cnt
 
@@ -484,14 +515,14 @@ class ImageConfigurationPage (HobPage):
     def layer_button_clicked_cb(self, button):
         # Create a layer selection dialog
         self.builder.show_layer_selection_dialog()
-        
+
     def view_adv_configuration_button_clicked_cb(self, button):
         # Create an advanced settings dialog
         response, settings_changed = self.builder.show_adv_settings_dialog()
         if not response:
             return
         if settings_changed:
-            self.builder.reparse_post_adv_settings()        
+            self.builder.reparse_post_adv_settings()
 
     def just_bake_button_clicked_cb(self, button):
         self.builder.parsing_warnings = []
-- 
1.7.9.5



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

* [PATCH 13/14] bitbake: save packages in IMAGE_INSTALL instead of PACKAGE_INSTALL
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (11 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 12/14] hob: implement the "retrieve image dialog" + changes to image combo box Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:35 ` [PATCH 14/14] hob: set focus on entry name when the name is not correct Cristiana Voicu
  2013-07-17 10:37 ` [PATCH 00/14] bitbake+hob: templates enhancement Voicu, Cristiana
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

Hob retrieves the list of recipes and packages using the IMAGE_INSTALL
variable, so a custom image should be saved using this variable.
Changed how the image is saved in a bb file

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/cooker.py |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index ad92dea..48be434 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1159,11 +1159,11 @@ class BBCooker:
                 if topdir in base_image:
                     base_image = require_line.split()[1]
                 imagefile.write("require " + base_image + "\n")
-            package_install = "PACKAGE_INSTALL_forcevariable = \""
+            image_install = "IMAGE_INSTALL_append = \""
             for package in package_queue:
-                package_install += str(package) + " "
-            package_install += "\"\n"
-            imagefile.write(package_install)
+                image_install += str(package) + " "
+            image_install += "\"\n"
+            imagefile.write(image_install)
 
             description_var = "DESCRIPTION = \"" + description + "\"\n"
             imagefile.write(description_var)
-- 
1.7.9.5



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

* [PATCH 14/14] hob: set focus on entry name when the name is not correct
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (12 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 13/14] bitbake: save packages in IMAGE_INSTALL instead of PACKAGE_INSTALL Cristiana Voicu
@ 2013-07-17 10:35 ` Cristiana Voicu
  2013-07-17 10:37 ` [PATCH 00/14] bitbake+hob: templates enhancement Voicu, Cristiana
  14 siblings, 0 replies; 18+ messages in thread
From: Cristiana Voicu @ 2013-07-17 10:35 UTC (permalink / raw)
  To: bitbake-devel

[YOCTO #4193]
Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py |    1 +
 1 file changed, 1 insertion(+)

diff --git a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
index f8bf39f..e9e8dd5 100644
--- a/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
+++ b/bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py
@@ -147,4 +147,5 @@ class SaveImageDialog (CrumbsDialog):
         HobButton.style_button(button)
 
         res = dialog.run()
+        self.name_entry.grab_focus()
         dialog.destroy()
-- 
1.7.9.5



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

* Re: [PATCH 00/14] bitbake+hob: templates enhancement
  2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
                   ` (13 preceding siblings ...)
  2013-07-17 10:35 ` [PATCH 14/14] hob: set focus on entry name when the name is not correct Cristiana Voicu
@ 2013-07-17 10:37 ` Voicu, Cristiana
  14 siblings, 0 replies; 18+ messages in thread
From: Voicu, Cristiana @ 2013-07-17 10:37 UTC (permalink / raw)
  To: Voicu, Cristiana, bitbake-devel@lists.openembedded.org

Hi,

If you want to test this functionality, there is a poky-contrib branch with these patches:
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=cvoicu/hobtemplates

Thanks,
Cristiana

-----Original Message-----
From: Voicu, Cristiana 
Sent: Wednesday, July 17, 2013 1:36 PM
To: bitbake-devel@lists.openembedded.org
Cc: Voicu, Cristiana
Subject: [PATCH 00/14] bitbake+hob: templates enhancement

This set implements the templates functionality in Hob.
There are two new files, with two different dialogs.
The changes are in bitbake and Hob.

Cristiana Voicu (14):
  hob: labelling changes in Hob
  hob: create save image dialog used to save a template
  hob/bitbake: create a template (a .bb file) from hob through bitbake
  hob/bitbake: save the description of a custom image
  hob: make changes in order to permit from UI to edit an image after
    saving it
  hob & bitbake: append a value to a variable from hob throught bitbake
  hob: change the name and description for the saveimagedialog
  hob: the saved image should be editable
  bitbake: when an image is saved, it should require an image from
    layers
  hob: changes to image combo box
  hob: retrieve file name of an image
  hob: implement the "retrieve image dialog" + changes to image combo
    box
  bitbake: save packages in IMAGE_INSTALL instead of PACKAGE_INSTALL
  hob: set focus on entry name when the name is not correct

 bitbake/lib/bb/command.py                          |   12 +-
 bitbake/lib/bb/cooker.py                           |   75 ++++++++--
 bitbake/lib/bb/data.py                             |    4 +
 bitbake/lib/bb/ui/crumbs/builder.py                |   15 ++
 .../lib/bb/ui/crumbs/hig/retrieveimagedialog.py    |   49 +++++++
 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py    |  151 ++++++++++++++++++++
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py        |   29 +++-
 bitbake/lib/bb/ui/crumbs/hoblistmodel.py           |   40 ++++--
 bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   70 +++++++--
 bitbake/lib/bb/ui/crumbs/imagedetailspage.py       |   37 ++++-
 10 files changed, 438 insertions(+), 44 deletions(-)  create mode 100644 bitbake/lib/bb/ui/crumbs/hig/retrieveimagedialog.py
 create mode 100644 bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py

--
1.7.9.5



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

* Re: [PATCH 09/14] bitbake: when an image is saved, it should require an image from layers
  2013-07-17 10:35 ` [PATCH 09/14] bitbake: when an image is saved, it should require an image from layers Cristiana Voicu
@ 2013-07-19 15:18   ` Chris Larson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Larson @ 2013-07-19 15:18 UTC (permalink / raw)
  To: Cristiana Voicu; +Cc: bitbake-devel@lists.openembedded.org

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

On Wed, Jul 17, 2013 at 3:35 AM, Cristiana Voicu
<cristiana.voicu@intel.com>wrote:

> If the image required is not from the layers and it is removed, when sanity
> check is running, Hob will show some errors related to this.
> Agreed to "require" only the images from layers.
>
> [YOCTO #4193]
> Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
>

Two issues with the commit message summary:
- bitbake: isn't necessary for the commit going to bit bake, only for when
it gets pulled into poky
- nowhere does it make it clear that this is hob-related
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 1252 bytes --]

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

* Re: [PATCH 01/14] hob: labelling changes in Hob
  2013-07-17 10:35 ` [PATCH 01/14] hob: labelling changes in Hob Cristiana Voicu
@ 2013-07-22 16:44   ` Paul Eggleton
  0 siblings, 0 replies; 18+ messages in thread
From: Paul Eggleton @ 2013-07-22 16:44 UTC (permalink / raw)
  To: Cristiana Voicu; +Cc: bitbake-devel

Hi Cristiana,

On Wednesday 17 July 2013 13:35:31 Cristiana Voicu wrote:
> When the design document for templates in Hob was created, we've noticed
> that some labels need to change.
> 
> [YOCTO #4193]
> Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
> ---
>  bitbake/lib/bb/ui/crumbs/hobeventhandler.py        |    2 +-
>  bitbake/lib/bb/ui/crumbs/hoblistmodel.py           |    2 +-
>  bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py |   16 ++++++----------
>  bitbake/lib/bb/ui/crumbs/imagedetailspage.py       |    5 +++++
>  4 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py index 8788083..ebcb846 100644
> --- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> +++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
> @@ -174,7 +174,7 @@ class HobHandler(gobject.GObject):
>                  targets.append(self.toolchain)
>              if targets[0] == "hob-image":
>                  hobImage = self.runCommand(["matchFile", "hob-image.bb"])
> -                if self.base_image != "Create your own image":
> +                if self.base_image != "Create a new base image":

I've been talking with Belen today, and it seems like we have a bit of a 
terminology problem here. What we're dealing with here are "image recipes" 
rather than "base images". (The "base" part was just in context for the 
initial selection when we're selecting what to base our custom image on and 
then modify its contents.). Could you work with Belen to get the appropriate 
minor changes for this solidified?

Thanks,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

end of thread, other threads:[~2013-07-22 16:44 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-17 10:35 [PATCH 00/14] bitbake+hob: templates enhancement Cristiana Voicu
2013-07-17 10:35 ` [PATCH 01/14] hob: labelling changes in Hob Cristiana Voicu
2013-07-22 16:44   ` Paul Eggleton
2013-07-17 10:35 ` [PATCH 02/14] hob: create save image dialog used to save a template Cristiana Voicu
2013-07-17 10:35 ` [PATCH 03/14] hob/bitbake: create a template (a .bb file) from hob through bitbake Cristiana Voicu
2013-07-17 10:35 ` [PATCH 04/14] hob/bitbake: save the description of a custom image Cristiana Voicu
2013-07-17 10:35 ` [PATCH 05/14] hob: make changes in order to permit from UI to edit an image after saving it Cristiana Voicu
2013-07-17 10:35 ` [PATCH 06/14] hob & bitbake: append a value to a variable from hob throught bitbake Cristiana Voicu
2013-07-17 10:35 ` [PATCH 07/14] hob: change the name and description for the saveimagedialog Cristiana Voicu
2013-07-17 10:35 ` [PATCH 08/14] hob: the saved image should be editable Cristiana Voicu
2013-07-17 10:35 ` [PATCH 09/14] bitbake: when an image is saved, it should require an image from layers Cristiana Voicu
2013-07-19 15:18   ` Chris Larson
2013-07-17 10:35 ` [PATCH 10/14] hob: changes to image combo box Cristiana Voicu
2013-07-17 10:35 ` [PATCH 11/14] hob: retrieve file name of an image Cristiana Voicu
2013-07-17 10:35 ` [PATCH 12/14] hob: implement the "retrieve image dialog" + changes to image combo box Cristiana Voicu
2013-07-17 10:35 ` [PATCH 13/14] bitbake: save packages in IMAGE_INSTALL instead of PACKAGE_INSTALL Cristiana Voicu
2013-07-17 10:35 ` [PATCH 14/14] hob: set focus on entry name when the name is not correct Cristiana Voicu
2013-07-17 10:37 ` [PATCH 00/14] bitbake+hob: templates enhancement Voicu, Cristiana

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.