give select command an --add switch to mark additional packages
https://progress.opensuse.org/issues/2892
This commit is contained in:
parent
ede4b285ae
commit
f679aeba78
@ -39,6 +39,8 @@ def _print_version(self):
|
||||
help='force the selection to become a move')
|
||||
@cmdln.option('-f', '--from', dest='from_', metavar='FROMPROJECT',
|
||||
help='manually specify different source project during request moving')
|
||||
@cmdln.option('--add', dest='add', metavar='PACKAGE',
|
||||
help='mark additional packages to be checked by repo checker')
|
||||
@cmdln.option('-o', '--old', action='store_true',
|
||||
help='use the old check algorithm')
|
||||
@cmdln.option('-v', '--version', action='store_true',
|
||||
@ -84,7 +86,9 @@ def do_staging(self, subcmd, opts, *args):
|
||||
elif cmd == 'check':
|
||||
min_args, max_args = 0, 2
|
||||
elif cmd == 'select':
|
||||
min_args, max_args = 2, None
|
||||
min_args, max_args = 1, None
|
||||
if not opts.add:
|
||||
min_args = 2
|
||||
elif cmd == 'unselect':
|
||||
min_args, max_args = 1, None
|
||||
elif cmd in ('list', 'cleanup_rings'):
|
||||
@ -119,7 +123,10 @@ def do_staging(self, subcmd, opts, *args):
|
||||
UnselectCommand(api).perform(args[1:])
|
||||
elif cmd == 'select':
|
||||
tprj = api.prj_from_letter(args[1])
|
||||
SelectCommand(api).perform(tprj, args[2:], opts.move, opts.from_)
|
||||
if opts.add:
|
||||
api.mark_additional_packages(tprj, [ opts.add ] )
|
||||
else:
|
||||
SelectCommand(api).perform(tprj, args[2:], opts.move, opts.from_)
|
||||
elif cmd == 'cleanup_rings':
|
||||
CleanupRings(opts.apiurl).perform()
|
||||
elif cmd == 'list':
|
||||
|
@ -362,9 +362,10 @@ class StagingAPI(object):
|
||||
# * removed linked packages
|
||||
try:
|
||||
data = yaml.load(description.text)
|
||||
data['requests']
|
||||
except:
|
||||
data = yaml.load('requests: []')
|
||||
except (TypeError, AttributeError):
|
||||
data = {}
|
||||
# make sure we have a requests field
|
||||
data['requests'] = data.get('requests', [])
|
||||
return data
|
||||
|
||||
def set_prj_pseudometa(self, project, meta):
|
||||
@ -392,8 +393,7 @@ class StagingAPI(object):
|
||||
title.text = nt[:240]
|
||||
# Write XML back
|
||||
url = make_meta_url('prj', project, self.apiurl, force=True)
|
||||
f = metafile(url, ET.tostring(root))
|
||||
http_PUT(f.url, file=f.filename)
|
||||
http_PUT(url, data=ET.tostring(root))
|
||||
|
||||
def _add_rq_to_prj_pseudometa(self, project, request_id, package):
|
||||
"""
|
||||
@ -1165,3 +1165,13 @@ class StagingAPI(object):
|
||||
lines.append(' * Request#%s for package %s submitted by @%s' % (req['id'], req['package'], author))
|
||||
msg = '\n'.join(lines)
|
||||
comment_api.add_comment(project_name=project, comment=msg)
|
||||
|
||||
def mark_additional_packages(self, project, packages):
|
||||
"""
|
||||
Adds packages that the repo checker needs to download from staging prj
|
||||
"""
|
||||
meta = self.get_prj_pseudometa(project)
|
||||
additionals = set(meta.get('add_to_repo', []))
|
||||
additionals.update(packages)
|
||||
meta['add_to_repo'] = sorted(additionals)
|
||||
self.set_prj_pseudometa(project, meta)
|
||||
|
Loading…
x
Reference in New Issue
Block a user