[tracker/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/wip/hadess/domain] data: Add option to set the D-Bus domain at build time
- Date: Thu, 27 Aug 2020 10:40:32 +0000 (UTC)
commit 7b5eb18f6cf04b92a57e81b4deba9d530bf8f704
Author: Bastien Nocera <hadess hadess net>
Date: Thu Aug 27 12:30:42 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/DOMAIN.Tracker3.Miner.Extract.service.in | 7 +++++++
data/DOMAIN.Tracker3.Miner.Files.service.in | 7 +++++++
data/DOMAIN.domain.rule.in | 19 +++++++++++++++++++
data/meson.build | 16 ++++++++++++++++
meson.build | 3 +++
meson_options.txt | 2 ++
6 files changed, 54 insertions(+)
---
diff --git a/data/DOMAIN.Tracker3.Miner.Extract.service.in b/data/DOMAIN.Tracker3.Miner.Extract.service.in
new file mode 100644
index 000000000..603f07acb
--- /dev/null
+++ b/data/DOMAIN.Tracker3.Miner.Extract.service.in
@@ -0,0 +1,7 @@
+[D-BUS Service]
+Name=@DOMAIN@.Tracker3.Miner.Extract
+Exec=@libexecdir@/tracker-extract-3 --domain-ontology @datadir@/tracker3/domain-ontologies/@DOMAIN domain
rule
+
+# Miner details needed for tracker-control
+Path=/org/freedesktop/Tracker3/Miner/Extract
+NameSuffix=Miner.Extract
diff --git a/data/DOMAIN.Tracker3.Miner.Files.service.in b/data/DOMAIN.Tracker3.Miner.Files.service.in
new file mode 100644
index 000000000..0b8463eb8
--- /dev/null
+++ b/data/DOMAIN.Tracker3.Miner.Files.service.in
@@ -0,0 +1,7 @@
+[D-BUS Service]
+Name=@DOMAIN@.Tracker3.Miner.Files
+Exec=@libexecdir@/tracker-miner-fs-3 --domain-ontology @datadir@/tracker3/domain-ontologies/@DOMAIN domain
rule --initial-sleep 0
+
+# Miner details needed for tracker-control
+Path=/org/freedesktop/Tracker3/Miner/Files
+NameSuffix=Miner.Files
diff --git a/data/DOMAIN.domain.rule.in b/data/DOMAIN.domain.rule.in
new file mode 100644
index 000000000..45d8a5bbc
--- /dev/null
+++ b/data/DOMAIN.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@/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@
+
+# List of miners we expect to run in this domain.
+Miners=Miner.Files;Miner.Extract
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 000000000..937d9f5f2
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,16 @@
+if get_option('domain') != ''
+ domain = get_option('domain')
+
+ configure_file(input: 'DOMAIN.domain.rule.in',
+ output: domain + 'domain.rule',
+ configuration: conf,
+ install_dir: get_option('datadir') / 'tracker/domain-ontologies/')
+ configure_file(input: 'DOMAIN.Tracker3.Miner.Extract.service.in',
+ output: domain + '.Tracker3.Miner.Extract.service',
+ configuration: conf,
+ install_dir: get_option('datadir') / 'dbus-1')
+ configure_file(input: 'DOMAIN.Tracker3.Miner.Files.service.in',
+ output: domain + '.Tracker3.Miner.Files.service',
+ configuration: conf,
+ install_dir: get_option('datadir') / 'dbus-1')
+endif
diff --git a/meson.build b/meson.build
index 5ed0a4745..0aabe848c 100644
--- a/meson.build
+++ b/meson.build
@@ -241,6 +241,7 @@ conf.set('HAVE_BUILTIN_FTS', sqlite3_has_builtin_fts5)
conf.set('HAVE_LIBICU', unicode_library_name == 'icu')
conf.set('HAVE_LIBSTEMMER', have_libstemmer)
conf.set('HAVE_LIBUNISTRING', unicode_library_name == 'unistring')
+conf.set('DOMAIN', get_option('domain'))
conf.set('HAVE_POSIX_FADVISE', cc.has_function('posix_fadvise', prefix : '#include <fcntl.h>'))
conf.set('HAVE_STATVFS64', cc.has_header_symbol('sys/statvfs.h', 'statvfs64', args: '-D_LARGEFILE64_SOURCE'))
@@ -260,6 +261,7 @@ conf.set('TRACKER_BINARY_AGE', 100 * tracker_minor_version + tracker_micro_versi
# Config that goes in some other generated files (.desktop, .service, etc)
conf.set('abs_top_builddir', meson.current_build_dir())
conf.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir')))
+conf.set('datadir', join_paths(get_option('prefix'), get_option('datadir')))
configure_file(input: 'config.h.meson.in',
output: 'config.h',
@@ -294,6 +296,7 @@ vapi_dir = join_paths(get_option('prefix'), get_option('datadir'), 'vala', 'vapi
typelib_dir = gobject_introspection.get_pkgconfig_variable('typelibdir',
define_variable: [ 'libdir', libdir ])
+subdir('data')
subdir('src')
subdir('docs')
subdir('examples')
diff --git a/meson_options.txt b/meson_options.txt
index 1c3372966..0dada62a3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,6 +4,8 @@ option('man', type: 'boolean', value: true, yield: true,
description: 'Install man pages')
option('override_sqlite_version_check', type: 'boolean', value: false,
description: 'Override checks for broken sqlite versions')
+option('domain', type: 'string', value: '',
+ description: 'Domain prefix to use for sandboxed')
option('network_manager', type: 'feature', value: 'auto',
description: 'Connection detection through NetworkManager')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]