appstream: Override <id> with <launchable type="desktop-id"> while parsing appdata files

Umang Jain requested to merge uajain/set-launchable-as-id into master

Problem statement: This has been a recurring problem since a long time now, where apps have started to drop the ".desktop" suffix from their tag present in their appdata. Reasoning for this change is given as the ".desktop" is not really a part of the app-id. Also, it's been seen as better aligning with flatpak ref-ids as dropping this suffix makes the app-id equivalent to the flatpak ref-id.

However, this breaks the mapping between the app's appdata and it's desktop file. GNOME Software parses both of these, to merge the metadata (ideally) under one GsApp object during refines. The appdata supplies information like description and categories whereas desktop files supplies information like icon, NoDisplay and so on.

So, things will break if metadata parsing of appdata and desktop file doesn't converge under one GsApp object. What happens here is gnome-software creates an app from a desktop file but could not relate to it's appdata file (because ".desktop" mismatch) and it ends up creating two GsApp objects, neither of which has full metadata from appdata and desktop file. Hence, anyone of these can bubble up in the UI with missing icons or info etc.

Solution: Apps dropping .desktop suffix adds a tag to the appdata. Check for the presence of this tag and override the tag, if it doesn't match the tag. This makes sure that the appdata can still relate to it's desktop file component.

https://phabricator.endlessm.com/T27779

Edited by Umang Jain

Merge request reports