1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 09:56:13 +01:00

add meta group function to edit / show group meta

This commit is contained in:
marco 2017-08-18 14:57:47 +02:00
parent d34e0ace77
commit a261c73cce
2 changed files with 35 additions and 4 deletions

View File

@ -774,6 +774,7 @@ class Osc(cmdln.Cmdln):
prjconf denotes the (build) configuration of a project.
pkg denotes metadata of a buildservice package.
user denotes the metadata of a user.
group denotes the metadata of a group.
pattern denotes installation patterns defined for a project.
To list patterns, use 'osc meta pattern PRJ'. An additional argument
@ -797,9 +798,9 @@ class Osc(cmdln.Cmdln):
Usage:
osc meta <prj|prjconf> [-r|--revision REV] ARGS...
osc meta <prj|pkg|prjconf|user|pattern> ARGS...
osc meta <prj|pkg|prjconf|user|pattern> [-m|--message TEXT] -e|--edit ARGS...
osc meta <prj|pkg|prjconf|user|pattern> [-m|--message TEXT] -F|--file ARGS...
osc meta <prj|pkg|prjconf|user|group|pattern> ARGS...
osc meta <prj|pkg|prjconf|user|group|pattern> [-m|--message TEXT] -e|--edit ARGS...
osc meta <prj|pkg|prjconf|user|group|pattern> [-m|--message TEXT] -F|--file ARGS...
osc meta pattern --delete PRJ PATTERN
osc meta attribute PRJ [PKG [SUBPACKAGE]] [--attribute ATTRIBUTE] [--create|--delete|--set [value_list]]
${cmd_option_list}
@ -877,6 +878,8 @@ class Osc(cmdln.Cmdln):
attributepath.append('_attribute')
elif cmd == 'user':
user = args[0]
elif cmd == 'group':
group = args[0]
elif cmd == 'pattern':
project = args[0]
if len(args) > 1:
@ -905,6 +908,10 @@ class Osc(cmdln.Cmdln):
r = get_user_meta(apiurl, user)
if r:
sys.stdout.write(''.join(r))
elif cmd == 'group':
r = get_group(apiurl, group)
if r:
sys.stdout.write(''.join(r))
elif cmd == 'pattern':
if pattern:
r = show_pattern_meta(apiurl, project, pattern)
@ -949,6 +956,12 @@ class Osc(cmdln.Cmdln):
path_args=(quote_plus(user)),
apiurl=apiurl,
template_args=({'user': user}))
elif cmd == 'group':
edit_meta(metatype='group',
edit=True,
path_args=(quote_plus(group)),
apiurl=apiurl,
template_args=({'group': group}))
elif cmd == 'pattern':
edit_meta(metatype='pattern',
edit=True,
@ -1012,6 +1025,12 @@ class Osc(cmdln.Cmdln):
edit=opts.edit,
apiurl=apiurl,
path_args=(quote_plus(user)))
elif cmd == 'group':
edit_meta(metatype='group',
data=f,
edit=opts.edit,
apiurl=apiurl,
path_args=(quote_plus(group)))
elif cmd == 'pattern':
edit_meta(metatype='pattern',
data=f,

View File

@ -179,6 +179,15 @@ new_user_template = """\
</person>
"""
new_group_template = """\
<group>
<title>%(group)s</title>
<person>
<person userid=""/>
</person>
</group>
"""
info_templ = """\
Project name: %s
Package name: %s
@ -3648,6 +3657,10 @@ metatypes = { 'prj': { 'path': 'source/%s/_meta',
'template': new_user_template,
'file_ext': '.xml'
},
'group': { 'path': 'group/%s',
'template': new_group_template,
'file_ext': '.xml'
},
'pattern': { 'path': 'source/%s/_pattern/%s',
'template': new_pattern_template,
'file_ext': '.xml'
@ -4475,7 +4488,6 @@ def get_user_meta(apiurl, user):
print('user \'%s\' not found' % user)
return None
def _get_xml_data(meta, *tags):
data = []
if meta != None: