]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-init-build-env: Allow startup with and without memres
authorJason Wessel <jason.wessel@windriver.com>
Mon, 25 Nov 2013 21:21:28 +0000 (15:21 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 2 Dec 2013 11:27:36 +0000 (11:27 +0000)
Use the bitbake --status-only and the fact that bitbake.lock will
contain the host name and port to determine when to activate or
shutdown the stay resident bitbake server.

This allows a end developer to cleanly switch between the two ways to
use bitbake as well as enter the memres bitbake server from multiple
shells without starting the server if it is already running.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
oe-init-build-env
oe-init-build-env-memres

index de9692fe44d8eb23bf0a8aa1353efead8e286df6..8ef32f3d551dd11427cba5fac059bb7cd29c7321 100755 (executable)
@@ -47,3 +47,12 @@ else
    unset BBPATH
 fi
 
+# Shutdown any bitbake server if the BBSERVER variable is not set
+if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then
+    grep ":" bitbake.lock > /dev/null && BBSERVER=`cat bitbake.lock` bitbake --status-only
+    if [ $? = 0 ] ; then
+       echo "Shutting down bitbake memory resident server with bitbake -m"
+       BBSERVER=`cat bitbake.lock` bitbake -m
+    fi
+fi
+
index 79b91b751a9053469f722f1152b59ace86a78e7c..687d5e1225e29a0d164607d91c6eef038fd9ee06 100755 (executable)
@@ -54,6 +54,21 @@ else
    unset OEROOT
    unset BBPATH
 fi
-bitbake --server-only -t xmlrpc -B localhost:$port
-export BBSERVER=localhost:$port
-echo "Bitbake server started on port $port, use bitbake -m to shut it down"
+res=1
+if [ -e bitbake.lock ] && grep : bitbake.lock > /dev/null ; then
+    BBSERVER=`cat bitbake.lock` bitbake --status-only
+    res=$?
+fi
+
+if [ $res != 0 ] ; then
+    bitbake --server-only -t xmlrpc -B localhost:$port
+fi
+
+export BBSERVER=`cat bitbake.lock`
+
+if [ $res = 0 ] ; then
+    echo "Using existing bitbake server at: $BBSERVER, use bitbake -m to shut it down"
+else
+    echo "Bitbake server started at: $BBSERVER, use bitbake -m to shut it down"
+fi
+unset res