From b61ed8a2ef0f9d662fc71171abc601fa21c1f1d2 Mon Sep 17 00:00:00 2001 From: jfuller Date: Thu, 18 Jan 2024 09:48:23 +0100 Subject: [PATCH] ensure output set is unique --- griffon/output.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/griffon/output.py b/griffon/output.py index 76da99f..26fca8b 100644 --- a/griffon/output.py +++ b/griffon/output.py @@ -206,6 +206,18 @@ def generate_normalised_results( ): normalised_results = list() if "results" in output: + # ensure unique result set + seen = set() + results = [] + for obj in output["results"]: + if "purl" in obj: + if obj["purl"] not in seen: + seen.add(obj["purl"]) + results.append(obj) + else: + if obj["nvr"] not in seen: + seen.add(obj["nvr"]) + results.append(obj) for item in output["results"]: for ps in item["product_streams"]: # only include component from active product stream