[gnome-continuous-yocto/gnomeostree-3.28-rocko: 6816/8267] bitbake: bb/main.py: avoid starting server when not needed



commit c276e38bf8f20d9f6ef0645d3c3050b383ac794a
Author: Robert Yang <liezhi yang windriver com>
Date:   Mon Jul 17 01:27:14 2017 -0700

    bitbake: bb/main.py: avoid starting server when not needed
    
    Fixed 1:
    $ . ../poky/oe-init-build-env-memres .
    $ bitbake -m
    $ bitbake -m # shutdown it again
    $ bitbake -m
    Starting bitbake server...
    Terminated bitbake server.
    
    It starts the server and kill it which is redundant.
    
    $ bitbake -m
    $ bitbake --status-only
    Starting bitbake server...
    
    It starts the server which is not what we need.
    
    (Bitbake rev: 335fd0106359dddfe1eeb0c7d0bc03f8454b895c)
    
    Signed-off-by: Robert Yang <liezhi yang windriver com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 bitbake/lib/bb/main.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py
index 84fe904..b09513f 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -368,8 +368,10 @@ def bitbake_main(configParams, configuration):
                           configuration.debug_domains)
 
     server_connection, ui_module = setup_bitbake(configParams, configuration)
-    if server_connection is None and configParams.kill_server:
-        return 0
+    # No server connection
+    if server_connection is None:
+        if configParams.status_only or configParams.kill_server:
+            return 1
 
     if not configParams.server_only:
         if configParams.status_only:
@@ -426,6 +428,10 @@ def setup_bitbake(configParams, configuration, extrafeatures=None, setup_logging
                 topdir, lock = lockBitbake()
                 sockname = topdir + "/bitbake.sock"
                 if lock:
+                    if configParams.status_only or configParams.kill_server:
+                        logger.info("bitbake server is not running.")
+                        lock.close()
+                        return None, None
                     # we start a server with a given configuration
                     logger.info("Starting bitbake server...")
                     server = bb.server.process.BitBakeServer(lock, sockname, configuration, featureset)


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