diff options
author | Denys Dmytriyenko <denis@denix.org> | 2009-10-12 04:00:47 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2009-11-08 19:20:38 +0000 |
commit | 186b73d6734254d195bde922398843065aab4fff (patch) | |
tree | 6f079bc840c41d3cefb2957d0eb6e20003b07414 | |
parent | d58d2735287bc5e93468d5e809c73bc5ddd33cd0 (diff) | |
download | bitbake-186b73d6734254d195bde922398843065aab4fff.tar.gz |
utils.py: add special handling for version delimiters
Make version comparison work properly for pre-releases and release-candidates,
when there is an extra suffix in the field, such as:
PV = "2.6.29+2.6.30-rc5-${PR}+gitr${SRCREV}"
More details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/26691
Signed-off-by: Denys Dmytriyenko <denis@denix.org>
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
-rw-r--r-- | lib/bb/utils.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 2469bd7ee..e6664e24e 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -21,8 +21,9 @@ BitBake Utility Functions digits = "0123456789" ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" +separators = ".-" -import re, fcntl, os +import re, fcntl, os, types def explode_version(s): r = [] @@ -39,12 +40,15 @@ def explode_version(s): r.append(m.group(1)) s = m.group(2) continue + r.append(s[0]) s = s[1:] return r def vercmp_part(a, b): va = explode_version(a) vb = explode_version(b) + sa = False + sb = False while True: if va == []: ca = None @@ -56,6 +60,16 @@ def vercmp_part(a, b): cb = vb.pop(0) if ca == None and cb == None: return 0 + + if type(ca) is types.StringType: + sa = ca in separators + if type(cb) is types.StringType: + sb = cb in separators + if sa and not sb: + return -1 + if not sa and sb: + return 1 + if ca > cb: return 1 if ca < cb: |