All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH_V2 0/5] Chnages in Hob in order to work correctly with bitbake-worker
@ 2013-06-20 10:19 Cristiana Voicu
  2013-06-20 10:19 ` [PATCH_V2 1/5] hob: remove the rest of the old template functionality Cristiana Voicu
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Cristiana Voicu @ 2013-06-20 10:19 UTC (permalink / raw)
  To: bitbake-devel


Cristiana Voicu (5):
  hob: remove the rest of the old template functionality
  bitbake & hob: modify some commands and call them from hob
  bitbake: call the initConfiguration when reparsing
  hob: replace the init cooker with reset in order to keep the history
  hob: save variables in conf/ directory

 bitbake/lib/bb/command.py                   |   16 ++-
 bitbake/lib/bb/cooker.py                    |   14 +-
 bitbake/lib/bb/ui/crumbs/builder.py         |  130 +++----------------
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |   64 ++++-----
 bitbake/lib/bb/ui/crumbs/template.py        |  187 ---------------------------
 5 files changed, 77 insertions(+), 334 deletions(-)
 delete mode 100644 bitbake/lib/bb/ui/crumbs/template.py

-- 
1.7.9.5



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

* [PATCH_V2 1/5] hob: remove the rest of the old template functionality
  2013-06-20 10:19 [PATCH_V2 0/5] Chnages in Hob in order to work correctly with bitbake-worker Cristiana Voicu
@ 2013-06-20 10:19 ` Cristiana Voicu
  2013-06-20 10:19 ` [PATCH_V2 2/5] bitbake & hob: modify some commands and call them from hob Cristiana Voicu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Cristiana Voicu @ 2013-06-20 10:19 UTC (permalink / raw)
  To: bitbake-devel

Until now, some configuration settings was saved in a hob specific
directory. From now on, it will be saved in conf directory through bitbake.

Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py  |  125 ++++-------------------
 bitbake/lib/bb/ui/crumbs/template.py |  187 ----------------------------------
 2 files changed, 18 insertions(+), 294 deletions(-)
 delete mode 100644 bitbake/lib/bb/ui/crumbs/template.py

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index b5cfd9e..2f7c496 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -30,7 +30,6 @@ import shlex
 import re
 import logging
 import sys
-from bb.ui.crumbs.template import TemplateMgr
 from bb.ui.crumbs.imageconfigurationpage import ImageConfigurationPage
 from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage
 from bb.ui.crumbs.packageselectionpage import PackageSelectionPage
@@ -192,36 +191,7 @@ class Configuration:
         self.split_proxy("socks", params["socks_proxy"])
         self.split_proxy("cvs", params["cvs_proxy_host"] + ":" + params["cvs_proxy_port"])
 
-    def load(self, template):
-        try:
-            self.image_rootfs_size = int(template.getVar("IMAGE_ROOTFS_SIZE"))
-        except:
-            pass
-        try:
-            self.image_extra_size = int(template.getVar("IMAGE_EXTRA_SPACE"))
-        except:
-            pass
-        # image_overhead_factor is read-only.
-        self.incompat_license = template.getVar("INCOMPATIBLE_LICENSE")
-        self.curr_sdk_machine = template.getVar("SDKMACHINE")
-        self.extra_setting = eval(template.getVar("EXTRA_SETTING"))
-        self.toolchain_build = eval(template.getVar("TOOLCHAIN_BUILD"))
-        self.image_fstypes = template.getVar("IMAGE_FSTYPES")
-        # image/recipes/packages
-        self.selected_image = template.getVar("__SELECTED_IMAGE__")
-        self.selected_recipes = template.getVar("DEPENDS").split()
-        self.selected_packages = template.getVar("IMAGE_INSTALL").split()
-        # proxy
-        self.enable_proxy = eval(template.getVar("enable_proxy"))
-        self.same_proxy = eval(template.getVar("use_same_proxy"))
-        self.split_proxy("http", template.getVar("http_proxy"))
-        self.split_proxy("https", template.getVar("https_proxy"))
-        self.split_proxy("ftp", template.getVar("ftp_proxy"))
-        self.split_proxy("socks", template.getVar("all_proxy"))
-        self.split_proxy("cvs", template.getVar("CVS_PROXY_HOST") + ":" + template.getVar("CVS_PROXY_PORT"))
-
     def save(self, handler, template, defaults=False):
-        template.setVar("VERSION", "%s" % hobVer)
         # bblayers.conf
         handler.set_var_in_file("BBLAYERS", self.layers, "bblayers.conf")
         # local.conf
@@ -240,29 +210,29 @@ class Configuration:
         handler.set_var_in_file("PARALLEL_MAKE", "-j %s" % self.pmake, "local.conf")
         handler.set_var_in_file("BB_NUMBER_THREADS", self.bbthread, "local.conf")
         handler.set_var_in_file("PACKAGE_CLASSES", " ".join(["package_" + i for i in self.curr_package_format.split()]), "local.conf")
-        template.setVar("IMAGE_ROOTFS_SIZE", self.image_rootfs_size)
-        template.setVar("IMAGE_EXTRA_SPACE", self.image_extra_size)
-        template.setVar("INCOMPATIBLE_LICENSE", self.incompat_license)
-        template.setVar("SDKMACHINE", self.curr_sdk_machine)
+        handler.set_var_in_file("IMAGE_ROOTFS_SIZE", self.image_rootfs_size, "local.conf")
+        handler.set_var_in_file("IMAGE_EXTRA_SPACE", self.image_extra_size, "local.conf")
+        handler.set_var_in_file("INCOMPATIBLE_LICENSE", self.incompat_license, "local.conf")
+        handler.set_var_in_file("SDKMACHINE", self.curr_sdk_machine, "local.conf")
         handler.set_var_in_file("CONF_VERSION", self.conf_version, "local.conf")
         handler.set_var_in_file("LCONF_VERSION", self.lconf_version, "bblayers.conf")
-        template.setVar("EXTRA_SETTING", self.extra_setting)
-        template.setVar("TOOLCHAIN_BUILD", self.toolchain_build)
-        template.setVar("IMAGE_FSTYPES", self.image_fstypes)
+        handler.set_var_in_file("EXTRA_SETTING", self.extra_setting, "local.conf")
+        handler.set_var_in_file("TOOLCHAIN_BUILD", self.toolchain_build, "local.conf")
+        handler.set_var_in_file("IMAGE_FSTYPES", self.image_fstypes, "local.conf")
         if not defaults:
             # image/recipes/packages
-            template.setVar("__SELECTED_IMAGE__", self.selected_image)
-            template.setVar("DEPENDS", self.selected_recipes)
-            template.setVar("IMAGE_INSTALL", self.user_selected_packages)
+            handler.set_var_in_file("__SELECTED_IMAGE__", self.selected_image, "local.conf")
+            handler.set_var_in_file("DEPENDS", self.selected_recipes, "local.conf")
+            handler.set_var_in_file("IMAGE_INSTALL", self.user_selected_packages, "local.conf")
         # proxy
-        template.setVar("enable_proxy", self.enable_proxy)
-        template.setVar("use_same_proxy", self.same_proxy)
-        template.setVar("http_proxy", self.combine_proxy("http"))
-        template.setVar("https_proxy", self.combine_proxy("https"))
-        template.setVar("ftp_proxy", self.combine_proxy("ftp"))
-        template.setVar("all_proxy", self.combine_proxy("socks"))
-        template.setVar("CVS_PROXY_HOST", self.combine_host_only("cvs"))
-        template.setVar("CVS_PROXY_PORT", self.combine_port_only("cvs"))
+        handler.set_var_in_file("enable_proxy", self.enable_proxy, "local.conf")
+        handler.set_var_in_file("use_same_proxy", self.same_proxy, "local.conf")
+        handler.set_var_in_file("http_proxy", self.combine_proxy("http"), "local.conf")
+        handler.set_var_in_file("https_proxy", self.combine_proxy("https"), "local.conf")
+        handler.set_var_in_file("ftp_proxy", self.combine_proxy("ftp"), "local.conf")
+        handler.set_var_in_file("all_proxy", self.combine_proxy("socks"), "local.conf")
+        handler.set_var_in_file("CVS_PROXY_HOST", self.combine_host_only("cvs"), "local.conf")
+        handler.set_var_in_file("CVS_PROXY_PORT", self.combine_port_only("cvs"), "local.conf")
 
     def __str__(self):
         s = "VERSION: '%s', BBLAYERS: '%s', MACHINE: '%s', DISTRO: '%s', DL_DIR: '%s'," % \
@@ -407,8 +377,6 @@ class Builder(gtk.Window):
         # handler
         self.handler = hobHandler
 
-        self.template = None
-
         # logger
         self.logger = logging.getLogger("BitBake")
         self.consolelog = None
@@ -552,7 +520,6 @@ class Builder(gtk.Window):
         self.handler.init_cooker()
         self.handler.set_extra_inherit("image_types")
         self.generate_configuration()
-        self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/"))
 
     def update_config_async(self):
         self.switch_page(self.MACHINE_SELECTION)
@@ -635,61 +602,6 @@ class Builder(gtk.Window):
     def cancel_parse_sync(self):
         self.handler.cancel_parse()
 
-    def load_template(self, path):
-        if not os.path.isfile(path):
-            return False
-
-        self.template = TemplateMgr()
-        # check compatibility
-        tempVer = self.template.getVersion(path)
-        if not tempVer or int(tempVer) < hobVer:
-            self.template.destroy()
-            self.template = None
-            return False
-
-        try:
-            self.template.load(path)
-            self.configuration.load(self.template)
-        except Exception as e:
-            self.show_error_dialog("Hob Exception - %s" % (str(e)))
-            self.reset()
-        finally:
-            self.template.destroy()
-            self.template = None
-
-        for layer in self.configuration.layers:
-            if not os.path.exists(layer+'/conf/layer.conf'):
-                return False
-
-        self.set_user_config_extra()
-        return True
-
-    def save_template(self, path, defaults=False):
-        if path.rfind("/") == -1:
-            filename = "default"
-            path = "."
-        else:
-            filename = path[path.rfind("/") + 1:len(path)]
-            path = path[0:path.rfind("/")]
-
-        self.template = TemplateMgr()
-        try:
-            self.template.open(filename, path)
-            self.configuration.save(self.handler, self.template, defaults)
-
-            self.template.save()
-        except Exception as e:
-            self.show_error_dialog("Hob Exception - %s" % (str(e)))
-            self.reset()
-        finally:
-            self.template.destroy()
-            self.template = None
-
-    def save_defaults(self):
-        if not os.path.exists(".hob/"):
-            os.mkdir(".hob/")
-        self.save_template(".hob/default", True)
-
     def switch_page(self, next_step):
         # Main Workflow (Business Logic)
         self.nb.set_current_page(self.__step2page__[next_step])
@@ -1255,7 +1167,6 @@ class Builder(gtk.Window):
         response = dialog.run()
         if response == gtk.RESPONSE_YES:
             self.configuration.layers = dialog.layers
-            self.save_defaults() # remember layers
             # DO refresh layers
             if dialog.layers_changed:
                 self.update_config_async()
diff --git a/bitbake/lib/bb/ui/crumbs/template.py b/bitbake/lib/bb/ui/crumbs/template.py
deleted file mode 100644
index 92c438f..0000000
--- a/bitbake/lib/bb/ui/crumbs/template.py
+++ /dev/null
@@ -1,187 +0,0 @@
-#
-# BitBake Graphical GTK User Interface
-#
-# Copyright (C) 2011        Intel Corporation
-#
-# Authored by Shane Wang <shane.wang@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 gobject
-import os
-import re
-
-class File(gobject.GObject):
-
-    def __init__(self, pathfilename, suffix):
-        if not pathfilename.endswith(suffix):
-            pathfilename = "%s%s" % (pathfilename, suffix)
-        gobject.GObject.__init__(self)
-        self.pathfilename = pathfilename
-
-    def readFile(self):
-        if not os.path.isfile(self.pathfilename):
-            return None
-        if not os.path.exists(self.pathfilename):
-            return None
-
-        with open(self.pathfilename, 'r') as f:
-            contents = f.readlines()
-        f.close()
-
-        return contents
-
-    def writeFile(self, contents):
-        if os.path.exists(self.pathfilename):
-            orig = "%s.orig" % self.pathfilename
-            if os.path.exists(orig):
-                os.remove(orig)
-            os.rename(self.pathfilename, orig)
-
-        with open(self.pathfilename, 'w') as f:
-            f.write(contents)
-        f.close()
-
-class ConfigFile(File):
-    """
-    This object does save general config file. (say bblayers.conf, or local.conf). Again, it is the base class for other template files and image bb files.
-    """
-    def __init__(self, pathfilename, suffix = None, header = None):
-        if suffix:
-            File.__init__(self, pathfilename, suffix)
-        else:
-            File.__init__(self, pathfilename, ".conf")
-        if header:
-            self.header = header
-        else:
-            self.header = "# Config generated by Hob\n\n"
-        self.dictionary = {}
-
-    def setVar(self, var, val):
-        if isinstance(val, list):
-            liststr = ""
-            if val:
-                i = 0
-                for value in val:
-                    if i < len(val) - 1:
-                        liststr += "%s " % value
-                    else:
-                        liststr += "%s" % value
-                    i += 1
-            self.dictionary[var] = liststr
-        else:
-            self.dictionary[var] = val
-
-    def save(self):
-        contents = self.header
-        for var, val in self.dictionary.items():
-            contents += "%s = \"%s\"\n" % (var, val)
-        File.writeFile(self, contents)
-
-class HobTemplateFile(ConfigFile):
-    """
-    This object does save or load hob specific file.
-    """
-    def __init__(self, pathfilename):
-        ConfigFile.__init__(self, pathfilename, ".hob", "# Hob Template generated by Hob\n\n")
-
-    def getVar(self, var):
-        if var in self.dictionary: 
-            return self.dictionary[var]
-        else:
-            return ""
-
-    def getVersion(self):
-        contents = ConfigFile.readFile(self)
-
-        pattern = "^\s*(\S+)\s*=\s*(\".*?\")"
-
-        for line in contents:
-            match = re.search(pattern, line)
-            if match:
-                if match.group(1) == "VERSION":
-                    return match.group(2).strip('"')
-        return None
-
-    def load(self):
-        contents = ConfigFile.readFile(self)
-        self.dictionary.clear()
-
-        pattern = "^\s*(\S+)\s*=\s*(\".*?\")"
-
-        for line in contents:
-            match = re.search(pattern, line)
-            if match:
-                var = match.group(1)
-                val = match.group(2).strip('"')
-                self.dictionary[var] = val
-        return self.dictionary
-
-class RecipeFile(ConfigFile):
-    """
-    This object is for image bb file.
-    """
-    def __init__(self, pathfilename):
-        ConfigFile.__init__(self, pathfilename, ".bb", "# Recipe generated by Hob\n\ninherit core-image\n")
-
-class TemplateMgr(gobject.GObject):
-
-    __gRecipeVars__ = ["DEPENDS", "IMAGE_INSTALL"]
-
-    def __init__(self):
-        gobject.GObject.__init__(self)
-        self.template_hob = None
-        self.bblayers_conf = None
-        self.local_conf = None
-        self.image_bb = None
-
-    @classmethod
-    def convert_to_template_pathfilename(cls, filename, path):
-        return "%s/%s%s%s" % (path, "template-", filename, ".hob")
-
-    @classmethod
-    def convert_to_image_pathfilename(cls, filename, path):
-        return "%s/%s%s%s" % (path, "hob-image-", filename, ".bb")
-
-    def open(self, filename, path):
-        self.template_hob = HobTemplateFile(TemplateMgr.convert_to_template_pathfilename(filename, path))
-        self.image_bb = RecipeFile(TemplateMgr.convert_to_image_pathfilename(filename, path))
-
-    def setVar(self, var, val):
-        if var in TemplateMgr.__gRecipeVars__:
-            self.image_bb.setVar(var, val)
-
-        self.template_hob.setVar(var, val)
-
-    def save(self):
-        self.image_bb.save()
-        self.template_hob.save()
-
-    def getVersion(self, path):
-        return HobTemplateFile(path).getVersion()
-
-    def load(self, path):
-        self.template_hob = HobTemplateFile(path)
-        self.dictionary = self.template_hob.load()
-
-    def getVar(self, var):
-        return self.template_hob.getVar(var)
-
-    def destroy(self):
-        if self.template_hob:
-            del self.template_hob
-            template_hob = None
-        if self.image_bb:
-            del self.image_bb
-            self.image_bb = None
-- 
1.7.9.5



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

* [PATCH_V2 2/5] bitbake & hob: modify some commands and call them from hob
  2013-06-20 10:19 [PATCH_V2 0/5] Chnages in Hob in order to work correctly with bitbake-worker Cristiana Voicu
  2013-06-20 10:19 ` [PATCH_V2 1/5] hob: remove the rest of the old template functionality Cristiana Voicu
