mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-14 01:26:23 +01:00
add meta group function to edit / show group meta
This commit is contained in:
parent
d34e0ace77
commit
a261c73cce
@ -774,6 +774,7 @@ class Osc(cmdln.Cmdln):
|
|||||||
prjconf denotes the (build) configuration of a project.
|
prjconf denotes the (build) configuration of a project.
|
||||||
pkg denotes metadata of a buildservice package.
|
pkg denotes metadata of a buildservice package.
|
||||||
user denotes the metadata of a user.
|
user denotes the metadata of a user.
|
||||||
|
group denotes the metadata of a group.
|
||||||
pattern denotes installation patterns defined for a project.
|
pattern denotes installation patterns defined for a project.
|
||||||
|
|
||||||
To list patterns, use 'osc meta pattern PRJ'. An additional argument
|
To list patterns, use 'osc meta pattern PRJ'. An additional argument
|
||||||
@ -797,9 +798,9 @@ class Osc(cmdln.Cmdln):
|
|||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
osc meta <prj|prjconf> [-r|--revision REV] ARGS...
|
osc meta <prj|prjconf> [-r|--revision REV] ARGS...
|
||||||
osc meta <prj|pkg|prjconf|user|pattern> ARGS...
|
osc meta <prj|pkg|prjconf|user|group|pattern> ARGS...
|
||||||
osc meta <prj|pkg|prjconf|user|pattern> [-m|--message TEXT] -e|--edit ARGS...
|
osc meta <prj|pkg|prjconf|user|group|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> [-m|--message TEXT] -F|--file ARGS...
|
||||||
osc meta pattern --delete PRJ PATTERN
|
osc meta pattern --delete PRJ PATTERN
|
||||||
osc meta attribute PRJ [PKG [SUBPACKAGE]] [--attribute ATTRIBUTE] [--create|--delete|--set [value_list]]
|
osc meta attribute PRJ [PKG [SUBPACKAGE]] [--attribute ATTRIBUTE] [--create|--delete|--set [value_list]]
|
||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
@ -877,6 +878,8 @@ class Osc(cmdln.Cmdln):
|
|||||||
attributepath.append('_attribute')
|
attributepath.append('_attribute')
|
||||||
elif cmd == 'user':
|
elif cmd == 'user':
|
||||||
user = args[0]
|
user = args[0]
|
||||||
|
elif cmd == 'group':
|
||||||
|
group = args[0]
|
||||||
elif cmd == 'pattern':
|
elif cmd == 'pattern':
|
||||||
project = args[0]
|
project = args[0]
|
||||||
if len(args) > 1:
|
if len(args) > 1:
|
||||||
@ -905,6 +908,10 @@ class Osc(cmdln.Cmdln):
|
|||||||
r = get_user_meta(apiurl, user)
|
r = get_user_meta(apiurl, user)
|
||||||
if r:
|
if r:
|
||||||
sys.stdout.write(''.join(r))
|
sys.stdout.write(''.join(r))
|
||||||
|
elif cmd == 'group':
|
||||||
|
r = get_group(apiurl, group)
|
||||||
|
if r:
|
||||||
|
sys.stdout.write(''.join(r))
|
||||||
elif cmd == 'pattern':
|
elif cmd == 'pattern':
|
||||||
if pattern:
|
if pattern:
|
||||||
r = show_pattern_meta(apiurl, project, pattern)
|
r = show_pattern_meta(apiurl, project, pattern)
|
||||||
@ -949,6 +956,12 @@ class Osc(cmdln.Cmdln):
|
|||||||
path_args=(quote_plus(user)),
|
path_args=(quote_plus(user)),
|
||||||
apiurl=apiurl,
|
apiurl=apiurl,
|
||||||
template_args=({'user': user}))
|
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':
|
elif cmd == 'pattern':
|
||||||
edit_meta(metatype='pattern',
|
edit_meta(metatype='pattern',
|
||||||
edit=True,
|
edit=True,
|
||||||
@ -1012,6 +1025,12 @@ class Osc(cmdln.Cmdln):
|
|||||||
edit=opts.edit,
|
edit=opts.edit,
|
||||||
apiurl=apiurl,
|
apiurl=apiurl,
|
||||||
path_args=(quote_plus(user)))
|
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':
|
elif cmd == 'pattern':
|
||||||
edit_meta(metatype='pattern',
|
edit_meta(metatype='pattern',
|
||||||
data=f,
|
data=f,
|
||||||
|
14
osc/core.py
14
osc/core.py
@ -179,6 +179,15 @@ new_user_template = """\
|
|||||||
</person>
|
</person>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
new_group_template = """\
|
||||||
|
<group>
|
||||||
|
<title>%(group)s</title>
|
||||||
|
<person>
|
||||||
|
<person userid=""/>
|
||||||
|
</person>
|
||||||
|
</group>
|
||||||
|
"""
|
||||||
|
|
||||||
info_templ = """\
|
info_templ = """\
|
||||||
Project name: %s
|
Project name: %s
|
||||||
Package name: %s
|
Package name: %s
|
||||||
@ -3648,6 +3657,10 @@ metatypes = { 'prj': { 'path': 'source/%s/_meta',
|
|||||||
'template': new_user_template,
|
'template': new_user_template,
|
||||||
'file_ext': '.xml'
|
'file_ext': '.xml'
|
||||||
},
|
},
|
||||||
|
'group': { 'path': 'group/%s',
|
||||||
|
'template': new_group_template,
|
||||||
|
'file_ext': '.xml'
|
||||||
|
},
|
||||||
'pattern': { 'path': 'source/%s/_pattern/%s',
|
'pattern': { 'path': 'source/%s/_pattern/%s',
|
||||||
'template': new_pattern_template,
|
'template': new_pattern_template,
|
||||||
'file_ext': '.xml'
|
'file_ext': '.xml'
|
||||||
@ -4475,7 +4488,6 @@ def get_user_meta(apiurl, user):
|
|||||||
print('user \'%s\' not found' % user)
|
print('user \'%s\' not found' % user)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _get_xml_data(meta, *tags):
|
def _get_xml_data(meta, *tags):
|
||||||
data = []
|
data = []
|
||||||
if meta != None:
|
if meta != None:
|
||||||
|
Loading…
Reference in New Issue
Block a user