core: adapt checkrepo.get_package_list_from_repository() as binary_list().
- utilize osc.core.get_binarylist() instead of building query manually - return a namedtuple for increased readability
This commit is contained in:
parent
c2e950eebd
commit
03a8666fa4
@ -1,7 +1,10 @@
|
|||||||
|
from collections import namedtuple
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
|
import re
|
||||||
from xml.etree import cElementTree as ET
|
from xml.etree import cElementTree as ET
|
||||||
|
|
||||||
|
from osc.core import get_binarylist
|
||||||
from osc.core import get_dependson
|
from osc.core import get_dependson
|
||||||
from osc.core import http_GET
|
from osc.core import http_GET
|
||||||
from osc.core import makeurl
|
from osc.core import makeurl
|
||||||
@ -9,6 +12,8 @@ from osc.core import owner
|
|||||||
from osc.core import show_project_meta
|
from osc.core import show_project_meta
|
||||||
from osclib.memoize import memoize
|
from osclib.memoize import memoize
|
||||||
|
|
||||||
|
BinaryParsed = namedtuple('BinaryParsed', ('filename', 'name', 'arch'))
|
||||||
|
|
||||||
|
|
||||||
@memoize(session=True)
|
@memoize(session=True)
|
||||||
def owner_fallback(apiurl, project, package):
|
def owner_fallback(apiurl, project, package):
|
||||||
@ -82,3 +87,22 @@ def request_staged(request):
|
|||||||
return review.by_project
|
return review.by_project
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def binary_list(apiurl, project, repository, arch, package=None):
|
||||||
|
parsed = []
|
||||||
|
for binary in get_binarylist(apiurl, project, repository, arch, package):
|
||||||
|
result = re.match(r'(.*)-([^-]*)-([^-]*)\.([^-\.]+)\.rpm', binary)
|
||||||
|
if not result:
|
||||||
|
continue
|
||||||
|
|
||||||
|
name = result.group(1)
|
||||||
|
if name.endswith('-debuginfo') or name.endswith('-debuginfo-32bit'):
|
||||||
|
continue
|
||||||
|
if name.endswith('-debugsource'):
|
||||||
|
continue
|
||||||
|
if result.group(4) == 'src':
|
||||||
|
continue
|
||||||
|
|
||||||
|
parsed.append(BinaryParsed(binary, name, result.group(4)))
|
||||||
|
|
||||||
|
return parsed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user