summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 3017ecfa4a..5fc1463e67 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -21,8 +21,9 @@ BitBake Utility Functions
21 21
22digits = "0123456789" 22digits = "0123456789"
23ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 23ascii_letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
24separators = ".-"
24 25
25import re, fcntl, os 26import re, fcntl, os, types
26 27
27def explode_version(s): 28def explode_version(s):
28 r = [] 29 r = []
@@ -39,12 +40,15 @@ def explode_version(s):
39 r.append(m.group(1)) 40 r.append(m.group(1))
40 s = m.group(2) 41 s = m.group(2)
41 continue 42 continue
43 r.append(s[0])
42 s = s[1:] 44 s = s[1:]
43 return r 45 return r
44 46
45def vercmp_part(a, b): 47def vercmp_part(a, b):
46 va = explode_version(a) 48 va = explode_version(a)
47 vb = explode_version(b) 49 vb = explode_version(b)
50 sa = False
51 sb = False
48 while True: 52 while True:
49 if va == []: 53 if va == []:
50 ca = None 54 ca = None
@@ -56,6 +60,16 @@ def vercmp_part(a, b):
56 cb = vb.pop(0) 60 cb = vb.pop(0)
57 if ca == None and cb == None: 61 if ca == None and cb == None:
58 return 0 62 return 0
63
64 if type(ca) is types.StringType:
65 sa = ca in separators
66 if type(cb) is types.StringType:
67 sb = cb in separators
68 if sa and not sb:
69 return -1
70 if not sa and sb:
71 return 1
72
59 if ca > cb: 73 if ca > cb:
60 return 1 74 return 1
61 if ca < cb: 75 if ca < cb:
@@ -151,7 +165,7 @@ def better_compile(text, file, realfile):
151 165
152 # split the text into lines again 166 # split the text into lines again
153 body = text.split('\n') 167 body = text.split('\n')
154 bb.msg.error(bb.msg.domain.Util, "Error in compiling: ", realfile) 168 bb.msg.error(bb.msg.domain.Util, "Error in compiling python function in: ", realfile)
155 bb.msg.error(bb.msg.domain.Util, "The lines resulting into this error were:") 169 bb.msg.error(bb.msg.domain.Util, "The lines resulting into this error were:")
156 bb.msg.error(bb.msg.domain.Util, "\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1])) 170 bb.msg.error(bb.msg.domain.Util, "\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1]))
157 171
@@ -176,7 +190,7 @@ def better_exec(code, context, text, realfile):
176 raise 190 raise
177 191
178 # print the Header of the Error Message 192 # print the Header of the Error Message
179 bb.msg.error(bb.msg.domain.Util, "Error in executing: %s" % realfile) 193 bb.msg.error(bb.msg.domain.Util, "Error in executing python function in: %s" % realfile)
180 bb.msg.error(bb.msg.domain.Util, "Exception:%s Message:%s" % (t,value) ) 194 bb.msg.error(bb.msg.domain.Util, "Exception:%s Message:%s" % (t,value) )
181 195
182 # let us find the line number now 196 # let us find the line number now