From 0b0e38aeb224ea5b74c775df8e846b1b18d4c1bf Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Aug 28 2019 13:17:30 +0000 Subject: PR#1627: Don't allow archive imports that don't match build type Merges #1627 https://pagure.io/koji/pull-request/1627 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 3e3a601..96196c9 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -6636,7 +6636,9 @@ def import_archive_internal(filepath, buildinfo, type, typeInfo, buildroot_id=No archiveinfo['type_id'] = archivetype['id'] btype = lookup_name('btype', type, strict=False) if btype is None: - raise koji.BuildError('unsupported archive type: %s' % type) + raise koji.BuildError('unsupported build type: %s' % type) + if btype not in get_build_type(buildinfo, strict=True): + raise koji.ImportError('Build does not have type %s', btype) archiveinfo['btype_id'] = btype['id'] # cg extra data