[oe-commits] [bitbake] branch 1.40 updated: bitbake: fix version comparison when one of the versions ends in .

git at git.openembedded.org git at git.openembedded.org
Sat Jun 15 10:07:26 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch 1.40
in repository bitbake.

The following commit(s) were added to refs/heads/1.40 by this push:
     new bd953d5  bitbake: fix version comparison when one of the versions ends in .
bd953d5 is described below

commit bd953d56d007a8bfa5ecb6e753da4abfb035f9f2
Author: Alexander Kanavin <alex.kanavin at gmail.com>
AuthorDate: Sat Jun 15 07:17:43 2019 +0000

    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'
    
    ----------------------------------------------------------------------
    
    Signed-off-by: Alexander Kanavin <alex.kanavin at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/tests/utils.py | 4 ++++
 lib/bb/utils.py       | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/lib/bb/tests/utils.py b/lib/bb/tests/utils.py
index 2f4ccf3..f1cd83a 100644
--- a/lib/bb/tests/utils.py
+++ b/lib/bb/tests/utils.py
@@ -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"]}
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 73b6cb4..215c18c 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -120,6 +120,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:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list