[Toaster] [PATCH 01/20] toaster: don't allow to run toaster as a script
Ed Bartosh
ed.bartosh at linux.intel.com
Sun Oct 11 14:15:38 PDT 2015
Removed support of starting toaster as a script.
Sourcing a toaster script becomes the only way to start it.
It's consistent with the way oe build system is started by sourcing
oe-init-build-env. It also returns user back to shell, so user can
continue running builds without having to open new terminal window.
[YOCTO #8279]
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
bin/toaster | 68 ++-----------------------------------------------------------
1 file changed, 2 insertions(+), 66 deletions(-)
diff --git a/bin/toaster b/bin/toaster
index bc439e6..abe539d 100755
--- a/bin/toaster
+++ b/bin/toaster
@@ -214,72 +214,8 @@ done
[ -n "${BASH_SOURCE}" ] && SRCFILE=${BASH_SOURCE} || SRCFILE=$_
if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then
- # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that.
- # Start just the web server, point the web browser to the interface, and start any Django services.
-
- if ! verify_prereq; then
- echo "Error: Could not verify that the needed dependencies are installed. Please use virtualenv and pip to install dependencies listed in toaster-requirements.txt" 1>&2
- exit 1
- fi
-
- if [ -n "$BUILDDIR" ]; then
- printf "Error: It looks like you sourced oe-init-build-env. Toaster cannot start in build mode from an oe-core build environment.\n You should be starting Toaster from a new terminal window.\n" 1>&2
- exit 1
- fi
-
- # Define a fake builddir where only the pid files are actually created. No real builds will take place here.
- BUILDDIR=/tmp/toaster_$$
- if [ -d "$BUILDDIR" ]; then
- echo "Previous toaster run directory $BUILDDIR found, cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1
- exit 1
- fi
-
- mkdir -p "$BUILDDIR"
-
- RUNNING=1
- trap_ctrlc() {
- echo "** Stopping system"
- webserverKillAll
- RUNNING=0
- }
-
- do_cleanup() {
- find "$BUILDDIR" -type f | xargs rm
- rmdir "$BUILDDIR"
- }
- cleanup() {
- if grep -ir error "$BUILDDIR" >/dev/null; then
- if grep -irn "That port is already in use" "$BUILDDIR"; then
- echo "You can use the \"webport=PORTNUMBER\" parameter to start Toaster on a different port (port $WEB_PORT is already in use)"
- do_cleanup
- else
- printf "\nErrors found in the Toaster log files present in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify toaster at yoctoproject.org or submit a bug https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
- fi
- else
- echo "No errors found, removing the run directory '$BUILDDIR'"
- do_cleanup
- fi
- }
- TOASTER_MANAGED=1
- export TOASTER_MANAGED=1
- if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
- echo "Failed to start the web server, stopping" 1>&2
- cleanup
- exit 1
- fi
- if [ $WEBSERVER -gt 0 ] && [ $NOBROWSER -eq 0 ] ; then
- echo "Starting browser..."
- xdg-open http://127.0.0.1:$WEB_PORT/ >/dev/null 2>&1 &
- fi
- trap trap_ctrlc 2
- echo "Toaster is now running. You can stop it with Ctrl-C"
- while [ $RUNNING -gt 0 ]; do
- python $BBBASEDIR/lib/toaster/manage.py runbuilds 2>&1 | tee -a "$BUILDDIR/toaster.log"
- sleep 1
- done
- cleanup
- echo "**** Exit"
- exit 0
+ echo "Error: This script needs to be sourced. Please run as '. $SRCFILE'"
+ exit 1
fi
--
2.1.4
More information about the toaster
mailing list