summaryrefslogtreecommitdiff
path: root/obsapi
diff options
context:
space:
mode:
authorScott Bahling <sbahling@suse.de>2016-02-20 20:24:51 +0100
committerScott Bahling <sbahling@suse.de>2016-02-20 20:24:51 +0100
commit96e67da70b43c911036cb2dd5a2a05b7e0a27095 (patch)
treed83c017c3a5f1cdb893e7fbc5076cd9989d8635b /obsapi
parentae29149adc0a1483f839961843804f199b15779e (diff)
downloadobsapi-96e67da70b43c911036cb2dd5a2a05b7e0a27095.tar.gz
obsapi-96e67da70b43c911036cb2dd5a2a05b7e0a27095.tar.xz
obsapi-96e67da70b43c911036cb2dd5a2a05b7e0a27095.zip
Implement get_build_info and get_nothing_provides
Diffstat (limited to 'obsapi')
-rw-r--r--obsapi/core.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/obsapi/core.py b/obsapi/core.py
index f1a27ed..e46e57f 100644
--- a/obsapi/core.py
+++ b/obsapi/core.py
@@ -351,6 +351,26 @@ class ObsApi(object):
api = '/build/{}/{}/_buildconfig'.format(prj, repo)
return self.get_xml(api)
+ def get_build_info(self, prj, pkg, repo, arch):
+ api = '/build/{}/{}/{}/{}/_buildinfo'.format(prj, repo, arch, pkg)
+ return self.get_xml(api)
+
+ def get_nothing_provides(self, prj, pkg, repo, arch):
+ tree = etree.fromstring(self.get_build_info(prj, pkg, repo, arch))
+ errors = (tree.xpath('error') or [EMPTY])[0]
+ nothing_provides = []
+
+ if errors is None or 'unresolvable' not in errors:
+ return nothing_provides
+
+ for unresolvable in [u.strip() for
+ u in errors.split('unresolvable:')[1].split(',')]:
+ if unresolvable.startswith('nothing provides'):
+ nothing_provides.append(unresolvable.split(
+ 'nothing provides ')[1])
+
+ return nothing_provides
+
def get_vendor(self, prj, repo=None):
''' Attempt to get the value of the %vendor macro if exists
Search build configs from all repos. Take first occurance.