summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDexuan Cui <dexuan.cui@intel.com>2011-08-02 14:08:32 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-02 14:32:10 +0100
commitbe2a2764d8ceb398d81714661e6f199c8b11946c (patch)
treea1a704af82c22a85fd1b3191a0118518604ac4b8 /scripts
parent68bd81506fd258d8dfae077a719982f91c56dceb (diff)
downloadpoky-be2a2764d8ceb398d81714661e6f199c8b11946c.tar.gz
oe-init-build-env, scripts/oe-buildenv-internal: add error detecting for $BDIR
[YOCTO #671] "readlink -f" in Ubuntu 10.04 is buggy: it doesn't ignore a trailing / (e.g., "readlink -f /tmp/non-existent-dir/" returns nothing, but according to http://www.gnu.org/s/coreutils/manual/coreutils.pdf it should do that -- hence we get bug 671. It seems Ubuntu 10.10 or even later Ubuntu 11.04, and other Linux distributions(e.g., Open Suse 11.4) haven't such an issue. So I think we should detect this and ask Ubuntu 10.04 users to avoid supply a path with trailing slash here. Moreever, I also add the detection of non-existent path, e.g., source oe-init-build-env /non-existent-dir/build can be detected and we'll print an error msg. And, if we get errors in oe-buildenv-internal, we should stop the script and shouldn't further run. (From OE-Core rev: 651ccb3b031d9ccb8331505a51171372002230d9) Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/oe-buildenv-internal13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
index c13fc40f8b..117b0c593e 100755
--- a/scripts/oe-buildenv-internal
+++ b/scripts/oe-buildenv-internal
@@ -21,7 +21,7 @@
21# It is assumed OEROOT is already defined when this is called 21# It is assumed OEROOT is already defined when this is called
22if [ -z "$OEROOT" ]; then 22if [ -z "$OEROOT" ]; then
23 echo >&2 "Error: OEROOT is not defined!" 23 echo >&2 "Error: OEROOT is not defined!"
24 return 24 return 1
25fi 25fi
26 26
27if [ "x$BDIR" = "x" ]; then 27if [ "x$BDIR" = "x" ]; then
@@ -29,6 +29,15 @@ if [ "x$BDIR" = "x" ]; then
29 BDIR="build" 29 BDIR="build"
30 else 30 else
31 BDIR=`readlink -f "$1"` 31 BDIR=`readlink -f "$1"`
32 if [ -z "$BDIR" ]; then
33 if expr "$1" : '.*/$' >/dev/null; then
34 echo >&2 "Error: please remove any trailing / in the argument."
35 else
36 PARENTDIR=`dirname "$1"`
37 echo >&2 "Error: the directory $PARENTDIR doesn't exist?"
38 fi
39 return 1
40 fi
32 fi 41 fi
33fi 42fi
34if expr "$BDIR" : '/.*' > /dev/null ; then 43if expr "$BDIR" : '/.*' > /dev/null ; then
@@ -45,7 +54,7 @@ BUILDDIR=`readlink -f "$BUILDDIR"`
45 54
46if ! (test -d "$BITBAKEDIR"); then 55if ! (test -d "$BITBAKEDIR"); then
47 echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location" 56 echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location"
48 return 57 return 1
49fi 58fi
50 59
51PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH" 60PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH"