[gnome-books/wip/carlosg/tracker3: 7/7] flatpak: Update reference to use Tracker3
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-books/wip/carlosg/tracker3: 7/7] flatpak: Update reference to use Tracker3
- Date: Tue, 26 Jan 2021 13:27:47 +0000 (UTC)
commit 9015ace91da70f4f05750fdb00cb9f0a4e1ac647
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jan 26 14:18:53 2021 +0100
flatpak: Update reference to use Tracker3
Use the Tracker3 policy to specify the accessed graph, drop
the builtin tracker copy, and change tracker-miners build parameters
so we can run our own internal copy.
In code, first check whether there is access to the stock miner,
then attempt this internal miner. This is a fallback for systems that
do not have tracker3 installed.
flatpak/org.gnome.Books.json | 33 +++++++++------------------------
src/application.js | 11 +++++++++++
src/query.js | 4 ++--
3 files changed, 22 insertions(+), 26 deletions(-)
---
diff --git a/flatpak/org.gnome.Books.json b/flatpak/org.gnome.Books.json
index 46ec24db..1610f024 100644
--- a/flatpak/org.gnome.Books.json
+++ b/flatpak/org.gnome.Books.json
@@ -17,15 +17,13 @@
"--filesystem=xdg-documents:ro", "--filesystem=xdg-download:ro",
/* Needs to talk to the network: */
"--share=network",
- /* Tracker D-Bus access */
- "--talk-name=org.freedesktop.Tracker1",
- "--talk-name=org.freedesktop.Tracker1.Miner.Extract",
- "--env=TRACKER_SPARQL_BACKEND=bus",
/* For the WebP loader */
"--env=GDK_PIXBUF_MODULE_FILE=/app/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache",
/* Needed for dconf to work */
"--filesystem=xdg-run/dconf", "--filesystem=~/.config/dconf:ro",
"--talk-name=ca.desrt.dconf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
+ /* Tracker3 graph access */
+ "--add-policy=Tracker3.dbus:org.freedesktop.Tracker3.Miner.Files=tracker:Documents",
],
"cleanup": [ "/include", "/lib/pkgconfig",
"/share/pkgconfig", "/share/aclocal",
@@ -106,18 +104,6 @@
}
]
},
- {
- "name": "tracker",
- "buildsystem": "meson",
- "cleanup": [ "/bin", "/etc", "/lib/systemd", "/libexec", "/share/dbus-1/services" ],
- "config-opts": [ "--default-library=shared", "-Dbash-completion=no", "-Ddocs=false",
"-Dsystemd_user_services=no" ],
- "sources": [
- {
- "type": "git",
- "url": "https://gitlab.gnome.org/GNOME/tracker.git"
- }
- ]
- },
{
"name": "intltool",
"cleanup": [ "*" ],
@@ -132,15 +118,14 @@
{
"name": "tracker-miners",
"buildsystem": "meson",
- "cleanup": [ "/bin", "/etc", "/lib/systemd", "/libexec" ],
- "config-opts": [ "--default-library=shared",
- "-Dminer_apps=false",
- "-Dminer_rss=false",
- "-Dextract=false",
- "-Dgeneric_media_extractor=none",
- "-Dwriteback=false",
+ "config-opts": [ "-Ddefault_index_single_directories=",
+ "-Ddefault_index_recursive_directories=&MUSIC",
+ "-Ddomain_prefix=org.gnome.Books",
+ "-Dman=false",
"-Dminer_fs=true",
- "-Ddbus_services=/app/share/dbus-1/services/" ],
+ "-Dminer_fs_cache_location=$XDG_CACHE_HOME/org.gnome.Books/miner/files",
+ "-Dminer_rss=false",
+ "-Dsystemd_user_services=false" ],
"sources": [
{
"type": "git",
diff --git a/src/application.js b/src/application.js
index c3ebf933..39a52584 100644
--- a/src/application.js
+++ b/src/application.js
@@ -68,6 +68,7 @@ var sourceManager = null;
var trackerCollectionsController = null;
var trackerDocumentsController = null;
var trackerSearchController = null;
+var trackerMinerService = null;
const TrackerMinerFilesIndexIface = '<node> \
<interface name="org.freedesktop.Tracker3.Miner.Files.Index"> \
@@ -185,6 +186,16 @@ var Application = new Lang.Class({
return;
}
+ // test access to global tracker daemon
+ try {
+ let busConn = Tracker.SparqlConnection.bus_new('org.freedesktop.Tracker3.Miner.Files',
+ null, Gio.DBus.session);
+ trackerMinerService = 'org.freedesktop.Tracker3.Miner.Files';
+ } catch (e) {
+ // if the daemon is not available, run our own copy (for the sandboxed case)
+ trackerMinerService = this.get_application_id() + '.Tracker3.Miner.Files';
+ }
+
connectionQueue = new TrackerController.TrackerConnectionQueue();
changeMonitor = new ChangeMonitor.TrackerChangeMonitor();
diff --git a/src/query.js b/src/query.js
index fa7c5ca1..4fc94b6b 100644
--- a/src/query.js
+++ b/src/query.js
@@ -212,7 +212,7 @@ var QueryBuilder = new Lang.Class({
tailSparql;
} else {
sparql +=
- 'SERVICE <dbus:org.freedesktop.Tracker3.Miner.Files> {' +
+ 'SERVICE <dbus:' + this._context.trackerMinerService + '> {' +
' GRAPH tracker:Documents { ' +
' SELECT DISTINCT ?urn ' +
selectClauses +
@@ -249,7 +249,7 @@ var QueryBuilder = new Lang.Class({
this._buildWhere(true, flags);
} else {
sparql = 'SELECT ?c {' +
- ' SERVICE <dbus:org.freedesktop.Tracker3.Miner.Files> { ' +
+ ' SERVICE <dbus:' + this._context.trackerMinerService + '> { ' +
' SELECT DISTINCT COUNT(?urn) AS ?c ' +
this._buildWhere(true, flags) +
' }' +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]