summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2017-08-20 18:01:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-23 12:07:42 +0100
commit9bfe460934dd9bafcfab7bdf8cbbf7ad968e9026 (patch)
tree0dfeb6ce3e580a54c190d2f8ef1236aae321efb2 /bitbake
parent52a67cc958185266f1b982555cf019a8b4f10817 (diff)
downloadpoky-9bfe460934dd9bafcfab7bdf8cbbf7ad968e9026.tar.gz
bitbake: Toaster: custom start and stop actions
Toaster needs the ability to allow custom extensions to execute when Toaster is started and stopped. Toaster will look for a custom extension script in the fixtures directory and execute any applicable hooks. [YOCTO #11938] (Bitbake rev: 12a73f6914488029f2b9dd680e004fba7dde41af) Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/toaster22
-rwxr-xr-xbitbake/lib/toaster/orm/fixtures/custom_toaster_append.sh_sample49
2 files changed, 69 insertions, 2 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index c2e33fe376..762451df23 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -24,6 +24,14 @@ Usage: source toaster start|stop [webport=<address:port>] [noweb]
24 [webport] Set the development server (default: localhost:8000) 24 [webport] Set the development server (default: localhost:8000)
25" 25"
26 26
27custom_extention()
28{
29 custom_extension=$BBBASEDIR/lib/toaster/orm/fixtures/custom_toaster_append.sh
30 if [ -f $custom_extension ] ; then
31 $custom_extension $*
32 fi
33}
34
27databaseCheck() 35databaseCheck()
28{ 36{
29 retval=0 37 retval=0
@@ -50,6 +58,11 @@ databaseCheck()
50webserverKillAll() 58webserverKillAll()
51{ 59{
52 local pidfile 60 local pidfile
61 if [ -f ${BUILDDIR}/.toastermain.pid ] ; then
62 custom_extention web_stop_postpend
63 else
64 custom_extention noweb_stop_postpend
65 fi
53 for pidfile in ${BUILDDIR}/.toastermain.pid ${BUILDDIR}/.runbuilds.pid; do 66 for pidfile in ${BUILDDIR}/.toastermain.pid ${BUILDDIR}/.runbuilds.pid; do
54 if [ -f ${pidfile} ]; then 67 if [ -f ${pidfile} ]; then
55 pid=`cat ${pidfile}` 68 pid=`cat ${pidfile}`
@@ -89,6 +102,7 @@ webserverStartAll()
89 else 102 else
90 echo "Toaster development webserver started at http://$ADDR_PORT" 103 echo "Toaster development webserver started at http://$ADDR_PORT"
91 echo -e "\nYou can now run 'bitbake <target>' on the command line and monitor your build in Toaster.\nYou can also use a Toaster project to configure and run a build.\n" 104 echo -e "\nYou can now run 'bitbake <target>' on the command line and monitor your build in Toaster.\nYou can also use a Toaster project to configure and run a build.\n"
105 custom_extention web_start_postpend $ADDR_PORT
92 fi 106 fi
93 107
94 return $retval 108 return $retval
@@ -168,7 +182,6 @@ fi
168unset OE_ROOT 182unset OE_ROOT
169 183
170 184
171
172WEBSERVER=1 185WEBSERVER=1
173ADDR_PORT="localhost:8000" 186ADDR_PORT="localhost:8000"
174unset CMD 187unset CMD
@@ -241,6 +254,7 @@ fi
241echo "The system will $CMD." 254echo "The system will $CMD."
242 255
243# Execute the commands 256# Execute the commands
257custom_extention toaster_prepend $CMD $ADDR_PORT
244 258
245case $CMD in 259case $CMD in
246 start ) 260 start )
@@ -262,9 +276,10 @@ case $CMD in
262 if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then 276 if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then
263 if ! databaseCheck; then 277 if ! databaseCheck; then
264 echo "Failed ${CMD}." 278 echo "Failed ${CMD}."
265 return 4 279 return 4
266 fi 280 fi
267 fi 281 fi
282 custom_extention noweb_start_postpend $ADDR_PORT
268 fi 283 fi
269 if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then 284 if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
270 echo "Failed ${CMD}." 285 echo "Failed ${CMD}."
@@ -278,6 +293,7 @@ case $CMD in
278 # set fail safe stop system on terminal exit 293 # set fail safe stop system on terminal exit
279 trap stop_system SIGHUP 294 trap stop_system SIGHUP
280 echo "Successful ${CMD}." 295 echo "Successful ${CMD}."
296 custom_extention toaster_postpend $CMD $ADDR_PORT
281 return 0 297 return 0
282 ;; 298 ;;
283 stop ) 299 stop )
@@ -285,3 +301,5 @@ case $CMD in
285 echo "Successful ${CMD}." 301 echo "Successful ${CMD}."
286 ;; 302 ;;
287esac 303esac
304custom_extention toaster_postpend $CMD $ADDR_PORT
305
diff --git a/bitbake/lib/toaster/orm/fixtures/custom_toaster_append.sh_sample b/bitbake/lib/toaster/orm/fixtures/custom_toaster_append.sh_sample
new file mode 100755
index 0000000000..8c4e163161
--- /dev/null
+++ b/bitbake/lib/toaster/orm/fixtures/custom_toaster_append.sh_sample
@@ -0,0 +1,49 @@
1#!/bin/bash
2
3# Copyright (C) 2017 Intel Corp.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License version 2 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12# See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18# This is sample software. Rename it to 'custom_toaster_append.sh' and
19# enable the respective custom sections.
20
21verbose=0
22if [ $verbose -ne 0 ] ; then
23 echo "custom_toaster_append.sh:$*"
24fi
25
26if [ "toaster_prepend" = "$1" ] ; then
27 echo "Add custom actions here when Toaster script is started"
28fi
29
30if [ "web_start_postpend" = "$1" ] ; then
31 echo "Add custom actions here after Toaster web service is started"
32fi
33
34if [ "web_stop_postpend" = "$1" ] ; then
35 echo "Add custom actions here after Toaster web service is stopped"
36fi
37
38if [ "noweb_start_postpend" = "$1" ] ; then
39 echo "Add custom actions here after Toaster (no web) service is started"
40fi
41
42if [ "noweb_stop_postpend" = "$1" ] ; then
43 echo "Add custom actions here after Toaster (no web) service is stopped"
44fi
45
46if [ "toaster_postpend" = "$1" ] ; then
47 echo "Add custom actions here after Toaster script is done"
48fi
49