Merge lp:~stolowski/unity8-session-snap/thumbnailer-fixes into lp:unity8-session-snap

Proposed by Paweł Stołowski on 2016-11-14
Status: Rejected
Rejected by: Paweł Stołowski on 2016-11-15
Proposed branch: lp:~stolowski/unity8-session-snap/thumbnailer-fixes
Merge into: lp:unity8-session-snap
Diff against target: 36 lines (+13/-0)
2 files modified
overlay/snappyenv (+12/-0)
snapcraft.yaml (+1/-0)
To merge this branch: bzr merge lp:~stolowski/unity8-session-snap/thumbnailer-fixes
Reviewer Review Type Date Requested Status
Unity8 Session Snap team 2016-11-14 Pending
Review via email: mp+310756@code.launchpad.net

Description of the Change

Fixes to make thumbnailer-service work in the snap. Without them thumbnailer considers images to be of text/plain type and also cannot process them because of missing pixbuf loaders.

There are two aspects of this fix:
- usr/share/mime files are genereted when the snap is created.
- gdk-pixbuf-loaders.cache is created by snappyenv script on first run (based on snappy-playpen/plank).

I'm not totally happy with the way the mime part works, i.e. the need to copy generated files from stage to install dir. The main problem is that update-mime-database doesn't support arbitrary target directories. I tried different approaches in snapcraft.yaml and x-mime plugin without success, but perhaps I missed something. Any suggestions for making this cleaner will be appreciated.

To test this branch you need scopes wich actually trigger thumbnailer with image://thumbnailer/ uris. I've tested it with unity-scope-fake from ppa:unity-team/scopes-dev (e.g with Fake Music scope).

To post a comment you must log in.
Michael Terry (mterry) wrote :

OK, I'm going to test this, but a couple quick comments:

- You might want to use post-process.mk instead of a custom plugin. Should be simpler overall and be consistent with existing post processing like gsettings schemas.

- To avoid polluting the stage directory, maybe copy ./stage/usr/share/mime to a working dir, run update-mime-database, then copy the result into the install dir and delete the working dir.

- Why do you set XDG_CACHE_HOME? HOME will be set to SNAP_USER_DATA already, so the default will be the same as the one you set. If you were just trying to be explicit (to avoid typing HOME/.cache elsewhere), at least use the correct value of HOME/.cache (since HOME will actually be different based on whether the wrapper script is running for a system daemon we install, like cgmanager, or a user command like unity8).

Michael Terry (mterry) wrote :

What normally runs gdk-pixbuf-query-loaders in a user session? Can we adjust them to know about SNAP instead of pulling that logic into our wrapper script?

Paweł Stołowski (stolowski) wrote :

> What normally runs gdk-pixbuf-query-loaders in a user session? Can we adjust
> them to know about SNAP instead of pulling that logic into our wrapper script?

It's normally run on per-system basis by dpkg hooks (/var/lib/dpkg/info/libgdk-pixbuf2.0-0*postinst). I'm not aware of doing this in user session. In snap world however it's been done like that for the plank launcher in snappy-playpen (I borrowed it from there).

As for your earlier suggestion sure, I will try doing that, thanks for the review!

Michael Terry (mterry) wrote :

OK, I took your mime bits and added them to post-process.mk in trunk. And verified it got picked up by the snap.

So thanks for that bit! You can drop that part of this MP now.

That leaves the pixbuf loaders...

Michael Terry (mterry) wrote :

Don't bother looking at the pixbuf loaders either actually. I'm trying to integrate the desktop-loader script from snappy land and it should address that for us...

Paweł Stołowski (stolowski) wrote :

I got it working in the meantime, but indeed using existing desktop-loaders is definately a better idea. Closing this MR.

Unmerged revisions

54. By Paweł Stołowski on 2016-11-15

Actually create loaders cache file

53. By Paweł Stołowski on 2016-11-15

Remove mime plugin since it's now handled by post-process.mk.
Update gdk pixbuf loaders cache if snap gets upgraded.

52. By Paweł Stołowski on 2016-11-15

Merged trunk

51. By Paweł Stołowski on 2016-11-14

Merged trunk.

50. By Paweł Stołowski on 2016-11-14

Generate mime data in usr/share/mime and initialize gdk-pixbuf loaders cache to make thumbnailer-service work in the snap.

49. By Paweł Stołowski on 2016-11-10

Added x-mime.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'overlay/snappyenv'
2--- overlay/snappyenv 2016-11-14 16:25:42 +0000
3+++ overlay/snappyenv 2016-11-15 14:13:35 +0000
4@@ -80,6 +80,18 @@
5 export FONTCONFIG_PATH=$SNAP/etc/fonts
6 export FONTCONFIG_FILE=$SNAP_USER_DATA/fonts.conf
7
8+# Setup GDK pixbuf loaders
9+export GDK_PIXBUF_MODULE_FILE=$HOME/.cache/gdk-pixbuf-loaders.cache
10+export GDK_PIXBUF_MODULEDIR=$SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/2.10.0/loaders
11+if [ -f $GDK_PIXBUF_MODULE_FILE ] && ! grep -q $SNAP $GDK_PIXBUF_MODULE_FILE; then
12+ # This is an old version of the file that points to another snap location.
13+ # Delete it and then recreate.
14+ rm $GDK_PIXBUF_MODULE_FILE
15+fi
16+if [ ! -e $GDK_PIXBUF_MODULE_FILE ]; then
17+ $SNAP/usr/lib/$ARCH/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders > $GDK_PIXBUF_MODULE_FILE
18+fi
19+
20 if [ -f $FONTCONFIG_FILE ] && ! grep -q $SNAP $FONTCONFIG_FILE; then
21 # This is an old version of the file that points to another snap location.
22 # Delete it and we'll recreate it in a second.
23
24=== added directory 'parts'
25=== added directory 'parts/plugins'
26=== modified file 'snapcraft.yaml'
27--- snapcraft.yaml 2016-11-14 16:53:00 +0000
28+++ snapcraft.yaml 2016-11-15 14:13:35 +0000
29@@ -71,6 +71,7 @@
30 - unity-scope-click
31 - unity-scope-mediascanner2
32 - url-dispatcher
33+ - libgdk-pixbuf2.0-0
34 - thumbnailer-service
35 - webbrowser-app
36 - webapp-container

Subscribers

People subscribed via source and target branches