1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 02:16:12 +01:00

Support flavors in aggregatepac

This commit is contained in:
Daniel Mach 2022-03-02 14:38:21 +01:00
parent f4626dd91f
commit 5c5597432c
2 changed files with 12 additions and 7 deletions

View File

@ -2972,7 +2972,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
DESTPAC is omitted. DESTPAC is omitted.
usage: usage:
osc aggregatepac SOURCEPRJ SOURCEPAC DESTPRJ [DESTPAC] osc aggregatepac SOURCEPRJ SOURCEPAC[:FLAVOR] DESTPRJ [DESTPAC]
${cmd_option_list} ${cmd_option_list}
""" """

View File

@ -5277,9 +5277,14 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map =
meta_change = False meta_change = False
dst_meta = '' dst_meta = ''
apiurl = conf.config['apiurl'] apiurl = conf.config['apiurl']
# we need to remove :flavor from the package names when accessing meta
src_package_meta = src_package.split(":")[0]
dst_package_meta = dst_package.split(":")[0]
try: try:
dst_meta = meta_exists(metatype='pkg', dst_meta = meta_exists(metatype='pkg',
path_args=(quote_plus(dst_project), quote_plus(dst_package)), path_args=(quote_plus(dst_project), quote_plus(dst_package_meta)),
template_args=None, template_args=None,
create_new=False, apiurl=apiurl) create_new=False, apiurl=apiurl)
root = ET.fromstring(parse_meta_to_string(dst_meta)) root = ET.fromstring(parse_meta_to_string(dst_meta))
@ -5292,8 +5297,8 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map =
meta_change = True meta_change = True
if meta_change: if meta_change:
src_meta = show_package_meta(apiurl, src_project, src_package) src_meta = show_package_meta(apiurl, src_project, src_package_meta)
dst_meta = replace_pkg_meta(src_meta, dst_package, dst_project) dst_meta = replace_pkg_meta(src_meta, dst_package_meta, dst_project)
meta_change = True meta_change = True
if disable_publish: if disable_publish:
@ -5307,12 +5312,12 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map =
dst_meta = ET.tostring(root, encoding=ET_ENCODING) dst_meta = ET.tostring(root, encoding=ET_ENCODING)
if meta_change: if meta_change:
edit_meta('pkg', edit_meta('pkg',
path_args=(dst_project, dst_package), path_args=(dst_project, dst_package_meta),
data=dst_meta) data=dst_meta)
# create the _aggregate file # create the _aggregate file
# but first, make sure not to overwrite an existing one # but first, make sure not to overwrite an existing one
if '_aggregate' in meta_get_filelist(apiurl, dst_project, dst_package): if '_aggregate' in meta_get_filelist(apiurl, dst_project, dst_package_meta):
print(file=sys.stderr) print(file=sys.stderr)
print('_aggregate file already exists...! Aborting', file=sys.stderr) print('_aggregate file already exists...! Aborting', file=sys.stderr)
sys.exit(1) sys.exit(1)
@ -5341,7 +5346,7 @@ def aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map =
</aggregatelist> </aggregatelist>
""" """
u = makeurl(apiurl, ['source', dst_project, dst_package, '_aggregate']) u = makeurl(apiurl, ['source', dst_project, dst_package_meta, '_aggregate'])
http_PUT(u, data=aggregate_template) http_PUT(u, data=aggregate_template)
print('Done.') print('Done.')