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.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 7ba1234578..5ac9bcfbd4 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -131,6 +131,28 @@ def vercmp_string(a, b):
131 tb = split_version(b) 131 tb = split_version(b)
132 return vercmp(ta, tb) 132 return vercmp(ta, tb)
133 133
134def vercmp_string_op(a, b, op):
135 """
136 Compare two versions and check if the specified comparison operator matches the result of the comparison.
137 This function is fairly liberal about what operators it will accept since there are a variety of styles
138 depending on the context.
139 """
140 res = vercmp_string(a, b)
141 if op in ('=', '=='):
142 return res == 0
143 elif op == '<=':
144 return res <= 0
145 elif op == '>=':
146 return res >= 0
147 elif op in ('>', '>>'):
148 return res > 0
149 elif op in ('<', '<<'):
150 return res < 0
151 elif op == '!=':
152 return res != 0
153 else:
154 raise VersionStringException('Unsupported comparison operator "%s"' % op)
155
134def explode_deps(s): 156def explode_deps(s):
135 """ 157 """
136 Take an RDEPENDS style string of format: 158 Take an RDEPENDS style string of format: