[oe-commits] Esquivel, Benjamin : oe-init-build-env-memres: Fix source check

git at git.openembedded.org git at git.openembedded.org
Fri Mar 20 11:10:03 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 1666b41e73f2aa7bd736c3e9bf3797946bff61b5
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=1666b41e73f2aa7bd736c3e9bf3797946bff61b5

Author: Esquivel, Benjamin <benjamin.esquivel at intel.com>
Date:   Thu Mar 19 20:31:41 2015 +0000

oe-init-build-env-memres: Fix source check

The source check was referring to oe-init-build-env instead of the
memres. It could be executed without the proper failure message and the
corresponding exit command out of the script. This commit makes the
memres script look more like the oe-init-build-env with the correct
script name.

[YOCTO #7487]

Signed-off-by: Benjamin Esquivel <benjamin.esquivel at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 oe-init-build-env-memres | 45 +++++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 20 deletions(-)

diff --git a/oe-init-build-env-memres b/oe-init-build-env-memres
index 9b9e0f4..c1dc4fe 100755
--- a/oe-init-build-env-memres
+++ b/oe-init-build-env-memres
@@ -32,28 +32,33 @@ else
     port=$1
     shift
 fi
-if [ -z "$ZSH_NAME" ] && [ "x$0" = "x./oe-init-build-env" ]; then
-   echo "Error: This script needs to be sourced. Please run as '. ./oe-init-build-env'"
+
+if [ -n "$BASH_SOURCE" ]; then
+  OEROOT="`dirname $BASH_SOURCE`"
+elif [ -n "$ZSH_NAME" ]; then
+  OEROOT="`dirname $0`"
 else
-   if [ -n "$BASH_SOURCE" ]; then
-      OEROOT="`dirname $BASH_SOURCE`"
-   elif [ -n "$ZSH_NAME" ]; then
-      OEROOT="`dirname $0`"
-   else
-      OEROOT="`pwd`"
-   fi
-   if [ -n "$BBSERVER" ]; then
-      unset BBSERVER
-   fi
-            
-   OEROOT=`readlink -f "$OEROOT"`
-   export OEROOT
-   . $OEROOT/scripts/oe-buildenv-internal && \
-        $OEROOT/scripts/oe-setup-builddir && \
-        [ -n "$BUILDDIR" ] && cd $BUILDDIR
-   unset OEROOT
-   unset BBPATH
+  OEROOT="`pwd`"
+fi
+if [ -n "$BBSERVER" ]; then
+  unset BBSERVER
+fi
+
+THIS_SCRIPT=$OEROOT/oe-init-build-env-memres
+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
 fi
+
+OEROOT=`readlink -f "$OEROOT"`
+export OEROOT
+. $OEROOT/scripts/oe-buildenv-internal && \
+    $OEROOT/scripts/oe-setup-builddir && \
+    [ -n "$BUILDDIR" ] && cd $BUILDDIR
+unset OEROOT
+unset BBPATH
+unset THIS_SCRIPT
+
 res=1
 if [ -e bitbake.lock ] && grep : bitbake.lock > /dev/null ; then
     BBSERVER=`cat bitbake.lock` bitbake --status-only



More information about the Openembedded-commits mailing list