handle task ids in download-build

This commit is contained in:
Mike McLean 2014-07-15 13:55:41 -04:00
parent d764ec7f4c
commit e254586991

View file

@ -5919,6 +5919,7 @@ def anon_handle_download_build(options, session, args):
parser.add_option("--type", help=_("Download archives of the given type, rather than rpms (maven, win, or image)"))
parser.add_option("--latestfrom", dest="latestfrom", help=_("Download the latest build from this tag"))
parser.add_option("--debuginfo", action="store_true", help=_("Also download -debuginfo rpms"))
parser.add_option("--task-id", action="store_true", help=_("Interperet id as a task id"))
parser.add_option("--key", help=_("Download rpms signed with the given key"))
parser.add_option("--topurl", metavar="URL", default=options.topurl,
help=_("URL under which Koji files are accessible"))
@ -5940,6 +5941,12 @@ def anon_handle_download_build(options, session, args):
print "--latestfrom not compatible with build IDs, specify a package name."
return 1
build = int(build)
if suboptions.task_id:
builds = session.listBuilds(taskID=build)
if not builds:
print "No associated builds for task %s" % build
return 1
build = builds[0]['build_id']
if suboptions.latestfrom:
# We want the latest build, not a specific build