Skip to contentSkip to conversation

bin/toaster: clean up unnecessary if statement and zsh fix.

PATCH In review Liam R. Howlett 2 participants 4 messages Aug 3, 2016 – Aug 4, 2016

lore
Share & tools
lore
#0 lore raw

cover bin/toaster: clean up unnecessary if statement and zsh fix.

Remove an unnecessary if statement that was left over from a change to a case statement and set a required zsh setting for the existing code to work more reliably.

Liam R. Howlett (2):
bin/toaster: Remove extra CMD check.
bin/toaster: set shwordsplit if using zsh.

 bin/toaster | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/2 bin/toaster: Remove extra CMD check.

This if statement was left over from the switch to the case statement logic.

---
 bin/toaster | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
bin/toaster +2 -4
index e3a0dae..66157d0 100755
@@ -253,10 +253,8 @@ echo "The system will $CMD."
 case $CMD in
     start )
         # check if addr:port is not in use
-        if [ "$CMD" == 'start' ]; then
-            if [ $WEBSERVER -gt 0 ]; then
-                $MANAGE checksocket "$ADDR_PORT" || return 1
-            fi
+        if [ ${WEBSERVER} -gt 0 ]; then
+            ${MANAGE} checksocket "$ADDR_PORT" || return 1
         fi
 
         # kill Toaster web server if it's alive
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 bin/toaster: set shwordsplit if using zsh.

In reply to Liam R. Howlett

Since this script is meant to be sourced, shwordsplit has to be explicitly set to ensure the variable MANAGE is set correctly and functions independent of the users shwordsplit setting.

---
 bin/toaster | 1 +
 1 file changed, 1 insertion(+)
bin/toaster +1 -0
index 66157d0..038e93b 100755
@@ -130,6 +130,7 @@ if [ -n "$BASH_SOURCE" ] ; then
     TOASTER=${BASH_SOURCE}
 elif [ -n "$ZSH_NAME" ] ; then
     TOASTER=${(%):-%x}
+    set -o shwordsplit
 else
     TOASTER=$0
 fi
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH 2/2] bin/toaster: set shwordsplit if using zsh.

Quoted 14 lines · Liam R. Howlett

Since this script is meant to be sourced, shwordsplit has to be explicitly set to ensure the variable MANAGE is set correctly and functions independent of the users shwordsplit setting.

---
  bin/toaster | 1 +
  1 file changed, 1 insertion(+)
bin/toaster +0 -0
index 66157d0..038e93b 100755

bin/toaster if [ -n "$BASH_SOURCE" ] ; then · line 136

Quoted 7 lines
bin/toaster +1 -0
@@ -130,6 +130,7 @@ if [ -n "$BASH_SOURCE" ] ; then
      TOASTER=${BASH_SOURCE}
  elif [ -n "$ZSH_NAME" ] ; then
      TOASTER=${(%):-%x}
+    set -o shwordsplit
  else
      TOASTER=$0
  fi

Thanks for these patches. Both look fine to me.

If you have patches for Toaster in the future we usually review them on the toaster mailing list first and then the reviewer sends them to bitbake-devel.

For more info please see https://wiki.yoctoproject.org/wiki/Contribute_to_Toaster

Michael

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.