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>
This commit is contained in:
Alexander Kanavin 2019-02-24 21:07:28 +01:00 committed by Richard Purdie
parent 0a96ea9134
commit 984a4def83
2 changed files with 8 additions and 0 deletions

View File

@ -42,6 +42,10 @@ class VerCmpString(unittest.TestCase):
self.assertTrue(result < 0)
result = bb.utils.vercmp_string('1.1', '1.0+1.1-beta1')
self.assertTrue(result > 0)
result = bb.utils.vercmp_string('1.', '1.1')
self.assertTrue(result < 0)
result = bb.utils.vercmp_string('1.1', '1.')
self.assertTrue(result > 0)
def test_explode_dep_versions(self):
correctresult = {"foo" : ["= 1.10"]}

View File

@ -121,6 +121,10 @@ def vercmp_part(a, b):
return -1
elif oa > ob:
return 1
elif ca is None:
return -1
elif cb is None:
return 1
elif ca < cb:
return -1
elif ca > cb: