PR#4411: support --wait-repo/--wait-build in wrapper-rpm command

Merges #4411
https://pagure.io/koji/pull-request/4411

Fixes: #4412
https://pagure.io/koji/issue/4412
 support --wait-repo/--wait-build in wrapper-rpm command
This commit is contained in:
Mike McLean 2025-07-02 16:29:15 -04:00
commit 2083513aab
3 changed files with 13 additions and 7 deletions

View file

@ -2256,7 +2256,8 @@ class WrapperRPMTask(BaseBuildTask):
if not repo_id:
# a parent task will generally pass in the repo it used, but if
# we are top level, we'll need to find our own
repo_info = self.getRepo(build_tag['id'])
repo_info = self.getRepo(build_tag['id'], builds=opts.get('wait_builds'),
wait=opts.get('wait_repo')) # (subtask)
else:
repo_info = self.session.repoInfo(repo_id, strict=True)
repo_id = repo_info['id']

View file

@ -835,6 +835,10 @@ def handle_wrapper_rpm(options, session, args):
help="Run the build at a lower priority")
parser.add_option("--create-draft", action="store_true",
help="Create a new draft build instead")
parser.add_option("--wait-repo", action="store_true",
help="Wait for a current repo for the build tag")
parser.add_option("--wait-build", metavar="NVR", action="append", dest="wait_builds",
default=[], help="Wait for the given nvr to appear in buildroot repo")
(build_opts, args) = parser.parse_args(args)
if build_opts.inis:
@ -879,14 +883,13 @@ def handle_wrapper_rpm(options, session, args):
if build_opts.background:
priority = 5
opts = {}
if build_opts.create_build:
opts['create_build'] = True
if build_opts.skip_tag:
opts['skip_tag'] = True
if build_opts.scratch:
opts['scratch'] = True
if build_opts.create_draft:
opts['draft'] = True
# the other passthough opts have matching names
for key in ('create_build', 'skip_tag', 'scratch', 'wait_repo', 'wait_builds'):
val = getattr(build_opts, key)
if val is not None:
opts[key] = val
task_id = session.wrapperRPM(build_id, url, target, priority, opts=opts)
print("Created task: %d" % task_id)
print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))

View file

@ -268,6 +268,8 @@ Options:
--nowait Don't wait on build
--background Run the build at a lower priority
--create-draft Create a new draft build instead
--wait-repo Wait for a current repo for the build tag
--wait-build=NVR Wait for the given nvr to appear in buildroot repo
""" % self.progname)