From f9c79fce6d90e7e5842f2c56a1ec98a151126874 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Sat, 1 Aug 2020 17:25:27 +0200 Subject: Use Tracker Miners inside Flatpak when not available on the host This means the Nautilus flatpak will be able to use Tracker on systems which don't have Tracker 3 available on the host. It comes at a cost of increased resource consumption inside the Flatpak due running an extra indexer process there. --- data/meson.build | 1 + data/tracker/meson.build | 31 ++++++++++++++++++++++ ...nome.Nautilus.Tracker3.Miner.Extract.service.in | 7 +++++ ....gnome.Nautilus.Tracker3.Miner.Files.service.in | 7 +++++ data/tracker/org.gnome.Nautilus.domain.rule.in | 21 +++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 data/tracker/meson.build create mode 100644 data/tracker/org.gnome.Nautilus.Tracker3.Miner.Extract.service.in create mode 100644 data/tracker/org.gnome.Nautilus.Tracker3.Miner.Files.service.in create mode 100644 data/tracker/org.gnome.Nautilus.domain.rule.in (limited to 'data') diff --git a/data/meson.build b/data/meson.build index e51ed50b1..9a4e2ff52 100644 --- a/data/meson.build +++ b/data/meson.build @@ -139,3 +139,4 @@ if appstream_util.found() endif subdir('ontology') +subdir('tracker') diff --git a/data/tracker/meson.build b/data/tracker/meson.build new file mode 100644 index 000000000..5320af164 --- /dev/null +++ b/data/tracker/meson.build @@ -0,0 +1,31 @@ +# Files needed for running Tracker inside the Flatpak sandbox, for systems +# which don't have a suitable version of Tracker in the host OS. +# +# We must export the .service files from the sandbox so they work on the +# session bus. This means the Tracker domain name must correspond with the +# application ID. + +domain_ontologies_dir = get_option('datadir') / 'tracker3' / 'domain-ontologies' +dbus_services_dir = get_option('datadir') / 'dbus-1' / 'services' + +tracker_domain_config = configuration_data() +tracker_domain_config.set('application_id', application_id) +tracker_domain_config.set('domain_rule', get_option('prefix') / domain_ontologies_dir / application_id + '.domain.rule') + +configure_file( + input: 'org.gnome.Nautilus.domain.rule.in', + output: application_id + '.domain.rule', + configuration: tracker_domain_config, + install_dir: domain_ontologies_dir) + +configure_file( + input: 'org.gnome.Nautilus.Tracker3.Miner.Extract.service.in', + output: application_id + '.Tracker3.Miner.Extract.service', + configuration: tracker_domain_config, + install_dir: dbus_services_dir) + +configure_file( + input: 'org.gnome.Nautilus.Tracker3.Miner.Files.service.in', + output: application_id + '.Tracker3.Miner.Files.service', + configuration: tracker_domain_config, + install_dir: dbus_services_dir) diff --git a/data/tracker/org.gnome.Nautilus.Tracker3.Miner.Extract.service.in b/data/tracker/org.gnome.Nautilus.Tracker3.Miner.Extract.service.in new file mode 100644 index 000000000..eb7a87aa6 --- /dev/null +++ b/data/tracker/org.gnome.Nautilus.Tracker3.Miner.Extract.service.in @@ -0,0 +1,7 @@ +[D-BUS Service] +Name=@application_id@.Tracker3.Miner.Extract +Exec=/app/libexec/tracker-extract-3 --domain-ontology @domain_rule@ + +# Miner details needed for tracker-control +Path=/org/freedesktop/Tracker3/Miner/Extract +NameSuffix=Miner.Files diff --git a/data/tracker/org.gnome.Nautilus.Tracker3.Miner.Files.service.in b/data/tracker/org.gnome.Nautilus.Tracker3.Miner.Files.service.in new file mode 100644 index 000000000..4fa7371d1 --- /dev/null +++ b/data/tracker/org.gnome.Nautilus.Tracker3.Miner.Files.service.in @@ -0,0 +1,7 @@ +[D-BUS Service] +Name=@application_id@.Tracker3.Miner.Files +Exec=/app/libexec/tracker-miner-fs-3 --domain-ontology @domain_rule@ --initial-sleep 0 + +# Miner details needed for tracker-control +Path=/org/freedesktop/Tracker3/Miner/Files +NameSuffix=Miner.Files diff --git a/data/tracker/org.gnome.Nautilus.domain.rule.in b/data/tracker/org.gnome.Nautilus.domain.rule.in new file mode 100644 index 000000000..ec0808e30 --- /dev/null +++ b/data/tracker/org.gnome.Nautilus.domain.rule.in @@ -0,0 +1,21 @@ +# This defines a private Tracker domain for Nautilus. +# +# It's used to run the Tracker indexer inside a Flatpak sandbox, when Nautilus +# is running on a host that doesn't have a suitable version of Tracker +# installed. + +[DomainOntology] +# Location for the Tracker database +CacheLocation=$XDG_CACHE_HOME/nautilus/miner/files + +# Name of the ontology to use, must be one located in +# $(sharedir)/tracker/ontologies +OntologyName=nepomuk + +# DBus name for the owner (not optional). Tracker will use +# the domain as the prefix of the DBus name for all the +# services related to this domain ontology. +Domain=@application_id@ + +# List of miners we expect to run in this domain. +Miners=Miner.Files;Miner.Extract -- cgit v1.2.1