mirror of
https://git.yoctoproject.org/poky
synced 2026-06-04 02:00:04 +00:00
bitbake: prserv: increment 9 to 10 correctly
Previously, incrementing "0.9" would result in "0.1.0", which generally gets recognised as a lower version number. Even more surprising, incrementing "0.99" returned "0.1.0.0". This is due to the behaviour of the list function on a string object; it adds each character as an element in a new list, causing the new string '10' to become the list [ '1', '0' ]. Instead of converting a string to a list, add the string to a new list, and concatenate it with the existing list slice. And provide test cases for "0.9" -> "0.10" and related edge cases. (Bitbake rev: 96ddeefa88ff4c37e9ea096726a7cdca5b5b4572) Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
d016d18a9f
commit
de29354e84
@@ -84,6 +84,8 @@ class FunctionTests(unittest.TestCase):
|
||||
self.assertEqual(increase_revision("1.0"), "1.1")
|
||||
self.assertEqual(increase_revision("1.1.1"), "1.1.2")
|
||||
self.assertEqual(increase_revision("1.1.1.3"), "1.1.1.4")
|
||||
self.assertEqual(increase_revision("9"), "10")
|
||||
self.assertEqual(increase_revision("1.9"), "1.10")
|
||||
self.assertRaises(ValueError, increase_revision, "1.a")
|
||||
self.assertRaises(ValueError, increase_revision, "1.")
|
||||
self.assertRaises(ValueError, increase_revision, "")
|
||||
|
||||
Reference in New Issue
Block a user