mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- added --keep-maintainers switch to copypac
(do not remove original maintainers and replace them with caller)
This commit is contained in:
parent
1326661f5b
commit
afec162189
7
CREDITS
7
CREDITS
@ -2,7 +2,8 @@ There is a number of people who have helped:
|
|||||||
|
|
||||||
Marcus Huewe - wipebinaries command, abortbuild command, editmeta error handling
|
Marcus Huewe - wipebinaries command, abortbuild command, editmeta error handling
|
||||||
Marcus Rueckert - help and countless suggestions
|
Marcus Rueckert - help and countless suggestions
|
||||||
Christoph Thiel - patch enabling build log following.
|
Christoph Thiel - patch enabling build log following.
|
||||||
Adrian Schroeter - one-liner showing how to handle an error ;-)
|
Adrian Schroeter - one-liner showing how to handle an error ;-)
|
||||||
Michael Marek
|
Michal Marek
|
||||||
Michael Wolf
|
Michael Wolf
|
||||||
|
Pavol Rusnak
|
||||||
|
@ -605,6 +605,8 @@ class Osc(cmdln.Cmdln):
|
|||||||
|
|
||||||
@cmdln.option('-c', '--client-side-copy', action='store_true',
|
@cmdln.option('-c', '--client-side-copy', action='store_true',
|
||||||
help='do a (slower) client-side copy')
|
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('-t', '--to-apiurl', metavar='URL',
|
@cmdln.option('-t', '--to-apiurl', metavar='URL',
|
||||||
help='URL of destination api server. Default is the source api server.')
|
help='URL of destination api server. Default is the source api server.')
|
||||||
def do_copypac(self, subcmd, opts, *args):
|
def do_copypac(self, subcmd, opts, *args):
|
||||||
@ -656,7 +658,8 @@ class Osc(cmdln.Cmdln):
|
|||||||
|
|
||||||
r = copy_pac(src_apiurl, src_project, src_package,
|
r = copy_pac(src_apiurl, src_project, src_package,
|
||||||
dst_apiurl, dst_project, dst_package,
|
dst_apiurl, dst_project, dst_package,
|
||||||
client_side_copy=opts.client_side_copy)
|
client_side_copy=opts.client_side_copy,
|
||||||
|
keep_maintainers=opts.keep_maintainers)
|
||||||
print r
|
print r
|
||||||
|
|
||||||
|
|
||||||
|
18
osc/core.py
18
osc/core.py
@ -2233,18 +2233,19 @@ def checkout_package(apiurl, project, package,
|
|||||||
os.chdir(olddir)
|
os.chdir(olddir)
|
||||||
|
|
||||||
|
|
||||||
def replace_pkg_meta(pkgmeta, new_name, new_prj):
|
def replace_pkg_meta(pkgmeta, new_name, new_prj, keep_maintainers = False):
|
||||||
"""
|
"""
|
||||||
update pkgmeta with new new_name and new_prj and set calling user as the
|
update pkgmeta with new new_name and new_prj and set calling user as the
|
||||||
only maintainer
|
only maintainer (unless keep_maintainers is set)
|
||||||
"""
|
"""
|
||||||
root = ET.fromstring(''.join(pkgmeta))
|
root = ET.fromstring(''.join(pkgmeta))
|
||||||
root.set('name', new_name)
|
root.set('name', new_name)
|
||||||
root.set('project', new_prj)
|
root.set('project', new_prj)
|
||||||
for person in root.findall('person'):
|
if not keep_maintainers:
|
||||||
root.remove(person)
|
for person in root.findall('person'):
|
||||||
ET.SubElement(root, 'person',
|
root.remove(person)
|
||||||
userid = conf.config['user'], role = 'maintainer')
|
ET.SubElement(root, 'person',
|
||||||
|
userid = conf.config['user'], role = 'maintainer')
|
||||||
return ET.tostring(root)
|
return ET.tostring(root)
|
||||||
|
|
||||||
def link_pac(src_project, src_package, dst_project, dst_package):
|
def link_pac(src_project, src_package, dst_project, dst_package):
|
||||||
@ -2318,7 +2319,8 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package):
|
|||||||
|
|
||||||
def copy_pac(src_apiurl, src_project, src_package,
|
def copy_pac(src_apiurl, src_project, src_package,
|
||||||
dst_apiurl, dst_project, dst_package,
|
dst_apiurl, dst_project, dst_package,
|
||||||
client_side_copy = False):
|
client_side_copy = False,
|
||||||
|
keep_maintainers = False):
|
||||||
"""
|
"""
|
||||||
Create a copy of a package.
|
Create a copy of a package.
|
||||||
|
|
||||||
@ -2329,7 +2331,7 @@ def copy_pac(src_apiurl, src_project, src_package,
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
src_meta = show_package_meta(src_apiurl, src_project, src_package)
|
src_meta = show_package_meta(src_apiurl, src_project, src_package)
|
||||||
src_meta = replace_pkg_meta(src_meta, dst_package, dst_project)
|
src_meta = replace_pkg_meta(src_meta, dst_package, dst_project, keep_maintainers)
|
||||||
|
|
||||||
print 'Sending meta data...'
|
print 'Sending meta data...'
|
||||||
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, '_meta'])
|
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, '_meta'])
|
||||||
|
Loading…
Reference in New Issue
Block a user