[gnome-continuous-yocto/gnomeostree-3.28-rocko: 7483/8267] bitbake: cooker: Allow changes in PRSERV_HOST to be responded to



commit 2e41f733fafc708149c03ace75d325580925fd88
Author: Richard Purdie <richard purdie linuxfoundation org>
Date:   Thu Aug 31 17:09:54 2017 +0100

    bitbake: cooker: Allow changes in PRSERV_HOST to be responded to
    
    When we reload the configuration, PRSERV_HOST can change. Therefore
    restart the PR Server depending on the new configuration at reparse.
    
    Note that the server has to be started from the right process, it
    can't be in the UI which shuts down as that shutdown triggers a shutdown
    of its children and the PR Server shuts down too. This is why we need
    pre_serve() which ensures its executed in the right context.
    
    (Bitbake rev: 971272e84f4efe7ebd0037e164ba54f013a2a34e)
    
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 bitbake/lib/bb/cooker.py |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 5ee1c0a..a2c1b40 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -379,6 +379,13 @@ class BBCooker:
         self.baseconfig_valid = True
         self.parsecache_valid = False
 
+    def handlePRServ(self):
+        # Setup a PR Server based on the new configuration
+        try:
+            self.prhost = prserv.serv.auto_start(self.data)
+        except prserv.serv.PRServiceConfigError as e:
+            bb.fatal("Unable to start PR Server, exitting")
+
     def enableDataTracking(self):
         self.configuration.tracking = True
         if hasattr(self, "data"):
@@ -1468,6 +1475,7 @@ class BBCooker:
         if not self.baseconfig_valid:
             logger.debug(1, "Reloading base configuration data")
             self.initConfigurationData()
+            self.handlePRServ()
 
     # This is called for all async commands when self.state != running
     def updateCache(self):
@@ -1571,14 +1579,9 @@ class BBCooker:
         return pkgs_to_build
 
     def pre_serve(self):
-        # Empty the environment. The environment will be populated as
-        # necessary from the data store.
-        #bb.utils.empty_environment()
-        try:
-            self.prhost = prserv.serv.auto_start(self.data)
-        except prserv.serv.PRServiceConfigError:
-            bb.event.fire(CookerExit(), self.data)
-            self.state = state.error
+        # We now are in our own process so we can call this here.
+        # PRServ exits if its parent process exits
+        self.handlePRServ()
         return
 
     def post_serve(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]