Attempt to detect when pseudo-native has been updated. If it has been updated, or if the user is attempting an operation with pseudo-native in the name, force a build of pseudo-native, prior to running the main build. Note: This causes a build, then clean in the case of bitbake -c cleansstate pseudo-native (From OE-Core rev: f79184d4000708020f76d82330428b5e7a803642) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
4.3 KiB
Executable File
#!/bin/sh
export BBFETCH2=True export BB_ENV_EXTRAWHITE="PSEUDO_BUILD PSEUDO_DISABLED $BB_ENV_EXTRAWHITE"
NO_BUILD_OPTS="--version -h --help -p --parse-only -s --show-versions -e --environment -g --graphviz" PASSTHROUGH_OPTS="-D -DD -DDD -DDDD -v" needpseudo="1" for opt in $@; do for key in $NO_BUILD_OPTS; do if [ $opt = $key ] then needpseudo="0" break fi done [ $needpseudo = "0" ] && break done
Make sure we're not using python v3.x. This check can't go into
sanity.bbclass because bitbake's source code doesn't even pass
parsing stage when used with python v3, so we catch it here so we
can offer a meaningful error message.
py_v3_check=/usr/bin/env python --version 2>&1 | grep "Python 3"
if [ "$py_v3_check" != "" ]; then
echo "Bitbake is not compatible with python v3"
echo "Please set up python v2 as your default python interpreter"
exit 1
fi
Similarly, we now have code that doesn't parse correctly with older
versions of Python, and rather than fixing that and be eternally
vigilant for any other new feature use, just check the version here.
py_v26_check=python -c 'import sys; print sys.version_info >= (2,6,0)'
if [ "$py_v26_check" != "True" ]; then
echo "BitBake requires Python 2.6 or later"
exit 1
fi
needtar="1"
TARVERSION=tar --version | head -n 1 | cut -d ' ' -f 4
float_test() {
echo | awk 'END { exit ( !( '"$1"')); }'
}
Tar version 1.24 and onwards handle symlinks in sstate packages correctly
but earlier versions do not
float_test "$TARVERSION > 1.23" && needtar="0"
if [ "pwd" != "$BUILDDIR" ] ; then
echo "BitBake must be run from your build directory: $BUILDDIR"
exit 1
fi
buildpseudo="1"
if [ $needpseudo = "1" ] && [ -e "$BUILDDIR/pseudodone" ]; then
PSEUDOBINDIR=cat $BUILDDIR/pseudodone
if [ -e "$PSEUDOBINDIR/pseudo" ]; then
buildpseudo="0"
fi
# Verify that the pseudo recipes are older then the pseudodone file
PSEUDO_RECIPE="`dirname $0`/../meta/recipes-devtools/pseudo"
if [ $buildpseudo -eq 0 ] && [ ! -d "$PSEUDO_RECIPE" ]; then
echo "Unable to verify if pseudo-native is up to date..." >&2
elif [ $buildpseudo -eq 0 ]; then
PSEUDO_NEWER=`find $PSEUDO_RECIPE -type f -newer $BUILDDIR/pseudodone`
if [ -n "$PSEUDO_NEWER" ]; then
buildpseudo="2"
fi
fi
fi
If tar is already built, we don't want to do it again...
if [ -e "$PSEUDOBINDIR/tar" -a "$needtar" = "1" ]; then needtar="0" fi
if [ $needpseudo = "0" ]; then buildpseudo="0" fi
If pseudo-native is an argument, assume the user wants to build pseudo-native!
if [ $needpseudo != "0" -a $buildpseudo -eq 0 ]; then for opt in $@; do if [ "$opt" = "pseudo-native" ]; then buildpseudo="3" break fi done fi
OLDPATH=$PATH
export PATH=echo $PATH | sed s#[^:]*/scripts:##
if [ $buildpseudo -gt 0 ]; then
[ $buildpseudo -eq 1 ] && echo "Pseudo is not present but is required, building this first before the main build"
[ $buildpseudo -eq 2 ] && echo "Pseudo may be out of date, rebuilding pseudo before the main build"
[ $buildpseudo -eq 3 ] && echo "Building pseudo-native before main build"
export PSEUDO_BUILD=1
TARTARGET="tar-replacement-native"
if [ $needtar = "0" ]; then
TARTARGET=""
fi
# Pass through debug options
additionalopts=""
for opt in $@; do
for key in $PASSTHROUGH_OPTS; do
if [ $opt = $key ]
then
additionalopts="$additionalopts $opt"
break
fi
done
done
bitbake pseudo-native $TARTARGET $additionalopts -c populate_sysroot
ret=$?
if [ "$ret" != "0" ]; then
exit 1
fi
PSEUDOBINDIR=bitbake -e | grep STAGING_BINDIR_NATIVE=\" | cut -d '=' -f2 | cut -d '"' -f2
ret=$?
if [ "$ret" != "0" ]; then
exit 1
fi
echo $PSEUDOBINDIR > $BUILDDIR/pseudodone
# This needs to exist in case pseudo has to log somewhere
mkdir -p $PSEUDOBINDIR/../../var/pseudo
fi
BITBAKE=which bitbake
export PATH=$OLDPATH
if [ $needpseudo = "1" ]; then
export PSEUDO_BUILD=2
PSEUDOBINDIR=cat $BUILDDIR/pseudodone
PSEUDO_BINDIR=$PSEUDOBINDIR PSEUDO_LIBDIR=$PSEUDOBINDIR/../lib/pseudo/lib PSEUDO_PREFIX=$PSEUDOBINDIR/../../ PSEUDO_DISABLED=1 $PSEUDOBINDIR/pseudo $BITBAKE $@
else
export PSEUDO_BUILD=0
$BITBAKE $@
fi
ret=$?
exit $ret