Today I released AppStream and libappstream 0.6.1, which feature mostly bugfixes, so nothing incredibly exciting to see there (but this also means no API/ABI breaks). The release clarifies some paragraphs in the spec which people found confusing, and fixes a few issues (like one example in the docs not being valid AppStream metadata). As only spec extension, we introduce a “priority” property in distro metadata to allow metadata from one repository to override data shipped by another one. This is used (although with a similar syntax) in Fedora already to have “placeholder” data for non-free stuff, which gets overridden by the real metadata if a new application was added. In general, the property tag was added to make the answer to the question “which data is preferred” much less magic.
The libappstream library got some new API to query component data in different ways, and I also brought back support for Vala (so if you missed the Vapi file: It’s back now, although you have to manually enable this feature).
The CLI tool also got some extensions to query AppStream data. Here is a brief introduction:
First of all, we need to make sure the database is up-to-date, which should be the case already (it is rebuilt automatically):
$ sudo appstream-index refresh
The database will only be rebuilt when necessary, if you want to force a rebuild anyway, use the “–force” parameter.
Now imagine we want to search for an app containing the word “media” (in description, keywords, summary, …):
$ appstream-index s media
which will return:
Identifier: gnome-media-player.desktop [desktop-app] Name: GNOME Media Player Summary: A simple media player for GNOME Package: gnome-media-player ---- Identifier: mediaplayer-app.desktop [desktop-app] Name: Media Player Summary: Media Player Package: mediaplayer-app ---- Identifier: kde4__plasma-mediacenter.desktop [desktop-app] Name: Plasma Media Center Summary: A mediacenter user interface written with the Plasma framework Package: plasma-mediacenter ---- etc.
If we already know the name if a .desktop-file or the ID of a component, we can have the tool print out information about the application, including which package it was installed from:
$ appstream-index get lyx.desktop
If we want to see more details, including e.g. a screenshot URL and a longer description, we can pass “–details” to the tool:
Identifier: lyx.desktop [desktop-app] Name: LyX Summary: An advanced document processor with the power of LaTeX. Package: lyx-common Homepage: http://www.lyx.org/ Icon: lyx.png Description: LyX is a document processor that encourages an approach to writing based on the structure of your documents (WYSIWYM) and not simply their appearance (WYSIWYG). LyX combines the power and flexibility of TeX/LaTeX[...] Sample Screenshot URL: http://alt.fedoraproject.org/pub/alt/screenshots/f21/source/lyx-ea535ddf18b5c7328c5e88d2cd2cbd8c.png License: GPLv2+
(I truncated the results slightly )
Okay, so far so good. But now it gets really exciting (and this is a feature added with 0.6.1): We can now query a component by the items it provides. For example, I want to know which software provides the library libfoo.2:
appstream-index what-provides lib libfoo.so.2
This also works with binaries, or Python modules:
appstream-index what-provides bin apper
This stuff works distribution-agnostic, and as long as software ships upstream metadata with a valid <provides/> field, or the distributor adds it while generating AppStream distro metadata.
This means that software can – as soon as we have sufficient metadata of this kind – declare it’s dependencies upstream in form of a simple text file, referencing the needed components to build and run it on any Linux distribution. Users can simply install missing stuff by passing that file to their package manager, which can look up the components->packaging mapping and versions and do the right thing in installing the dependencies. So basically, this allows things “pip -r” does for Python, but for any application (not only Python stuff), and based on the distributors package database.
With the provides-items, we can also scan software to detect it’s dependencies automatically (and have it in a distro-agnostic form directly). We can also easily search for missing mimetype-handlers, missing kernel-modules, missing firmware etc. to install it on-demand, making the system much smarter in handling it’s dependencies. And users don’t need to do search orgies to find the right component for a given task.
Also on my todo list for the future, based on this feature: A small tool telling upstream authors which distribution has their application in which version, using just one command (and AppStream data from multiple distros).
Also planned: A cross-distro information page showing which distros ship which library versions, Python modules and application versions (and also the support status of the distro), so developers know which library versions (or GCC versions etc.) they should at least support to make their application easily available on most distributions.