mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- make sure that the package meta has a <person> element and remove
all <person> elements from the orginal package (this change affects {link,aggregate,copy}_pac). Patch from Michal Marek <mmarek@suse.cz> - thanks!
This commit is contained in:
parent
69e3fd1d4e
commit
5518e15673
52
osc/core.py
52
osc/core.py
@ -1377,6 +1377,20 @@ def checkout_package(apiurl, project, package, revision=None):
|
||||
os.chdir(olddir)
|
||||
|
||||
|
||||
def replace_pkg_meta(pkgmeta, new_name, new_prj):
|
||||
"""
|
||||
update pkgmeta with new new_name and new_prj and set calling user as the
|
||||
only maintainer
|
||||
"""
|
||||
root = ET.fromstring(''.join(pkgmeta))
|
||||
root.set('name', new_name)
|
||||
root.set('project', new_prj)
|
||||
for person in root.findall('person'):
|
||||
root.remove(person)
|
||||
ET.SubElement(root, 'person',
|
||||
userid = conf.config['user'], role = 'maintainer')
|
||||
return ET.tostring(root)
|
||||
|
||||
def link_pac(src_project, src_package, dst_project, dst_package):
|
||||
"""
|
||||
create a linked package
|
||||
@ -1385,18 +1399,7 @@ def link_pac(src_project, src_package, dst_project, dst_package):
|
||||
"""
|
||||
|
||||
src_meta = show_package_meta(conf.config['apiurl'], src_project, src_package)
|
||||
|
||||
# replace package name and username
|
||||
# using a string buffer
|
||||
# and create the package
|
||||
tree = ET.parse(StringIO(''.join(src_meta)))
|
||||
root = tree.getroot()
|
||||
root.set('name', dst_package)
|
||||
root.set('project', dst_project)
|
||||
tree.find('person').set('userid', conf.config['user'])
|
||||
buf = StringIO()
|
||||
tree.write(buf)
|
||||
src_meta = buf.getvalue()
|
||||
src_meta = replace_pkg_meta(src_meta, dst_package, dst_project)
|
||||
|
||||
edit_meta('pkg',
|
||||
path_args=(dst_project, dst_package),
|
||||
@ -1431,18 +1434,7 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package):
|
||||
"""
|
||||
|
||||
src_meta = show_package_meta(conf.config['apiurl'], src_project, src_package)
|
||||
|
||||
# replace package name and username
|
||||
# using a string buffer
|
||||
# and create the package
|
||||
tree = ET.parse(StringIO(''.join(src_meta)))
|
||||
root = tree.getroot()
|
||||
root.set('name', dst_package)
|
||||
root.set('project', dst_project)
|
||||
tree.find('person').set('userid', conf.config['user'])
|
||||
buf = StringIO()
|
||||
tree.write(buf)
|
||||
src_meta = buf.getvalue()
|
||||
src_meta = replace_pkg_meta(src_meta, dst_package, dst_project)
|
||||
|
||||
edit_meta('pkg',
|
||||
path_args=(dst_project, dst_package),
|
||||
@ -1477,17 +1469,7 @@ def copy_pac(src_apiurl, src_project, src_package,
|
||||
import tempfile
|
||||
|
||||
src_meta = show_package_meta(src_apiurl, src_project, src_package)
|
||||
|
||||
# replace project and package name
|
||||
# using a string buffer
|
||||
# and create the package
|
||||
tree = ET.parse(StringIO(''.join(src_meta)))
|
||||
root = tree.getroot()
|
||||
root.set('name', dst_package)
|
||||
root.set('project', dst_project)
|
||||
buf = StringIO()
|
||||
tree.write(buf)
|
||||
src_meta = buf.getvalue()
|
||||
src_meta = replace_pkg_meta(src_meta, dst_package, dst_project)
|
||||
|
||||
print 'Sending meta data...'
|
||||
u = makeurl(dst_apiurl, ['source', dst_project, dst_package, '_meta'])
|
||||
|
Loading…
Reference in New Issue
Block a user