summaryrefslogtreecommitdiff
path: root/scripts/oe-buildenv-internal
diff options
context:
space:
mode:
authorDexuan Cui <dexuan.cui@intel.com>2011-08-04 14:53:20 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-10 13:21:02 +0100
commit074ca832c0274e0e92698b4d006ef2708be105b8 (patch)
treea8c16bdb1c434191343b5dc3ea4f0ef064c07498 /scripts/oe-buildenv-internal
parent34f2b2a207df8013f70a6de5a5f7e911ee2a8d71 (diff)
downloadopenembedded-core-074ca832c0274e0e92698b4d006ef2708be105b8.tar.gz
openembedded-core-074ca832c0274e0e92698b4d006ef2708be105b8.tar.bz2
openembedded-core-074ca832c0274e0e92698b4d006ef2708be105b8.tar.xz
openembedded-core-074ca832c0274e0e92698b4d006ef2708be105b8.zip
scripts/oe-buildenv-internal: improve the error detecting for $BDIR
The previous fix for a bug in Ubuntu 10.04 readlink, be2a2764d8ceb398d81714661e6f199c8b11946c, notified the user when a trailing slash was used. As there is no semantic difference, simply remove any trailing slashes and proceed without nagging the user. See [YOCTO #671] for more details. Signed-off-by: Dexuan Cui <dexuan.cui@intel.com> Acked-by: Darren Hart <dvhart@linux.intel.com> Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'scripts/oe-buildenv-internal')
-rwxr-xr-xscripts/oe-buildenv-internal23
1 files changed, 15 insertions, 8 deletions
diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
index 117b0c593..61ac18c14 100755
--- a/scripts/oe-buildenv-internal
+++ b/scripts/oe-buildenv-internal
@@ -28,14 +28,21 @@ if [ "x$BDIR" = "x" ]; then
if [ "x$1" = "x" ]; then
BDIR="build"
else
- BDIR=`readlink -f "$1"`
- if [ -z "$BDIR" ]; then
- if expr "$1" : '.*/$' >/dev/null; then
- echo >&2 "Error: please remove any trailing / in the argument."
- else
- PARENTDIR=`dirname "$1"`
- echo >&2 "Error: the directory $PARENTDIR doesn't exist?"
- fi
+ BDIR="$1"
+ if [ "$BDIR" = "/" ]; then
+ echo >&2 "Error: / is not supported as a build directory."
+ return 1
+ fi
+
+ # Remove any possible trailing slashes. This is used to work around
+ # buggy readlink in Ubuntu 10.04 that doesn't ignore trailing slashes
+ # and hence "readlink -f new_dir_to_be_created/" returns empty.
+ BDIR=`echo $BDIR | sed -re 's|/+$||'`
+
+ BDIR=`readlink -f "$BDIR"`
+ if [ -z "$BDIR" ]; then
+ PARENTDIR=`dirname "$1"`
+ echo >&2 "Error: the directory $PARENTDIR does not exist?"
return 1
fi
fi