Skip to contentSkip to conversation

cooker: Split data from configuration

PATCH New Richard Purdie 1 participant 1 message Jun 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cooker: Split data from configuration

Stashing the data store within the configuration data is rather ugly and leads to problems trying to pickle just the configuration for example.

The reasons for combining these objects is ancient history, it makes sense to clean things up and separate them out now. This follows non logically from the configuration cleansups and leads well into the bitbake-worker changes.

---
This patch is a prerequisite for the bitbake-worker changes but I'd forgotten about it

bitbake/lib/bb/command.py +9 -9
index cc6a981..ab69501 100644
@@ -116,11 +116,11 @@ class Command:
 
     def finishAsyncCommand(self, msg=None, code=None):
         if msg:
-            bb.event.fire(CommandFailed(msg), self.cooker.configuration.event_data)
+            bb.event.fire(CommandFailed(msg), self.cooker.event_data)
         elif code:
-            bb.event.fire(CommandExit(code), self.cooker.configuration.event_data)
+            bb.event.fire(CommandExit(code), self.cooker.event_data)
         else:
-            bb.event.fire(CommandCompleted(), self.cooker.configuration.event_data)
+            bb.event.fire(CommandCompleted(), self.cooker.event_data)
         self.currentAsyncCommand = None
 
 
@@ -145,22 +145,22 @@ class CommandsSync:
 
     def getVariable(self, command, params):
         """
-        Read the value of a variable from configuration.data
+        Read the value of a variable from data
         """
         varname = params[0]
         expand = True
         if len(params) > 1:
             expand = params[1]
 
-        return command.cooker.configuration.data.getVar(varname, expand)
+        return command.cooker.data.getVar(varname, expand)
 
     def setVariable(self, command, params):
         """
-        Set the value of variable in configuration.data
+        Set the value of variable in data
         """
         varname = params[0]
         value = str(params[1])
-        command.cooker.configuration.data.setVar(varname, value)
+        command.cooker.data.setVar(varname, value)
 
     def setConfig(self, command, params):
         """
@@ -375,7 +375,7 @@ class CommandsAsync:
         """
         Parse the .bb files
         """
-        if bb.fetch.fetcher_compare_revisions(command.cooker.configuration.data):
+        if bb.fetch.fetcher_compare_revisions(command.cooker.data):
             command.finishAsyncCommand(code=1)
         else:
             command.finishAsyncCommand()
@@ -398,7 +398,7 @@ class CommandsAsync:
         Trigger a certain event
         """
         event = params[0]
-        bb.event.fire(eval(event), command.cooker.configuration.data)
+        bb.event.fire(eval(event), command.cooker.data)
         command.currentAsyncCommand = None
     triggerEvent.needcache = False
 
bitbake/lib/bb/cooker.py +73 -73

461 lines not on this page · raw message

bitbake/lib/bb/runqueue.py +6 -6
index f1964da..090d1b5 100644
@@ -957,7 +957,7 @@ class RunQueue:
         for task in range(len(self.rqdata.runq_fnid)):
             if self.rqdata.runq_fnid[task] not in done:
                 fn = self.rqdata.taskData.fn_index[self.rqdata.runq_fnid[task]]
-                the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.collection.get_file_appends(fn), self.cooker.configuration.data)
+                the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.collection.get_file_appends(fn), self.cooker.data)
                 done.add(self.rqdata.runq_fnid[task])
 
         bb.parse.siggen.dump_sigs(self.rqdata.dataCache)
@@ -1119,11 +1119,11 @@ class RunQueueExecute:
             if umask:
                 os.umask(umask)
 
-            self.cooker.configuration.data.setVar("BB_WORKERCONTEXT", "1")
+            self.cooker.data.setVar("BB_WORKERCONTEXT", "1")
             bb.parse.siggen.set_taskdata(self.rqdata.hashes, self.rqdata.hash_deps)
             ret = 0
             try:
-                the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.collection.get_file_appends(fn), self.cooker.configuration.data)
+                the_data = bb.cache.Cache.loadDataFull(fn, self.cooker.collection.get_file_appends(fn), self.cooker.data)
                 the_data.setVar('BB_TASKHASH', self.rqdata.runq_hash[task])
                 for h in self.rqdata.hashes:
                     the_data.setVar("BBHASH_%s" % h, self.rqdata.hashes[h])
@@ -1180,7 +1180,7 @@ class RunQueueExecute:
             taskname = self.rqdata.runq_task[depid]
             taskdata[dep] = [pn, taskname, fn]
         call = self.rq.depvalidate + "(task, taskdata, notneeded, d)"
-        locs = { "task" : task, "taskdata" : taskdata, "notneeded" : self.scenequeue_notneeded, "d" : self.cooker.configuration.data }
+        locs = { "task" : task, "taskdata" : taskdata, "notneeded" : self.scenequeue_notneeded, "d" : self.cooker.data }
         valid = bb.utils.better_eval(call, locs)
         return valid
 
@@ -1247,7 +1247,7 @@ class RunQueueExecuteTasks(RunQueueExecute):
 
             call = self.rq.setsceneverify + "(covered, tasknames, fnids, fns, d, invalidtasks=invalidtasks)"
             call2 = self.rq.setsceneverify + "(covered, tasknames, fnids, fns, d)"
-            locs = { "covered" : self.rq.scenequeue_covered, "tasknames" : self.rqdata.runq_task, "fnids" : self.rqdata.runq_fnid, "fns" : self.rqdata.taskData.fn_index, "d" : self.cooker.configuration.data, "invalidtasks" : invalidtasks }
+            locs = { "covered" : self.rq.scenequeue_covered, "tasknames" : self.rqdata.runq_task, "fnids" : self.rqdata.runq_fnid, "fns" : self.rqdata.taskData.fn_index, "d" : self.cooker.data, "invalidtasks" : invalidtasks }
             # Backwards compatibility with older versions without invalidtasks
             try:
                 covered_remove = bb.utils.better_eval(call, locs)
@@ -1607,7 +1607,7 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
                 sq_taskname.append(taskname)
                 sq_task.append(task)
             call = self.rq.hashvalidate + "(sq_fn, sq_task, sq_hash, sq_hashfn, d)"
-            locs = { "sq_fn" : sq_fn, "sq_task" : sq_taskname, "sq_hash" : sq_hash, "sq_hashfn" : sq_hashfn, "d" : self.cooker.configuration.data }
+            locs = { "sq_fn" : sq_fn, "sq_task" : sq_taskname, "sq_hash" : sq_hash, "sq_hashfn" : sq_hashfn, "d" : self.cooker.data }
             valid = bb.utils.better_eval(call, locs)
 
             valid_new = stamppresent