[bitbake-devel] [PATCH 6/6] cookerdata/cooker: Restore original datastore upon client disconnect

Richard Purdie richard.purdie at linuxfoundation.org
Tue Jul 18 21:37:00 UTC 2017


Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/cooker.py     | 2 ++
 lib/bb/cookerdata.py | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 313090b..a3058dd 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1566,6 +1566,8 @@ class BBCooker:
     def clientComplete(self):
         """Called when the client is done using the server"""
         self.finishcommand()
+        self.databuilder.reset()
+        self.data = self.databuilder.data
 
 def server_main(cooker, func, *args):
     cooker.pre_serve()
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index 9d1d3d2..e6662d0 100644
--- a/lib/bb/cookerdata.py
+++ b/lib/bb/cookerdata.py
@@ -328,6 +328,13 @@ class CookerDataBuilder(object):
             logger.exception("Error parsing configuration files")
             raise bb.BBHandledException
 
+        # Create a copy so we can reset at a later date when UIs disconnect
+        self.origdata = self.data
+        self.data = bb.data.createCopy(self.origdata)
+
+    def reset(self):
+        self.data = bb.data.createCopy(self.origdata)
+
     def _findLayerConf(self, data):
         return findConfigFile("bblayers.conf", data)
 
-- 
2.7.4




More information about the bitbake-devel mailing list