[oe-commits] [openembedded-core] 48/66: oe-init-build-env*: Remove unnecessary differences between the scripts

git at git.openembedded.org git at git.openembedded.org
Sun Mar 20 23:13:59 UTC 2016


rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 1295d413f27941d0763a3d58982378738bf3ca06
Author: Peter Kjellerstedt <pkj at axis.com>
AuthorDate: Tue Mar 15 16:04:11 2016 +0100

    oe-init-build-env*: Remove unnecessary differences between the scripts
    
    While at it, also fix:
    * consistent indentation (four spaces)
    * unset temporary variables
    * use $(...) instead of `...`
    
    Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 oe-init-build-env        | 21 ++++++++++-----------
 oe-init-build-env-memres | 30 +++++++++++++++---------------
 2 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/oe-init-build-env b/oe-init-build-env
index fa9eacd..0b4df1b 100755
--- a/oe-init-build-env
+++ b/oe-init-build-env
@@ -33,12 +33,12 @@ else
     THIS_SCRIPT="$(pwd)/oe-init-build-env"
 fi
 if [ -n "$BBSERVER" ]; then
-   unset BBSERVER
+    unset BBSERVER
 fi
 
 if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
-   echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
-   exit 1
+    echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
+    exit 1
 fi
 
 if [ -z "$OEROOT" ]; then
@@ -49,16 +49,15 @@ unset THIS_SCRIPT
 
 export OEROOT
 . $OEROOT/scripts/oe-buildenv-internal && \
-     TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir && \
-     [ -n "$BUILDDIR" ] && cd "$BUILDDIR"
+    TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir && \
+    [ -n "$BUILDDIR" ] && cd "$BUILDDIR"
 unset OEROOT
 
 # Shutdown any bitbake server if the BBSERVER variable is not set
-if [ -z "$BBSERVER" ] && [ -f bitbake.lock ] ; then
-    grep ":" bitbake.lock > /dev/null && BBSERVER=`cat bitbake.lock` bitbake --status-only
-    if [ $? = 0 ] ; then
-	echo "Shutting down bitbake memory resident server with bitbake -m"
-	BBSERVER=`cat bitbake.lock` bitbake -m
+if [ -z "$BBSERVER" ] && [ -f bitbake.lock ]; then
+    grep ":" bitbake.lock > /dev/null && BBSERVER=$(cat bitbake.lock) bitbake --status-only
+    if [ $? = 0 ]; then
+        echo "Shutting down bitbake memory resident server with bitbake -m"
+        BBSERVER=$(cat bitbake.lock) bitbake -m
     fi
 fi
-
diff --git a/oe-init-build-env-memres b/oe-init-build-env-memres
index 41c09d8..9d393f5 100755
--- a/oe-init-build-env-memres
+++ b/oe-init-build-env-memres
@@ -41,12 +41,12 @@ else
     THIS_SCRIPT="$(pwd)/oe-init-build-env"
 fi
 if [ -n "$BBSERVER" ]; then
-  unset BBSERVER
+    unset BBSERVER
 fi
 
-if [ -z "$ZSH_NAME" ] && [ "x$0" = "x$THIS_SCRIPT" ]; then
-   echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
-   exit 1
+if [ -z "$ZSH_NAME" ] && [ "$0" = "$THIS_SCRIPT" ]; then
+    echo "Error: This script needs to be sourced. Please run as '. $THIS_SCRIPT'"
+    exit 1
 fi
 
 if [ -z "$OEROOT" ]; then
@@ -57,30 +57,30 @@ unset THIS_SCRIPT
 
 export OEROOT
 . $OEROOT/scripts/oe-buildenv-internal && \
-    $OEROOT/scripts/oe-setup-builddir && \
-    [ -n "$BUILDDIR" ] && cd $BUILDDIR
+    TEMPLATECONF="$TEMPLATECONF" $OEROOT/scripts/oe-setup-builddir && \
+    [ -n "$BUILDDIR" ] && cd "$BUILDDIR"
 unset OEROOT
 
 res=1
-if [ -e bitbake.lock ] && grep : bitbake.lock > /dev/null ; then
-    BBSERVER=`cat bitbake.lock` bitbake --status-only
+if [ -e bitbake.lock ] && grep : bitbake.lock > /dev/null; then
+    BBSERVER=$(cat bitbake.lock) bitbake --status-only
     res=$?
 fi
 
-if [ $res != 0 ] ; then
+if [ $res != 0 ]; then
     bitbake --server-only -t xmlrpc -B localhost:$port
 fi
 
-if [ $port = -1 ] ; then
+if [ $port = -1 ]; then
     export BBSERVER=localhost:-1
     echo "Bitbake server started on demand as needed, use bitbake -m to shut it down"
 else
-    export BBSERVER=`cat bitbake.lock`
+    export BBSERVER=$(cat bitbake.lock)
 
-    if [ $res = 0 ] ; then
-	echo "Using existing bitbake server at: $BBSERVER, use bitbake -m to shut it down"
+    if [ $res = 0 ]; then
+        echo "Using existing bitbake server at: $BBSERVER, use bitbake -m to shut it down"
     else
-	echo "Bitbake server started at: $BBSERVER, use bitbake -m to shut it down"
+        echo "Bitbake server started at: $BBSERVER, use bitbake -m to shut it down"
     fi
-    unset res
 fi
+unset port res

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list