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
3
CREDITS
3
CREDITS
@ -4,5 +4,6 @@ Marcus Huewe - wipebinaries command, abortbuild command, editmeta error handling
|
||||
Marcus Rueckert - help and countless suggestions
|
||||
Christoph Thiel - patch enabling build log following.
|
||||
Adrian Schroeter - one-liner showing how to handle an error ;-)
|
||||
Michael Marek
|
||||
Michal Marek
|
||||
Michael Wolf
|
||||
Pavol Rusnak
|
||||
|
@ -605,6 +605,8 @@ class Osc(cmdln.Cmdln):
|
||||
|
||||
@cmdln.option('-c', '--client-side-copy', action='store_true',
|
||||
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',
|
||||
help='URL of destination api server. Default is the source api server.')
|
||||
def do_copypac(self, subcmd, opts, *args):
|
||||
@ -656,7 +658,8 @@ class Osc(cmdln.Cmdln):
|
||||
|
||||
r = copy_pac(src_apiurl, src_project, src_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
|
||||
|
||||
|
||||
|
10
osc/core.py
10
osc/core.py
@ -2233,14 +2233,15 @@ def checkout_package(apiurl, project, package,
|
||||
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
|
||||
only maintainer
|
||||
only maintainer (unless keep_maintainers is set)
|
||||
"""
|
||||
root = ET.fromstring(''.join(pkgmeta))
|
||||
root.set('name', new_name)
|
||||
root.set('project', new_prj)
|
||||
if not keep_maintainers:
|
||||
for person in root.findall('person'):
|
||||
root.remove(person)
|
||||
ET.SubElement(root, 'person',
|
||||
@ -2318,7 +2319,8 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package):
|
||||
|
||||
def copy_pac(src_apiurl, src_project, src_package,
|
||||
dst_apiurl, dst_project, dst_package,
|
||||
client_side_copy = False):
|
||||
client_side_copy = False,
|
||||
keep_maintainers = False):
|
||||
"""
|
||||
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 = 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...'
|
||||
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, '_meta'])
|
||||
|
Loading…
Reference in New Issue
Block a user