@ 2013-06-20 10:19 ` Cristiana Voicu
  2013-06-20 10:19 ` [PATCH_V2 3/5] bitbake: call the initConfiguration when reparsing Cristiana Voicu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Cristiana Voicu @ 2013-06-20 10:19 UTC (permalink / raw)
  To: bitbake-devel

This patch adds a new command to create an extra configuration
file, in order to create it from Hob.
Also, it calls the enable/disable data tracking when needed.
Modified the prefiles and postfiles variables because the cooker
expects some lists.

Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/command.py                   |   16 +++++++++++++---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |    2 ++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 5f696c2..9dc38ec 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -217,11 +217,21 @@ class CommandsSync:
         return command.cooker.generateNewImage(image, base_image, package_queue)
 
     def setVarFile(self, command, params):
+        """
+        Save a variable in a file; used for saving in a configuration file
+        """
         var = params[0]
         val = params[1]
         default_file = params[2]
         command.cooker.saveConfigurationVar(var, val, default_file)
 
+    def createConfigFile(self, command, params):
+        """
+        Create an extra configuration file
+        """
+        name = params[0]
+        command.cooker.createConfigFile(name)
+
 class CommandsAsync:
     """
     A class of asynchronous commands
@@ -390,11 +400,11 @@ class CommandsAsync:
         """
         Parse the configuration files
         """
-        prefiles = params[0]
-        postfiles = params[1]
+        prefiles = params[0].split()
+        postfiles = params[1].split()
         command.cooker.configuration.prefile = prefiles
         command.cooker.configuration.postfile = postfiles
-        command.cooker.loadConfigurationData()
+        command.cooker.loadConfigurationData(tracking=True)
         command.finishAsyncCommand()
     parseConfigurationFiles.needcache = False
 
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index d060bc0..8fd989b 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -454,7 +454,9 @@ class HobHandler(gobject.GObject):
         return " ".join(ret)
 
     def set_var_in_file(self, var, val, default_file=None):
+        self.runCommand(["enableDataTracking"])
         self.server.runCommand(["setVarFile", var, val, default_file])
+        self.runCommand(["disableDataTracking"])
 
     def get_parameters(self):
         # retrieve the parameters from bitbake
-- 
1.7.9.5



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

* [PATCH_V2 3/5] bitbake: call the initConfiguration when reparsing
  2013-06-20 10:19 [PATCH_V2 0/5] Chnages in Hob in order to work correctly with bitbake-worker Cristiana Voicu
  2013-06-20 10:19 ` [PATCH_V2 1/5] hob: remove the rest of the old template functionality Cristiana Voicu
  2013-06-20 10:19 ` [PATCH_V2 2/5] bitbake & hob: modify some commands and call them from hob Cristiana Voicu
@ 2013-06-20 10:19 ` Cristiana Voicu
  2013-06-20 12:25   ` Richard Purdie
  2013-06-20 10:19 ` [PATCH_V2 4/5] hob: replace the init cooker with reset in order to keep the history Cristiana Voicu
  2013-06-20 10:19 ` [PATCH_V2 5/5] hob: save variables in conf/ directory Cristiana Voicu
  4 siblings, 1 reply; 7+ messages in thread
From: Cristiana Voicu @ 2013-06-20 10:19 UTC (permalink / raw)
  To: bitbake-devel

As it is implemented now, when parsing the configuration files is
needed, it also needs an initialization.
Also, implemented a function to create an extra configuration files
which can be used as postfile/prefiles when parsing.

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

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index f375a6f..e1b33f1 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -109,7 +109,6 @@ class BBCooker:
                 sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name)
 
         self.data = None
-        self.initConfigurationData()
         self.loadConfigurationData()
 
         # Take a lock so only one copy of bitbake can run against a given build
@@ -155,7 +154,10 @@ class BBCooker:
     def disableDataTracking(self):
         self.data.disableTracking()
 
-    def loadConfigurationData(self):
+    def loadConfigurationData(self, tracking = False):
+        self.initConfigurationData()
+        if tracking:
+            self.enableDataTracking()
         self.databuilder.parseBaseConfiguration()
         self.data = self.databuilder.data
         self.data_hash = self.databuilder.data_hash
@@ -243,6 +245,11 @@ class BBCooker:
             loginfo = {"op":set, "file":default_file, "line":total.count("\n")}
             self.data.setVar(var, val, **loginfo)
 
+    def createConfigFile(self, name):
+        path = os.getcwd()
+        confpath = os.path.join(path, "conf", name)
+        open(confpath, 'w').close()
+
     def parseConfiguration(self):
 
         # Set log file verbosity
@@ -1201,8 +1208,7 @@ class BBCooker:
 
     def reset(self):
         self.state = state.initial
-        self.initConfigurationData()
-        self.loadConfigurationData()
+        self.loadConfigurationData(tracking=True)
 
 def server_main(cooker, func, *args):
     cooker.pre_serve()
-- 
1.7.9.5



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

* [PATCH_V2 4/5] hob: replace the init cooker with reset in order to keep the history
  2013-06-20 10:19 [PATCH_V2 0/5] Chnages in Hob in order to work correctly with bitbake-worker Cristiana Voicu
                   ` (2 preceding siblings ...)
  2013-06-20 10:19 ` [PATCH_V2 3/5] bitbake: call the initConfiguration when reparsing Cristiana Voicu
@ 2013-06-20 10:19 ` Cristiana Voicu
  2013-06-20 10:19 ` [PATCH_V2 5/5] hob: save variables in conf/ directory Cristiana Voicu
  4 siblings, 0 replies; 7+ messages in thread
From: Cristiana Voicu @ 2013-06-20 10:19 UTC (permalink / raw)
  To: bitbake-devel

When the cooker initialization is called, the variables history is lost.
It need a reset, in order to load the configuration files.
Also, concatenated the value for INHERIT variable.

Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/builder.py |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 2f7c496..d5df60f 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -684,12 +684,11 @@ class Builder(gtk.Window):
         self.handler.set_sdk_machine(self.configuration.curr_sdk_machine)
         self.handler.set_image_fstypes(self.configuration.image_fstypes)
         self.handler.set_extra_config(self.configuration.extra_setting)
-        self.handler.set_extra_inherit("packageinfo")
-        self.handler.set_extra_inherit("image_types")
+        self.handler.set_extra_inherit("packageinfo image_types")
         self.set_user_config_proxies()
 
     def set_user_config(self):
-        self.handler.init_cooker()
+        self.handler.reset_cooker()
         # set bb layers
         self.handler.set_bblayers(self.configuration.layers)
         # set local configuration
-- 
1.7.9.5



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

* [PATCH_V2 5/5] hob: save variables in conf/ directory
  2013-06-20 10:19 [PATCH_V2 0/5] Chnages in Hob in order to work correctly with bitbake-worker Cristiana Voicu
                   ` (3 preceding siblings ...)
  2013-06-20 10:19 ` [PATCH_V2 4/5] hob: replace the init cooker with reset in order to keep the history Cristiana Voicu
@ 2013-06-20 10:19 ` Cristiana Voicu
  4 siblings, 0 replies; 7+ messages in thread
From: Cristiana Voicu @ 2013-06-20 10:19 UTC (permalink / raw)
  To: bitbake-devel

Until now the variables were saved in bitbake configuration,
now they are saved in configuration files, in order to be read by
bitbake-worker. This helps to assure the consistency for the rest
of the variables.

Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |   62 ++++++++++++++-------------
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 8fd989b..421a1f3 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -146,9 +146,7 @@ class HobHandler(gobject.GObject):
         elif next_command == self.SUB_MATCH_CLASS:
             self.runCommand(["findFilesMatchingInDir", "rootfs_", "classes"])
         elif next_command == self.SUB_PARSE_CONFIG:
-            self.runCommand(["enableDataTracking"])
-            self.runCommand(["parseConfigurationFiles", "", ""])
-            self.runCommand(["disableDataTracking"])
+            self.runCommand(["parseConfigurationFiles", "conf/.hob.conf", ""])
         elif next_command == self.SUB_GNERATE_TGTS:
             self.runCommand(["generateTargetsTree", "classes/image.bbclass", []])
         elif next_command == self.SUB_GENERATE_PKGINFO:
@@ -167,10 +165,10 @@ class HobHandler(gobject.GObject):
             self.building = True
             targets = [self.image]
             if self.package_queue:
-                self.runCommand(["setVariable", "LINGUAS_INSTALL", ""])
-                self.runCommand(["setVariable", "PACKAGE_INSTALL", " ".join(self.package_queue)])
+                self.set_var_in_file("LINGUAS_INSTALL", "", "local.conf")
+                self.set_var_in_file("PACKAGE_INSTALL", " ".join(self.package_queue), "local.conf")
             if self.toolchain_packages:
-                self.runCommand(["setVariable", "TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages)])
+                self.set_var_in_file("TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages), "local.conf")
                 targets.append(self.toolchain)
             if targets[0] == "hob-image":
                 hobImage = self.runCommand(["matchFile", "hob-image.bb"])
@@ -204,8 +202,8 @@ class HobHandler(gobject.GObject):
         elif isinstance(event, bb.event.SanityCheckPassed):
             reparse = self.runCommand(["getVariable", "BB_INVALIDCONF"]) or None
             if reparse is True:
-                self.runCommand(["setVariable", "BB_INVALIDCONF", False])
-                self.runCommand(["parseConfigurationFiles", "", ""])
+                self.set_var_in_file("BB_INVALIDCONF", False, "local.conf")
+                self.runCommand(["parseConfigurationFiles", "conf/.hob.conf", ""])
             self.run_next_command()
 
         elif isinstance(event, bb.event.SanityCheckFailed):
@@ -300,79 +298,83 @@ class HobHandler(gobject.GObject):
 
     def init_cooker(self):
         self.runCommand(["initCooker"])
+        self.runCommand(["createConfigFile", ".hob.conf"])
+
+    def reset_cooker(self):
+        self.runCommand(["resetCooker"])
 
     def set_extra_inherit(self, bbclass):
         inherits = self.runCommand(["getVariable", "INHERIT"]) or ""
         inherits = inherits + " " + bbclass
-        self.runCommand(["setVariable", "INHERIT", inherits])
+        self.set_var_in_file("INHERIT", inherits, ".hob.conf")
 
     def set_bblayers(self, bblayers):
-        self.runCommand(["setVariable", "BBLAYERS", " ".join(bblayers)])
+        self.set_var_in_file("BBLAYERS", " ".join(bblayers), "bblayers.conf")
 
     def set_machine(self, machine):
         if machine:
-            self.runCommand(["setVariable", "MACHINE", machine])
+            self.set_var_in_file("MACHINE", machine, "local.conf")
 
     def set_sdk_machine(self, sdk_machine):
-        self.runCommand(["setVariable", "SDKMACHINE", sdk_machine])
+        self.set_var_in_file("SDKMACHINE", sdk_machine, "local.conf")
 
     def set_image_fstypes(self, image_fstypes):
-        self.runCommand(["setVariable", "IMAGE_FSTYPES", image_fstypes])
+        self.set_var_in_file("IMAGE_FSTYPES", image_fstypes, "local.conf")
 
     def set_distro(self, distro):
-        self.runCommand(["setVariable", "DISTRO", distro])
+        self.set_var_in_file("DISTRO", distro, "local.conf")
 
     def set_package_format(self, format):
         package_classes = ""
         for pkgfmt in format.split():
             package_classes += ("package_%s" % pkgfmt + " ")
-        self.runCommand(["setVariable", "PACKAGE_CLASSES", package_classes])
+        self.set_var_in_file("PACKAGE_CLASSES", package_classes, "local.conf")
 
     def set_bbthreads(self, threads):
-        self.runCommand(["setVariable", "BB_NUMBER_THREADS", threads])
+        self.set_var_in_file("BB_NUMBER_THREADS", threads, "local.conf")
 
     def set_pmake(self, threads):
         pmake = "-j %s" % threads
-        self.runCommand(["setVariable", "PARALLEL_MAKE", pmake])
+        self.set_var_in_file("PARALLEL_MAKE", pmake, "local.conf")
 
     def set_dl_dir(self, directory):
-        self.runCommand(["setVariable", "DL_DIR", directory])
+        self.set_var_in_file("DL_DIR", directory, "local.conf")
 
     def set_sstate_dir(self, directory):
-        self.runCommand(["setVariable", "SSTATE_DIR", directory])
+        self.set_var_in_file("SSTATE_DIR", directory, "local.conf")
 
     def set_sstate_mirrors(self, url):
-        self.runCommand(["setVariable", "SSTATE_MIRRORS", url])
+        self.set_var_in_file("SSTATE_MIRRORS", url, "local.conf")
 
     def set_extra_size(self, image_extra_size):
-        self.runCommand(["setVariable", "IMAGE_ROOTFS_EXTRA_SPACE", str(image_extra_size)])
+        self.set_var_in_file("IMAGE_ROOTFS_EXTRA_SPACE", str(image_extra_size), "local.conf")
 
     def set_rootfs_size(self, image_rootfs_size):
-        self.runCommand(["setVariable", "IMAGE_ROOTFS_SIZE", str(image_rootfs_size)])
+        self.set_var_in_file("IMAGE_ROOTFS_SIZE", str(image_rootfs_size), "local.conf")
 
     def set_incompatible_license(self, incompat_license):
-        self.runCommand(["setVariable", "INCOMPATIBLE_LICENSE", incompat_license])
+        self.set_var_in_file("INCOMPATIBLE_LICENSE", incompat_license, "local.conf")
 
     def set_extra_config(self, extra_setting):
         for key in extra_setting.keys():
             value = extra_setting[key]
-            self.runCommand(["setVariable", key, value])
+            self.set_var_in_file(key, value, "local.conf")
 
     def set_http_proxy(self, http_proxy):
-        self.runCommand(["setVariable", "http_proxy", http_proxy])
+        self.set_var_in_file("http_proxy", http_proxy, "local.conf")
 
     def set_https_proxy(self, https_proxy):
-        self.runCommand(["setVariable", "https_proxy", https_proxy])
+        self.set_var_in_file("https_proxy", https_proxy, "local.conf")
 
     def set_ftp_proxy(self, ftp_proxy):
-        self.runCommand(["setVariable", "ftp_proxy", ftp_proxy])
+        self.set_var_in_file("ftp_proxy", ftp_proxy, "local.conf")
 
     def set_socks_proxy(self, socks_proxy):
-        self.runCommand(["setVariable", "all_proxy", socks_proxy])
+        self.set_var_in_file("all_proxy", socks_proxy, "local.conf")
 
     def set_cvs_proxy(self, host, port):
-        self.runCommand(["setVariable", "CVS_PROXY_HOST", host])
-        self.runCommand(["setVariable", "CVS_PROXY_PORT", port])
+        self.set_var_in_file("CVS_PROXY_HOST", host, "local.conf")
+        self.set_var_in_file("CVS_PROXY_PORT", port, "local.conf")
 
     def request_package_info(self):
         self.commands_async.append(self.SUB_GENERATE_PKGINFO)
-- 
1.7.9.5



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

* Re: [PATCH_V2 3/5] bitbake: call the initConfiguration when reparsing
  2013-06-20 10:19 ` [PATCH_V2 3/5] bitbake: call the initConfiguration when reparsing Cristiana Voicu
@ 2013-06-20 12:25   ` Richard Purdie
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Purdie @ 2013-06-20 12:25 UTC (permalink / raw)
  To: Cristiana Voicu; +Cc: bitbake-devel

On Thu, 2013-06-20 at 13:19 +0300, Cristiana Voicu wrote:
> As it is implemented now, when parsing the configuration files is
> needed, it also needs an initialization.
> Also, implemented a function to create an extra configuration files
> which can be used as postfile/prefiles when parsing.
> 
> Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
> ---
>  bitbake/lib/bb/cooker.py |   14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
> index f375a6f..e1b33f1 100644
> --- a/bitbake/lib/bb/cooker.py
> +++ b/bitbake/lib/bb/cooker.py
> @@ -109,7 +109,6 @@ class BBCooker:
>                  sys.exit("FATAL: Failed to import extra cache class '%s'." % cache_name)
>  
>          self.data = None
> -        self.initConfigurationData()
>          self.loadConfigurationData()
>  
>          # Take a lock so only one copy of bitbake can run against a given build
> @@ -155,7 +154,10 @@ class BBCooker:
>      def disableDataTracking(self):
>          self.data.disableTracking()
>  
> -    def loadConfigurationData(self):
> +    def loadConfigurationData(self, tracking = False):
> +        self.initConfigurationData()
> +        if tracking:
> +            self.enableDataTracking()
>          self.databuilder.parseBaseConfiguration()
>          self.data = self.databuilder.data
>          self.data_hash = self.databuilder.data_hash
> @@ -243,6 +245,11 @@ class BBCooker:
>              loginfo = {"op":set, "file":default_file, "line":total.count("\n")}
>              self.data.setVar(var, val, **loginfo)
>  
> +    def createConfigFile(self, name):
> +        path = os.getcwd()
> +        confpath = os.path.join(path, "conf", name)
> +        open(confpath, 'w').close()
> +
>      def parseConfiguration(self):
>  
>          # Set log file verbosity
> @@ -1201,8 +1208,7 @@ class BBCooker:
>  
>      def reset(self):
>          self.state = state.initial
> -        self.initConfigurationData()
> -        self.loadConfigurationData()
> +        self.loadConfigurationData(tracking=True)

I don't like having one default used in some cases yet the reset does
something different by default. Can you set the tracking to enabled from
hob please instead of this default?

Cheers,

Richard




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

end of thread, other threads:[~2013-06-20 12:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-20 10:19 [PATCH_V2 0/5] Chnages in Hob in order to work correctly with bitbake-worker Cristiana Voicu
2013-06-20 10:19 ` [PATCH_V2 1/5] hob: remove the rest of the old template functionality Cristiana Voicu
2013-06-20 10:19 ` [PATCH_V2 2/5] bitbake & hob: modify some commands and call them from hob Cristiana Voicu
2013-06-20 10:19 ` [PATCH_V2 3/5] bitbake: call the initConfiguration when reparsing Cristiana Voicu
2013-06-20 12:25   ` Richard Purdie
2013-06-20 10:19 ` [PATCH_V2 4/5] hob: replace the init cooker with reset in order to keep the history Cristiana Voicu
2013-06-20 10:19 ` [PATCH_V2 5/5] hob: save variables in conf/ directory Cristiana Voicu

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.