[totem/sam/tracker3-flatpak-bundle: 1/2] Run Tracker Miners inside the Flatpak sandbox
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/sam/tracker3-flatpak-bundle: 1/2] Run Tracker Miners inside the Flatpak sandbox
- Date: Tue, 18 Aug 2020 21:55:46 +0000 (UTC)
commit aa8a58d212992df2ae41af6e543254e2c2f1e2f1
Author: Sam Thursfield <sam afuera me uk>
Date: Sun Aug 2 12:28:11 2020 +0200
Run Tracker Miners inside the Flatpak sandbox
The Flatpak version of Totem will now run a local tracker-miner-fs-3
instance instead of using the host instance, in all cases.
For background, see:
https://gitlab.gnome.org/GNOME/totem/-/merge_requests/154#note_881125
data/meson.build | 2 ++
data/tracker/meson.build | 32 ++++++++++++++++++++++
...g.gnome.Totem.Tracker3.Miner.Extract.service.in | 7 +++++
...org.gnome.Totem.Tracker3.Miner.Files.service.in | 7 +++++
data/tracker/org.gnome.Totem.domain.rule.in | 20 ++++++++++++++
flatpak/org.gnome.Totem.Devel.json | 24 +++++++++++++---
src/totem-grilo.c | 9 ++++++
7 files changed, 97 insertions(+), 4 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 32f2f8450..3190e733b 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -180,3 +180,5 @@ install_data(
'totem.convert',
install_dir: join_paths(totem_datadir, 'GConf', 'gsettings')
)
+
+subdir('tracker')
diff --git a/data/tracker/meson.build b/data/tracker/meson.build
new file mode 100644
index 000000000..594ab3778
--- /dev/null
+++ b/data/tracker/meson.build
@@ -0,0 +1,32 @@
+# 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.Totem.domain.rule.in',
+ output: application_id + '.domain.rule',
+ configuration: tracker_domain_config,
+ install_dir: domain_ontologies_dir)
+
+configure_file(
+ input: 'org.gnome.Totem.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.Totem.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.Totem.Tracker3.Miner.Extract.service.in
b/data/tracker/org.gnome.Totem.Tracker3.Miner.Extract.service.in
new file mode 100644
index 000000000..eb7a87aa6
--- /dev/null
+++ b/data/tracker/org.gnome.Totem.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.Totem.Tracker3.Miner.Files.service.in
b/data/tracker/org.gnome.Totem.Tracker3.Miner.Files.service.in
new file mode 100644
index 000000000..4fa7371d1
--- /dev/null
+++ b/data/tracker/org.gnome.Totem.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.Totem.domain.rule.in b/data/tracker/org.gnome.Totem.domain.rule.in
new file mode 100644
index 000000000..d1ce398d3
--- /dev/null
+++ b/data/tracker/org.gnome.Totem.domain.rule.in
@@ -0,0 +1,20 @@
+# This defines a private Tracker domain for GNOME Totem.
+#
+# It's used to run the Tracker indexer inside a Flatpak sandbox, when Totem 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/totem/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
diff --git a/flatpak/org.gnome.Totem.Devel.json b/flatpak/org.gnome.Totem.Devel.json
index 5f6550080..c4540c91d 100644
--- a/flatpak/org.gnome.Totem.Devel.json
+++ b/flatpak/org.gnome.Totem.Devel.json
@@ -44,9 +44,7 @@
/* MPRIS plugin */
"--own-name=org.mpris.MediaPlayer2.totem",
/* im-status plugin */
- "--talk-name=org.gnome.SessionManager",
- /* Tracker 3 policy */
- "--add-policy=Tracker3.dbus:org.freedesktop.Tracker3.Miner.Files=tracker:Video"
+ "--talk-name=org.gnome.SessionManager"
],
"cleanup": [ "/include", "/share/bash-completion" ],
"modules": [
@@ -165,6 +163,24 @@
}
]
},
+ {
+ "name": "tracker-miners",
+ "cleanup": [ "/bin", "/etc", "/share/dbus-1/services" ],
+ "buildsystem": "meson",
+ "config-opts" : [
+ "-Dman=false",
+ "-Dminer_fs=true",
+ "-Dminer_rss=false",
+ "-Dsystemd_user_services=false",
+ "-Dwriteback=false"
+ ],
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://gitlab.gnome.org/GNOME/tracker-miners.git"
+ }
+ ]
+ },
{
"name": "libmediaart",
"cleanup": [ "/bin", "/etc", "/libexec" ],
@@ -213,7 +229,7 @@
"-Denable-lua-factory=yes",
"-Denable-metadata-store=yes",
"-Denable-vimeo=yes",
- "-Denable-tracker=yes",
+ "-Denable-tracker3=yes",
"-Denable-local-metadata=yes",
"-Denable-dleyna=yes",
"-Denable-thetvdb=yes",
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index ec0b68041..69573a2aa 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -1484,6 +1484,15 @@ load_grilo_plugins (TotemGrilo *self)
return;
}
+ if (grl_registry_activate_plugin_by_id (registry, "grl-tracker3", &error)) {
+ config = grl_config_new ("grl-tracker3", NULL);
+ grl_config_set_string (config, "miner-service", APPLICATION_ID ".Tracker3.Miner.Files");
+ grl_registry_add_config (registry, config, NULL);
+ } else {
+ g_message ("Didn't activate grl-tracker3 plugin: %s", error->message);
+ g_clear_error (&error);
+ }
+
for (i = 0; i < G_N_ELEMENTS(required_plugins); i++) {
if (!grl_registry_activate_plugin_by_id (registry, required_plugins[i], &error)) {
g_warning ("Failed to load %s plugin: %s", required_plugins[i], error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]