diff options
author | Peter Kjellerstedt <pkj@axis.com> | 2016-03-15 17:58:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-20 23:12:30 +0000 |
commit | 76f10fd0469805553153684bc64c9120ea8ffd11 (patch) | |
tree | 08c14c7b783d827629960a2a17749354114a534f /scripts/oe-buildenv-internal | |
parent | 4d1efc38ca1485b18da63d5aff3803fe2959c225 (diff) | |
download | poky-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-x | scripts/oe-buildenv-internal | 46 |
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 |
25 | fi | 25 | fi |
26 | 26 | ||
27 | if [ -z "$OE_SKIP_SDK_CHECK" -a ! -z "$OECORE_SDK_VERSION" ]; then | 27 | if [ -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 |
30 | fi | 30 | fi |
@@ -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. |
36 | py_v3_check=`/usr/bin/env python --version 2>&1 | grep "Python 3"` | 36 | py_v3_check=$(/usr/bin/env python --version 2>&1 | grep "Python 3") |
37 | if [ "$py_v3_check" != "" ]; then | 37 | if [ -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 |
41 | fi | 41 | fi |
42 | unset 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. |
46 | py_v26_check=`python -c 'import sys; print sys.version_info >= (2,7,3)'` | 47 | py_v26_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)') |
47 | if [ "$py_v26_check" != "True" ]; then | 48 | if [ "$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 |
50 | fi | 51 | fi |
52 | unset py_v26_check | ||
51 | 53 | ||
52 | if [ "x$BDIR" = "x" ]; then | 54 | if [ -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 |
77 | fi | 79 | fi |
78 | if expr "$BDIR" : '/.*' > /dev/null ; then | 80 | if [ "${BDIR#/}" != "$BDIR" ]; then |
79 | BUILDDIR="$BDIR" | 81 | BUILDDIR="$BDIR" |
80 | else | 82 | else |
81 | BUILDDIR="`pwd`/$BDIR" | 83 | BUILDDIR="$(pwd)/$BDIR" |
82 | fi | 84 | fi |
83 | unset BDIR | 85 | unset BDIR |
84 | 86 | ||
85 | if [ "x$BITBAKEDIR" = "x" ]; then | 87 | if [ -z "$BITBAKEDIR" ]; then |
86 | BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/" | 88 | BITBAKEDIR="$OEROOT/bitbake$BBEXTRA" |
87 | fi | 89 | fi |
88 | 90 | ||
89 | BITBAKEDIR=`readlink -f "$BITBAKEDIR"` | 91 | BITBAKEDIR=$(readlink -f "$BITBAKEDIR") |
90 | BUILDDIR=`readlink -f "$BUILDDIR"` | 92 | BUILDDIR=$(readlink -f "$BUILDDIR") |
91 | 93 | ||
92 | if ! (test -d "$BITBAKEDIR"); then | 94 | if [ ! -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 |
95 | fi | 97 | fi |