1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-13 17:16:23 +01:00

- partly fix #478516: copypac: added --keep-develproject option

This commit is contained in:
Marcus Hüwe 2009-03-11 15:23:23 +00:00
parent 298fd445f9
commit ce8027fc14
2 changed files with 15 additions and 5 deletions

View File

@ -773,6 +773,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='do a (slower) client-side copy')
@cmdln.option('-k', '--keep-maintainers', action='store_true',
help='keep original maintainers. Default is remove all and replace with the one calling the script.')
@cmdln.option('-d', '--keep-develproject', action='store_true',
help='keep develproject tag in the package metadata')
@cmdln.option('-t', '--to-apiurl', metavar='URL',
help='URL of destination api server. Default is the source api server.')
def do_copypac(self, subcmd, opts, *args):
@ -825,7 +827,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
r = copy_pac(src_apiurl, src_project, src_package,
dst_apiurl, dst_project, dst_package,
client_side_copy=opts.client_side_copy,
keep_maintainers=opts.keep_maintainers)
keep_maintainers=opts.keep_maintainers,
keep_develproject=opts.keep_develproject)
print r

View File

@ -2377,10 +2377,12 @@ def checkout_package(apiurl, project, package,
os.chdir(olddir)
def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False, dst_userid = None):
def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False,
dst_userid = None, keep_develproject = False):
"""
update pkgmeta with new new_name and new_prj and set calling user as the
only maintainer (unless keep_maintainers is set)
only maintainer (unless keep_maintainers is set). Additionally remove the
develproject entry (<devel />) unless keep_develproject is true.
"""
root = ET.fromstring(''.join(pkgmeta))
root.set('name', new_name)
@ -2391,6 +2393,9 @@ def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False, dst_u
dst_userid = dst_userid or conf.config['user']
ET.SubElement(root, 'person',
userid = dst_userid, role = 'maintainer')
if not keep_develproject:
for dp in root.findall('devel'):
root.remove(dp)
return ET.tostring(root)
def link_pac(src_project, src_package, dst_project, dst_package, rev=''):
@ -2491,7 +2496,8 @@ def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None)
def copy_pac(src_apiurl, src_project, src_package,
dst_apiurl, dst_project, dst_package,
client_side_copy = False,
keep_maintainers = False):
keep_maintainers = False,
keep_develproject = False):
"""
Create a copy of a package.
@ -2503,7 +2509,8 @@ def copy_pac(src_apiurl, src_project, src_package,
src_meta = show_package_meta(src_apiurl, src_project, src_package)
dst_userid = conf.get_apiurl_usr(dst_apiurl)
src_meta = replace_pkg_meta(src_meta, dst_package, dst_project, keep_maintainers, dst_userid)
src_meta = replace_pkg_meta(src_meta, dst_package, dst_project, keep_maintainers,
dst_userid, keep_develproject)
print 'Sending meta data...'
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, '_meta'])