cli: support download-build --type=remote-sources

Prior to this change, "koji download-build --type=remote-sources" failed
with an AssertionError.

Add support for OSBS's cachito remote-sources btype.
This commit is contained in:
Ken Dreyer 2020-12-16 14:02:24 -07:00 committed by Tomas Kopecek
parent 1c5c7674bc
commit 659a450bc1
2 changed files with 5 additions and 1 deletions

View file

@ -6754,7 +6754,7 @@ def anon_handle_download_build(options, session, args):
help=_("Only download packages for this arch (may be used multiple times)"))
parser.add_option("--type",
help=_("Download archives of the given type, rather than rpms "
"(maven, win, or image)"))
"(maven, win, image, remote-source)"))
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"))

View file

@ -653,6 +653,10 @@ def download_archive(build, archive, topurl, quiet=False, noprogress=False):
elif archive['btype'] == 'image':
url = os.path.join(pi.imagebuild(build), archive['filename'])
path = archive['filename']
elif archive['btype'] == 'remote-sources':
directory = pi.typedir(build, 'remote-sources')
url = os.path.join(directory, archive['filename'])
path = archive['filename']
else:
# TODO: cover module/operator-manifests/remote-sources
raise NotImplementedError(archive['btype'])