summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2012-07-30 09:08:46 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-31 11:38:18 +0100
commitf28f6267271edbbef16caec323e9ba76e2216723 (patch)
treea7d357807fc83a8c00905cc5a4007acd01d7bc50 /scripts
parentb3ef5a986e3bc1a29ba2b4a25d063a0267e2f72f (diff)
downloadopenembedded-core-contrib-f28f6267271edbbef16caec323e9ba76e2216723.tar.gz
scripts/bitbake: unbreak the git version comparison
With the current code, we're calling awk to do a floating point comparison between '1.7.0.4' and '1.7.5' (on an ubuntu 10.04 LTS machine). These clearly aren't proper floating point numbers, and the comparison is incorrect. It's returning true for 1.7.0.4 >= 1.7.5. Instead of using a floating point comparison for this, call out to python and let it do it. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bitbake5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/bitbake b/scripts/bitbake
index 580f377a61..09f8a86240 100755
--- a/scripts/bitbake
+++ b/scripts/bitbake
@@ -64,13 +64,16 @@ GITVERSION=`git --version | cut -d ' ' -f 3`
float_test() {
echo | awk 'END { exit ( !( '"$1"')); }'
}
+version_compare() {
+ python -c "from distutils.version import LooseVersion; import sys; sys.exit(not (LooseVersion('$1') $2 LooseVersion('$3')))"
+}
# Tar version 1.24 and onwards handle overwriting symlinks correctly
# but earlier versions do not; this needs to work properly for sstate
float_test "$TARVERSION > 1.23" && needtar="0"
# Need git >= 1.7.5 for git-remote --mirror=xxx syntax
-float_test "$GITVERSION >= 1.7.5" && needgit="0"
+version_compare $GITVERSION ">=" 1.7.5 && needgit="0"
buildpseudo="1"