diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2019-02-24 21:07:28 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-25 16:35:33 +0000 |
commit | 984a4def83b7a29c975de838ce0b0e199c4bd9d5 (patch) | |
tree | dfd3c267af102fd898fb180c0b075a63ad46859f /bitbake | |
parent | 0a96ea9134aa392393b9f2913a97f2ab9cafb909 (diff) | |
download | poky-984a4def83b7a29c975de838ce0b0e199c4bd9d5.tar.gz |
bitbake: bitbake: fix version comparison when one of the versions ends in .
Previously, this would happen:
======================================================================
ERROR: test_vercmpstring (bb.tests.utils.VerCmpString)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alexander/development/poky/bitbake/lib/bb/tests/utils.py", line 45, in test_vercmpstring
result = bb.utils.vercmp_string('1.', '1.1')
File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 143, in vercmp_string
return vercmp(ta, tb)
File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 135, in vercmp
r = vercmp_part(va, vb)
File "/home/alexander/development/poky/bitbake/lib/bb/utils.py", line 124, in vercmp_part
elif ca < cb:
TypeError: '<' not supported between instances of 'NoneType' and 'int'
----------------------------------------------------------------------
(Bitbake rev: fef56d28c3efec4876c379898cbc4d4c65303aee)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/tests/utils.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/utils.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py index 2f4ccf3c62..f1cd83a419 100644 --- a/bitbake/lib/bb/tests/utils.py +++ b/bitbake/lib/bb/tests/utils.py | |||
@@ -42,6 +42,10 @@ class VerCmpString(unittest.TestCase): | |||
42 | self.assertTrue(result < 0) | 42 | self.assertTrue(result < 0) |
43 | result = bb.utils.vercmp_string('1.1', '1.0+1.1-beta1') | 43 | result = bb.utils.vercmp_string('1.1', '1.0+1.1-beta1') |
44 | self.assertTrue(result > 0) | 44 | self.assertTrue(result > 0) |
45 | result = bb.utils.vercmp_string('1.', '1.1') | ||
46 | self.assertTrue(result < 0) | ||
47 | result = bb.utils.vercmp_string('1.1', '1.') | ||
48 | self.assertTrue(result > 0) | ||
45 | 49 | ||
46 | def test_explode_dep_versions(self): | 50 | def test_explode_dep_versions(self): |
47 | correctresult = {"foo" : ["= 1.10"]} | 51 | correctresult = {"foo" : ["= 1.10"]} |
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 9cb702dbb7..b652a6838a 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -121,6 +121,10 @@ def vercmp_part(a, b): | |||
121 | return -1 | 121 | return -1 |
122 | elif oa > ob: | 122 | elif oa > ob: |
123 | return 1 | 123 | return 1 |
124 | elif ca is None: | ||
125 | return -1 | ||
126 | elif cb is None: | ||
127 | return 1 | ||
124 | elif ca < cb: | 128 | elif ca < cb: |
125 | return -1 | 129 | return -1 |
126 | elif ca > cb: | 130 | elif ca > cb: |