From 3b8530d2bd75ce00d09f984bfc96f1cfcc7c5d07 Mon Sep 17 00:00:00 2001 From: Yashvardhan Nanavati Date: Aug 28 2019 04:04:12 +0000 Subject: Add support for finding rpm brew builds included in a module The current code returns NVRs of Koji builds of RPMs attached to the advisory. But for modular advisories, it returns the NVR of the module build itself and not of the koji builds in the module. This commit fixes that problem. --- diff --git a/freshmaker/errata.py b/freshmaker/errata.py index 873e07e..e87c2f5 100644 --- a/freshmaker/errata.py +++ b/freshmaker/errata.py @@ -321,6 +321,15 @@ class Errata(object): :rtype: set of strings :return: Set of NVR builds. """ + def get_srpms_nvrs(build_dict): + """ Gets srpms nvrs from the build dictionary. """ + for key, val in build_dict.items(): + if build_dict.get('SRPMS'): + return {nvr.split(".src.rpm")[0] for nvr in build_dict['SRPMS']} + if isinstance(val, dict): + return get_srpms_nvrs(val) + return + if rhel_release_prefix is None: rhel_release_prefix = conf.errata_rhel_release_prefix @@ -342,7 +351,7 @@ class Errata(object): product_version, rhel_release_prefix) continue for build in builds: - nvrs.update(set(build.keys())) + nvrs.update(get_srpms_nvrs(build)) return nvrs def get_pulp_repository_ids(self, errata_id):