summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorbrian avery <avery.brian@gmail.com>2016-03-01 11:40:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-02 22:41:23 +0000
commit937ecd07d393ff3e543fb366b67876b498c9ac29 (patch)
treeb099ae7e0fab629dea682786d4945ccac1ff5cb5 /bitbake/bin
parenta7d1b95c96950326f0c0b09ec901abd57a27b38e (diff)
downloadpoky-937ecd07d393ff3e543fb366b67876b498c9ac29.tar.gz
bitbake: toaster: cleanup of bin/toaster startup code
This cleanup fixes a few issues: 1) Removes the superflous code to set toasterconf.json - this isn't used and referenced meta-yocto 2) Changes exit to return so we don't surprise the user by exiting their shell - this is necessary because it is being sourced 3) Removes the last references to the old TOASTER_MANAGED variable - this is historical and no longer used. 4) Adds -t parameter to lsof - This stops it from dying on odd filesystems and is much faster since all we are using are processes anyway 5) Handles start and stop as params - it was easy to confuse the script especially if we were calling it with parameters. - if start/stop isn't specified, it will still toggle (Bitbake rev: 88fddbe80f56828026bf93560037af52b5dab628) Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/toaster41
1 files changed, 17 insertions, 24 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 72eae64166..d409554d13 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -128,7 +128,7 @@ stop_bitbake() {
128 BBSERVER=0.0.0.0:-1 bitbake -m 128 BBSERVER=0.0.0.0:-1 bitbake -m
129 unset BBSERVER 129 unset BBSERVER
130 # force stop any misbehaving bitbake server 130 # force stop any misbehaving bitbake server
131 lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill 131 lsof -t bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill
132} 132}
133 133
134verify_prereq() { 134verify_prereq() {
@@ -177,7 +177,7 @@ if [ -n "$TEMPLATECONF" ]; then
177 fi 177 fi
178 if [ ! -d "$TEMPLATECONF" ]; then 178 if [ ! -d "$TEMPLATECONF" ]; then
179 echo >&2 "Error: '$TEMPLATECONF' must be a directory containing toasterconf.json" 179 echo >&2 "Error: '$TEMPLATECONF' must be a directory containing toasterconf.json"
180 [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1 180 return 1
181 fi 181 fi
182 fi 182 fi
183fi 183fi
@@ -189,7 +189,7 @@ fi
189 189
190if [ ! -f $TOASTER_CONF ]; then 190if [ ! -f $TOASTER_CONF ]; then
191 echo "$TOASTER_CONF configuration file not found. Set TOASTER_CONF to specify file or fix .templateconf" 191 echo "$TOASTER_CONF configuration file not found. Set TOASTER_CONF to specify file or fix .templateconf"
192 [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1 192 return 1
193fi 193fi
194 194
195# this defines the dir toaster will use for 195# this defines the dir toaster will use for
@@ -204,7 +204,7 @@ export TOASTER_DIR=`pwd`
204NOTOASTERUI=0 204NOTOASTERUI=0
205WEBSERVER=1 205WEBSERVER=1
206WEB_PORT="8000" 206WEB_PORT="8000"
207 207unset CMD
208for param in $*; do 208for param in $*; do
209 case $param in 209 case $param in
210 noui ) 210 noui )
@@ -213,6 +213,12 @@ for param in $*; do
213 noweb ) 213 noweb )
214 WEBSERVER=0 214 WEBSERVER=0
215 ;; 215 ;;
216 start )
217 CMD=$param
218 ;;
219 stop )
220 CMD=$param
221 ;;
216 webport=*) 222 webport=*)
217 WEB_PORT="${param#*=}" 223 WEB_PORT="${param#*=}"
218 esac 224 esac
@@ -220,7 +226,7 @@ done
220 226
221if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then 227if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then
222 echo "Error: This script needs to be sourced. Please run as . $TOASTER" 228 echo "Error: This script needs to be sourced. Please run as . $TOASTER"
223 exit 1 229 return 1
224fi 230fi
225 231
226if [ "$1" = 'restart-bitbake' ] ; then 232if [ "$1" = 'restart-bitbake' ] ; then
@@ -240,22 +246,6 @@ if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then
240 return 2 246 return 2
241fi 247fi
242 248
243# this is the configuraton file we are using for toaster
244# note default is assuming yocto. Override this if you are
245# running in a pure OE environment and use the toasterconf.json
246# in meta/conf/toasterconf.json
247# note: for future there are a number of relative path assumptions
248# in the local layers that currently prevent using an arbitrary
249# toasterconf.json
250if [ "$TOASTER_CONF" = "" ]; then
251 TOASTER_CONF="$(dirname $TOASTER)/../../meta-yocto/conf/toasterconf.json"
252 export TOASTER_CONF=$(python -c "import os; print os.path.realpath('$TOASTER_CONF')")
253fi
254if [ ! -f $TOASTER_CONF ]; then
255 echo "$TOASTER_CONF configuration file not found."
256 echo " set TOASTER_CONF to specify a path"
257 return 1
258fi
259# this defines the dir toaster will use for 249# this defines the dir toaster will use for
260# 1) clones of layers (in _toaster_clones ) 250# 1) clones of layers (in _toaster_clones )
261# 2) the build dir (in build) 251# 2) the build dir (in build)
@@ -267,9 +257,12 @@ fi
267export TOASTER_DIR=`dirname $BUILDDIR` 257export TOASTER_DIR=`dirname $BUILDDIR`
268 258
269# Determine the action. If specified by arguments, fine, if not, toggle it 259# Determine the action. If specified by arguments, fine, if not, toggle it
270if [ "$1" = 'start' ] || [ "$1" = 'stop' ]; then 260if [ "$CMD" = "start" ] ; then
271 CMD="$1" 261 if [ -n "$BBSERVER" ]; then
272else 262 echo " Toaster is already running. Exiting..."
263 return 1
264fi
265elif [ "$CMD" = "" ]; then
273 if [ -z "$BBSERVER" ]; then 266 if [ -z "$BBSERVER" ]; then
274 CMD="start" 267 CMD="start"
275 else 268 else