From 0c89846dafa229b5af9653d6e141011c35451825 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Thu, 5 Feb 2015 12:07:44 +0000 Subject: bitbake: toaster: enhancements for the startup sequence This patch brings fixes and enhancements in the startup sequence. - the dependency version checking is now correctly enforced when starting in both modes - fixed errors in looking up environment variables - added message with 'daemon' program start location - presenting menu for selecting config file [YOCTO #7283] [YOCTO #7291] [YOCTO #7273] (Bitbake rev: c5ddd9d88910857a1b745b1c237df0390dd56835) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/bin/toaster | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'bitbake/bin') diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index 6f7c6f09ea..c3b8633c25 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster @@ -126,17 +126,20 @@ function notify_chldexit() { } -# Verify prerequisites +function verify_prereq() { + # Verify prerequisites -if ! echo "import django; print (1,) == django.VERSION[0:1] and django.VERSION[1:2][0] in (5,6)" | python 2>/dev/null | grep True >/dev/null; then - echo -e "This program needs Django 1.5 or 1.6. Please install with\n\npip install django==1.6" - return 2 -fi + if ! echo "import django; print (1,) == django.VERSION[0:1] and django.VERSION[1:2][0] in (5,6)" | python 2>/dev/null | grep True >/dev/null; then + echo -e "This program needs Django 1.5 or 1.6. Please install with\n\npip install django==1.6\n" + return 2 + fi -if ! echo "import south; print [0,8,4] == map(int,south.__version__.split(\".\"))" | python 2>/dev/null | grep True >/dev/null; then - echo -e "This program needs South 0.8.4. Please install with\n\npip install south==0.8.4" - return 2 -fi + if ! echo "import south; print reduce(lambda x, y: 2 if x==2 else 0 if x == 0 else y, map(lambda x: 1+cmp(x[1]-x[0],0), zip([0,8,4], map(int,south.__version__.split(\".\"))))) > 0" | python 2>/dev/null | grep True >/dev/null; then + echo -e "This program needs South 0.8.4. Please install with\n\npip install south==0.8.4\n" + return 2 + fi + return 0 +} # read command line parameters @@ -170,13 +173,18 @@ if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; th # 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 -e "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 - echo -e "Error: It looks like you sourced oe-init-build-env. Toaster cannot start in build mode from an oe-core build environment. You can work around this problem by starting Toaster from a new terminal window." 1>&2; + echo -e "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." 1>&2; exit 1; fi if [ "x`which daemon`" == "x" ]; then - echo -e "Failed dependency; toaster needs the 'daemon' program in order to be able to start builds'. Please install the 'daemon' program." 1>&2; + echo -e "Failed dependency; toaster needs the 'daemon' program in order to be able to start builds'. Please install the 'daemon' program from your distribution repositories or http://www.libslack.org/daemon/" 1>&2; exit 1; fi @@ -208,6 +216,13 @@ if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; th exit 0 fi + +if ! verify_prereq; then + echo -e "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" ] || [ -z `which bitbake` ]; then echo "Error: Build environment is not setup or bitbake is not in path." 1>&2; -- cgit v1.2.3-54-g00ecf