diff --git a/flatpak_builder_lint/appstream.py b/flatpak_builder_lint/appstream.py index d7992878..54514f19 100644 --- a/flatpak_builder_lint/appstream.py +++ b/flatpak_builder_lint/appstream.py @@ -1,6 +1,8 @@ import os import subprocess +from lxml import etree # type: ignore + def validate(path: str) -> dict: if not os.path.isfile(path): @@ -17,3 +19,15 @@ def validate(path: str) -> dict: } return ret + + +def is_developer_name_present(path: str) -> bool: + if not os.path.isfile(path): + raise FileNotFoundError("AppStream file not found") + + root = etree.parse(path) + components = root.xpath("/components/component") + + developer = components[0].xpath("developer_name") + + return bool(developer) diff --git a/flatpak_builder_lint/checks/metainfo.py b/flatpak_builder_lint/checks/metainfo.py index 695f5750..c074ccdf 100644 --- a/flatpak_builder_lint/checks/metainfo.py +++ b/flatpak_builder_lint/checks/metainfo.py @@ -38,6 +38,9 @@ def _validate(self, path: str, appid: str, flathub_json: Optional[dict]) -> None if appinfo_validation["returncode"] != 0: self.errors.add("appstream-failed-validation") + if not appstream.is_developer_name_present(appstream_path): + self.errors.add("appstream-missing-developer-name") + if not flathub_json.get("skip-icons-check"): if not os.path.exists(icon_path): self.errors.add("appstream-missing-icon-file")