flathub-infra / flatpak-builder-lint

A linter for flatpak-builder manifests
MIT License
48 stars 115 forks source link

metainfo: Check if launchable defined in appstream is actually installed #373

Closed bbhtt closed 2 months ago

bbhtt commented 2 months ago

For legacy ids that end in .desktop, appstreamcli validate does not raise the usual launchable missing error here and assumes the file is present. compose also ignores that the file does not exist

bbhtt commented 2 months ago

This shouldn't be a breaking change because we already had https://github.com/flathub-infra/flatpak-builder-lint/blob/027e4eeb9c1560acd773dfd9de60cb37c33452fb/flatpak_builder_lint/appstream.py#L27 for everything else and without the launchable tag compose would fail anyway on one of icon-not-found, gui-app-without-icon, no-valid-category

Launchable is already a mandatory requirement.

bbhtt commented 2 months ago
from lxml import etree

# curl -sL https://hub.flathub.org/repo/appstream/x86_64/appstream.xml.gz | gunzip -- > appstream.xml
components = etree.parse("appstream.xml").getroot()
for component in components.iterchildren(tag="component"):
   if component.attrib.get("type") not in ("desktop","desktop-application"):
        continue
   appstream_id = component.find("id").text
   launchable = component.xpath("launchable[@type='desktop-id']/text()")
   if not launchable:
      print(appstream_id)

shows

com.lettier.movie-monad.desktop
org.sparkleshare.SparkleShare.desktop