mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-24 19:22:13 +01:00
- osc maintainer:
-D devel_project, --devel-project=devel_project define the project where this package is primarily developed - core: add addDevelProject() method
This commit is contained in:
parent
849e2a7153
commit
d80c47c0b9
@ -2082,6 +2082,8 @@ class Osc(cmdln.Cmdln):
|
||||
help='show email addresses instead of user names')
|
||||
@cmdln.option('-v', '--verbose', action='store_true',
|
||||
help='show more information')
|
||||
@cmdln.option('-D', '--devel-project', metavar='devel_project',
|
||||
help='define the project where this package is primarily developed')
|
||||
@cmdln.option('-a', '--add', metavar='user',
|
||||
help='add a new maintainer')
|
||||
@cmdln.option('-d', '--delete', metavar='user',
|
||||
@ -2136,6 +2138,9 @@ class Osc(cmdln.Cmdln):
|
||||
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)
|
||||
|
||||
|
24
osc/core.py
24
osc/core.py
@ -3135,6 +3135,30 @@ 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,
|
||||
path_args=path,
|
||||
template_args=None,
|
||||
create_new=False)
|
||||
|
||||
if data and show_project_meta(apiurl, dprj) != None:
|
||||
tree = ET.fromstring(''.join(data))
|
||||
if not tree.find('devel') != None:
|
||||
ET.SubElement(tree, 'devel')
|
||||
elem = tree.find('devel')
|
||||
elem.attrib['project'] = dprj
|
||||
edit_meta(metatype=kind,
|
||||
path_args=path,
|
||||
data=ET.tostring(tree))
|
||||
else:
|
||||
print "osc: an error occured"
|
||||
|
||||
def createPackageDir(pathname, prj_obj=None):
|
||||
"""
|
||||
create and initialize a new package dir in the given project.
|
||||
|
Loading…
x
Reference in New Issue
Block a user