Files
poky/scripts/oe-buildenv-internal
Dexuan Cui be2a2764d8 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>
2011-08-02 14:32:10 +01:00

68 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
# OE-Core Build Enviroment Setup Script
#
# Copyright (C) 2006-2011 Linux Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# It is assumed OEROOT is already defined when this is called
if [ -z "$OEROOT" ]; then
echo >&2 "Error: OEROOT is not defined!"
return 1
fi
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
return 1
fi
fi
fi
if expr "$BDIR" : '/.*' > /dev/null ; then
BUILDDIR="$BDIR"
else
BUILDDIR="`pwd`/$BDIR"
fi
unset BDIR
BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/"
BITBAKEDIR=`readlink -f "$BITBAKEDIR"`
BUILDDIR=`readlink -f "$BUILDDIR"`
if ! (test -d "$BITBAKEDIR"); then
echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location"
return 1
fi
PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH"
unset BITBAKEDIR
# Used by the runqemu script
export BUILDDIR
export PATH
export BB_ENV_EXTRAWHITE="MACHINE DISTRO TCMODE TCLIBC http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS PARALLEL_MAKE GIT_PROXY_COMMAND"