oe-init-build-env-memres: Add auto port functionality

In order to run multiple bitbake memory resident servers on the same
machine they must each use different ports.

This patch works in conjuction with bitbake to make the auto port
selection and lazy server startup the default.

(From OE-Core rev: 9cf1ac73c4e35101a4f5c01a5e1c53f9d567bc58)

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Jason Wessel 2013-11-25 15:21:29 -06:00 committed by Richard Purdie
parent 644a1a27ec
commit 72e650d97c
1 changed files with 17 additions and 12 deletions

View File

@ -26,8 +26,8 @@
# to sourcing this script. # to sourcing this script.
# #
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "No port specified, using 12345" echo "No port specified, using dynamically selected port"
port=12345 port=-1
else else
port=$1 port=$1
shift shift
@ -60,15 +60,20 @@ if [ -e bitbake.lock ] && grep : bitbake.lock > /dev/null ; then
res=$? res=$?
fi fi
if [ $res != 0 ] ; then if [ $port = -1 ] ; then
bitbake --server-only -t xmlrpc -B localhost:$port export BBSERVER=localhost:-1
fi echo "Bitbake server started on demand as needed, use bitbake -m to shut it down"
export BBSERVER=`cat bitbake.lock`
if [ $res = 0 ] ; then
echo "Using existing bitbake server at: $BBSERVER, use bitbake -m to shut it down"
else else
echo "Bitbake server started at: $BBSERVER, use bitbake -m to shut it down" 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
fi fi
unset res