summaryrefslogtreecommitdiffstats
path: root/scripts/oe-buildenv-internal
diff options
context:
space:
mode:
authorPeter Kjellerstedt <pkj@axis.com>2016-03-15 17:58:07 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-20 23:12:30 +0000
commit76f10fd0469805553153684bc64c9120ea8ffd11 (patch)
tree08c14c7b783d827629960a2a17749354114a534f /scripts/oe-buildenv-internal
parent4d1efc38ca1485b18da63d5aff3803fe2959c225 (diff)
downloadpoky-76f10fd0469805553153684bc64c9120ea8ffd11.tar.gz
oe-buildenv-internal: Some clean up
* Consistent indentation (four spaces) * Use [ -z ...] and [ -n ... ] where possible * Unset temporary variables * Use $(...) instead of `...` * Avoid an unnecessary call to expr (From OE-Core rev: 791eec016792c3f4c04b12ae6ff93c1e23266f87) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-buildenv-internal')
-rwxr-xr-xscripts/oe-buildenv-internal46
1 files changed, 24 insertions, 22 deletions
diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
index 354501ed4b..bc6a4fedcd 100755
--- a/scripts/oe-buildenv-internal
+++ b/scripts/oe-buildenv-internal
@@ -24,7 +24,7 @@ if [ -z "$OEROOT" ]; then
24 return 1 24 return 1
25fi 25fi
26 26
27if [ -z "$OE_SKIP_SDK_CHECK" -a ! -z "$OECORE_SDK_VERSION" ]; then 27if [ -z "$OE_SKIP_SDK_CHECK" ] && [ -n "$OECORE_SDK_VERSION" ]; then
28 echo >&2 "Error: The OE SDK/ADT was detected as already being present in this shell environment. Please use a clean shell when sourcing this environment script." 28 echo >&2 "Error: The OE SDK/ADT was detected as already being present in this shell environment. Please use a clean shell when sourcing this environment script."
29 return 1 29 return 1
30fi 30fi
@@ -33,24 +33,26 @@ fi
33# sanity.bbclass because bitbake's source code doesn't even pass 33# sanity.bbclass because bitbake's source code doesn't even pass
34# parsing stage when used with python v3, so we catch it here so we 34# parsing stage when used with python v3, so we catch it here so we
35# can offer a meaningful error message. 35# can offer a meaningful error message.
36py_v3_check=`/usr/bin/env python --version 2>&1 | grep "Python 3"` 36py_v3_check=$(/usr/bin/env python --version 2>&1 | grep "Python 3")
37if [ "$py_v3_check" != "" ]; then 37if [ -n "$py_v3_check" ]; then
38 echo >&2 "Bitbake is not compatible with python v3" 38 echo >&2 "Bitbake is not compatible with python v3"
39 echo >&2 "Please set up python v2 as your default python interpreter" 39 echo >&2 "Please set up python v2 as your default python interpreter"
40 return 1 40 return 1
41fi 41fi
42unset py_v3_check
42 43
43# Similarly, we now have code that doesn't parse correctly with older 44# Similarly, we now have code that doesn't parse correctly with older
44# versions of Python, and rather than fixing that and being eternally 45# versions of Python, and rather than fixing that and being eternally
45# vigilant for any other new feature use, just check the version here. 46# vigilant for any other new feature use, just check the version here.
46py_v26_check=`python -c 'import sys; print sys.version_info >= (2,7,3)'` 47py_v26_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)')
47if [ "$py_v26_check" != "True" ]; then 48if [ "$py_v26_check" != "True" ]; then
48 echo >&2 "BitBake requires Python 2.7.3 or later" 49 echo >&2 "BitBake requires Python 2.7.3 or later"
49 return 1 50 return 1
50fi 51fi
52unset py_v26_check
51 53
52if [ "x$BDIR" = "x" ]; then 54if [ -z "$BDIR" ]; then
53 if [ "x$1" = "x" ]; then 55 if [ -z "$1" ]; then
54 BDIR="build" 56 BDIR="build"
55 else 57 else
56 BDIR="$1" 58 BDIR="$1"
@@ -62,34 +64,34 @@ if [ "x$BDIR" = "x" ]; then
62 # Remove any possible trailing slashes. This is used to work around 64 # Remove any possible trailing slashes. This is used to work around
63 # buggy readlink in Ubuntu 10.04 that doesn't ignore trailing slashes 65 # buggy readlink in Ubuntu 10.04 that doesn't ignore trailing slashes
64 # and hence "readlink -f new_dir_to_be_created/" returns empty. 66 # and hence "readlink -f new_dir_to_be_created/" returns empty.
65 BDIR=`echo $BDIR | sed -re 's|/+$||'` 67 BDIR=$(echo $BDIR | sed -re 's|/+$||')
66 68
67 BDIR=`readlink -f "$BDIR"` 69 BDIR=$(readlink -f "$BDIR")
68 if [ -z "$BDIR" ]; then 70 if [ -z "$BDIR" ]; then
69 PARENTDIR=`dirname "$1"` 71 PARENTDIR=$(dirname "$1")
70 echo >&2 "Error: the directory $PARENTDIR does not exist?" 72 echo >&2 "Error: the directory $PARENTDIR does not exist?"
71 return 1 73 return 1
72 fi 74 fi
73 fi 75 fi
74 if [ "x$2" != "x" ]; then 76 if [ -n "$2" ]; then
75 BITBAKEDIR="$2" 77 BITBAKEDIR="$2"
76 fi 78 fi
77fi 79fi
78if expr "$BDIR" : '/.*' > /dev/null ; then 80if [ "${BDIR#/}" != "$BDIR" ]; then
79 BUILDDIR="$BDIR" 81 BUILDDIR="$BDIR"
80else 82else
81 BUILDDIR="`pwd`/$BDIR" 83 BUILDDIR="$(pwd)/$BDIR"
82fi 84fi
83unset BDIR 85unset BDIR
84 86
85if [ "x$BITBAKEDIR" = "x" ]; then 87if [ -z "$BITBAKEDIR" ]; then
86 BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/" 88 BITBAKEDIR="$OEROOT/bitbake$BBEXTRA"
87fi 89fi
88 90
89BITBAKEDIR=`readlink -f "$BITBAKEDIR"` 91BITBAKEDIR=$(readlink -f "$BITBAKEDIR")
90BUILDDIR=`readlink -f "$BUILDDIR"` 92BUILDDIR=$(readlink -f "$BUILDDIR")
91 93
92if ! (test -d "$BITBAKEDIR"); then 94if [ ! -d "$BITBAKEDIR" ]; then
93 echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location" 95 echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location"
94 return 1 96 return 1
95fi 97fi