diff --git a/osc/commandline.py b/osc/commandline.py index 42a6ae0b..d893c725 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -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) diff --git a/osc/core.py b/osc/core.py index b24ec44e..900a0dde 100755 --- a/osc/core.py +++ b/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 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.