[bitbake-devel,PATCH_V2,3/5] bitbake: call the initConfiguration when reparsing

Submitted by Cristiana Voicu on June 20, 2013, 10:19 a.m.

Details

Message ID 1371723585-27966-4-git-send-email-cristiana.voicu@intel.com
State New
Headers show

Commit Message

Cristiana Voicu June 20, 2013, 10:19 a.m.
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(-)

Patch hide | download patch | download mbox

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()

Comments

Richard Purdie June 20, 2013, 12:25 p.m.
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