AppStream & libappstream

NOTE: This page is a recollection of what I've written previously. I do not guarantee it's accuracy.

AppStream is a new standard from FreeDesktop.Org for an offline XML/YAML database of all available apps in your package repositories, harvested by those repositories from all the packages they hold. libappstream is the implementation Odysseus and the elementary AppCenter use to read this database. It is used by Odysseus to ease the uptake of new filetypes, URI schemes, and webfeeds.

Upon initialization libappstream traverses the standard directories to find all the XML (via libxml2) and YAML (via libyaml) files telling the object hierarchy to parse themselves from it, deduplicating where needed (with help from a hashmap) and caching the results in a binary (via GVariant) and GZipped file on disk. It is the responsibility of calling applications to evict this cache.

Beyond that libappstream does little more than offer an object graph to traverse, and offer some helper methods to check filter all parsed apps, etc by some condition like supported MIMEtypes.

Showing the install screen

Odysseus can show the install screen for any of the compatible apps it finds to recommend by rendering them out as normal links in the error page, but using the appstream:// URI scheme. This’ll get dispatched to your (compatible) package manager GUI using the normal codepaths.

Which in the case of the elementary AppCenter will scan the available apps for one of the correct identifier, build a UI to present it’s information, and permantly cache that as a child of the containing stack subclass. That parent will also register with it’s child to handle navigating any related apps.