Flatpaking of Paperwork: Issues with locale-specific files and scanner drivers

Alexander Larsson alexl at redhat.com
Thu Oct 12 11:45:47 UTC 2017


On Wed, 2017-10-11 at 20:34 +0000, Jerome Flesch wrote:
> Hello,
> 
> 
> I'm trying to package Paperwork ( https://openpaper.work/ | https://g
> ithub.com/openpaperwork/paperwork ), and I've hit two issues:
> 
> - Paperwork uses Tesseract for OCR, and Tesseract requires specific
> data files for each language ( https://github.com/tesseract-ocr/tessd
> ata/ ). All the data files for all the languages take about 600MB.
> Most users will use at most 2 or 3 languages, so bundling them all
> with Paperwork would be pretty overkill.

Flatpak splits out locale data into a separate extension called
org.my.App.Locale, and when you install the app only parts of the
locale extension is installed, depending on exactly what languages are
configured. For example, if you only use "sv" then only the /sv
directory of the locale extension is installed.

This can be used to add locale-specific data files. For instance, the
freedesktop.org platform recently grew dictionary data, which are
placed in the locale extension. This means you only get the
dictionaries for your installed languages.

Exactly how the locales work has changed a bit over time. For the
longest time it only installed the languages that were the current
language when you installed, but at some point per-installation
configuration option was added, and some changes in what is installed
by default. In fact, only yesterday i did some work on this in master.

Here is the current behaviour:
There is a new command "flatpak config" which lets you set the set of
languages to install:
 flatpak config --set language sv;en;de
(or with --user to set the per-user config)
This is then used whenever you install/update apps.
If this is not configured then the default is used. For --user installs
the default is the current languages as defined by various locale env
vars. For system defaults we ask AccountServices for all users
configured languages and combine those as the list. If AccountServices
is not there, or some user has no language set we install all
languages.

> - Paperwork uses Sane to access scanners. However, Sane only has
> user-land drivers (most uses libusb I guess). Most users don't have
> saned (Sane daemon) enabled on their system. Therefore, libsane
> usually access directly the scanner(s) using the user-land drivers
> bundled with it. I can easily package all the open-source drivers of
> sane-backends with Paperwork, but some people have scanners requiring
> proprietary drivers. For instance, my Brother scanner is installed
> using a shell script provided by Brother, and this shell script
> download and install .deb files.

You can make an app extension point for this, then people can package
drivers either as flatpaks, or by using "unmanaged extensions" which
are just a correctly named directory on the host acting as an
extension.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a maverick Catholic astronaut searching for his wife's true killer. 
She's a scantily clad hypochondriac nun fleeing from a Satanic cult. They 
fight crime! 


More information about the Flatpak mailing list