Skip to contentSkip to conversation

bitbake: toaster: Code cleanup: bashisms

PATCH In review Ed Bartosh 2 participants 7 messages May 4, 2015 – Jun 9, 2015 2 messages not in the archive

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 bitbake: toaster: Code cleanup: bashisms

Fixed the following bashisms:
replaced echo -e -> printf
removed 'function' from function definitions
replaced $(< ${file}) -> cat ${file}

---
 bitbake/bin/toaster | 49 +++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)
bitbake/bin/toaster +25 -24
index 162d4d9..dfbc58d 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # (c) 2013 Intel Corp.
 
 # This program is free software; you can redistribute it and/or modify
@@ -28,13 +28,14 @@
 
 # Helper function to kill a background toaster development server
 
-function webserverKillAll()
+webserverKillAll()
 {
     local pidfile
     for pidfile in ${BUILDDIR}/.toastermain.pid; do
         if [ -f ${pidfile} ]; then
-            while kill -0 $(< ${pidfile}) 2>/dev/null; do
-                kill -SIGTERM -$(< ${pidfile}) 2>/dev/null
+            pid=`cat ${pidfile}`
+            while kill -0 $pid 2>/dev/null; do
+                kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
                 # Kill processes if they are still running - may happen in interactive shells
                 ps fux | grep "python.*manage.py runserver" | awk '{print $2}' | xargs kill
@@ -44,7 +45,7 @@ function webserverKillAll()
     done
 }
 
