Appstream ID and Flatpak

Matthias Klumpp matthias at tenstral.net
Tue Dec 12 17:05:01 UTC 2017


2017-12-12 9:33 GMT+01:00 Alexander Larsson <alexl at redhat.com>:
> What exactly does this mean:
>
> ```
> <component type="desktop-application">
>   <id>org.example.FooBar</id>
>   <launchable type="desktop-id">foobar.desktop</launchable>
>   <provides>
>     <id>foobar.desktop</id>
>   </provides>
>   ...
> </component>
> ```
>
> Suppose the upstream app has a foobar.desktop file (with corresponding
> id=foobar.desktop in the appdata file).

That's not necessary (anymore) and not even wanted, because the ID can
be independent from the .desktop filename of the application, and
should (sometimes must) follow a reverse-DNS scheme.

> We need the shipped desktop file with the app to be
> org.example.FooBar.desktop, and the appdata file must find that file when
> for the extra info. What should we put in the modified appdata file?

Something like this:
```
<component type="desktop-application">
  <id>org.example.FooBar</id>
  <launchable type="desktop-id">org.example.FooBar.desktop</launchable>
  ...
</component>
```

Ideally, the metainfo file should be complete enough so the only thing
that is still fetched from the .desktop file is the icon. But if it
isn't, the following heuristic is applied:
1) If exactly one <launchable/> tag of type desktop-id is present,
merge in information from that
2) Otherwise, if the <id/> has a .desktop suffix, find a desktop file
with that name and merge information
3) For compatibility: If the <id/> has no .desktop suffix and no
<launchable/> tag is present, try to find .desktop file matching the
id+".desktop" name - if there is none, just don't merge in anything

This applies only for desktop-application components though, which is
the only case where we have the "merge in stuff from other files"
situation.

> Also, the actual renaming of the appdata file should not be a problem right?
> We do that so the tooling finds it in a well-known path, the issue is only
> the id listed in the xml.

The specification doesn't enforce a naming scheme for those, but the
recommendation is to name the file %{id}.appdata.xml or
%{id}.metainfo.xml. AFAIK Richard uses that in GNOME Software to
quickly check whether a metainfo file for a certain ID exists (just
stat a file instead of parse all XML).
For this issue, and also in general, the name of the appdata/metainfo
files doesn't matter at all though, only the value of the <id/> tag is
important.


Cheers,
    Matthias


More information about the Flatpak mailing list