diff options
| author | Scott Bahling <sbahling@suse.de> | 2016-02-20 20:24:51 +0100 |
|---|---|---|
| committer | Scott Bahling <sbahling@suse.de> | 2016-02-20 20:24:51 +0100 |
| commit | 96e67da70b43c911036cb2dd5a2a05b7e0a27095 (patch) | |
| tree | d83c017c3a5f1cdb893e7fbc5076cd9989d8635b | |
| parent | ae29149adc0a1483f839961843804f199b15779e (diff) | |
| download | obsapi-96e67da70b43c911036cb2dd5a2a05b7e0a27095.tar.gz obsapi-96e67da70b43c911036cb2dd5a2a05b7e0a27095.tar.xz obsapi-96e67da70b43c911036cb2dd5a2a05b7e0a27095.zip | |
Implement get_build_info and get_nothing_provides
| -rw-r--r-- | obsapi/core.py | 20 |
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. |