-function webserverStartAll()
+webserverStartAll()
 {
     # do not start if toastermain points to a valid process
     if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs -I{} kill -0 {} ; then
@@ -58,7 +59,7 @@ function webserverStartAll()
     if [ $retval -eq 1 ]; then
         echo "Failed db sync, stopping system start" 1>&2
     elif [ $retval -eq 2 ]; then
-        echo -e "\nError on migration, trying to recover... \n"
+        printf "\nError on migration, trying to recover... \n"
         python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial --fake
         retval=0
         python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
@@ -83,7 +84,7 @@ function webserverStartAll()
 
 # Helper functions to add a special configuration file
 
-function addtoConfiguration()
+addtoConfiguration()
 {
     file=$1
     shift
@@ -94,13 +95,13 @@ function addtoConfiguration()
 INSTOPSYSTEM=0
 
 # define the stop command
-function stop_system()
+stop_system()
 {
     # prevent reentry
     if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
     INSTOPSYSTEM=1
     if [ -f ${BUILDDIR}/.toasterui.pid ]; then
-        kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
+        kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null
         rm ${BUILDDIR}/.toasterui.pid
     fi
     BBSERVER=0.0.0.0:-1 bitbake -m
@@ -113,12 +114,12 @@ function stop_system()
     INSTOPSYSTEM=0
 }
 
-function check_pidbyfile() {
-    [ -e $1 ] && kill -0 $(< $1) 2>/dev/null
+check_pidbyfile() {
+    [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
 }
 
 
-function notify_chldexit() {
+notify_chldexit() {
     if [ $NOTOASTERUI -eq 0 ]; then
         check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
         stop_system
@@ -126,16 +127,16 @@ function notify_chldexit() {
 }
 
 
-function verify_prereq() {
+verify_prereq() {
     # Verify prerequisites
 
     if ! echo "import django; print (1,) == django.VERSION[0:1] and django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True >/dev/null; then
-        echo -e "This program needs Django 1.6. Please install with\n\npip install django==1.6\n"
+        printf "This program needs Django 1.6. Please install with\n\npip install django==1.6\n"
         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"
+        printf "This program needs South 0.8.4. Please install with\n\npip install south==0.8.4\n"
         return 2
     fi
     return 0
@@ -174,47 +175,47 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then
     # 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
+        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
-        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
+        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." 1>&2
         exit 1
     fi
 
     if ! which daemon >/dev/null 2>&1; then
-        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
+        echo "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
 
     # 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 -e "Previous toaster run directory $BUILDDIR found, cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1
+        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
-    function trap_ctrlc() {
+    trap_ctrlc() {
         echo "** Stopping system"
         webserverKillAll
         RUNNING=0
     }
 
-    function do_cleanup() {
+    do_cleanup() {
         find "$BUILDDIR" -type f | xargs rm
         rmdir "$BUILDDIR"
     }
-    function cleanup() {
+    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
-                echo -e "\nErrors found in the Toaster log files present in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
+                printf "\nErrors found in the Toaster log files present in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
             fi
         else
             echo "No errors found, removing the run directory '$BUILDDIR'"
@@ -245,7 +246,7 @@ 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
+    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
 
Signature · 1 line
2.1.4
#1 lore raw

Taken for submission,

Thank you,
Alex

Quoted 234 lines · Ed Bartosh

Fixed the following bashisms:
replaced echo -e -> printf
removed 'function' from function definitions
replaced $(< ${file}) -> cat ${file}

---
 bitbake/bin/toaster | 49 +++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)
bitbake/bin/toaster +5 -4
index 162d4d9..dfbc58d 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # (c) 2013 Intel Corp.
 
 # This program is free software; you can redistribute it and/or modify
@@ -28,13 +28,14 @@
 
 # Helper function to kill a background toaster development server
 
-function webserverKillAll()
+webserverKillAll()
 {
     local pidfile
     for pidfile in ${BUILDDIR}/.toastermain.pid; do
         if [ -f ${pidfile} ]; then
-            while kill -0 $(< ${pidfile}) 2>/dev/null; do
-                kill -SIGTERM -$(< ${pidfile}) 2>/dev/null
+            pid=`cat ${pidfile}`
+            while kill -0 $pid 2>/dev/null; do
+                kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
                 # Kill processes if they are still running - may happen

in interactive shells
ps fux | grep "python.*manage.py runserver" | awk '{print
$2}' | xargs kill

bitbake/bin/toaster +9 -11
@@ -44,7 +45,7 @@ function webserverKillAll()
     done
 }
 
-function webserverStartAll()
+webserverStartAll()
 {
     # do not start if toastermain points to a valid process
     if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs -I{} kill
-0 {} ; then
@@ -58,7 +59,7 @@ function webserverStartAll()
     if [ $retval -eq 1 ]; then
         echo "Failed db sync, stopping system start" 1>&2
     elif [ $retval -eq 2 ]; then
-        echo -e "\nError on migration, trying to recover... \n"
+        printf "\nError on migration, trying to recover... \n"
         python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial
--fake
         retval=0
         python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
@@ -83,7 +84,7 @@ function webserverStartAll()
 
 # Helper functions to add a special configuration file
 
-function addtoConfiguration()
+addtoConfiguration()
 {
     file=$1
     shift
@@ -94,13 +95,13 @@ function addtoConfiguration()
 INSTOPSYSTEM=0
 
 # define the stop command
-function stop_system()
+stop_system()
 {
     # prevent reentry
     if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
     INSTOPSYSTEM=1
     if [ -f ${BUILDDIR}/.toasterui.pid ]; then
-        kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
+        kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null
         rm ${BUILDDIR}/.toasterui.pid
     fi
     BBSERVER=0.0.0.0:-1 bitbake -m
@@ -113,12 +114,12 @@ function stop_system()
     INSTOPSYSTEM=0
 }
 
-function check_pidbyfile() {
-    [ -e $1 ] && kill -0 $(< $1) 2>/dev/null
+check_pidbyfile() {
+    [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
 }
 
 
-function notify_chldexit() {
+notify_chldexit() {
     if [ $NOTOASTERUI -eq 0 ]; then
         check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
         stop_system
@@ -126,16 +127,16 @@ function notify_chldexit() {
 }
 
 
-function verify_prereq() {
+verify_prereq() {
     # Verify prerequisites
 
     if ! echo "import django; print (1,) == django.VERSION[0:1] and

django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True

Quoted 1 line

/dev/null; then

- echo -e "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"
+ printf "This program needs Django 1.6. Please install with\n\npip
install django==1.6\n"

         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"
+ printf "This program needs South 0.8.4. Please install
with\n\npip install south==0.8.4\n"
return 2
fi
return 0

bitbake/bin/toaster +0 -0
@@ -174,47 +175,47 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"`

]; then
# 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
+ 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

- 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
+ 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." 1>&2
exit 1
fi

if ! which daemon >/dev/null 2>&1; then
- 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
+ echo "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

# 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 -e "Previous toaster run directory $BUILDDIR found, cowardly
refusing to start. Please remove the directory when that toaster instance is over" 2>&1
+ 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

bitbake/bin/toaster +3 -3
-    function trap_ctrlc() {
+    trap_ctrlc() {
         echo "** Stopping system"
         webserverKillAll
         RUNNING=0
     }
 
-    function do_cleanup() {
+    do_cleanup() {
         find "$BUILDDIR" -type f | xargs rm
         rmdir "$BUILDDIR"
     }
-    function cleanup() {
+    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
- echo -e "\nErrors found in the Toaster log files present
in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
+ printf "\nErrors found in the Toaster log files present
in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
fi
else
echo "No errors found, removing the run directory '$BUILDDIR'"

bitbake/bin/toaster +0 -1
@@ -245,7 +246,7 @@ 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
+ 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

--
2.1.4

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC
#2 lore raw

Actually, I spoke too soon.

This patch doesn't pass testing - it breaks launching toaster on my system, where /bin/sh is actually dash. Since this is default on Ubuntu systems, we need to support it to run out of the box.

I will not be submitting this patch. Can you please debug it also with dash as /bin/sh ?

Thank you,
Alex

Quoted 253 lines · Alexandru

Taken for submission,

Thank you,
Alex

Quoted 228 lines · Ed Bartosh

Fixed the following bashisms:
replaced echo -e -> printf
removed 'function' from function definitions
replaced $(< ${file}) -> cat ${file}

---
 bitbake/bin/toaster | 49
+++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)
bitbake/bin/toaster +5 -4
index 162d4d9..dfbc58d 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # (c) 2013 Intel Corp.
 
 # This program is free software; you can redistribute it and/or modify
@@ -28,13 +28,14 @@
 
 # Helper function to kill a background toaster development server
 
-function webserverKillAll()
+webserverKillAll()
 {
     local pidfile
     for pidfile in ${BUILDDIR}/.toastermain.pid; do
         if [ -f ${pidfile} ]; then
-            while kill -0 $(< ${pidfile}) 2>/dev/null; do
-                kill -SIGTERM -$(< ${pidfile}) 2>/dev/null
+            pid=`cat ${pidfile}`
+            while kill -0 $pid 2>/dev/null; do
+                kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
                 # Kill processes if they are still running - may happen

in interactive shells
ps fux | grep "python.*manage.py runserver" | awk
'{print $2}' | xargs kill

bitbake/bin/toaster +1 -1
@@ -44,7 +45,7 @@ function webserverKillAll()
     done
 }
 
-function webserverStartAll()
+webserverStartAll()
 {
     # do not start if toastermain points to a valid process
     if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs -I{}

kill -0 {} ; then

bitbake/bin/toaster +8 -9
@@ -58,7 +59,7 @@ function webserverStartAll()
     if [ $retval -eq 1 ]; then
         echo "Failed db sync, stopping system start" 1>&2
     elif [ $retval -eq 2 ]; then
-        echo -e "\nError on migration, trying to recover... \n"
+        printf "\nError on migration, trying to recover... \n"
         python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial
--fake
         retval=0
         python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
@@ -83,7 +84,7 @@ function webserverStartAll()
 
 # Helper functions to add a special configuration file
 
-function addtoConfiguration()
+addtoConfiguration()
 {
     file=$1
     shift
@@ -94,13 +95,13 @@ function addtoConfiguration()
 INSTOPSYSTEM=0
 
 # define the stop command
-function stop_system()
+stop_system()
 {
     # prevent reentry
     if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
     INSTOPSYSTEM=1
     if [ -f ${BUILDDIR}/.toasterui.pid ]; then
-        kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
+        kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null
         rm ${BUILDDIR}/.toasterui.pid
     fi
     BBSERVER=0.0.0.0:-1 bitbake -m
@@ -113,12 +114,12 @@ function stop_system()
     INSTOPSYSTEM=0
 }
 
-function check_pidbyfile() {
-    [ -e $1 ] && kill -0 $(< $1) 2>/dev/null
+check_pidbyfile() {
+    [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
 }
 
 
-function notify_chldexit() {
+notify_chldexit() {
     if [ $NOTOASTERUI -eq 0 ]; then
         check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
         stop_system
@@ -126,16 +127,16 @@ function notify_chldexit() {
 }
 
 
-function verify_prereq() {
+verify_prereq() {
     # Verify prerequisites
 
     if ! echo "import django; print (1,) == django.VERSION[0:1] and

django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True

Quoted 1 line

/dev/null; then

- echo -e "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"
+ printf "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"

         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"
+ printf "This program needs South 0.8.4. Please install
with\n\npip install south==0.8.4\n"
return 2
fi
return 0

bitbake/bin/toaster +0 -0
@@ -174,47 +175,47 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"`

]; then
# 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
+ 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

- 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
+ 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." 1>&2
exit 1
fi

if ! which daemon >/dev/null 2>&1; then
- 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
+ echo "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

# 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 -e "Previous toaster run directory $BUILDDIR found,
cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1
+ 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

bitbake/bin/toaster +3 -3
-    function trap_ctrlc() {
+    trap_ctrlc() {
         echo "** Stopping system"
         webserverKillAll
         RUNNING=0
     }
 
-    function do_cleanup() {
+    do_cleanup() {
         find "$BUILDDIR" -type f | xargs rm
         rmdir "$BUILDDIR"
     }
-    function cleanup() {
+    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
- echo -e "\nErrors found in the Toaster log files present
in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
+ printf "\nErrors found in the Toaster log files present
in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
fi
else
echo "No errors found, removing the run directory
'$BUILDDIR'"

bitbake/bin/toaster +0 -1
@@ -245,7 +246,7 @@ 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
+ 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

Quoted 9 lines

--
2.1.4

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

--
Alex Damian
Yocto Project
SSG / OTC

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC
author
#3 lore raw
Quoted 8 lines · Alexandru

Actually, I spoke too soon.

This patch doesn't pass testing - it breaks launching toaster on my system, where /bin/sh is actually dash. Since this is default on Ubuntu systems, we need to support it to run out of the box.

I will not be submitting this patch. Can you please debug it also with dash as /bin/sh ?

Unfortunately I can't find equivalent of $BASH_SOURCE for dash. dirname $0 can be used only if script is executed. However, if script is sourced $0 is pointing to dash itself. Looks like there is no way to get name of sourced script in dash and probably in other simple shells.

Any ideas how to work around this?

Regards,
Ed

Quoted 266 lines

Thank you,
Alex

Quoted 253 lines · Alexandru

Taken for submission,

Thank you,
Alex

Quoted 228 lines · Ed Bartosh

Fixed the following bashisms:
replaced echo -e -> printf
removed 'function' from function definitions
replaced $(< ${file}) -> cat ${file}

---
 bitbake/bin/toaster | 49
+++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)
bitbake/bin/toaster +5 -4
index 162d4d9..dfbc58d 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # (c) 2013 Intel Corp.
 
 # This program is free software; you can redistribute it and/or modify
@@ -28,13 +28,14 @@
 
 # Helper function to kill a background toaster development server
 
-function webserverKillAll()
+webserverKillAll()
 {
     local pidfile
     for pidfile in ${BUILDDIR}/.toastermain.pid; do
         if [ -f ${pidfile} ]; then
-            while kill -0 $(< ${pidfile}) 2>/dev/null; do
-                kill -SIGTERM -$(< ${pidfile}) 2>/dev/null
+            pid=`cat ${pidfile}`
+            while kill -0 $pid 2>/dev/null; do
+                kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
                 # Kill processes if they are still running - may happen

in interactive shells
ps fux | grep "python.*manage.py runserver" | awk
'{print $2}' | xargs kill

bitbake/bin/toaster +1 -1
@@ -44,7 +45,7 @@ function webserverKillAll()
     done
 }
 
-function webserverStartAll()
+webserverStartAll()
 {
     # do not start if toastermain points to a valid process
     if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs -I{}

kill -0 {} ; then

bitbake/bin/toaster +8 -9
@@ -58,7 +59,7 @@ function webserverStartAll()
     if [ $retval -eq 1 ]; then
         echo "Failed db sync, stopping system start" 1>&2
     elif [ $retval -eq 2 ]; then
-        echo -e "\nError on migration, trying to recover... \n"
+        printf "\nError on migration, trying to recover... \n"
         python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial
--fake
         retval=0
         python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
@@ -83,7 +84,7 @@ function webserverStartAll()
 
 # Helper functions to add a special configuration file
 
-function addtoConfiguration()
+addtoConfiguration()
 {
     file=$1
     shift
@@ -94,13 +95,13 @@ function addtoConfiguration()
 INSTOPSYSTEM=0
 
 # define the stop command
-function stop_system()
+stop_system()
 {
     # prevent reentry
     if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
     INSTOPSYSTEM=1
     if [ -f ${BUILDDIR}/.toasterui.pid ]; then
-        kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
+        kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null
         rm ${BUILDDIR}/.toasterui.pid
     fi
     BBSERVER=0.0.0.0:-1 bitbake -m
@@ -113,12 +114,12 @@ function stop_system()
     INSTOPSYSTEM=0
 }
 
-function check_pidbyfile() {
-    [ -e $1 ] && kill -0 $(< $1) 2>/dev/null
+check_pidbyfile() {
+    [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
 }
 
 
-function notify_chldexit() {
+notify_chldexit() {
     if [ $NOTOASTERUI -eq 0 ]; then
         check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
         stop_system
@@ -126,16 +127,16 @@ function notify_chldexit() {
 }
 
 
-function verify_prereq() {
+verify_prereq() {
     # Verify prerequisites
 
     if ! echo "import django; print (1,) == django.VERSION[0:1] and

django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True

Quoted 1 line

/dev/null; then

- echo -e "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"
+ printf "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"

         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"
+ printf "This program needs South 0.8.4. Please install
with\n\npip install south==0.8.4\n"
return 2
fi
return 0

bitbake/bin/toaster +0 -0
@@ -174,47 +175,47 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"`

]; then
# 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
+ 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

- 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
+ 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." 1>&2
exit 1
fi

if ! which daemon >/dev/null 2>&1; then
- 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
+ echo "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

# 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 -e "Previous toaster run directory $BUILDDIR found,
cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1
+ 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

bitbake/bin/toaster +3 -3
-    function trap_ctrlc() {
+    trap_ctrlc() {
         echo "** Stopping system"
         webserverKillAll
         RUNNING=0
     }
 
-    function do_cleanup() {
+    do_cleanup() {
         find "$BUILDDIR" -type f | xargs rm
         rmdir "$BUILDDIR"
     }
-    function cleanup() {
+    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
- echo -e "\nErrors found in the Toaster log files present
in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
+ printf "\nErrors found in the Toaster log files present
in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
fi
else
echo "No errors found, removing the run directory
'$BUILDDIR'"

bitbake/bin/toaster +0 -1
@@ -245,7 +246,7 @@ 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
+ 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

Quoted 9 lines

--
2.1.4

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

--
Alex Damian
Yocto Project
SSG / OTC

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC
Signature · 3 lines
--
Regards,
Ed
author
#4 lore raw
In reply to Damian, Alexandru

Hi Alex,

Can you show me how exactly it breaks?

It works for me just fine in dash:

$ echo $0
dash
$ ./bitbake/bin/toaster
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

Synced:

Quoted 8 lines

django.contrib.auth
django.contrib.contenttypes
django.contrib.messages
django.contrib.sessions
django.contrib.admin
django.contrib.staticfiles
django.contrib.humanize
south

Not synced (use migrations):
- orm
- bldcontrol
(use ./manage.py migrate to migrate these)
Running migrations for orm:
- Nothing to migrate.
- Loading initial data for orm.
Installed 0 object(s) from 0 fixture(s)
Running migrations for bldcontrol:
- Nothing to migrate.
- Loading initial data for bldcontrol.
Installed 0 object(s) from 0 fixture(s)
Verifying the Build Environment. If the local Build Environment is not properly configured, you will be asked to configure it. Starting webserver...
Webserver address: http://0.0.0.0:8000/
Starting browser...
Toaster is now running. You can stop it with Ctrl-C

sourcing toaster will not work in dash for sure, but it doesn't depend on which shell is in shebang I believe.

Regards,
Ed

Quoted 275 lines · Alexandru

Actually, I spoke too soon.

This patch doesn't pass testing - it breaks launching toaster on my system, where /bin/sh is actually dash. Since this is default on Ubuntu systems, we need to support it to run out of the box.

I will not be submitting this patch. Can you please debug it also with dash as /bin/sh ?

Thank you,
Alex

Quoted 253 lines · Alexandru

Taken for submission,

Thank you,
Alex

Quoted 228 lines · Ed Bartosh

Fixed the following bashisms:
replaced echo -e -> printf
removed 'function' from function definitions
replaced $(< ${file}) -> cat ${file}

---
 bitbake/bin/toaster | 49
+++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)
bitbake/bin/toaster +5 -4
index 162d4d9..dfbc58d 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # (c) 2013 Intel Corp.
 
 # This program is free software; you can redistribute it and/or modify
@@ -28,13 +28,14 @@
 
 # Helper function to kill a background toaster development server
 
-function webserverKillAll()
+webserverKillAll()
 {
     local pidfile
     for pidfile in ${BUILDDIR}/.toastermain.pid; do
         if [ -f ${pidfile} ]; then
-            while kill -0 $(< ${pidfile}) 2>/dev/null; do
-                kill -SIGTERM -$(< ${pidfile}) 2>/dev/null
+            pid=`cat ${pidfile}`
+            while kill -0 $pid 2>/dev/null; do
+                kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
                 # Kill processes if they are still running - may happen

in interactive shells
ps fux | grep "python.*manage.py runserver" | awk
'{print $2}' | xargs kill

bitbake/bin/toaster +1 -1
@@ -44,7 +45,7 @@ function webserverKillAll()
     done
 }
 
-function webserverStartAll()
+webserverStartAll()
 {
     # do not start if toastermain points to a valid process
     if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs -I{}

kill -0 {} ; then

bitbake/bin/toaster +8 -9
@@ -58,7 +59,7 @@ function webserverStartAll()
     if [ $retval -eq 1 ]; then
         echo "Failed db sync, stopping system start" 1>&2
     elif [ $retval -eq 2 ]; then
-        echo -e "\nError on migration, trying to recover... \n"
+        printf "\nError on migration, trying to recover... \n"
         python $BBBASEDIR/lib/toaster/manage.py migrate orm 0001_initial
--fake
         retval=0
         python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
@@ -83,7 +84,7 @@ function webserverStartAll()
 
 # Helper functions to add a special configuration file
 
-function addtoConfiguration()
+addtoConfiguration()
 {
     file=$1
     shift
@@ -94,13 +95,13 @@ function addtoConfiguration()
 INSTOPSYSTEM=0
 
 # define the stop command
-function stop_system()
+stop_system()
 {
     # prevent reentry
     if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
     INSTOPSYSTEM=1
     if [ -f ${BUILDDIR}/.toasterui.pid ]; then
-        kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
+        kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null
         rm ${BUILDDIR}/.toasterui.pid
     fi
     BBSERVER=0.0.0.0:-1 bitbake -m
@@ -113,12 +114,12 @@ function stop_system()
     INSTOPSYSTEM=0
 }
 
-function check_pidbyfile() {
-    [ -e $1 ] && kill -0 $(< $1) 2>/dev/null
+check_pidbyfile() {
+    [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
 }
 
 
-function notify_chldexit() {
+notify_chldexit() {
     if [ $NOTOASTERUI -eq 0 ]; then
         check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
         stop_system
@@ -126,16 +127,16 @@ function notify_chldexit() {
 }
 
 
-function verify_prereq() {
+verify_prereq() {
     # Verify prerequisites
 
     if ! echo "import django; print (1,) == django.VERSION[0:1] and

django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True

Quoted 1 line

/dev/null; then

- echo -e "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"
+ printf "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"

         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"
+ printf "This program needs South 0.8.4. Please install
with\n\npip install south==0.8.4\n"
return 2
fi
return 0

bitbake/bin/toaster +0 -0
@@ -174,47 +175,47 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"`

]; then
# 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
+ 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

- 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
+ 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." 1>&2
exit 1
fi

if ! which daemon >/dev/null 2>&1; then
- 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
+ echo "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

# 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 -e "Previous toaster run directory $BUILDDIR found,
cowardly refusing to start. Please remove the directory when that toaster instance is over" 2>&1
+ 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

bitbake/bin/toaster +3 -3
-    function trap_ctrlc() {
+    trap_ctrlc() {
         echo "** Stopping system"
         webserverKillAll
         RUNNING=0
     }
 
-    function do_cleanup() {
+    do_cleanup() {
         find "$BUILDDIR" -type f | xargs rm
         rmdir "$BUILDDIR"
     }
-    function cleanup() {
+    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
- echo -e "\nErrors found in the Toaster log files present
in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
+ printf "\nErrors found in the Toaster log files present
in '$BUILDDIR'. Directory will not be cleaned.\n Please review the errors and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
fi
else
echo "No errors found, removing the run directory
'$BUILDDIR'"

bitbake/bin/toaster +0 -1
@@ -245,7 +246,7 @@ 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
+ 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

Quoted 9 lines

--
2.1.4

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

--
Alex Damian
Yocto Project
SSG / OTC

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC
Signature · 3 lines
--
Regards,
Ed

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAJ2CSBsv+k=J8DCzbFg5DbhF24cdZB21r_KC_o4h4oE3kcbKaw@mail.gmail.com

author
#7 lore raw

[review-request] ed/toaster/shells

Quoted 10 lines · Alexandru

It's the command line start that breaks. If I change the

#!/bin/bash

to

#!/bin/sh

Quoted 7 lines

My output is:

yocto$ ./poky/bitbake/bin/toaster
./poky/bitbake/bin/toaster: 1: ./poky/bitbake/bin/toaster: Bad substitution ./poky/bitbake/bin/toaster: 201: ./poky/bitbake/bin/toaster: Syntax error:
"(" unexpected (expecting "fi")

Thank you for the info. I didn't see this as my /bin/sh points to bash even if I run dash :)

Quoted 4 lines

Why shouldn't we use the bash as the shebang script ? I suspect that all reasonably modern Linuxes have bash installed, and it doesn't conflict with whatever shell the user actually uses.

Sure they have. I just wanted to make it run under zsh and clean up bashisms. Cleaning up bashsms and leaving bash in shebang doesn't look very logical to me. If it's clean it should work in any shell. If it can work only in bash then what's the point of cleaning it from bashisms?

Anyway, I made it to work in dash too. Please, review ed/toaster/shells

Regards,
Ed

Quoted 394 lines
Quoted 383 lines · Ed Bartosh

ping

Quoted 24 lines · Ed Bartosh

Hi Alex,

Can you show me how exactly it breaks?

It works for me just fine in dash:

$ echo $0
dash
$ ./bitbake/bin/toaster
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

Synced:

Quoted 8 lines

django.contrib.auth
django.contrib.contenttypes
django.contrib.messages
django.contrib.sessions
django.contrib.admin
django.contrib.staticfiles
django.contrib.humanize
south

Quoted 13 lines

Not synced (use migrations):
- orm
- bldcontrol
(use ./manage.py migrate to migrate these)
Running migrations for orm:
- Nothing to migrate.
- Loading initial data for orm.
Installed 0 object(s) from 0 fixture(s)
Running migrations for bldcontrol:
- Nothing to migrate.
- Loading initial data for bldcontrol.
Installed 0 object(s) from 0 fixture(s)
Verifying the Build Environment. If the local Build Environment is not

properly configured, you will be asked to configure it.

Quoted 6 lines

Starting webserver...
Webserver address: http://0.0.0.0:8000/
Starting browser...
Toaster is now running. You can stop it with Ctrl-C

sourcing toaster will not work in dash for sure, but it doesn't depend

on which shell is in shebang I believe.

Quoted 8 lines

Regards,
Ed

Quoted 3 lines · Alexandru

Actually, I spoke too soon.

This patch doesn't pass testing - it breaks launching toaster on my

system,

Quoted 1 line
Quoted 1 line

where /bin/sh is actually dash. Since this is default on Ubuntu

systems, we

Quoted 3 lines
Quoted 3 lines

need to support it to run out of the box.

I will not be submitting this patch. Can you please debug it also with

dash

Quoted 8 lines
Quoted 8 lines

as /bin/sh ?

Thank you,
Alex

On Thu, May 7, 2015 at 11:30 AM, Damian, Alexandru < [email protected]> wrote:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Taken for submission,

Thank you,
Alex

On Mon, May 4, 2015 at 11:42 AM, Ed Bartosh <

[email protected]>

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 20 lines · wrote:

Fixed the following bashisms:
replaced echo -e -> printf
removed 'function' from function definitions
replaced $(< ${file}) -> cat ${file}

---
 bitbake/bin/toaster | 49
+++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)
bitbake/bin/toaster +1 -1
index 162d4d9..dfbc58d 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # (c) 2013 Intel Corp.
 
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/bin/toaster line 4

Quoted 1 line
bitbake/bin/toaster +0 -0
 # This program is free software; you can redistribute it and/or

modify

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
bitbake/bin/toaster +0 -0
@@ -28,13 +28,14 @@
 
 # Helper function to kill a background toaster development server
 
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
bitbake/bin/toaster +1 -1
-function webserverKillAll()
+webserverKillAll()
 {
     local pidfile
     for pidfile in ${BUILDDIR}/.toastermain.pid; do
Quoted 8 lines
Quoted 8 lines

bitbake/bin/toaster

Quoted 8 lines
bitbake/bin/toaster +3 -2
         if [ -f ${pidfile} ]; then
-            while kill -0 $(< ${pidfile}) 2>/dev/null; do
-                kill -SIGTERM -$(< ${pidfile}) 2>/dev/null
+            pid=`cat ${pidfile}`
+            while kill -0 $pid 2>/dev/null; do
+                kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
                 # Kill processes if they are still running - may

happen

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

in interactive shells
ps fux | grep "python.*manage.py runserver" | awk
'{print $2}' | xargs kill

bitbake/bin/toaster +0 -0
@@ -44,7 +45,7 @@ function webserverKillAll()
     done
 }
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

bitbake/bin/toaster function webserverKillAll()

Quoted 5 lines
bitbake/bin/toaster +1 -1
-function webserverStartAll()
+webserverStartAll()
 {
     # do not start if toastermain points to a valid process
     if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs

-I{}

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

bitbake/bin/toaster function webserverStartAll() · line 63

Quoted 8 lines

kill -0 {} ; then

bitbake/bin/toaster +1 -1
@@ -58,7 +59,7 @@ function webserverStartAll()
     if [ $retval -eq 1 ]; then
         echo "Failed db sync, stopping system start" 1>&2
     elif [ $retval -eq 2 ]; then
-        echo -e "\nError on migration, trying to recover... \n"
+        printf "\nError on migration, trying to recover... \n"
         python $BBBASEDIR/lib/toaster/manage.py migrate orm

0001_initial

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

bitbake/bin/toaster function webserverStartAll()

Quoted 3 lines
bitbake/bin/toaster +0 -1
--fake
         retval=0
         python $BBBASEDIR/lib/toaster/manage.py migrate orm ||

retval=1

Quoted 52 lines
Quoted 52 lines
Quoted 52 lines
Quoted 52 lines
bitbake/bin/toaster +7 -7
@@ -83,7 +84,7 @@ function webserverStartAll()
 
 # Helper functions to add a special configuration file
 
-function addtoConfiguration()
+addtoConfiguration()
 {
     file=$1
     shift
@@ -94,13 +95,13 @@ function addtoConfiguration()
 INSTOPSYSTEM=0
 
 # define the stop command
-function stop_system()
+stop_system()
 {
     # prevent reentry
     if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
     INSTOPSYSTEM=1
     if [ -f ${BUILDDIR}/.toasterui.pid ]; then
-        kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
+        kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null
         rm ${BUILDDIR}/.toasterui.pid
     fi
     BBSERVER=0.0.0.0:-1 bitbake -m
@@ -113,12 +114,12 @@ function stop_system()
     INSTOPSYSTEM=0
 }
 
-function check_pidbyfile() {
-    [ -e $1 ] && kill -0 $(< $1) 2>/dev/null
+check_pidbyfile() {
+    [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
 }
 
 
-function notify_chldexit() {
+notify_chldexit() {
     if [ $NOTOASTERUI -eq 0 ]; then
         check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
         stop_system
@@ -126,16 +127,16 @@ function notify_chldexit() {
 }
 
 
-function verify_prereq() {
+verify_prereq() {
     # Verify prerequisites
 
     if ! echo "import django; print (1,) == django.VERSION[0:1] and

django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True

Quoted 1 line

/dev/null; then

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

- echo -e "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"
+ printf "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"

         return 2
     fi

     if ! echo "import south; print reduce(lambda x, y: 2 if x==2

else 0

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

bitbake/bin/toaster if [ `basename \"$0\"` = `basename

Quoted 9 lines

True >/dev/null; then
- echo -e "This program needs South 0.8.4. Please install
with\n\npip install south==0.8.4\n"
+ printf "This program needs South 0.8.4. Please install
with\n\npip install south==0.8.4\n"
return 2
fi
return 0

bitbake/bin/toaster +0 -0
@@ -174,47 +175,47 @@ if [ `basename \"$0\"` = `basename

\"${SRCFILE}\"`

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

]; then
# Start just the web server, point the web browser to the

interface,

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

and start any Django services.

if ! verify_prereq; then
- echo -e "Error: Could not verify that the needed

dependencies

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

are installed. Please use virtualenv and pip to install

dependencies listed

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

in toaster-requirements.txt" 1>&2
+ echo "Error: Could not verify that the needed dependencies

are

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

installed. Please use virtualenv and pip to install dependencies

listed in

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

toaster-requirements.txt" 1>&2

         exit 1
     fi

     if [ -n "$BUILDDIR" ]; then

- echo -e "Error: It looks like you sourced

oe-init-build-env.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Toaster cannot start in build mode from an oe-core build

environment.\n You

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

should be starting Toaster from a new terminal window." 1>&2
+ 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

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

should be starting Toaster from a new terminal window." 1>&2
exit 1
fi

if ! which daemon >/dev/null 2>&1; then
- echo -e "Failed dependency; toaster needs the 'daemon'

program

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in order to be able to start builds'. Please install the 'daemon'

program

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

from your distribution repositories or

http://www.libslack.org/daemon/"

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

1>&2
+ echo "Failed dependency; toaster needs the 'daemon'

program in

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

order to be able to start builds'. Please install the 'daemon'

program from

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

your distribution repositories or http://www.libslack.org/daemon/"

1>&2

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

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 -e "Previous toaster run directory $BUILDDIR found,
cowardly refusing to start. Please remove the directory when that

toaster

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

instance is over" 2>&1
+ echo "Previous toaster run directory $BUILDDIR found,

cowardly

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

refusing to start. Please remove the directory when that toaster

instance

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines

is over" 2>&1
exit 1
fi

mkdir -p "$BUILDDIR"

RUNNING=1

bitbake/bin/toaster +1 -1
-    function trap_ctrlc() {
+    trap_ctrlc() {
         echo "** Stopping system"
         webserverKillAll
         RUNNING=0
     }
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

bitbake/bin/toaster if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then

Quoted 9 lines
bitbake/bin/toaster +2 -2
-    function do_cleanup() {
+    do_cleanup() {
         find "$BUILDDIR" -type f | xargs rm
         rmdir "$BUILDDIR"
     }
-    function cleanup() {
+    cleanup() {
         if grep -ir error "$BUILDDIR" >/dev/null; then
             if grep -irn "That port is already in use"

"$BUILDDIR"; then

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

echo "You can use the \"webport=PORTNUMBER\"

parameter

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to start Toaster on a different port (port $WEB_PORT is already in

use)"

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

do_cleanup
else
- echo -e "\nErrors found in the Toaster log files

present

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in '$BUILDDIR'. Directory will not be cleaned.\n Please review the

errors

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
+ printf "\nErrors found in the Toaster log files

present

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in '$BUILDDIR'. Directory will not be cleaned.\n Please review the

errors

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

bitbake/bin/toaster fi · line 248

Quoted 11 lines

and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster"
fi
else
echo "No errors found, removing the run directory
'$BUILDDIR'"

bitbake/bin/toaster +0 -1
@@ -245,7 +246,7 @@ fi
 
 
 if ! verify_prereq; then
-    echo -e "Error: Could not verify that the needed dependencies

are

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

installed. Please use virtualenv and pip to install dependencies

listed in

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

toaster-requirements.txt" 1>&2
+ echo "Error: Could not verify that the needed dependencies are
installed. Please use virtualenv and pip to install dependencies

listed in

Quoted 29 lines
Quoted 24 lines
Quoted 16 lines
Quoted 4 lines

toaster-requirements.txt" 1>&2
return 1
fi

Quoted 9 lines

--
2.1.4

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Quoted 5 lines

--
Alex Damian
Yocto Project
SSG / OTC

Quoted 4 lines

--
Alex Damian
Yocto Project
SSG / OTC

Quoted 9 lines

--
--
Regards,
Ed
--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

--
--
Regards,
Ed

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC
Signature · 3 lines
--
Regards,
Ed
#8 lore raw

Re: [review-request] ed/toaster/shells

Hi,

Sorry for the delay, patches ok, with amendments.

Cheers,
Alex

Quoted 466 lines · Ed Bartosh
Quoted 7 lines · Alexandru

It's the command line start that breaks. If I change the

#!/bin/bash

to

Quoted 7 lines

#!/bin/sh

My output is:

yocto$ ./poky/bitbake/bin/toaster ./poky/bitbake/bin/toaster: 1: ./poky/bitbake/bin/toaster: Bad

substitution

Quoted 1 line

./poky/bitbake/bin/toaster: 201: ./poky/bitbake/bin/toaster: Syntax

error:

Quoted 2 lines

"(" unexpected (expecting "fi")

Thank you for the info. I didn't see this as my /bin/sh points to bash even if
I run dash :)

Quoted 3 lines

Why shouldn't we use the bash as the shebang script ? I suspect that all reasonably modern Linuxes have bash installed, and it doesn't conflict

with

Quoted 1 line

whatever shell the user actually uses.

Sure they have. I just wanted to make it run under zsh and clean up bashisms.
Cleaning up bashsms and leaving bash in shebang doesn't look very logical to me.
If it's clean it should work in any shell. If it can work only in bash then what's
the point of cleaning it from bashisms?

Anyway, I made it to work in dash too. Please, review ed/toaster/shells

Regards,
Ed

Quoted 31 lines
Quoted 27 lines · Ed Bartosh

ping

Quoted 24 lines · Ed Bartosh

Hi Alex,

Can you show me how exactly it breaks?

It works for me just fine in dash:

$ echo $0
dash
$ ./bitbake/bin/toaster
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

Synced:

Quoted 8 lines

django.contrib.auth
django.contrib.contenttypes
django.contrib.messages
django.contrib.sessions
django.contrib.admin
django.contrib.staticfiles
django.contrib.humanize
south

Quoted 13 lines
Quoted 5 lines
Quoted 5 lines

Not synced (use migrations):
- orm
- bldcontrol
(use ./manage.py migrate to migrate these)
Running migrations for orm:

Quoted 8 lines
Quoted 8 lines

- Nothing to migrate.
- Loading initial data for orm.
Installed 0 object(s) from 0 fixture(s)
Running migrations for bldcontrol:
- Nothing to migrate.
- Loading initial data for bldcontrol.
Installed 0 object(s) from 0 fixture(s)
Verifying the Build Environment. If the local Build Environment is

not

Quoted 7 lines
Quoted 7 lines

properly configured, you will be asked to configure it.

Quoted 6 lines

Starting webserver...
Webserver address: http://0.0.0.0:8000/
Starting browser...
Toaster is now running. You can stop it with Ctrl-C

sourcing toaster will not work in dash for sure, but it doesn't

depend

Quoted 8 lines
Quoted 8 lines

on which shell is in shebang I believe.

Quoted 7 lines

Regards,
Ed

Quoted 2 lines · Alexandru

Actually, I spoke too soon.

Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line

This patch doesn't pass testing - it breaks launching toaster on my

system,

Quoted 1 line
Quoted 1 line

where /bin/sh is actually dash. Since this is default on Ubuntu

systems, we

Quoted 3 lines
Quoted 3 lines

need to support it to run out of the box.

I will not be submitting this patch. Can you please debug it also

with

Quoted 38 lines
Quoted 38 lines

dash

Quoted 8 lines
Quoted 8 lines

as /bin/sh ?

Thank you,
Alex

On Thu, May 7, 2015 at 11:30 AM, Damian, Alexandru < [email protected]> wrote:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Taken for submission,

Thank you,
Alex

On Mon, May 4, 2015 at 11:42 AM, Ed Bartosh <

[email protected]>

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 20 lines · wrote:

Fixed the following bashisms:
replaced echo -e -> printf
removed 'function' from function definitions
replaced $(< ${file}) -> cat ${file}

---
 bitbake/bin/toaster | 49
+++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 24 deletions(-)
bitbake/bin/toaster +1 -1
index 162d4d9..dfbc58d 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # (c) 2013 Intel Corp.
 
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

bitbake/bin/toaster line 4

Quoted 1 line
bitbake/bin/toaster +0 -0
 # This program is free software; you can redistribute it and/or

modify

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

bitbake/bin/toaster line 29

Quoted 3 lines
bitbake/bin/toaster +0 -0
@@ -28,13 +28,14 @@
 
 # Helper function to kill a background toaster development

server

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 4 lines
bitbake/bin/toaster +1 -1
-function webserverKillAll()
+webserverKillAll()
 {

bitbake/bin/toaster line 39

Quoted 10 lines
bitbake/bin/toaster +3 -2
     local pidfile
     for pidfile in ${BUILDDIR}/.toastermain.pid; do
         if [ -f ${pidfile} ]; then
-            while kill -0 $(< ${pidfile}) 2>/dev/null; do
-                kill -SIGTERM -$(< ${pidfile}) 2>/dev/null
+            pid=`cat ${pidfile}`
+            while kill -0 $pid 2>/dev/null; do
+                kill -SIGTERM -$pid 2>/dev/null
                 sleep 1
                 # Kill processes if they are still running -

may

Quoted 3 lines
Quoted 3 lines

happen

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

in interactive shells
ps fux | grep "python.*manage.py runserver" |

awk

Quoted 69 lines
Quoted 69 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

bitbake/bin/toaster function webserverKillAll() · line 51

Quoted 10 lines

'{print $2}' | xargs kill

bitbake/bin/toaster +1 -1
@@ -44,7 +45,7 @@ function webserverKillAll()
     done
 }
 
-function webserverStartAll()
+webserverStartAll()
 {
     # do not start if toastermain points to a valid process
     if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs

-I{}

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

bitbake/bin/toaster function webserverStartAll() · line 63

Quoted 8 lines

kill -0 {} ; then

bitbake/bin/toaster +1 -1
@@ -58,7 +59,7 @@ function webserverStartAll()
     if [ $retval -eq 1 ]; then
         echo "Failed db sync, stopping system start" 1>&2
     elif [ $retval -eq 2 ]; then
-        echo -e "\nError on migration, trying to recover... \n"
+        printf "\nError on migration, trying to recover... \n"
         python $BBBASEDIR/lib/toaster/manage.py migrate orm

0001_initial

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

bitbake/bin/toaster function webserverStartAll()

Quoted 3 lines
bitbake/bin/toaster +0 -1
--fake
         retval=0
         python $BBBASEDIR/lib/toaster/manage.py migrate orm ||

retval=1

Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
Quoted 45 lines
bitbake/bin/toaster +6 -6
@@ -83,7 +84,7 @@ function webserverStartAll()
 
 # Helper functions to add a special configuration file
 
-function addtoConfiguration()
+addtoConfiguration()
 {
     file=$1
     shift
@@ -94,13 +95,13 @@ function addtoConfiguration()
 INSTOPSYSTEM=0
 
 # define the stop command
-function stop_system()
+stop_system()
 {
     # prevent reentry
     if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
     INSTOPSYSTEM=1
     if [ -f ${BUILDDIR}/.toasterui.pid ]; then
-        kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
+        kill `cat ${BUILDDIR}/.toasterui.pid` 2>/dev/null
         rm ${BUILDDIR}/.toasterui.pid
     fi
     BBSERVER=0.0.0.0:-1 bitbake -m
@@ -113,12 +114,12 @@ function stop_system()
     INSTOPSYSTEM=0
 }
 
-function check_pidbyfile() {
-    [ -e $1 ] && kill -0 $(< $1) 2>/dev/null
+check_pidbyfile() {
+    [ -e $1 ] && kill -0 `cat $1` 2>/dev/null
 }
 
 
-function notify_chldexit() {
+notify_chldexit() {
     if [ $NOTOASTERUI -eq 0 ]; then
         check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
         stop_system
@@ -126,16 +127,16 @@ function notify_chldexit() {
 }
 
 
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

bitbake/bin/toaster function notify_chldexit() { · line 133

Quoted 5 lines
bitbake/bin/toaster +1 -1
-function verify_prereq() {
+verify_prereq() {
     # Verify prerequisites
 
     if ! echo "import django; print (1,) ==

django.VERSION[0:1] and

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

django.VERSION[1:2][0] in (6,)" | python 2>/dev/null | grep True

Quoted 1 line

/dev/null; then

- echo -e "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"
+ printf "This program needs Django 1.6. Please install
with\n\npip install django==1.6\n"
return 2
fi

if ! echo "import south; print reduce(lambda x, y: 2 if

x==2

Quoted 19 lines
Quoted 19 lines

else 0

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

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

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

bitbake/bin/toaster if [ `basename \"$0\"` = `basename

Quoted 9 lines

True >/dev/null; then
- echo -e "This program needs South 0.8.4. Please install
with\n\npip install south==0.8.4\n"
+ printf "This program needs South 0.8.4. Please install
with\n\npip install south==0.8.4\n"
return 2
fi
return 0

bitbake/bin/toaster +0 -0
@@ -174,47 +175,47 @@ if [ `basename \"$0\"` = `basename

\"${SRCFILE}\"`

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

]; then
# Start just the web server, point the web browser to the

interface,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

and start any Django services.

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

if ! verify_prereq; then
- echo -e "Error: Could not verify that the needed

dependencies

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

are installed. Please use virtualenv and pip to install

dependencies listed

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

in toaster-requirements.txt" 1>&2
+ echo "Error: Could not verify that the needed

dependencies

Quoted 7 lines
Quoted 7 lines

are

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

installed. Please use virtualenv and pip to install dependencies

listed in

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

toaster-requirements.txt" 1>&2
exit 1
fi

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
     if [ -n "$BUILDDIR" ]; then

- echo -e "Error: It looks like you sourced

oe-init-build-env.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Toaster cannot start in build mode from an oe-core build

environment.\n You

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

should be starting Toaster from a new terminal window." 1>&2
+ printf "Error: It looks like you sourced

oe-init-build-env.

Quoted 10 lines
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Toaster cannot start in build mode from an oe-core build

environment.\n You

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

should be starting Toaster from a new terminal window." 1>&2
exit 1
fi

if ! which daemon >/dev/null 2>&1; then
- echo -e "Failed dependency; toaster needs the 'daemon'

program

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in order to be able to start builds'. Please install the

'daemon'

Quoted 9 lines
Quoted 9 lines

program

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

from your distribution repositories or

http://www.libslack.org/daemon/"

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

1>&2
+ echo "Failed dependency; toaster needs the 'daemon'

program in

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

order to be able to start builds'. Please install the 'daemon'

program from

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

your distribution repositories or

http://www.libslack.org/daemon/"

Quoted 5 lines
Quoted 5 lines

1>&2

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

exit 1
fi

# Define a fake builddir where only the pid files are

actually

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

created. No real builds will take place here.

     BUILDDIR=/tmp/toaster_$$
     if [ -d "$BUILDDIR" ]; then

- echo -e "Previous toaster run directory $BUILDDIR

found,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

cowardly refusing to start. Please remove the directory when

that

Quoted 29 lines
Quoted 29 lines

toaster

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

instance is over" 2>&1
+ echo "Previous toaster run directory $BUILDDIR found,

cowardly

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

refusing to start. Please remove the directory when that toaster

instance

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines

is over" 2>&1
exit 1
fi

mkdir -p "$BUILDDIR"

RUNNING=1

bitbake/bin/toaster +3 -3
-    function trap_ctrlc() {
+    trap_ctrlc() {
         echo "** Stopping system"
         webserverKillAll
         RUNNING=0
     }
 
-    function do_cleanup() {
+    do_cleanup() {
         find "$BUILDDIR" -type f | xargs rm
         rmdir "$BUILDDIR"
     }
-    function cleanup() {
+    cleanup() {
         if grep -ir error "$BUILDDIR" >/dev/null; then
             if grep -irn "That port is already in use"
Quoted 4 lines
Quoted 4 lines

"$BUILDDIR"; then

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

echo "You can use the \"webport=PORTNUMBER\"

parameter

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

to start Toaster on a different port (port $WEB_PORT is already

in

Quoted 4 lines
Quoted 4 lines

use)"

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

do_cleanup
else
- echo -e "\nErrors found in the Toaster log

files

Quoted 2 lines
Quoted 2 lines

present

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in '$BUILDDIR'. Directory will not be cleaned.\n Please review

the

Quoted 3 lines
Quoted 3 lines

errors

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster

"

Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ printf "\nErrors found in the Toaster log files

present

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

in '$BUILDDIR'. Directory will not be cleaned.\n Please review

the

Quoted 3 lines
Quoted 3 lines

errors

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

and notify [email protected] or submit a bug
https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Toaster

"

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

bitbake/bin/toaster fi · line 248

Quoted 9 lines

fi
else
echo "No errors found, removing the run directory
'$BUILDDIR'"

bitbake/bin/toaster +0 -1
@@ -245,7 +246,7 @@ fi
 
 
 if ! verify_prereq; then
-    echo -e "Error: Could not verify that the needed

dependencies

Quoted 5 lines
Quoted 5 lines

are

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

installed. Please use virtualenv and pip to install dependencies

listed in

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

toaster-requirements.txt" 1>&2
+ echo "Error: Could not verify that the needed dependencies

are

Quoted 49 lines
Quoted 41 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

installed. Please use virtualenv and pip to install dependencies

listed in

Quoted 29 lines
Quoted 24 lines
Quoted 16 lines
Quoted 4 lines

toaster-requirements.txt" 1>&2
return 1
fi

Quoted 9 lines

--
2.1.4

--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Quoted 5 lines

--
Alex Damian
Yocto Project
SSG / OTC

Quoted 4 lines

--
Alex Damian
Yocto Project
SSG / OTC

Quoted 9 lines

--
--
Regards,
Ed
--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Quoted 5 lines

--
--
Regards,
Ed

Quoted 4 lines

--
Alex Damian
Yocto Project
SSG / OTC

--
--
Regards,
Ed

Signature · 3 lines
Alex Damian
Yocto Project
SSG / OTC