1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-21 22:18:52 +02:00

maintainer search: lookup via package name by default and binary as fallback

This is faster in best case since the binary search does not need
to be executed on the server.

It also finds package names where no binary with that name exists.
(as for some multibuild cases)
This commit is contained in:
2020-08-12 09:14:16 +02:00
parent 568cb38e3d
commit 36fc925ee0
3 changed files with 26 additions and 10 deletions

View File

@@ -6809,12 +6809,21 @@ def search(apiurl, queries=None, **kwargs):
res[urlpath] = ET.parse(f).getroot()
return res
def owner(apiurl, binary, mode="binary", attribute=None, project=None, usefilter=None, devel=None, limit=None):
def owner(apiurl, search_term=None, mode="binary", attribute=None,
project=None, usefilter=None, devel=None, limit=None, binary=None):
"""
Perform a binary package owner search. This is supported since OBS 2.4.
"""
# binary is just for API backward compatibility
if not ((search_term is None) ^ (binary is None)):
raise ValueError('Either specify search_term or binary')
elif binary is not None:
search_term = binary
# find default project, if not specified
query = { mode: binary }
# mode can be "binary" or "package" atm
query = { mode: search_term }
if attribute:
query['attribute'] = attribute
if project: