[gnome-boxes/wip/carlosg/tracker3: 4/5] Bundle Tracker Miners inside the Flatpak




commit b4d9828c1cf5c209ac6b7a87401cc529e7985d75
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Aug 2 14:08:44 2020 +0200

    Bundle Tracker Miners inside the Flatpak
    
    This allows Boxes to use Tracker for indexing on systems which don't
    have Tracker 3 available on the host.

 build-aux/flatpak/org.gnome.Boxes.json | 49 +++++++---------------------------
 src/media-manager.vala                 | 11 ++++++++
 2 files changed, 20 insertions(+), 40 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Boxes.json b/build-aux/flatpak/org.gnome.Boxes.json
index 8b53caed..92da2abe 100644
--- a/build-aux/flatpak/org.gnome.Boxes.json
+++ b/build-aux/flatpak/org.gnome.Boxes.json
@@ -16,14 +16,13 @@
         "--system-talk-name=org.freedesktop.timedate1",
         "--system-talk-name=org.freedesktop.Accounts",
         "--filesystem=/var/lib/AccountsService/icons:ro",
-        "--talk-name=org.freedesktop.Tracker1",
-        "--env=TRACKER_SPARQL_BACKEND=bus",
         "--talk-name=org.freedesktop.secrets",
         "--filesystem=xdg-run/dconf",
         "--filesystem=~/.config/dconf:ro",
         "--filesystem=home",
         "--talk-name=ca.desrt.dconf",
-        "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
+        "--env=DCONF_USER_CONFIG_DIR=.config/dconf",
+        "--add-policy=Tracker3.dbus:org.freedesktop.Tracker3.Miner.Files=tracker:Software"
     ],
     "modules" : [
         {
@@ -275,59 +274,29 @@
                 }
             ]
         },
-        {
-            "name" : "tracker",
-            "buildsystem" : "meson",
-            "cleanup" : [
-                "/bin",
-                "/etc",
-                "/libexec"
-            ],
-            "config-opts" : [
-                "-Dbash_completion=no",
-                "-Dfunctional_tests=false",
-                "-Dman=false",
-                "-Ddocs=false",
-                "-Dsystemd_user_services=no"
-            ],
-            "sources" : [
-                {
-                    "type" : "git",
-                    "url" : "https://gitlab.gnome.org/GNOME/tracker.git";,
-                    "branch": "tracker-2.3"
-                }
-            ]
-        },
         {
             "name": "tracker-miners",
             "buildsystem": "meson",
             "cleanup": [
                 "/etc",
-                "/lib",
                 "/libexec",
-                "/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Extract.service",
-                "/share/dbus-1/services/org.freedesktop.Tracker1.Writeback.service",
-                "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Applications.service",
-                "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Extract.service",
-                "/share/tracker/miners/org.freedesktop.Tracker1.Miner.RSS.service",
-                "/share/tracker-miners",
-                "/share/glib-2.0/schemas/org.freedesktop.Tracker.Extract.gschema.xml",
-                "/share/glib-2.0/schemas/org.freedesktop.Tracker.Writeback.gschema.xml"
+                "/share/tracker/miners"
             ],
             "config-opts": [
-                "-Dextract=false",
+                "-Ddomain_prefix=org.gnome.BoxesDevel",
+                "-Dextract=true",
                 "-Dgeneric_media_extractor=none",
-                "-Dminer_apps=false",
+                "-Dman=false",
                 "-Dminer_fs=true",
+                "-Dminer_fs_cache_location=$XDG_CACHE_HOME/gnome-boxes/miner/files",
                 "-Dminer_rss=false",
-                "-Dsystemd_user_services=no",
+                "-Dsystemd_user_services=false",
                 "-Dwriteback=false"
             ],
             "sources": [
                 {
                     "type": "git",
-                    "url": "https://gitlab.gnome.org/GNOME/tracker-miners.git";,
-                    "branch" : "tracker-miners-2.3"
+                    "url": "https://gitlab.gnome.org/GNOME/tracker-miners.git";
                 }
             ]
         },
diff --git a/src/media-manager.vala b/src/media-manager.vala
index c5648240..da758d17 100644
--- a/src/media-manager.vala
+++ b/src/media-manager.vala
@@ -1,5 +1,6 @@
 // This file is part of GNOME Boxes. License: LGPLv2+
 
+using Config;
 using Osinfo;
 using Tracker;
 
@@ -229,7 +230,17 @@ private MediaManager () {
             connection = Sparql.Connection.bus_new ("org.freedesktop.Tracker3.Miner.Files",
                                                     null, null);
         } catch (GLib.Error error) {
+#if !FLATPAK
             critical ("Error connecting to Tracker: %s", error.message);
+#else
+            message ("Error connecting to host Tracker Miners: %s", error.message);
+            try {
+                connection = Sparql.Connection.bus_new (Config.APPLICATION_ID + "Tracker3.Miner.Files",
+                                                        null, null);
+            } catch (GLib.Error error) {
+                critical ("Error starting local Tracker Miners: %s", error.message);
+            }
+#endif
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]