Prevent artifacts from other products in updateinfo

This commit is contained in:
Mustafa Gezen 2023-02-03 01:48:30 +01:00
parent 81f5961d80
commit de498e885c
Signed by untrusted user who does not match committer: mustafa
GPG Key ID: DCDF010D946438C1

View File

@ -194,7 +194,7 @@ async def get_updateinfo(
# collections, and module RPMs need to go into their own collection based on # collections, and module RPMs need to go into their own collection based on
# module name, while non-module RPMs go into the main collection (if any) # module name, while non-module RPMs go into the main collection (if any)
for pkg in advisory.packages: for pkg in advisory.packages:
if pkg.repo_name != repo: if pkg.product_name != product_name:
continue continue
if pkg.module_name: if pkg.module_name:
collection_short = f"{default_collection_short}__{pkg.module_name}" collection_short = f"{default_collection_short}__{pkg.module_name}"
@ -207,8 +207,7 @@ async def get_updateinfo(
"module_version": pkg.module_version, "module_version": pkg.module_version,
} }
no_default_collection = True no_default_collection = True
if pkg not in collections[collection_short]["packages"]: collections[collection_short]["packages"].append(pkg)
collections[collection_short]["packages"].append(pkg)
else: else:
if no_default_collection: if no_default_collection:
continue continue
@ -216,10 +215,7 @@ async def get_updateinfo(
collections[default_collection_short] = { collections[default_collection_short] = {
"packages": [], "packages": [],
} }
if pkg not in collections[default_collection_short]["packages"]: collections[default_collection_short]["packages"].append(pkg)
collections[default_collection_short]["packages"].append(
pkg
)
if no_default_collection and default_collection_short in collections: if no_default_collection and default_collection_short in collections:
del collections[default_collection_short] del collections[default_collection_short]