[tracker-miners/sam/test-runner-fix: 1/21] Compile gschemas in the build directory, for use by tests



commit b92ced4eafdcc91c57102d19aee3ac37f5a1ef26
Author: Sam Thursfield <sam afuera me uk>
Date:   Fri Jan 4 20:52:47 2019 +0100

    Compile gschemas in the build directory, for use by tests
    
    Allow running tests without the need to install the gsettings schemas.
    This commit moves all the gschemas in the data directory and compiles
    them in the build directory. Tests that require gschemas need to be
    launched with the proper GSETTINGS_SCHEMA_DIR env variable.
    
    Based on tracker.git commit c33c080c20dae1e60982, by Andrea Azzarone.

 data/meson.build                                   |  35 +++++
 data/org.freedesktop.Tracker.Extract.gschema.xml   |  58 ++++++++
 ...org.freedesktop.Tracker.Miner.Files.gschema.xml | 162 +++++++++++++++++++++
 data/org.freedesktop.Tracker.Writeback.gschema.xml |  28 ++++
 meson.build                                        |   1 +
 src/miners/fs/meson.build                          |   3 -
 src/tracker-extract/meson.build                    |   3 -
 src/tracker-writeback/meson.build                  |   3 -
 tests/functional-tests/meson.build                 |   1 +
 9 files changed, 285 insertions(+), 9 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 000000000..246c3fa25
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,35 @@
+schemas = [
+  'org.freedesktop.Tracker.Extract.gschema.xml',
+  'org.freedesktop.Tracker.Miner.Files.gschema.xml',
+  'org.freedesktop.Tracker.Writeback.gschema.xml',
+]
+
+foreach schema : schemas
+  schemas = configure_file(
+    input: schema,
+    output: schema,
+    copy: true,
+    install: true,
+    install_dir: gsettings_schema_dir)
+endforeach
+
+tracker_miners_settings_enums = custom_target('tracker-miners-common-settings-enums',
+    input: '../src/libtracker-miners-common/tracker-enums.h',
+    output: 'org.freedesktop.TrackerMiners.enums.xml',
+    command: [glib_mkenums,
+              '--comments', '<!-- @comment@ -->',
+              '--fhead', '<schemalist>',
+              '--vhead', '<@type@ id="org.freedesktop.TrackerMiners.@EnumName@">',
+              '--vprod', '    <value nick="@valuenick@" value="@valuenum@"/>',
+              '--vtail', '  </@type@>',
+              '--ftail', '</schemalist>', '@INPUT@'],
+    capture: true,
+    install: true,
+    install_dir: gsettings_schema_dir)
+
+# for unit tests
+custom_target('tracker-miners-compile-schemas',
+  output: 'gschemas.compiled',
+  command: [find_program('glib-compile-schemas'), meson.current_build_dir()],
+  build_by_default: true,
+  depends: tracker_miners_settings_enums)
diff --git a/data/org.freedesktop.Tracker.Extract.gschema.xml 
b/data/org.freedesktop.Tracker.Extract.gschema.xml
new file mode 100644
index 000000000..e1449e747
--- /dev/null
+++ b/data/org.freedesktop.Tracker.Extract.gschema.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2011, Nokia <ivan frade nokia com>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA  02110-1301, USA.
+-->
+<schemalist>
+  <schema id="org.freedesktop.Tracker.Extract" path="/org/freedesktop/tracker/extract/" 
gettext-domain="tracker-miners">
+    <key name="verbosity" enum="org.freedesktop.TrackerMiners.TrackerVerbosity">
+      <default>'errors'</default>
+      <summary>Log verbosity</summary>
+      <description>Log verbosity.</description>
+    </key>
+
+    <key name="sched-idle" enum="org.freedesktop.TrackerMiners.TrackerSchedIdle">
+      <default>'first-index'</default>
+      <summary>Scheduler priority when idle</summary>
+      <description>
+       The scheduler is the kernel component that decides which
+       runnable application will be executed by the CPU next. Each
+       application has an associated scheduling policy and priority.
+      </description>
+    </key>
+
+    <key name="max-bytes" type="i">
+      <summary>Max bytes to extract</summary>
+      <description>Maximum number of UTF-8 bytes to extract.</description>
+      <range min="0" max="10485760"/>
+      <default>1048576</default>
+    </key>
+
+    <key name="max-media-art-width" type="i">
+      <summary>Max media art width</summary>
+      <description>Maximum width in pixels for any media art extracted. Anything bigger is resized. Set to 
-1 to disable saving media art from files. Setting to 0 sets no limit on the media art width.</description>
+      <range min="-1" max="2048"/>
+      <default>0</default>
+    </key>
+
+    <key name="wait-for-miner-fs" type="b">
+      <summary>Wait for FS miner to be done before extracting</summary>
+      <description>When true, tracker-extract will wait for tracker-miner-fs to be done crawling before 
extracting meta-data. This option is useful on constrained environment where it is important to list files as 
fast as possible and can wait to get meta-data later.</description>
+      <default>false</default>
+    </key>
+  </schema>
+</schemalist>
diff --git a/data/org.freedesktop.Tracker.Miner.Files.gschema.xml 
b/data/org.freedesktop.Tracker.Miner.Files.gschema.xml
new file mode 100644
index 000000000..5ba77d9fe
--- /dev/null
+++ b/data/org.freedesktop.Tracker.Miner.Files.gschema.xml
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2011, Nokia <ivan frade nokia com>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA  02110-1301, USA.
+-->
+<schemalist>
+  <schema id="org.freedesktop.Tracker.Miner.Files" path="/org/freedesktop/tracker/miner/files/" 
gettext-domain="tracker-miners">
+    <key name="verbosity" enum="org.freedesktop.TrackerMiners.TrackerVerbosity">
+      <default>'errors'</default>
+      <summary>Log verbosity</summary>
+      <description>Log verbosity.</description>
+    </key>
+
+    <key name="initial-sleep" type="i">
+      <summary>Initial sleep</summary>
+      <description>Initial sleep time, in seconds.</description>
+      <range min="0" max="1000"/>
+      <default>15</default>
+    </key>
+
+    <key name="sched-idle" enum="org.freedesktop.TrackerMiners.TrackerSchedIdle">
+      <default>'first-index'</default>
+      <summary>Scheduler priority when idle</summary>
+      <description>
+       The scheduler is the kernel component that decides which
+       runnable application will be executed by the CPU next. Each
+       application has an associated scheduling policy and priority.
+      </description>
+    </key>
+
+    <key name="throttle" type="i">
+      <summary>Throttle</summary>
+      <description>Indexing speed, the higher the slower.</description>
+      <range min="0" max="20"/>
+      <default>0</default>
+    </key>
+
+    <key name="low-disk-space-limit" type="i">
+      <summary>Low disk space limit</summary>
+      <description>Disk space threshold in percent at which to pause indexing, or -1 to 
disable.</description>
+      <range min="-1" max="100"/>
+      <default>-1</default>
+    </key>
+
+    <key name="crawling-interval" type="i">
+      <summary>Crawling interval</summary>
+      <description>
+        Interval in days to check whether the filesystem is up to date in the database.
+       0 forces crawling anytime, -1 forces it only after unclean shutdowns, and -2
+       disables it entirely.
+      </description>
+      <range min="-2" max="365"/>
+      <default>-1</default>
+    </key>
+
+    <key name="removable-days-threshold" type="i">
+      <summary>Removable devices’ data permanence threshold</summary>
+      <description>
+       Threshold in days after which files from removables devices
+       will be removed from database if not mounted. 0 means never,
+       maximum is 365.
+      </description>
+      <range min="0" max="365"/>
+      <default>3</default>
+    </key>
+
+    <key name="enable-monitors" type="b">
+      <summary>Enable monitors</summary>
+      <description>Set to false to completely disable any file monitoring</description>
+      <default>true</default>
+    </key>
+
+    <key name="enable-writeback" type="b">
+      <summary>Enable writeback</summary>
+      <description>Set to false to completely disable any file writeback</description>
+      <default>true</default>
+    </key>
+
+    <key name="index-removable-devices" type="b">
+      <summary>Index removable devices</summary>
+      <description>Set to true to enable indexing mounted directories for removable devices.</description>
+      <default>false</default>
+    </key>
+
+    <key name="index-optical-discs" type="b">
+      <summary>Index optical discs</summary>
+      <description>
+       Set to true to enable indexing CDs, DVDs, and generally optical media
+       (if removable devices are not indexed, optical discs won’t be either)
+      </description>
+      <default>false</default>
+    </key>
+
+    <key name="index-on-battery" type="b">
+      <summary>Index when running on battery</summary>
+      <description>Set to true to index while running on battery</description>
+      <default>true</default>
+    </key>
+
+    <key name="index-on-battery-first-time" type="b">
+      <summary>Perform initial indexing when running on battery</summary>
+      <description>Set to true to index while running on battery for the first time only</description>
+      <default>true</default>
+    </key>
+
+    <key name="index-recursive-directories" type="as">
+      <summary>Directories to index recursively</summary>
+      <description>
+       List of directories to index recursively, Special values include:
+       &amp;DESKTOP, &amp;DOCUMENTS, &amp;DOWNLOAD, &amp;MUSIC, &amp;PICTURES,
+       &amp;PUBLIC_SHARE, &amp;TEMPLATES, &amp;VIDEOS.
+
+       See /etc/xdg/user-dirs.defaults and $HOME/.config/user-dirs.default
+      </description>
+      <default>[ '&amp;DESKTOP', '&amp;DOCUMENTS', '&amp;DOWNLOAD', '&amp;MUSIC', '&amp;PICTURES', 
'&amp;VIDEOS' ]</default>
+    </key>
+
+    <key name="index-single-directories" type="as">
+      <summary>Directories to index non-recursively</summary>
+      <description>
+       List of directories to index without inspecting subfolders, Special values include:
+       &amp;DESKTOP, &amp;DOCUMENTS, &amp;DOWNLOAD, &amp;MUSIC, &amp;PICTURES,
+       &amp;PUBLIC_SHARE, &amp;TEMPLATES, &amp;VIDEOS.
+
+       See /etc/xdg/user-dirs.defaults and $HOME/.config/user-dirs.default
+      </description>
+      <default>[ '$HOME' ]</default>
+    </key>
+
+    <key name="ignored-files" type="as">
+      <summary>Ignored files</summary>
+      <description>List of file patterns to avoid</description>
+      <default>[ '*~', '*.o', '*.la', '*.lo' , '*.loT', '*.in', '*.csproj', '*.m4', '*.rej', '*.gmo', 
'*.orig', '*.pc', '*.omf', '*.aux', '*.tmp', '*.vmdk', '*.vm*', '*.nvram', '*.part', '*.rcore', '*.lzo', 
'autom4te', 'conftest', 'confstat', 'Makefile', 'SCCS', 'ltmain.sh', 'libtool', 'config.status', 
'confdefs.h', 'configure', '#*#', '~$*.doc?', '~$*.dot?', '~$*.xls?', '~$*.xlt?', '~$*.xlam', '~$*.ppt?', 
'~$*.pot?', '~$*.ppam', '~$*.ppsm', '~$*.ppsx', '~$*.vsd?', '~$*.vss?', '~$*.vst?', 'mimeapps.list', 
'mimeinfo.cache', '*.directory' ]</default>
+    </key>
+
+    <key name="ignored-directories" type="as">
+      <summary>Ignored directories</summary>
+      <description>List of directories to avoid</description>
+      <default>[ 'po', 'CVS', 'core-dumps', 'lost+found' ]</default>
+    </key>
+
+    <key name="ignored-directories-with-content" type="as">
+      <summary>Ignored directories with content</summary>
+      <description>Avoid any directory containing a file blacklisted here</description>
+      <default>[ '.trackerignore', '.git', '.hg' ]</default>
+    </key>
+  </schema>
+</schemalist>
diff --git a/data/org.freedesktop.Tracker.Writeback.gschema.xml 
b/data/org.freedesktop.Tracker.Writeback.gschema.xml
new file mode 100644
index 000000000..597bd8df4
--- /dev/null
+++ b/data/org.freedesktop.Tracker.Writeback.gschema.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2011, Nokia <ivan frade nokia com>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA  02110-1301, USA.
+-->
+<schemalist>
+  <schema id="org.freedesktop.Tracker.Writeback" path="/org/freedesktop/tracker/writeback/" 
gettext-domain="tracker-miners">
+    <key name="verbosity" enum="org.freedesktop.TrackerMiners.TrackerVerbosity">
+      <default>'errors'</default>
+      <summary>Log verbosity</summary>
+      <description>Log verbosity.</description>
+    </key>
+  </schema>
+</schemalist>
diff --git a/meson.build b/meson.build
index ac21ba506..904c2d0af 100644
--- a/meson.build
+++ b/meson.build
@@ -386,6 +386,7 @@ vapi_dir = join_paths(get_option('prefix'), get_option('datadir'), 'vala', 'vapi
 glib_mkenums = find_program('glib-mkenums')
 
 subdir('src')
+subdir('data')
 
 if get_option('docs')
   subdir('docs')
diff --git a/src/miners/fs/meson.build b/src/miners/fs/meson.build
index 3cb46c7b1..f96daa95d 100644
--- a/src/miners/fs/meson.build
+++ b/src/miners/fs/meson.build
@@ -58,9 +58,6 @@ desktop_file = custom_target('tracker-miner-fs-desktop-file',
     install: true,
     install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'))
 
-install_data('org.freedesktop.Tracker.Miner.Files.gschema.xml',
-    install_dir: gsettings_schema_dir)
-
 if install_systemd_user_services
   configure_file(
       input: 'tracker-miner-fs.service.in',
diff --git a/src/tracker-extract/meson.build b/src/tracker-extract/meson.build
index 2ffa90ba7..0d8966c4c 100644
--- a/src/tracker-extract/meson.build
+++ b/src/tracker-extract/meson.build
@@ -198,9 +198,6 @@ desktop_file = custom_target('tracker-extract-desktop-file',
   install: true,
   install_dir: join_paths(get_option('sysconfdir'), 'xdg/autostart'))
 
-install_data('org.freedesktop.Tracker.Extract.gschema.xml',
-  install_dir: gsettings_schema_dir)
-
 if install_systemd_user_services
   configure_file(
     input: 'tracker-extract.service.in',
diff --git a/src/tracker-writeback/meson.build b/src/tracker-writeback/meson.build
index 367c9dcc5..ad3d86e0d 100644
--- a/src/tracker-writeback/meson.build
+++ b/src/tracker-writeback/meson.build
@@ -56,9 +56,6 @@ dbus_service_file = configure_file(
   install: true,
   install_dir: dbus_services_dir)
 
-install_data('org.freedesktop.Tracker.Writeback.gschema.xml',
-  install_dir: gsettings_schema_dir)
-
 if install_systemd_user_services
   configure_file(
     input: 'tracker-writeback.service.in',
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index aefacef5a..723866ea6 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -63,6 +63,7 @@ tracker_extractors_dir = join_paths(meson.current_build_dir(), '..', '..', 'src'
 
 test_env = environment()
 test_env.set('DCONF_PROFILE', dconf_profile_full_path)
+test_env.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
 
 test_env.set('TRACKER_DB_ONTOLOGIES_DIR', tracker_uninstalled_nepomuk_ontologies_dir)
 test_env.set('TRACKER_EXTRACTORS_DIR', tracker_extractors_dir)


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