mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-14 00:06:15 +01:00
* "osc maintainer" is following to the development project / package now
* "osc maintainer" list maintainer and bugowner roles now * rename addDevelProject to setDevelProject since the devel element is only allowed once
This commit is contained in:
parent
d017b16426
commit
7ef5e04cc9
2
NEWS
2
NEWS
@ -4,6 +4,8 @@
|
||||
- add "osc request list -t <type>" to list only submit, delete or develchange requests
|
||||
- add shell completion scripts
|
||||
- fix support of listing requests with multiple actions
|
||||
- "osc maintainer" is following to the development project / package now
|
||||
- "osc maintainer" list maintainer and bugowner roles now
|
||||
|
||||
0.119:
|
||||
- Support new request types
|
||||
|
@ -2936,8 +2936,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
sys.stdout.write(out)
|
||||
|
||||
|
||||
@cmdln.option('-b', '--bugowner', action='store_true',
|
||||
help='Show only the bugowner')
|
||||
@cmdln.option('-e', '--email', action='store_true',
|
||||
help='show email addresses instead of user names')
|
||||
@cmdln.option('--nodevelproject', action='store_true',
|
||||
help='do not follow a defined devel project ' \
|
||||
'(primary project where a package is developed)')
|
||||
@cmdln.option('-v', '--verbose', action='store_true',
|
||||
help='show more information')
|
||||
@cmdln.option('-D', '--devel-project', metavar='devel_project',
|
||||
@ -2959,21 +2964,50 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
${cmd_option_list}
|
||||
"""
|
||||
|
||||
maintainers = []
|
||||
pac = None
|
||||
tree = None
|
||||
roles = [ 'bugowner', 'maintainer' ]
|
||||
if opts.bugowner:
|
||||
roles = [ 'bugowner' ]
|
||||
|
||||
if len(args) == 1:
|
||||
m = show_project_meta(conf.config['apiurl'], args[0])
|
||||
prj = args[0]
|
||||
m = show_project_meta(conf.config['apiurl'], prj)
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
elif len(args) == 2:
|
||||
m = show_package_meta(conf.config['apiurl'], args[0], args[1])
|
||||
prj = args[0]
|
||||
pac = args[1]
|
||||
m = show_package_meta(conf.config['apiurl'], prj, pac)
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
if not opts.nodevelproject and not opts.delete and not opts.add:
|
||||
while tree.findall('devel'):
|
||||
d = tree.find('devel')
|
||||
prj = d.get('project', prj)
|
||||
pac = d.get('package', pac)
|
||||
print "Following to the development space:", prj, "/", pac
|
||||
m = show_package_meta(conf.config['apiurl'], prj, pac)
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
if not tree.findall('person'):
|
||||
print "No dedicated persons in package defined, showing the project persons !"
|
||||
m = show_project_meta(conf.config['apiurl'], prj)
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
else:
|
||||
raise oscerr.WrongArgs('I need at least one argument.')
|
||||
|
||||
maintainers = []
|
||||
|
||||
tree = ET.parse(StringIO(''.join(m)))
|
||||
if opts.add:
|
||||
addMaintainer(conf.config['apiurl'], prj, pac, opts.add)
|
||||
elif opts.delete:
|
||||
delMaintainer(conf.config['apiurl'], prj, pac, opts.delete)
|
||||
elif opts.devel_project:
|
||||
setDevelProject(conf.config['apiurl'], prj, pac, opts.devel_project)
|
||||
else:
|
||||
# showing the maintainers
|
||||
for role in roles:
|
||||
print ""
|
||||
print role, ":"
|
||||
for person in tree.findall('person'):
|
||||
if person.get('role') == role:
|
||||
maintainers.append(person.get('userid'))
|
||||
|
||||
if opts.email:
|
||||
@ -2992,13 +3026,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
userdata.append(itm)
|
||||
for row in build_table(3, userdata, ['realname', 'userid', 'email\n']):
|
||||
print row
|
||||
elif opts.add:
|
||||
addMaintainer(conf.config['apiurl'], prj, pac, opts.add)
|
||||
elif opts.delete:
|
||||
delMaintainer(conf.config['apiurl'], prj, pac, opts.delete)
|
||||
elif opts.devel_project:
|
||||
addDevelProject(conf.config['apiurl'], prj, pac, opts.devel_project)
|
||||
|
||||
else:
|
||||
print ', '.join(maintainers)
|
||||
|
||||
|
21
osc/core.py
21
osc/core.py
@ -3703,14 +3703,10 @@ def delMaintainer(apiurl, prj, pac, user):
|
||||
else:
|
||||
print "an error occured"
|
||||
|
||||
def addDevelProject(apiurl, prj, pac, dprj):
|
||||
""" add a <devel project="..."> element to package metadata"""
|
||||
path = quote_plus(prj),
|
||||
kind = 'prj'
|
||||
if pac:
|
||||
path = path + (quote_plus(pac),)
|
||||
kind = 'pkg'
|
||||
data = meta_exists(metatype=kind,
|
||||
def setDevelProject(apiurl, prj, pac, dprj, dpkg=None):
|
||||
""" set the <devel project="..."> element to package metadata"""
|
||||
path = (quote_plus(prj),) + (quote_plus(pac),)
|
||||
data = meta_exists(metatype='pkg',
|
||||
path_args=path,
|
||||
template_args=None,
|
||||
create_new=False)
|
||||
@ -3720,8 +3716,15 @@ def addDevelProject(apiurl, prj, pac, dprj):
|
||||
if not tree.find('devel') != None:
|
||||
ET.SubElement(tree, 'devel')
|
||||
elem = tree.find('devel')
|
||||
if dprj:
|
||||
elem.attrib['project'] = dprj
|
||||
edit_meta(metatype=kind,
|
||||
else:
|
||||
del elem.attrib['project']
|
||||
if dpkg:
|
||||
elem.attrib['package'] = dpkg
|
||||
else:
|
||||
del elem.attrib['package']
|
||||
edit_meta(metatype='pkg',
|
||||
path_args=path,
|
||||
data=ET.tostring(tree))
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user