Using appstream in xdg-app

Alexander Larsson alexl at redhat.com
Mon Dec 21 20:17:32 UTC 2015


On mån, 2015-12-21 at 15:36 +0100, Matthias Klumpp wrote:
> 2015-12-18 16:27 GMT+01:00 Richard Hughes <rhughes at redhat.com>:
> > > 
> > > The name of the appinfo file needs to be "$(APP_ID).appdata.xml",
> > > in
> > > order to be allowed for export (xdg-app only allows files with
> > > the app-
> > > id as prefix to be exported, to avoid conflicts in the exported
> > > directories). The id of the app should be that of the desktop
> > > file,
> > > which due to the prefix rule is "$(APP_ID).desktop", and
> > > similarly the
> > > icon will have the app-id as the prefix.
> > 
> > Is this an upstream change required for apps? If so we probably
> > want to blog about this a bit more, and if this does stick it makes
> > the "find an application icon" code in appstream-glib becomes SO
> > much simpler.
> 
> Well, you can't assume that everyone will follow that guideline if
> just because we say so (as always)...

We can assume it for the xdg-app extractor perhaps. But yeah, not in
general.

> > > On the client
> > > =============
> > > 
> > > Each xdg-app directory (i.e. /var/xdg-app and ~/.local/share/xdg-
> > > app)
> > > will maintain a local mirror of the "appdata" branch of each
> > > configured remote. This will typically be a reference called
> > > "€remotename:appdata/$arch" and be stored in
> > > "repo/remotes/$remotename/appdata/$arch".
> > 
> > wfm.
> > 
> > > Additionally, there will be a deployed version of this branch in
> > > "appdata/$remotename". This is where e.g. gnome-software would
> > > look
> > > for appdata info and icons.
> 
> Why does this need to be done? If the repository data & icons are
> already exported to /var/{lib|cache}/app-info/{xmls|icons}, all
> AppStream implementations will read it. With xdg-app putting stuff
> elsewhere, there are even more locations to read data from, and if we
> can assume the distro XML is up-to-date, we don't nee to read the
> AppData stuff at all.

There are several issues here:

First of all, the the /var/cache location is not writable by the user,
so its completely impossible to use for the user installed xdg-app.

Secondly, with multiple sources of app info data (e.g. several xdg-app
repos) its tricky to keep a cache up to date. For instance, if one repo
removes an app, how/when do we remove the corresponding cached icon.
You'd need to keep a lot of bookkeeping data around, or regenerate the
cache on any change.

Third, there is no way to sanely handle conflicts with a shared cache.
If two repos have the same named icon then you don't know which one
wins.

> > > Localized data is pretty large, and we generally don't need all
> > > locales. For instance, on my fedora 23 install 62% of the
> > > uncompressed
> > > repo appdata is made up of localized strings. We could split up
> > > the
> > > xml files per-locale and have separate branches (say
> > > "appdata/$arch/$locale" and "appdata/$arch/icons"). Would this be
> > > worth it? Also, does appstream support localized icons?
> > 
> > We support localised icons in theory, but I don't think any of the
> > tools support it.
> 
> I would say we don't support localized icons at all - it's not
> mentioned anywhere in the spec, and if we would support
> localizations,

This is how you would specify them:

<icon height="64" width="64" type="cached" xml:lang="it">foo.png</icon>

I don't know how much the spec talks about how translations are
implemented though.

> we would need to define subdirectories for localization in the icon
> cache or have the icon files renamed to something, which is
> completely

There is no need for that, the app would have to do the renaming and
just add the renamed filename to the xml node.

> unclear. Also, no tool will understand localized icons currently, and
> I've see no application using them, likely because the XDG icon spec
> also doesn't support this.

Desktop files define the "Icon" fields as type "localestring" which
means that its supposed to be supported to translate it. Glib
implements this, but I'm not sure any app uses it.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's an old-fashioned skateboarding gangster looking for a cure to the 
poison coursing through his veins. She's a beautiful cigar-chomping 
advertising executive living on borrowed time. They fight crime! 





More information about the xdg-app mailing list