diff options
author | Guillaume Girol <symphorien+git@xlumurb.eu> | 2022-10-13 12:00:00 +0000 |
---|---|---|
committer | Guillaume Girol <symphorien+git@xlumurb.eu> | 2022-11-11 13:30:00 +0100 |
commit | e094494915761e7b4e6de47f5b9c87a301edb974 (patch) | |
tree | c69a625242a5140baa5bb40e400775c41174cff7 /pkgs/applications/networking/mailreaders/evolution/evolution-ews | |
parent | 0533be43f1ce89c51ce9720386258ea5c19fcb1d (diff) |
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
Diffstat (limited to 'pkgs/applications/networking/mailreaders/evolution/evolution-ews')
-rw-r--r-- | pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix | 36 | ||||
-rw-r--r-- | pkgs/applications/networking/mailreaders/evolution/evolution-ews/hardcode-gsettings.patch | 72 |
2 files changed, 105 insertions, 3 deletions
diff --git a/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix b/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix index af1781f3af748..51e1c2e52c87d 100644 --- a/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix +++ b/pkgs/applications/networking/mailreaders/evolution/evolution-ews/default.nix @@ -14,6 +14,9 @@ , json-glib , libmspack , webkitgtk_4_1 +, substituteAll +, _experimental-update-script-combinators +, glib }: stdenv.mkDerivation rec { @@ -25,6 +28,17 @@ stdenv.mkDerivation rec { sha256 = "p5Jp7wnoqAuo8My8ZDMl0rsFc0158G8x8lAehWfLjb0="; }; + patches = [ + # evolution-ews contains .so files loaded by evolution-data-server refering + # schemas from evolution. evolution-data-server is not wrapped with + # evolution's schemas because it would be a circular dependency with + # evolution. + (substituteAll { + src = ./hardcode-gsettings.patch; + evo = glib.makeSchemaPath evolution evolution.name; + }) + ]; + nativeBuildInputs = [ cmake gettext @@ -50,10 +64,26 @@ stdenv.mkDerivation rec { ]; passthru = { - updateScript = gnome.updateScript { - packageName = "evolution-ews"; - versionPolicy = "odd-unstable"; + hardcodeGsettingsPatch = glib.mkHardcodeGsettingsPatch { + inherit src; + glib-schema-to-var = { + "org.gnome.evolution.mail" = "evo"; + "org.gnome.evolution.calendar" = "evo"; + }; }; + + updateScript = + let + updateSource = gnome.updateScript { + packageName = "evolution-ews"; + versionPolicy = "odd-unstable"; + }; + updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "evolution-ews.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; + in + _experimental-update-script-combinators.sequence [ + updateSource + updatePatch + ]; }; meta = with lib; { diff --git a/pkgs/applications/networking/mailreaders/evolution/evolution-ews/hardcode-gsettings.patch b/pkgs/applications/networking/mailreaders/evolution/evolution-ews/hardcode-gsettings.patch new file mode 100644 index 0000000000000..c5fb77fc2a510 --- /dev/null +++ b/pkgs/applications/networking/mailreaders/evolution/evolution-ews/hardcode-gsettings.patch @@ -0,0 +1,72 @@ +diff --git a/src/EWS/camel/camel-ews-utils.c b/src/EWS/camel/camel-ews-utils.c +index 0707f72..1e71954 100644 +--- a/src/EWS/camel/camel-ews-utils.c ++++ b/src/EWS/camel/camel-ews-utils.c +@@ -1552,7 +1552,18 @@ ews_utils_save_category_changes (GHashTable *old_categories, /* gchar *guid ~> C + + evo_labels = g_ptr_array_new_full (5, g_free); + +- settings = g_settings_new ("org.gnome.evolution.mail"); ++ { ++ g_autoptr(GSettingsSchemaSource) schema_source; ++ g_autoptr(GSettingsSchema) schema; ++ schema_source = g_settings_schema_source_new_from_directory("@evo@", ++ g_settings_schema_source_get_default(), ++ TRUE, ++ NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ "org.gnome.evolution.mail", ++ FALSE); ++ settings = g_settings_new_full(schema, NULL, NULL); ++ } + strv = g_settings_get_strv (settings, "labels"); + + for (ii = 0; strv && strv[ii]; ii++) { +diff --git a/src/EWS/common/e-ews-calendar-utils.c b/src/EWS/common/e-ews-calendar-utils.c +index 6deda60..9b44cc7 100644 +--- a/src/EWS/common/e-ews-calendar-utils.c ++++ b/src/EWS/common/e-ews-calendar-utils.c +@@ -413,7 +413,18 @@ ews_get_configured_icaltimezone (void) + gchar *location; + ICalTimezone *zone = NULL; + +- settings = g_settings_new ("org.gnome.evolution.calendar"); ++ { ++ g_autoptr(GSettingsSchemaSource) schema_source; ++ g_autoptr(GSettingsSchema) schema; ++ schema_source = g_settings_schema_source_new_from_directory("@evo@", ++ g_settings_schema_source_get_default(), ++ TRUE, ++ NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ "org.gnome.evolution.calendar", ++ FALSE); ++ settings = g_settings_new_full(schema, NULL, NULL); ++ } + location = g_settings_get_string (settings, "timezone"); + if (location) { + zone = i_cal_timezone_get_builtin_timezone (location); +diff --git a/src/Microsoft365/camel/camel-m365-store.c b/src/Microsoft365/camel/camel-m365-store.c +index ff1b8e3..4f876c0 100644 +--- a/src/Microsoft365/camel/camel-m365-store.c ++++ b/src/Microsoft365/camel/camel-m365-store.c +@@ -309,7 +309,18 @@ m365_store_save_category_changes (GHashTable *old_categories, /* gchar *id ~> Ca + + evo_labels = g_ptr_array_new_full (5, g_free); + +- settings = g_settings_new ("org.gnome.evolution.mail"); ++ { ++ g_autoptr(GSettingsSchemaSource) schema_source; ++ g_autoptr(GSettingsSchema) schema; ++ schema_source = g_settings_schema_source_new_from_directory("@evo@", ++ g_settings_schema_source_get_default(), ++ TRUE, ++ NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ "org.gnome.evolution.mail", ++ FALSE); ++ settings = g_settings_new_full(schema, NULL, NULL); ++ } + strv = g_settings_get_strv (settings, "labels"); + + for (ii = 0; strv && strv[ii]; ii++) { |