glib: add an update script combinator to patch gsettings schema paths

and use it in evolution-data-server and evolution-ews as a proof of
concept

+225 -92
+33 -3
pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix
··· 14 14 , json-glib 15 15 , libmspack 16 16 , webkitgtk_4_1 17 + , substituteAll 18 + , _experimental-update-script-combinators 19 + , glib 17 20 }: 18 21 19 22 stdenv.mkDerivation rec { ··· 24 27 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 25 28 sha256 = "p5Jp7wnoqAuo8My8ZDMl0rsFc0158G8x8lAehWfLjb0="; 26 29 }; 30 + 31 + patches = [ 32 + # evolution-ews contains .so files loaded by evolution-data-server refering 33 + # schemas from evolution. evolution-data-server is not wrapped with 34 + # evolution's schemas because it would be a circular dependency with 35 + # evolution. 36 + (substituteAll { 37 + src = ./hardcode-gsettings.patch; 38 + evo = glib.makeSchemaPath evolution evolution.name; 39 + }) 40 + ]; 27 41 28 42 nativeBuildInputs = [ 29 43 cmake ··· 50 64 ]; 51 65 52 66 passthru = { 53 - updateScript = gnome.updateScript { 54 - packageName = "evolution-ews"; 55 - versionPolicy = "odd-unstable"; 67 + hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch { 68 + inherit src; 69 + glib-schema-to-var = { 70 + "org.gnome.evolution.mail" = "evo"; 71 + "org.gnome.evolution.calendar" = "evo"; 72 + }; 56 73 }; 74 + 75 + updateScript = 76 + let 77 + updateSource = gnome.updateScript { 78 + packageName = "evolution-ews"; 79 + versionPolicy = "odd-unstable"; 80 + }; 81 + updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 82 + in 83 + _experimental-update-script-combinators.sequence [ 84 + updateSource 85 + updatePatch 86 + ]; 57 87 }; 58 88 59 89 meta = with lib; {
+72
pkgs/applications/networking/mailreaders/evolution/evolution-ews/hardcode-gsettings.patch
··· 1 + diff --git a/src/EWS/camel/camel-ews-utils.c b/src/EWS/camel/camel-ews-utils.c 2 + index 0707f72..1e71954 100644 3 + --- a/src/EWS/camel/camel-ews-utils.c 4 + +++ b/src/EWS/camel/camel-ews-utils.c 5 + @@ -1552,7 +1552,18 @@ ews_utils_save_category_changes (GHashTable *old_categories, /* gchar *guid ~> C 6 + 7 + evo_labels = g_ptr_array_new_full (5, g_free); 8 + 9 + - settings = g_settings_new ("org.gnome.evolution.mail"); 10 + + { 11 + + g_autoptr(GSettingsSchemaSource) schema_source; 12 + + g_autoptr(GSettingsSchema) schema; 13 + + schema_source = g_settings_schema_source_new_from_directory("@evo@", 14 + + g_settings_schema_source_get_default(), 15 + + TRUE, 16 + + NULL); 17 + + schema = g_settings_schema_source_lookup(schema_source, 18 + + "org.gnome.evolution.mail", 19 + + FALSE); 20 + + settings = g_settings_new_full(schema, NULL, NULL); 21 + + } 22 + strv = g_settings_get_strv (settings, "labels"); 23 + 24 + for (ii = 0; strv && strv[ii]; ii++) { 25 + diff --git a/src/EWS/common/e-ews-calendar-utils.c b/src/EWS/common/e-ews-calendar-utils.c 26 + index 6deda60..9b44cc7 100644 27 + --- a/src/EWS/common/e-ews-calendar-utils.c 28 + +++ b/src/EWS/common/e-ews-calendar-utils.c 29 + @@ -413,7 +413,18 @@ ews_get_configured_icaltimezone (void) 30 + gchar *location; 31 + ICalTimezone *zone = NULL; 32 + 33 + - settings = g_settings_new ("org.gnome.evolution.calendar"); 34 + + { 35 + + g_autoptr(GSettingsSchemaSource) schema_source; 36 + + g_autoptr(GSettingsSchema) schema; 37 + + schema_source = g_settings_schema_source_new_from_directory("@evo@", 38 + + g_settings_schema_source_get_default(), 39 + + TRUE, 40 + + NULL); 41 + + schema = g_settings_schema_source_lookup(schema_source, 42 + + "org.gnome.evolution.calendar", 43 + + FALSE); 44 + + settings = g_settings_new_full(schema, NULL, NULL); 45 + + } 46 + location = g_settings_get_string (settings, "timezone"); 47 + if (location) { 48 + zone = i_cal_timezone_get_builtin_timezone (location); 49 + diff --git a/src/Microsoft365/camel/camel-m365-store.c b/src/Microsoft365/camel/camel-m365-store.c 50 + index ff1b8e3..4f876c0 100644 51 + --- a/src/Microsoft365/camel/camel-m365-store.c 52 + +++ b/src/Microsoft365/camel/camel-m365-store.c 53 + @@ -309,7 +309,18 @@ m365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca 54 + 55 + evo_labels = g_ptr_array_new_full (5, g_free); 56 + 57 + - settings = g_settings_new ("org.gnome.evolution.mail"); 58 + + { 59 + + g_autoptr(GSettingsSchemaSource) schema_source; 60 + + g_autoptr(GSettingsSchema) schema; 61 + + schema_source = g_settings_schema_source_new_from_directory("@evo@", 62 + + g_settings_schema_source_get_default(), 63 + + TRUE, 64 + + NULL); 65 + + schema = g_settings_schema_source_lookup(schema_source, 66 + + "org.gnome.evolution.mail", 67 + + FALSE); 68 + + settings = g_settings_new_full(schema, NULL, NULL); 69 + + } 70 + strv = g_settings_get_strv (settings, "labels"); 71 + 72 + for (ii = 0; strv && strv[ii]; ii++) {
+13 -28
pkgs/desktops/gnome/core/evolution-data-server/default.nix
··· 2 2 , lib 3 3 , fetchurl 4 4 , substituteAll 5 - , runCommand 6 - , git 7 - , coccinelle 8 5 , pkg-config 9 6 , gnome 10 7 , _experimental-update-script-combinators ··· 70 67 71 68 prePatch = '' 72 69 substitute ${./hardcode-gsettings.patch} hardcode-gsettings.patch \ 73 - --subst-var-by EDS_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"} 70 + --subst-var-by EDS ${glib.makeSchemaPath "$out" "${pname}-${version}"} 74 71 patches="$patches $PWD/hardcode-gsettings.patch" 75 72 ''; 76 73 ··· 153 150 ''; 154 151 155 152 passthru = { 156 - # In order for GNOME not to depend on OCaml through Coccinelle, 157 - # we materialize the SmPL patch into a unified diff-style patch. 158 - hardcodeGsettingsPatch = 159 - runCommand 160 - "hardcode-gsettings.patch" 161 - { 162 - inherit src; 163 - nativeBuildInputs = [ 164 - git 165 - coccinelle 166 - python3 # For patch script 167 - ]; 168 - } 169 - '' 170 - unpackPhase 171 - cd "''${sourceRoot:-.}" 172 - git init 173 - git add -A 174 - spatch --sp-file "${./hardcode-gsettings.cocci}" --dir . --in-place 175 - git diff > "$out" 176 - ''; 153 + hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch { 154 + glib-schema-to-var = { 155 + "org.gnome.Evolution.DefaultSources" = "EDS"; 156 + "org.gnome.evolution.shell.network-config" = "EDS"; 157 + "org.gnome.evolution-data-server.addressbook" = "EDS"; 158 + "org.gnome.evolution-data-server.calendar" = "EDS"; 159 + "org.gnome.evolution-data-server" = "EDS"; 177 160 161 + }; 162 + inherit src; 163 + }; 178 164 updateScript = 179 165 let 180 166 updateSource = gnome.updateScript { 181 167 packageName = "evolution-data-server"; 182 168 versionPolicy = "odd-unstable"; 183 169 }; 184 - 185 - updateGsettingsPatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-data-server.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 170 + updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-data-server.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 186 171 in 187 172 _experimental-update-script-combinators.sequence [ 188 173 updateSource 189 - updateGsettingsPatch 174 + updatePatch 190 175 ]; 191 176 }; 192 177
+10 -15
pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.cocci pkgs/development/libraries/glib/hardcode-gsettings.cocci
··· 3 3 * where GSettings system could look for schemas, we need to point the software to a correct location somehow. 4 4 * For executables, we handle this using wrappers but this is not an option for libraries like e-d-s. 5 5 * Instead, we hardcode the schema path when creating the settings. 6 + * A schema path (ie org.gnome.evolution) can be replaced by @EVOLUTION_SCHEMA_PATH@ 7 + * which is then replaced at build time by substituteAll. 8 + * The mapping is provided in a json file ./glib-schema-to-var.json 6 9 */ 7 10 8 11 @initialize:python@ 9 12 @@ 13 + import json 10 14 11 15 cpp_constants = {} 12 16 ··· 16 20 def resolve_cpp_constant(const_name): 17 21 return cpp_constants.get(const_name, const_name) 18 22 19 - e_s_d_schema_constants = [ 20 - # The following are actually part of e-d-s, despite the name. 21 - # We rename the old ambiguos constant name in ./prepare-for-gsettings-patching.patch 22 - "\"org.gnome.Evolution.DefaultSources\"", 23 - "\"org.gnome.evolution.shell.network-config\"", 24 - ] 25 - 26 - g_d_s_schema_constants = [ 27 - ] 23 + with open("./glib-schema-to-var.json") as mapping_file: 24 + schema_to_var = json.load(mapping_file); 28 25 29 26 def get_schema_directory(schema_path): 30 27 # Sometimes the schema id is referenced using C preprocessor #define constant in the same file 31 28 # let’s try to resolve it first. 32 - schema_path = resolve_cpp_constant(schema_path.strip()) 33 - if schema_path.startswith("\"org.gnome.evolution-data-server") or schema_path in e_s_d_schema_constants: 34 - return "\"@EDS_GSETTINGS_PATH@\"" 35 - elif schema_path in g_d_s_schema_constants: 36 - return "\"@GDS_GSETTINGS_PATH@\"" 37 - raise Exception(f"Unknown schema path {schema_path}") 29 + schema_path = resolve_cpp_constant(schema_path.strip()).strip('"') 30 + if schema_path in schema_to_var: 31 + return f'"@{schema_to_var[schema_path]}@"' 32 + raise Exception(f"Unknown schema path {schema_path!r}, please add it to ./glib-schema-to-var.json") 38 33 39 34 40 35 @find_cpp_constants@
+46 -46
pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.patch
··· 1 1 diff --git a/src/addressbook/libebook/e-book-client.c b/src/addressbook/libebook/e-book-client.c 2 - index 7888e69..c3b695c 100644 2 + index 7888e69..27215e4 100644 3 3 --- a/src/addressbook/libebook/e-book-client.c 4 4 +++ b/src/addressbook/libebook/e-book-client.c 5 5 @@ -1983,7 +1983,18 @@ e_book_client_get_self (ESourceRegistry *registry, ··· 10 10 + { 11 11 + g_autoptr(GSettingsSchemaSource) schema_source; 12 12 + g_autoptr(GSettingsSchema) schema; 13 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 13 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 14 14 + g_settings_schema_source_get_default(), 15 15 + TRUE, 16 16 + NULL); ··· 30 30 + { 31 31 + g_autoptr(GSettingsSchemaSource) schema_source; 32 32 + g_autoptr(GSettingsSchema) schema; 33 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 33 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 34 34 + g_settings_schema_source_get_default(), 35 35 + TRUE, 36 36 + NULL); ··· 51 51 + if (!settings) { 52 52 + g_autoptr(GSettingsSchemaSource) schema_source; 53 53 + g_autoptr(GSettingsSchema) schema; 54 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 54 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 55 55 + g_settings_schema_source_get_default(), 56 56 + TRUE, 57 57 + NULL); ··· 64 64 g_mutex_unlock (&mutex); 65 65 66 66 diff --git a/src/addressbook/libebook/e-book.c b/src/addressbook/libebook/e-book.c 67 - index 8dfff6d..cd88392 100644 67 + index 8dfff6d..fb4434b 100644 68 68 --- a/src/addressbook/libebook/e-book.c 69 69 +++ b/src/addressbook/libebook/e-book.c 70 70 @@ -2587,7 +2587,18 @@ e_book_get_self (ESourceRegistry *registry, ··· 75 75 + { 76 76 + g_autoptr(GSettingsSchemaSource) schema_source; 77 77 + g_autoptr(GSettingsSchema) schema; 78 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 78 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 79 79 + g_settings_schema_source_get_default(), 80 80 + TRUE, 81 81 + NULL); ··· 95 95 + { 96 96 + g_autoptr(GSettingsSchemaSource) schema_source; 97 97 + g_autoptr(GSettingsSchema) schema; 98 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 98 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 99 99 + g_settings_schema_source_get_default(), 100 100 + TRUE, 101 101 + NULL); ··· 115 115 + { 116 116 + g_autoptr(GSettingsSchemaSource) schema_source; 117 117 + g_autoptr(GSettingsSchema) schema; 118 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 118 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 119 119 + g_settings_schema_source_get_default(), 120 120 + TRUE, 121 121 + NULL); ··· 128 128 g_object_unref (settings); 129 129 130 130 diff --git a/src/addressbook/libedata-book/e-book-meta-backend.c b/src/addressbook/libedata-book/e-book-meta-backend.c 131 - index d3f130e..9e8edd4 100644 131 + index d3f130e..bc820e9 100644 132 132 --- a/src/addressbook/libedata-book/e-book-meta-backend.c 133 133 +++ b/src/addressbook/libedata-book/e-book-meta-backend.c 134 134 @@ -135,7 +135,18 @@ ebmb_is_power_saver_enabled (void) ··· 139 139 + { 140 140 + g_autoptr(GSettingsSchemaSource) schema_source; 141 141 + g_autoptr(GSettingsSchema) schema; 142 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 142 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 143 143 + g_settings_schema_source_get_default(), 144 144 + TRUE, 145 145 + NULL); ··· 152 152 if (g_settings_get_boolean (settings, "limit-operations-in-power-saver-mode")) { 153 153 GPowerProfileMonitor *power_monitor; 154 154 diff --git a/src/calendar/backends/contacts/e-cal-backend-contacts.c b/src/calendar/backends/contacts/e-cal-backend-contacts.c 155 - index 42f3457..faac410 100644 155 + index 42f3457..b4926af 100644 156 156 --- a/src/calendar/backends/contacts/e-cal-backend-contacts.c 157 157 +++ b/src/calendar/backends/contacts/e-cal-backend-contacts.c 158 158 @@ -1387,7 +1387,18 @@ e_cal_backend_contacts_init (ECalBackendContacts *cbc) ··· 163 163 + { 164 164 + g_autoptr(GSettingsSchemaSource) schema_source; 165 165 + g_autoptr(GSettingsSchema) schema; 166 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 166 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 167 167 + g_settings_schema_source_get_default(), 168 168 + TRUE, 169 169 + NULL); ··· 176 176 cbc->priv->update_alarms_id = 0; 177 177 cbc->priv->alarm_enabled = FALSE; 178 178 diff --git a/src/calendar/libecal/e-reminder-watcher.c b/src/calendar/libecal/e-reminder-watcher.c 179 - index 52095a4..e839991 100644 179 + index 52095a4..184b657 100644 180 180 --- a/src/calendar/libecal/e-reminder-watcher.c 181 181 +++ b/src/calendar/libecal/e-reminder-watcher.c 182 182 @@ -2555,7 +2555,19 @@ e_reminder_watcher_init (EReminderWatcher *watcher) ··· 187 187 + { 188 188 + g_autoptr(GSettingsSchemaSource) schema_source; 189 189 + g_autoptr(GSettingsSchema) schema; 190 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 190 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 191 191 + g_settings_schema_source_get_default(), 192 192 + TRUE, 193 193 + NULL); ··· 201 201 watcher->priv->default_zone = e_cal_util_copy_timezone (zone); 202 202 watcher->priv->timers_enabled = TRUE; 203 203 diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.c b/src/calendar/libedata-cal/e-cal-meta-backend.c 204 - index 94a875f..1f914a9 100644 204 + index 94a875f..1d2ed92 100644 205 205 --- a/src/calendar/libedata-cal/e-cal-meta-backend.c 206 206 +++ b/src/calendar/libedata-cal/e-cal-meta-backend.c 207 207 @@ -149,7 +149,18 @@ ecmb_is_power_saver_enabled (void) ··· 212 212 + { 213 213 + g_autoptr(GSettingsSchemaSource) schema_source; 214 214 + g_autoptr(GSettingsSchema) schema; 215 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 215 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 216 216 + g_settings_schema_source_get_default(), 217 217 + TRUE, 218 218 + NULL); ··· 225 225 if (g_settings_get_boolean (settings, "limit-operations-in-power-saver-mode")) { 226 226 GPowerProfileMonitor *power_monitor; 227 227 diff --git a/src/camel/camel-cipher-context.c b/src/camel/camel-cipher-context.c 228 - index 8013ba7..ba74769 100644 228 + index 8013ba7..1bba6d1 100644 229 229 --- a/src/camel/camel-cipher-context.c 230 230 +++ b/src/camel/camel-cipher-context.c 231 231 @@ -1625,7 +1625,18 @@ camel_cipher_can_load_photos (void) ··· 236 236 + { 237 237 + g_autoptr(GSettingsSchemaSource) schema_source; 238 238 + g_autoptr(GSettingsSchema) schema; 239 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 239 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 240 240 + g_settings_schema_source_get_default(), 241 241 + TRUE, 242 242 + NULL); ··· 249 249 g_clear_object (&settings); 250 250 251 251 diff --git a/src/camel/camel-gpg-context.c b/src/camel/camel-gpg-context.c 252 - index 205372e..2023704 100644 252 + index 205372e..f75a88e 100644 253 253 --- a/src/camel/camel-gpg-context.c 254 254 +++ b/src/camel/camel-gpg-context.c 255 255 @@ -582,7 +582,18 @@ gpg_ctx_get_executable_name (void) ··· 260 260 + { 261 261 + g_autoptr(GSettingsSchemaSource) schema_source; 262 262 + g_autoptr(GSettingsSchema) schema; 263 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 263 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 264 264 + g_settings_schema_source_get_default(), 265 265 + TRUE, 266 266 + NULL); ··· 273 273 g_clear_object (&settings); 274 274 275 275 diff --git a/src/camel/camel-utils.c b/src/camel/camel-utils.c 276 - index e61160c..d17871a 100644 276 + index e61160c..b6553a4 100644 277 277 --- a/src/camel/camel-utils.c 278 278 +++ b/src/camel/camel-utils.c 279 279 @@ -362,7 +362,19 @@ void ··· 284 284 + { 285 285 + g_autoptr(GSettingsSchemaSource) schema_source; 286 286 + g_autoptr(GSettingsSchema) schema; 287 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 287 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 288 288 + g_settings_schema_source_get_default(), 289 289 + TRUE, 290 290 + NULL); ··· 298 298 G_CALLBACK (mi_user_headers_settings_changed_cb), NULL); 299 299 G_UNLOCK (mi_user_headers); 300 300 diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c 301 - index e5645e2..170a0be 100644 301 + index e5645e2..96a1ce3 100644 302 302 --- a/src/camel/providers/imapx/camel-imapx-server.c 303 303 +++ b/src/camel/providers/imapx/camel-imapx-server.c 304 304 @@ -5573,7 +5573,18 @@ camel_imapx_server_skip_old_flags_update (CamelStore *store) ··· 309 309 + { 310 310 + g_autoptr(GSettingsSchemaSource) schema_source; 311 311 + g_autoptr(GSettingsSchema) schema; 312 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 312 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 313 313 + g_settings_schema_source_get_default(), 314 314 + TRUE, 315 315 + NULL); ··· 322 322 if (g_settings_get_boolean (eds_settings, "limit-operations-in-power-saver-mode")) { 323 323 GPowerProfileMonitor *power_monitor; 324 324 diff --git a/src/camel/providers/smtp/camel-smtp-transport.c b/src/camel/providers/smtp/camel-smtp-transport.c 325 - index f535ad6..30130b9 100644 325 + index f535ad6..918975d 100644 326 326 --- a/src/camel/providers/smtp/camel-smtp-transport.c 327 327 +++ b/src/camel/providers/smtp/camel-smtp-transport.c 328 328 @@ -1458,7 +1458,18 @@ smtp_helo (CamelSmtpTransport *transport, ··· 333 333 + { 334 334 + g_autoptr(GSettingsSchemaSource) schema_source; 335 335 + g_autoptr(GSettingsSchema) schema; 336 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 336 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 337 337 + g_settings_schema_source_get_default(), 338 338 + TRUE, 339 339 + NULL); ··· 346 346 g_clear_object (&settings); 347 347 348 348 diff --git a/src/libedataserver/e-network-monitor.c b/src/libedataserver/e-network-monitor.c 349 - index 188f276..7c4db94 100644 349 + index 188f276..939f89b 100644 350 350 --- a/src/libedataserver/e-network-monitor.c 351 351 +++ b/src/libedataserver/e-network-monitor.c 352 352 @@ -256,7 +256,18 @@ e_network_monitor_constructed (GObject *object) ··· 357 357 + { 358 358 + g_autoptr(GSettingsSchemaSource) schema_source; 359 359 + g_autoptr(GSettingsSchema) schema; 360 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 360 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 361 361 + g_settings_schema_source_get_default(), 362 362 + TRUE, 363 363 + NULL); ··· 370 370 settings, "network-monitor-gio-name", 371 371 object, "gio-name", 372 372 diff --git a/src/libedataserver/e-oauth2-service-google.c b/src/libedataserver/e-oauth2-service-google.c 373 - index f215388..3b67126 100644 373 + index f215388..501222e 100644 374 374 --- a/src/libedataserver/e-oauth2-service-google.c 375 375 +++ b/src/libedataserver/e-oauth2-service-google.c 376 376 @@ -71,7 +71,18 @@ eos_google_read_settings (EOAuth2Service *service, ··· 381 381 + { 382 382 + g_autoptr(GSettingsSchemaSource) schema_source; 383 383 + g_autoptr(GSettingsSchema) schema; 384 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 384 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 385 385 + g_settings_schema_source_get_default(), 386 386 + TRUE, 387 387 + NULL); ··· 394 394 g_object_unref (settings); 395 395 396 396 diff --git a/src/libedataserver/e-oauth2-service-outlook.c b/src/libedataserver/e-oauth2-service-outlook.c 397 - index 9cff0d0..fd95f0b 100644 397 + index 9cff0d0..4c9a203 100644 398 398 --- a/src/libedataserver/e-oauth2-service-outlook.c 399 399 +++ b/src/libedataserver/e-oauth2-service-outlook.c 400 400 @@ -71,7 +71,18 @@ eos_outlook_read_settings (EOAuth2Service *service, ··· 405 405 + { 406 406 + g_autoptr(GSettingsSchemaSource) schema_source; 407 407 + g_autoptr(GSettingsSchema) schema; 408 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 408 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 409 409 + g_settings_schema_source_get_default(), 410 410 + TRUE, 411 411 + NULL); ··· 418 418 g_object_unref (settings); 419 419 420 420 diff --git a/src/libedataserver/e-oauth2-service-yahoo.c b/src/libedataserver/e-oauth2-service-yahoo.c 421 - index 8e4ee81..bb8f8f7 100644 421 + index 8e4ee81..cc94026 100644 422 422 --- a/src/libedataserver/e-oauth2-service-yahoo.c 423 423 +++ b/src/libedataserver/e-oauth2-service-yahoo.c 424 424 @@ -67,7 +67,18 @@ eos_yahoo_read_settings (EOAuth2Service *service, ··· 429 429 + { 430 430 + g_autoptr(GSettingsSchemaSource) schema_source; 431 431 + g_autoptr(GSettingsSchema) schema; 432 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 432 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 433 433 + g_settings_schema_source_get_default(), 434 434 + TRUE, 435 435 + NULL); ··· 442 442 g_object_unref (settings); 443 443 444 444 diff --git a/src/libedataserver/e-oauth2-service.c b/src/libedataserver/e-oauth2-service.c 445 - index 7783781..6fb22cb 100644 445 + index 7783781..6a2db01 100644 446 446 --- a/src/libedataserver/e-oauth2-service.c 447 447 +++ b/src/libedataserver/e-oauth2-service.c 448 448 @@ -90,7 +90,18 @@ eos_default_guess_can_process (EOAuth2Service *service, ··· 453 453 + { 454 454 + g_autoptr(GSettingsSchemaSource) schema_source; 455 455 + g_autoptr(GSettingsSchema) schema; 456 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 456 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 457 457 + g_settings_schema_source_get_default(), 458 458 + TRUE, 459 459 + NULL); ··· 466 466 g_object_unref (settings); 467 467 468 468 diff --git a/src/libedataserver/e-source-registry.c b/src/libedataserver/e-source-registry.c 469 - index 6701a3a..6b8ee33 100644 469 + index 6701a3a..f497263 100644 470 470 --- a/src/libedataserver/e-source-registry.c 471 471 +++ b/src/libedataserver/e-source-registry.c 472 472 @@ -1764,7 +1764,19 @@ e_source_registry_init (ESourceRegistry *registry) ··· 477 477 + { 478 478 + g_autoptr(GSettingsSchemaSource) schema_source; 479 479 + g_autoptr(GSettingsSchema) schema; 480 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 480 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 481 481 + g_settings_schema_source_get_default(), 482 482 + TRUE, 483 483 + NULL); ··· 491 491 g_signal_connect ( 492 492 registry->priv->settings, "changed", 493 493 diff --git a/src/libedataserverui/e-reminders-widget.c b/src/libedataserverui/e-reminders-widget.c 494 - index 14b6481..6dc55bb 100644 494 + index 14b6481..7149b74 100644 495 495 --- a/src/libedataserverui/e-reminders-widget.c 496 496 +++ b/src/libedataserverui/e-reminders-widget.c 497 497 @@ -1986,7 +1986,19 @@ static void ··· 502 502 + { 503 503 + g_autoptr(GSettingsSchemaSource) schema_source; 504 504 + g_autoptr(GSettingsSchema) schema; 505 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 505 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 506 506 + g_settings_schema_source_get_default(), 507 507 + TRUE, 508 508 + NULL); ··· 516 516 reminders->priv->is_empty = TRUE; 517 517 reminders->priv->is_mapped = FALSE; 518 518 diff --git a/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c b/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c 519 - index 6f03053..127c92e 100644 519 + index 6f03053..b5db6b2 100644 520 520 --- a/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c 521 521 +++ b/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c 522 522 @@ -706,7 +706,18 @@ evolution_source_registry_merge_autoconfig_sources (ESourceRegistryServer *serve ··· 527 527 + { 528 528 + g_autoptr(GSettingsSchemaSource) schema_source; 529 529 + g_autoptr(GSettingsSchema) schema; 530 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 530 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 531 531 + g_settings_schema_source_get_default(), 532 532 + TRUE, 533 533 + NULL); ··· 540 540 autoconfig_sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, e_autoconfig_free_merge_source_data); 541 541 542 542 diff --git a/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c b/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c 543 - index d531cb9..3d8807c 100644 543 + index d531cb9..c96f1d5 100644 544 544 --- a/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c 545 545 +++ b/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c 546 546 @@ -61,7 +61,18 @@ evolution_source_registry_migrate_proxies (ESourceRegistryServer *server) ··· 551 551 + { 552 552 + g_autoptr(GSettingsSchemaSource) schema_source; 553 553 + g_autoptr(GSettingsSchema) schema; 554 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 554 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 555 555 + g_settings_schema_source_get_default(), 556 556 + TRUE, 557 557 + NULL); ··· 564 564 switch (g_settings_get_int (settings, "proxy-type")) { 565 565 case 1: 566 566 diff --git a/src/services/evolution-source-registry/evolution-source-registry.c b/src/services/evolution-source-registry/evolution-source-registry.c 567 - index 1c0a113..d26b059 100644 567 + index 1c0a113..6b41423 100644 568 568 --- a/src/services/evolution-source-registry/evolution-source-registry.c 569 569 +++ b/src/services/evolution-source-registry/evolution-source-registry.c 570 570 @@ -181,7 +181,18 @@ main (gint argc, ··· 575 575 + { 576 576 + g_autoptr(GSettingsSchemaSource) schema_source; 577 577 + g_autoptr(GSettingsSchema) schema; 578 - + schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@", 578 + + schema_source = g_settings_schema_source_new_from_directory("@EDS@", 579 579 + g_settings_schema_source_get_default(), 580 580 + TRUE, 581 581 + NULL);
+51
pkgs/development/libraries/glib/default.nix
··· 8 8 , coreutils, dbus, libxml2, tzdata 9 9 , desktop-file-utils, shared-mime-info 10 10 , darwin 11 + # update script 12 + , runCommand, git, coccinelle 11 13 }: 12 14 13 15 assert stdenv.isLinux -> util-linuxMinimal != null; ··· 246 248 packageName = "glib"; 247 249 versionPolicy = "odd-unstable"; 248 250 }; 251 + /* 252 + can be used as part of an update script to automatically create a patch 253 + hardcoding the path of all gsettings schemas in C code. 254 + For example: 255 + passthru = { 256 + hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch { 257 + inherit src; 258 + glib-schema-to-var = { 259 + ... 260 + }; 261 + }; 262 + 263 + updateScript = 264 + let 265 + updateSource = ...; 266 + patch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 267 + in 268 + _experimental-update-script-combinators.sequence [ 269 + updateSource 270 + patch 271 + ]; 272 + }; 273 + } 274 + takes as input a mapping from schema path to variable name. 275 + For example `{ "org.gnome.evolution" = "EVOLUTION_SCHEMA_PATH"; }` 276 + hardcodes looking for `org.gnome.evolution` into `@EVOLUTION_SCHEMA_PATH@`. 277 + All schemas must be listed. 278 + */ 279 + mkHardcodeGsettingsPatch = { src, glib-schema-to-var }: 280 + runCommand 281 + "hardcode-gsettings.patch" 282 + { 283 + inherit src; 284 + nativeBuildInputs = [ 285 + git 286 + coccinelle 287 + python3 # For patch script 288 + ]; 289 + } 290 + '' 291 + unpackPhase 292 + cd "''${sourceRoot:-.}" 293 + set -x 294 + cp ${builtins.toFile "glib-schema-to-var.json" (builtins.toJSON glib-schema-to-var)} ./glib-schema-to-var.json 295 + git init 296 + git add -A 297 + spatch --sp-file "${./hardcode-gsettings.cocci}" --dir . --in-place 298 + git diff > "$out" 299 + ''; 249 300 }; 250 301 251 302 meta = with lib; {