mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
[python3] fix decoding for packageqeury.py
name, arch, version and release need to be decoded
This commit is contained in:
parent
2d5a3aeb3b
commit
c6d3870942
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
from osc.util.helper import decode_it
|
||||||
|
|
||||||
class PackageError(Exception):
|
class PackageError(Exception):
|
||||||
"""base class for all package related errors"""
|
"""base class for all package related errors"""
|
||||||
@ -30,11 +31,11 @@ class PackageQueries(dict):
|
|||||||
self.__setitem__(query.name(), query)
|
self.__setitem__(query.name(), query)
|
||||||
|
|
||||||
def __setitem__(self, name, query):
|
def __setitem__(self, name, query):
|
||||||
if name != query.name():
|
if decode_it(name) != decode_it(query.name()):
|
||||||
raise ValueError("key '%s' does not match "
|
raise ValueError("key '%s' does not match "
|
||||||
"package query name '%s'" % (name, query.name()))
|
"package query name '%s'" % (name, query.name()))
|
||||||
|
|
||||||
architecture = query.arch()
|
architecture = decode_it(query.arch())
|
||||||
|
|
||||||
if (architecture in [self.wanted_architecture, 'noarch', 'all', 'any']
|
if (architecture in [self.wanted_architecture, 'noarch', 'all', 'any']
|
||||||
or self.wanted_architecture in self.architectureMap.get(architecture,
|
or self.wanted_architecture in self.architectureMap.get(architecture,
|
||||||
@ -149,16 +150,21 @@ class PackageQueryResult:
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def evr(self):
|
def evr(self):
|
||||||
evr = self.version()
|
evr = decode_it(self.version())
|
||||||
|
|
||||||
if self.release():
|
if self.release():
|
||||||
evr += "-" + self.release()
|
evr += "-" + decode_it(self.release())
|
||||||
|
|
||||||
epoch = self.epoch()
|
epoch = self.epoch()
|
||||||
if epoch is not None and epoch != 0:
|
if epoch is not None and epoch != 0:
|
||||||
evr = epoch + ":" + evr
|
evr = epoch + ":" + evr
|
||||||
return evr
|
return evr
|
||||||
|
|
||||||
|
|
||||||
|
def cmp(a, b):
|
||||||
|
return (a > b) - (a < b)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
import sys
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user