diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-12-09 19:56:43 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-14 23:13:08 +0000 |
commit | 4ff0d60ea851d74b74e3521d8a94be7e523b72c5 (patch) | |
tree | 224732df909db8825bf4a4ff56c00563e401e4e8 | |
parent | 4a784169437c94feb8a0e909515e9cf23236df8c (diff) | |
download | poky-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>
-rwxr-xr-x | bitbake/bin/toaster | 24 | ||||
-rw-r--r-- | bitbake/toaster-requirements.txt | 2 |
2 files changed, 11 insertions, 15 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index 7645c56b15..1c1e029838 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster | |||
@@ -156,16 +156,15 @@ notify_chldexit() { | |||
156 | 156 | ||
157 | 157 | ||
158 | verify_prereq() { | 158 | verify_prereq() { |
159 | # Verify prerequisites | 159 | # Verify Django version |
160 | regex="([0-9])\.([0-9])" | 160 | reqfile=$(python -c "import os; print os.path.realpath('$BBBASEDIR/toaster-requirements.txt')") |
161 | for line in `cat $BBBASEDIR/toaster-requirements.txt | grep Django` ; do | 161 | exp='s/Django\([><=]\+\)\([^,]\+\),\([><=]\+\)\(.\+\)/' |
162 | [[ `echo $line` =~ $regex ]] | 162 | exp=$exp'import sys,django;version=django.get_version().split(".");' |
163 | required_major_version="${BASH_REMATCH[1]}" | 163 | exp=$exp'sys.exit(not (version \1 "\2".split(".") and version \3 "\4".split(".")))/p' |
164 | required_minor_version="${BASH_REMATCH[2]}" | 164 | if ! sed -n "$exp" $reqfile | python - ; then |
165 | done | 165 | req=`grep ^Django $reqfile` |
166 | 166 | echo "This program needs $req" | |
167 | 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 | 167 | echo "Please install with pip install -r $reqfile" |
168 | printf "This program needs Django $required_major_version.$required_minor_version. Please install with\n\npip install -r $BBBASEDIR/toaster-requirements.txt\n" | ||
169 | return 2 | 168 | return 2 |
170 | fi | 169 | fi |
171 | 170 | ||
@@ -265,10 +264,7 @@ if [ "$1" = 'restart-bitbake' ] ; then | |||
265 | return $rc | 264 | return $rc |
266 | fi | 265 | fi |
267 | 266 | ||
268 | if ! verify_prereq; then | 267 | verify_prereq || return 1 |
269 | 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 | ||
270 | return 1 | ||
271 | fi | ||
272 | 268 | ||
273 | # We make sure we're running in the current shell and in a good environment | 269 | # We make sure we're running in the current shell and in a good environment |
274 | if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then | 270 | if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then |
diff --git a/bitbake/toaster-requirements.txt b/bitbake/toaster-requirements.txt index 5d34494d54..0e8c742cb9 100644 --- a/bitbake/toaster-requirements.txt +++ b/bitbake/toaster-requirements.txt | |||
@@ -1,4 +1,4 @@ | |||
1 | Django==1.8.6 | 1 | Django>1.8,<1.9 |
2 | argparse==1.2.1 | 2 | argparse==1.2.1 |
3 | wsgiref==0.1.2 | 3 | wsgiref==0.1.2 |
4 | beautifulsoup4>=4.4.0 | 4 | beautifulsoup4>=4.4.0 |