Skip to content

build: Fix GSETTINGS_SCHEMA_DIR envvar handling in tests

GSETTINGS_SCHEMA_DIR does not support multiple colon-separated paths.

This gets me closer to having working tests on fresh install downstream. Unfortunately that's not enough to get it fully working, but avoids one extra hack in my package. It doesn't fully work, because nothing is compiling the schemas before install phase (and for distros that's even later in a postinst rule, after it's copied from DISTDIR to live system), and the setting isn't looking at that place either (so it shouldn't work even if running tests after install, IF DISTDIR is involved). So if a system install of gnome-builder doesn't exist, about 5 tests fail due to not finding org.gnome.builder.plugins schemas (ERROR: Settings schema 'org.gnome.builder.plugin' is not installed)

One hacky way to make it work fully is found in epiphany tests/meson.build but it's not pretty. In our downstream packages we do a similar hack at package level and are used to that, but this easy fix in this MR avoids having to mess with GSETTINGS_SCHEMA_DIR on our end at least, and the change is principally correct anyways and works towards fully working out-of-tree tests. I can file a separate issue for those glib-compile-schemas bits later.

My package level hack is this ($S is toplevel source_dir, BUILD_DIR is meson builddir):

find "${S}" -name '*.gschema.xml' -exec cp {} "${BUILD_DIR}/data/gsettings" \;
glib-compile-schemas --allow-any-name "${BUILD_DIR}/data/gsettings"

Merge request reports