All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: toaster@yoctoproject.org
Subject: [PATCH 01/26] toaster: don't allow to run toaster as a script
Date: Thu, 12 Nov 2015 13:55:15 +0200	[thread overview]
Message-ID: <fb3363eb8a0c7893ec3ab9270b26f3ab6a323322.1447328915.git.ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <cover.1447328915.git.ed.bartosh@linux.intel.com>
In-Reply-To: <cover.1447328915.git.ed.bartosh@linux.intel.com>

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@linux.intel.com>
---
 bitbake/bin/toaster | 82 ++++-------------------------------------------------
 1 file changed, 6 insertions(+), 76 deletions(-)

diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 2c3432c..d59a8c8 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/echo ERROR: This script needs to be sourced. Please run as .
 # (c) 2013 Intel Corp.
 
 # This program is free software; you can redistribute it and/or modify
@@ -81,9 +81,7 @@ webserverStartAll()
         return $retval
     fi
 
-    if [ "$TOASTER_MANAGED" = '1' ]; then
-        python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1
-    fi
+    python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1
 
     if [ $retval -eq 1 ]; then
         printf "\nError while checking settings; aborting\n"
@@ -176,8 +174,6 @@ else
     TOASTER=$0
 fi
 
-[ `basename \"$0\"` = `basename \"${TOASTER}\"` ] && TOASTER_MANAGED=1
-
 BBBASEDIR=`dirname $TOASTER`/..
 
 RUNNING=0
@@ -201,7 +197,7 @@ if [ "$TOASTER_CONF" = "" ]; then
 fi
 if [ ! -f $TOASTER_CONF ]; then
     echo "$TOASTER_CONF configuration file not found. set TOASTER_CONF to specify a path"
-    [ "$TOASTER_MANAGED" = '1' ] && exit 1 || return 1
+    return 1
 fi
 # this defines the dir toaster will use for
 # 1) clones of layers (in _toaster_clones )
@@ -234,88 +230,22 @@ for param in $*; do
     esac
 done
 
-if [ "$TOASTER_MANAGED" = '1' ]; 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@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
-    }
-    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
+if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then
+    echo "Error: This script needs to be sourced. Please run as . $TOASTER"
+    exit 1
 fi
 
-
 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
     return 1
 fi
 
-
 # We make sure we're running in the current shell and in a good environment
 if [ -z "$BUILDDIR" ] ||  ! which bitbake >/dev/null 2>&1 ; then
     echo "Error: Build environment is not setup or bitbake is not in path." 1>&2
     return 2
 fi
 
-
 # Determine the action. If specified by arguments, fine, if not, toggle it
 if [ "$1" = 'start' ] || [ "$1" = 'stop' ]; then
     CMD="$1"
-- 
2.1.4



  reply	other threads:[~2015-11-12 12:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 11:55 [PATCH v4 00/26] toaster: 8279: Provide a single way of starting Toaster Ed Bartosh
2015-11-12 11:55 ` Ed Bartosh [this message]
2015-11-12 11:55 ` [PATCH 02/26] toaster: implement get-dburl command Ed Bartosh
2015-11-12 11:55 ` [PATCH 03/26] toaster: set DATABASE_URL in toaster script Ed Bartosh
2015-11-12 11:55 ` [PATCH 04/26] toaster: run bitbake the same way Ed Bartosh
2015-11-12 11:55 ` [PATCH 05/26] toaster: remove unused variable Ed Bartosh
2015-11-12 11:55 ` [PATCH 06/26] toaster: check for toaster configuration later Ed Bartosh
2015-11-12 11:55 ` [PATCH 07/26] toaster: use parent of the build dir Ed Bartosh
2015-11-12 11:55 ` [PATCH 08/26] toaster: make runbuilds to loop Ed Bartosh
2015-11-12 12:04 ` [PATCH 09/26] toaster: start 'manage.py runbuilds' in the script Ed Bartosh
2015-11-12 12:04 ` [PATCH 10/26] toaster: update brbe and project attributes Ed Bartosh
2015-11-12 12:04 ` [PATCH 11/26] toaster: implement stop_bitbake function Ed Bartosh
2015-11-12 12:04 ` [PATCH 12/26] toaster: implement start_bitbake function Ed Bartosh
2015-11-12 12:04 ` [PATCH 13/26] toaster: implement 'toaster restart-bitbake' Ed Bartosh
2015-11-12 12:04 ` [PATCH 14/26] toaster: remove _setupBE function Ed Bartosh
2015-11-12 12:04 ` [PATCH 15/26] toaster: reimplemented startBBServer method Ed Bartosh
2015-11-12 12:04 ` [PATCH 16/26] toaster: remove stopBBServer API Ed Bartosh
2015-11-12 12:04 ` [PATCH 17/26] toaster: do not terminate bb server Ed Bartosh
2015-11-12 12:04 ` [PATCH 18/26] toaster: remove usage of BUILD_MODE variable Ed Bartosh
2015-11-12 12:04 ` [PATCH 19/26] toaster: do not create duplicate HelpText objects Ed Bartosh
2015-11-12 12:04 ` [PATCH 20/26] toaster: buildinfohelper Broaden the toaster created recipe data case Ed Bartosh
2015-11-12 12:04 ` [PATCH 21/26] toaster: implement BitbakeController.getVariable Ed Bartosh
2015-11-12 12:04 ` [PATCH 22/26] toaster: set varibales on bitbake server Ed Bartosh
2015-11-12 12:04 ` [PATCH 23/26] toaster: remove writeConfFile API Ed Bartosh
2015-11-12 12:04 ` [PATCH 24/26] toaster: stop using toaster-pre.conf Ed Bartosh
2015-11-12 12:04 ` [PATCH 25/26] toaster: remove SDKMACHINE from project variables Ed Bartosh
2015-11-12 12:04 ` [PATCH 26/26] toaster: get rid of complicated heuristics Ed Bartosh
2015-11-16 18:40 ` [PATCH v4 00/26] toaster: 8279: Provide a single way of starting Toaster Brian Avery

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb3363eb8a0c7893ec3ab9270b26f3ab6a323322.1447328915.git.ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=toaster@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.