From 6ebe902d800bf2c2103f781ae0a3d9b4d6184fce Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 3 Jul 2024 19:19:27 -0400 Subject: [PATCH] Drop old placeholder syntax All placeholders in content-resolver-input are now using the new syntax. --- feedback_pipeline.py | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/feedback_pipeline.py b/feedback_pipeline.py index 0c2ff1f..be44c4f 100755 --- a/feedback_pipeline.py +++ b/feedback_pipeline.py @@ -458,44 +458,7 @@ def _load_config_workload(document_id, document, settings): config["package_placeholders"]["pkgs"] = {} config["package_placeholders"]["srpms"] = {} if "package_placeholders" in document["data"]: - - # So yeah, this is kind of awful but also brilliant. - # The old syntax of package placeholders was a dict, - # but the new one is a list. - # So I can be backwards compatible! - # - # The old format - if isinstance(document["data"]["package_placeholders"], dict): - for pkg_name, pkg_data in document["data"]["package_placeholders"].items(): - pkg_description = pkg_data.get("description", "Description not provided.") - pkg_requires = pkg_data.get("requires", []) - pkg_buildrequires = pkg_data.get("buildrequires", []) - limit_arches = pkg_data.get("limit_arches", None) - srpm = pkg_data.get("srpm", pkg_name) - - config["package_placeholders"]["pkgs"][pkg_name] = {} - config["package_placeholders"]["pkgs"][pkg_name]["name"] = pkg_name - config["package_placeholders"]["pkgs"][pkg_name]["description"] = pkg_description - config["package_placeholders"]["pkgs"][pkg_name]["requires"] = pkg_requires - config["package_placeholders"]["pkgs"][pkg_name]["limit_arches"] = limit_arches - config["package_placeholders"]["pkgs"][pkg_name]["srpm"] = srpm - - # Because the old format isn't great, it needs a srpm - # to be defined for every rpm, including the build requires. - # That can cause conflicts. - # So the best thing (I think) is to just take the first one and ignore - # the others. This is better than nothing. And people should move - # to the new format anyway. - if srpm not in config["package_placeholders"]["srpms"]: - config["package_placeholders"]["srpms"][srpm] = {} - config["package_placeholders"]["srpms"][srpm]["name"] = srpm - config["package_placeholders"]["srpms"][srpm]["buildrequires"] = pkg_buildrequires - config["package_placeholders"]["srpms"][srpm]["limit_arches"] = limit_arches - - - # - # The new format - elif isinstance(document["data"]["package_placeholders"], list): + if isinstance(document["data"]["package_placeholders"], list): for srpm in document["data"]["package_placeholders"]: srpm_name = srpm["srpm_name"] if not srpm_name: