Patchwork [bitbake-devel,2/5] bitbake: add a new command and modify others

login
register
mail settings
Submitter Cristiana Voicu
Date June 19, 2013, 2:16 p.m.
Message ID <1371651387-20886-3-git-send-email-cristiana.voicu@intel.com>
Download mbox | patch
Permalink /patch/52009/
State New
Headers show

Comments

Cristiana Voicu - June 19, 2013, 2:16 p.m.
This patch adds a new command to create an extra configuration
file, in order to create it from Hob.
Also, it removes 2 commands used to enable and disable the tracking
history for variables, because it will be called in the body of each
command 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 |   30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)
Richard Purdie - June 20, 2013, 7:36 a.m.
On Wed, 2013-06-19 at 17:16 +0300, Cristiana Voicu wrote:
> This patch adds a new command to create an extra configuration
> file, in order to create it from Hob.
> Also, it removes 2 commands used to enable and disable the tracking
> history for variables, because it will be called in the body of each
> command when needed.

I'm not sure I like the idea of hard coding in when the tracking gets
turned on/off. Can we not do this at the correct points in hob?

The rest of the patch series looks good but the removal of these
commands is giving me some concern.

Cheers,

Richard




> 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 |   30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
> index 5f696c2..9ddb96d 100644
> --- a/bitbake/lib/bb/command.py
> +++ b/bitbake/lib/bb/command.py
> @@ -174,18 +174,6 @@ class CommandsSync:
>          value = str(params[1])
>          setattr(command.cooker.configuration, varname, value)
>  
> -    def enableDataTracking(self, command, params):
> -        """
> -        Enable history tracking for variables
> -        """
> -        command.cooker.enableDataTracking()
> -
> -    def disableDataTracking(self, command, params):
> -        """
> -        Disable history tracking for variables
> -        """
> -        command.cooker.disableDataTracking()
> -
>      def initCooker(self, command, params):
>          """
>          Init the cooker to initial state with nothing parsed
> @@ -217,10 +205,22 @@ 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.enableDataTracking()
>          command.cooker.saveConfigurationVar(var, val, default_file)
> +        command.cooker.disableDataTracking()
> +
> +    def createConfigFile(self, command, params):
> +        """
> +        Create an extra configuration file
> +        """
> +        name = params[0]
> +        command.cooker.createConfigFile(name)
>  
>  class CommandsAsync:
>      """
> @@ -390,11 +390,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
>

Patch

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 5f696c2..9ddb96d 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -174,18 +174,6 @@  class CommandsSync:
         value = str(params[1])
         setattr(command.cooker.configuration, varname, value)
 
-    def enableDataTracking(self, command, params):
-        """
-        Enable history tracking for variables
-        """
-        command.cooker.enableDataTracking()
-
-    def disableDataTracking(self, command, params):
-        """
-        Disable history tracking for variables
-        """
-        command.cooker.disableDataTracking()
-
     def initCooker(self, command, params):
         """
         Init the cooker to initial state with nothing parsed
@@ -217,10 +205,22 @@  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.enableDataTracking()
         command.cooker.saveConfigurationVar(var, val, default_file)
+        command.cooker.disableDataTracking()
+
+    def createConfigFile(self, command, params):
+        """
+        Create an extra configuration file
+        """
+        name = params[0]
+        command.cooker.createConfigFile(name)
 
 class CommandsAsync:
     """
@@ -390,11 +390,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