checkrepo: provide target_archs() method to determine relevant archs.

The default behavior is to return the archs for which the target project
is built against, but can be used to check any project (like stagings).
This commit is contained in:
Jimmy Berry 2017-05-11 22:19:38 -05:00
parent 13dba97ed7
commit e29f7e060b

View File

@ -22,6 +22,7 @@ import urllib2
from xml.etree import cElementTree as ET
from pprint import pformat
import osc.core
from osc.core import get_binary_file
from osc.core import http_DELETE
from osc.core import http_GET
@ -592,6 +593,17 @@ class CheckRepo(object):
return repos_to_check
@memoize(session=True)
def target_archs(self, project=None):
if not project: project = self.project
meta = osc.core.show_project_meta(self.apiurl, project)
meta = ET.fromstring(''.join(meta))
archs = []
for arch in meta.findall('repository[@name="standard"]/arch'):
archs.append(arch.text)
return archs
def is_binary(self, project, repository, arch, package):
"""Return True if is a binary package."""
root_xml = self.build(project, repository, arch, package)