1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-24 17:16:12 +01:00

"maintainer --user" support to search for all official maintained instance for given user or group

This commit is contained in:
Adrian Schröter 2013-02-20 11:41:17 +01:00
parent f0d1acf8d4
commit 220ec0e2cf
3 changed files with 61 additions and 39 deletions

1
NEWS
View File

@ -2,6 +2,7 @@
- support generic emulator virtualization
- added "--host" argument to "osc build" (used to perform the build on a remote host)
- "search --maintained" is obsolete. Abort on usage.
- "maintainer --user" support to search for all official maintained instance for given user or group
0.138
- add support to remove repositories recursively (mostly only usefull for admins)

View File

@ -6111,7 +6111,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"""${cmd_name}: show waiting work, packages, projects or requests involving yourself
Examples:
# list all tasks where it is expected to work on
# list all open tasks for me
osc ${cmd_name} [work]
# list packages where I am bugowner
osc ${cmd_name} pkg -b
@ -6769,6 +6769,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='Set the bugowner to specified person')
@cmdln.option('-S', '--set-bugowner-request', metavar='user',
help='Set the bugowner to specified person via a request')
@cmdln.option('-U', '--user', metavar='USER',
help='All official maintained instances for the specified USER')
@cmdln.option('-G', '--group', metavar='GROUP',
help='All official maintained instances for the specified GROUP')
@cmdln.option('-d', '--delete', metavar='user',
help='delete a maintainer/bugowner (can be specified via --role)')
@cmdln.option('-r', '--role', metavar='role', action='append', default=[],
@ -6777,8 +6781,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
def do_maintainer(self, subcmd, opts, *args):
"""${cmd_name}: Show maintainers of a project/package
osc maintainer <options>
# Search for official maintained sources in OBS instance
osc maintainer BINARY <options>
osc maintainer -U <user> <options>
osc maintainer -G <group> <options>
# Lookup in specific containers
osc maintainer <options>
osc maintainer PRJ <options>
osc maintainer PRJ PKG <options>
@ -6804,7 +6813,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
roles = [ 'bugowner' ]
args = slash_split(args)
if len(args) == 0:
if opts.user or opts.group:
if len(args) != 0:
raise oscerr.WrongArgs('Either search for user or for packages.')
elif len(args) == 0:
try:
pac = store_read_package('.')
except oscerr.NoWorkingCopy:
@ -6822,7 +6834,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
apiurl = self.get_api_url()
# Try the OBS 2.4 way first.
if pac==None and binary:
if binary or opts.user or opts.group:
limit=None
if opts.all:
limit=0
@ -6830,7 +6842,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if filterroles == [ 'bugowner', 'maintainer' ]:
# use server side configured default
filterroles=None
searchresult = owner(apiurl, binary, usefilter=filterroles, devel=None, limit=limit)
if binary:
searchresult = owner(apiurl, binary, "binary", usefilter=filterroles, devel=None, limit=limit)
elif opts.user:
searchresult = owner(apiurl, opts.user, "user", usefilter=filterroles, devel=None)
elif opts.group:
searchresult = owner(apiurl, opts.group, "group", usefilter=filterroles, devel=None)
else:
raise oscerr.WrongArgs('osc bug, no valid search criteria')
if opts.add:
if searchresult:
@ -6916,7 +6935,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
metaroot = ET.fromstring(''.join(m))
else:
# fallback to project lookup for old servers
if not searchresult:
if prj and not searchresult:
m = show_project_meta(apiurl, prj)
metaroot = ET.fromstring(''.join(m))
@ -6951,6 +6970,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else:
print "Defined in project: ", definingproject
if prj:
# not for user/group search
for role in roles:
if opts.bugowner and not len(maintainers.get(role, [])):
role = 'maintainer'

View File

@ -5735,12 +5735,12 @@ def search(apiurl, **kwargs):
res[urlpath] = ET.parse(f).getroot()
return res
def owner(apiurl, binary, attribute=None, project=None, usefilter=None, devel=None, limit=None):
def owner(apiurl, binary, mode="binary", attribute=None, project=None, usefilter=None, devel=None, limit=None):
"""
Perform a binary package owner search. This is supported since OBS 2.4.
"""
# find default project, if not specified
query = { 'binary': binary }
query = { mode: binary }
if attribute:
query['attribute'] = attribute
if project: