aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-12-09 19:56:43 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-14 23:13:08 +0000
commit4ff0d60ea851d74b74e3521d8a94be7e523b72c5 (patch)
tree224732df909db8825bf4a4ff56c00563e401e4e8 /bitbake/bin
parent4a784169437c94feb8a0e909515e9cf23236df8c (diff)
downloadopenembedded-core-contrib-4ff0d60ea851d74b74e3521d8a94be7e523b72c5.tar.gz
bitbake: toaster: rework checking of Django version
Checked django version considering information from toaster-requirements.txt, e.g. if requirements file contains line "Django>1.8,<1.9" toaster should be able to check that requirement correctly. (Bitbake rev: 49976eca4a6e37e7653814c569badcd3e0fb719a) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/toaster24
1 files changed, 10 insertions, 14 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 7645c56b151..1c1e0298383 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -156,16 +156,15 @@ notify_chldexit() {
verify_prereq() {
- # Verify prerequisites
- regex="([0-9])\.([0-9])"
- for line in `cat $BBBASEDIR/toaster-requirements.txt | grep Django` ; do
- [[ `echo $line` =~ $regex ]]
- required_major_version="${BASH_REMATCH[1]}"
- required_minor_version="${BASH_REMATCH[2]}"
- done
-
- if ! echo "import django; print ($required_major_version,) == django.VERSION[0:1] and django.VERSION[1:2][0] in ($required_minor_version,)" | python 2>/dev/null | grep True >/dev/null; then
- printf "This program needs Django $required_major_version.$required_minor_version. Please install with\n\npip install -r $BBBASEDIR/toaster-requirements.txt\n"
+ # Verify Django version
+ reqfile=$(python -c "import os; print os.path.realpath('$BBBASEDIR/toaster-requirements.txt')")
+ exp='s/Django\([><=]\+\)\([^,]\+\),\([><=]\+\)\(.\+\)/'
+ exp=$exp'import sys,django;version=django.get_version().split(".");'
+ exp=$exp'sys.exit(not (version \1 "\2".split(".") and version \3 "\4".split(".")))/p'
+ if ! sed -n "$exp" $reqfile | python - ; then
+ req=`grep ^Django $reqfile`
+ echo "This program needs $req"
+ echo "Please install with pip install -r $reqfile"
return 2
fi
@@ -265,10 +264,7 @@ if [ "$1" = 'restart-bitbake' ] ; then
return $rc
fi
-if ! verify_prereq; then
- echo "Error: Could not verify that the needed dependencies are installed. Please use virtualenv and pip to install dependencies listed in toaster-requirements.txt" 1>&2
- return 1
-fi
+verify_prereq || return 1
# We make sure we're running in the current shell and in a good environment
if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then