mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- slightly modified version of David Greaves' <david@dgreaves.com> patch to add a --map-repo option to aggregatepac
This commit is contained in:
parent
2d1126b847
commit
365be249c3
@ -952,6 +952,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
link_pac(src_project, src_package, dst_project, dst_package, opts.force, rev, opts.cicount)
|
||||
|
||||
@cmdln.option('-m', '--map-repo', metavar='SRC=TARGET[,SRC=TARGET]',
|
||||
help='Allows repository mapping(s) to be given as SRC=TARGET[,SRC=TARGET]')
|
||||
def do_aggregatepac(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: "Aggregate" a package to another package
|
||||
|
||||
@ -988,7 +990,17 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if src_project == dst_project and src_package == dst_package:
|
||||
print >>sys.stderr, 'Error: source and destination are the same.'
|
||||
return 1
|
||||
aggregate_pac(src_project, src_package, dst_project, dst_package)
|
||||
|
||||
repo_map = {}
|
||||
if opts.map_repo:
|
||||
for pair in opts.map_repo.split(','):
|
||||
src_tgt = pair.split('=')
|
||||
if len(src_tgt) != 2:
|
||||
print >>sys.stderr, 'map "%s" must be SRC=TARGET[,SRC=TARGET]' % opts.map_repo
|
||||
return 1
|
||||
repo_map[src_tgt[0]] = src_tgt[1]
|
||||
|
||||
aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map)
|
||||
|
||||
|
||||
@cmdln.option('-c', '--client-side-copy', action='store_true',
|
||||
|
12
osc/core.py
12
osc/core.py
@ -2723,11 +2723,12 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
|
||||
http_PUT(u, data=link_template)
|
||||
print 'Done.'
|
||||
|
||||
def aggregate_pac(src_project, src_package, dst_project, dst_package):
|
||||
def aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map = {}):
|
||||
"""
|
||||
aggregate package
|
||||
- "src" is the original package
|
||||
- "dst" is the "aggregate" package that we are creating here
|
||||
- "map" is a dictionary SRC => TARGET repository mappings
|
||||
"""
|
||||
|
||||
src_meta = show_package_meta(conf.config['apiurl'], src_project, src_package)
|
||||
@ -2748,10 +2749,17 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package):
|
||||
aggregate_template = """\
|
||||
<aggregatelist>
|
||||
<aggregate project="%s">
|
||||
""" % (src_project)
|
||||
for tgt, src in repo_map.iteritems():
|
||||
aggregate_template += """\
|
||||
<repository target="%s" source="%s" />
|
||||
""" % (tgt, src)
|
||||
|
||||
aggregate_template += """\
|
||||
<package>%s</package>
|
||||
</aggregate>
|
||||
</aggregatelist>
|
||||
""" % (src_project, src_package)
|
||||
""" % ( src_package)
|
||||
|
||||
u = makeurl(conf.config['apiurl'], ['source', dst_project, dst_package, '_aggregate'])
|
||||
http_PUT(u, data=aggregate_template)
|
||||
|
Loading…
Reference in New Issue
Block a user