1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

- RpmQuery.rpmvercmp: support tilde ('~')

This commit is contained in:
Marcus Huewe 2015-07-03 14:22:00 +02:00
parent e065c9b371
commit fa4f24f06b

View File

@ -286,11 +286,21 @@ class RpmQuery(packagequery.PackageQuery, packagequery.PackageQueryResult):
return 0
res = 0
while res == 0:
# remove all leading non alphanumeric chars
ver1 = re.sub('^[^a-zA-Z0-9]*', '', ver1)
ver2 = re.sub('^[^a-zA-Z0-9]*', '', ver2)
# remove all leading non alphanumeric or tilde chars
ver1 = re.sub('^[^a-zA-Z0-9~]*', '', ver1)
ver2 = re.sub('^[^a-zA-Z0-9~]*', '', ver2)
if ver1.startswith('~') or ver2.startswith('~'):
if not ver1.startswith('~'):
return 1
elif not ver2.startswith('~'):
return -1
ver1 = ver1[1:]
ver2 = ver2[1:]
continue
if not (len(ver1) and len(ver2)):
break
# check if we have a digits segment
mo1 = re.match('(\d+)', ver1)
mo2 = re.match('(\d+)', ver2)