[AppStream] RFC: A UniqueID in AppStream

Richard Hughes hughsient at gmail.com
Mon Aug 8 15:47:17 UTC 2016


For a long time appstream-glib has supported having more than one
"scope" of component in the system store. This allowed us to represent
more than one type of bundle in the gnome-software UI. An example of
the deduplication ID I was using was "gimp.desktop" for the
distro-supplied package, flatpak:gimp.desktop for the system flatpak
instance, and flatpak-user:gimp.desktop for the per-user flatpak app.
This was a hack, and meant the API was inflexible, but worked well
enough if you remembered that each AsApp object ad a get_id() and
get_id_no_prefix() method that would produce different results.

I've been working a bit with Endless, and one of the requirements they
have to have more than one branch of the same software in the AsStore,
e.g. "unstable" and "stable". This allows them to filter in the
application according to user preference. This is where my prefix hack
breaks down a bit, as a "flatpak-user{stable}gimp.desktop" encoding
starts to look more and more like a hack.

I've prototyped a new "unique id" that I've been testing in
appstream-glib for a couple of weeks. This isn't designed to be in the
XML itself (as like the scope it depends on how the <component> is
being used), but I'm using it internally for matching and
de-duplication of apps. The unique-id is made up of the following
string:

scope/system/origin/kind/id/arch/branch/version

the kind/id/arch/branch section should look familiar, as it's nearly
the same (although, see below) to the ID that flatpak uses to identify
different things in each remote. This means you can have a unique ID
of:

system/package/fedora/desktop/gimp.desktop/i386/f23/3.1.2
or
user/flatpak/gnome-apps-nightly/runtime/gimp.desktop/*/master/*

The wildcard character indicating "don't know" or "don't care".
Supporting a wildcard makes all of the API so much easier to
implement, for example an merge component might only have
/*/*/*/*/gimp.desktop/*/*/* as the unique ID, which matches against
the flatpak *and* the package instance.

Some differences to what flatpak uses:

 * we're using "desktop" (or "desktop-application", urgh) rather than "app"
 * we're using a .desktop suffix on the ID like in <id>

So, I guess any comments are welcome; this isn't super important to
get a consensus on as it's not in the XML representation, but I
thought it might be useful to share what I'm doing as it's likely
libappstream will be dealing with the same issue sometime soon.

Richard


More information about the AppStream mailing list