[tracker-miners/wip/hadess/domain] data: Add option to set the D-Bus domain at build time
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/hadess/domain] data: Add option to set the D-Bus domain at build time
- Date: Thu, 27 Aug 2020 11:36:11 +0000 (UTC)
commit 8ae95ef77022f76f750390bb833f9462b772dac1
Author: Bastien Nocera <hadess hadess net>
Date: Thu Aug 27 12:45:23 2020 +0200
data: Add option to set the D-Bus domain at build time
Make it easier to run the tracker miners inside a sandbox by installing
the necessary files under a specific domain when the -Ddomain option is
passed.
Closes: #122
data/meson.build | 7 +++++++
data/org.freedesktop.domain.rule.in | 19 +++++++++++++++++++
meson.build | 8 ++++++++
meson_options.txt | 2 ++
src/miners/fs/meson.build | 2 +-
.../org.freedesktop.Tracker3.Miner.Files.service.in | 4 ++--
src/tracker-extract/meson.build | 2 +-
.../org.freedesktop.Tracker3.Miner.Extract.service.in | 8 ++++++--
8 files changed, 46 insertions(+), 6 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 7f6672f49..4cc9d420e 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -48,3 +48,10 @@ install_data('default.rule',
install_dir: join_paths(get_option('datadir'), tracker_versioned_name, 'domain-ontologies'))
tracker_miners_uninstalled_domain_rule = meson.current_source_dir() / 'default.rule'
+
+if get_option('domain_prefix') != 'org.freedesktop'
+ configure_file(input: 'org.freedesktop.domain.rule.in',
+ output: get_option('domain_prefix') + '.domain.rule',
+ configuration: conf,
+ install_dir: get_option('datadir') / 'tracker/domain-ontologies/')
+endif
diff --git a/data/org.freedesktop.domain.rule.in b/data/org.freedesktop.domain.rule.in
new file mode 100644
index 000000000..9a0d42894
--- /dev/null
+++ b/data/org.freedesktop.domain.rule.in
@@ -0,0 +1,19 @@
+# This defines a private Tracker domain for @DOMAIN@
+#
+# It's used to run the Tracker indexer inside a Flatpak sandbox.
+
+[DomainOntology]
+# Location for the Tracker database
+CacheLocation=$XDG_CACHE_HOME/@DOMAIN_PREFIX@/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=@DOMAIN_PREFIX@
+
+# List of miners we expect to run in this domain.
+Miners=Miner.Files;Miner.Extract
diff --git a/meson.build b/meson.build
index f89d33513..049f41f35 100644
--- a/meson.build
+++ b/meson.build
@@ -345,6 +345,14 @@ conf.set('HAVE_LIBIPTCDATA', libiptcdata.found())
conf.set('HAVE_LIBSECCOMP', libseccomp.found())
conf.set('HAVE_UPOWER', battery_detection_library_name == 'upower')
conf.set('HAVE_NETWORK_MANAGER', have_network_manager)
+conf.set('DOMAIN_PREFIX', get_option('domain_prefix'))
+if get_option('domain_prefix') != 'org.freedesktop'
+ rule_file = get_option('domain_prefix') + '.domain.rule'
+ domain_rule_path = get_option('datadir') / 'tracker3/domain-ontologies' / rule_file
+ conf.set('DOMAIN_ONTOLOGY_OPTIONS', '--initial-sleep 0 --domain-ontology ' + rule_file)
+else
+ conf.set('DOMAIN_ONTOLOGY_OPTIONS', '')
+endif
conf.set('HAVE_GETLINE', cc.has_function('getline', prefix : '#include <stdio.h>'))
conf.set('HAVE_POSIX_FADVISE', cc.has_function('posix_fadvise', prefix : '#include <fcntl.h>'))
diff --git a/meson_options.txt b/meson_options.txt
index 5ad5868f5..ecb839b44 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -15,6 +15,8 @@ option('miner_rss', type: 'boolean', value: true,
description: 'Enable the Tracker RSS miner')
option('writeback', type: 'boolean', value: true,
description: 'Enable Tracker writeback feature')
+option('domain_prefix', type: 'string', value: 'org.freedesktop',
+ description: 'Domain prefix to use, useful for sandboxing')
option('network_manager', type: 'feature', value: 'auto',
description: 'Connection detection through NetworkManager')
diff --git a/src/miners/fs/meson.build b/src/miners/fs/meson.build
index bf73467aa..8de4c82a2 100644
--- a/src/miners/fs/meson.build
+++ b/src/miners/fs/meson.build
@@ -33,7 +33,7 @@ executable('tracker-miner-fs-@0@'.format(tracker_api_major),
# It's also used by tracker-control to identify the miner.
dbus_service_file = configure_file(
input: 'org.freedesktop.Tracker3.Miner.Files.service.in',
- output: 'org.freedesktop.Tracker3.Miner.Files.service',
+ output: get_option('domain_prefix') + '.Tracker3.Miner.Files.service',
configuration: conf,
install: true,
install_dir: dbus_services_dir,
diff --git a/src/miners/fs/org.freedesktop.Tracker3.Miner.Files.service.in
b/src/miners/fs/org.freedesktop.Tracker3.Miner.Files.service.in
index 867c246dd..1921f5091 100644
--- a/src/miners/fs/org.freedesktop.Tracker3.Miner.Files.service.in
+++ b/src/miners/fs/org.freedesktop.Tracker3.Miner.Files.service.in
@@ -1,6 +1,6 @@
[D-BUS Service]
-Name=org.freedesktop.Tracker3.Miner.Files
-Exec=@libexecdir@/tracker-miner-fs-3
+Name=@DOMAIN_PREFIX@.Tracker3.Miner.Files
+Exec=@libexecdir@/tracker-miner-fs-3 @DOMAIN_ONTOLOGY_OPTIONS@
SystemdService=tracker-miner-fs-3.service
# Miner details needed for tracker-control
diff --git a/src/tracker-extract/meson.build b/src/tracker-extract/meson.build
index c6a5c6127..7c014cef2 100644
--- a/src/tracker-extract/meson.build
+++ b/src/tracker-extract/meson.build
@@ -168,7 +168,7 @@ executable('tracker-extract-@0@'.format(tracker_api_major),
# It's also used by tracker-control to identify the miner.
dbus_service_file = configure_file(
input: 'org.freedesktop.Tracker3.Miner.Extract.service.in',
- output: 'org.freedesktop.Tracker3.Miner.Extract.service',
+ output: get_option('domain_prefix') + '.Tracker3.Miner.Extract.service',
configuration: conf,
install: true,
install_dir: dbus_services_dir)
diff --git a/src/tracker-extract/org.freedesktop.Tracker3.Miner.Extract.service.in
b/src/tracker-extract/org.freedesktop.Tracker3.Miner.Extract.service.in
index 4fd5dc069..616dd7c4a 100644
--- a/src/tracker-extract/org.freedesktop.Tracker3.Miner.Extract.service.in
+++ b/src/tracker-extract/org.freedesktop.Tracker3.Miner.Extract.service.in
@@ -1,4 +1,8 @@
[D-BUS Service]
-Name=org.freedesktop.Tracker3.Miner.Extract
-Exec=@libexecdir@/tracker-extract-3
+Name=@DOMAIN_PREFIX@.Tracker3.Miner.Extract
+Exec=@libexecdir@/tracker-extract-3 @DOMAIN_ONTOLOGY_OPTIONS@
SystemdService=tracker-extract-3.service
+
+# Miner details needed for tracker-control
+Path=/org/freedesktop/Tracker3/Miner/Extract
+NameSuffix=Miner.Extract
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]