Added search for modules by binary rpm.

Signed-off-by: Martin Curlej <mcurlej@redhat.com>

Updated PR according to review.

Signed-off-by: Martin Curlej <mcurlej@redhat.com>

Searching by multiple koji tags + tests

Signed-off-by: Martin Curlej <mcurlej@redhat.com>
This commit is contained in:
Martin Curlej
2018-06-19 17:01:16 +02:00
parent 6981449853
commit 0aa9f014ce
3 changed files with 85 additions and 3 deletions

View File

@@ -1064,3 +1064,26 @@ chmod 644 %buildroot/etc/rpm/macros.zz-modules
if self.config.koji_enable_content_generator and self.module.state == 3:
cg = KojiContentGenerator(self.module, self.config)
cg.koji_import()
@staticmethod
def get_rpm_module_tag(rpm):
"""
Returns koji tag of a given rpm filename.
:param str rpm: the *.rpm filename of a rpm
:rtype: str
:return: koji tag
"""
session = KojiModuleBuilder.get_session(conf, None)
rpm_md = session.getRPM(rpm)
if not rpm_md:
return None
tags = []
koji_tags = session.listTags(rpm_md["build_id"])
for t in koji_tags:
if not t["name"].endswith("-build") and t["name"].startswith("module-"):
tags.append(t["name"])
return tags