[GConf2] Improve gsettings-data-convert behaviour

Matthias Clasen mclasen at fedoraproject.org
Thu Jan 19 15:14:17 UTC 2012


commit 724be447d671e226c611b453985a247a37e92846
Author: Matthias Clasen <mclasen at redhat.com>
Date:   Thu Jan 19 10:00:55 2012 -0500

    Improve gsettings-data-convert behaviour

 ...Cosmetics-Consistenly-capitalize-messages.patch |   79 ++++++++++++++++++++
 0002-Skip-nonexisting-schemas.patch                |   57 ++++++++++++++
 0003-Bump-GIO-dep-to-2.32.patch                    |   26 +++++++
 GConf2.spec                                        |   13 +++-
 4 files changed, 173 insertions(+), 2 deletions(-)
---
diff --git a/0001-Cosmetics-Consistenly-capitalize-messages.patch b/0001-Cosmetics-Consistenly-capitalize-messages.patch
new file mode 100644
index 0000000..2f31431
--- /dev/null
+++ b/0001-Cosmetics-Consistenly-capitalize-messages.patch
@@ -0,0 +1,79 @@
+From 76e5c8e2cf3d2555beb8d06211711d82962a9ebf Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Thu, 19 Jan 2012 09:51:16 -0500
+Subject: [PATCH 1/3] Cosmetics: Consistenly capitalize messages
+
+---
+ gsettings/gsettings-data-convert.c |   14 +++++++-------
+ 1 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/gsettings/gsettings-data-convert.c b/gsettings/gsettings-data-convert.c
+index b529476..9b33700 100644
+--- a/gsettings/gsettings-data-convert.c
++++ b/gsettings/gsettings-data-convert.c
+@@ -93,7 +93,7 @@ handle_file (const gchar *filename)
+ 
+       if (verbose)
+         {
+-          g_print ("collecting settings for schema '%s'\n", schema_path[0]);
++          g_print ("Collecting settings for schema '%s'\n", schema_path[0]);
+           if (schema_path[1])
+             g_print ("for storage at '%s'\n", schema_path[1]);
+         }
+@@ -157,7 +157,7 @@ handle_file (const gchar *filename)
+             {
+             case GCONF_VALUE_STRING:
+               if (dry_run)
+-                g_print ("set key '%s' to string '%s'\n", keys[j],
++                g_print ("Set key '%s' to string '%s'\n", keys[j],
+                          gconf_value_get_string (value));
+               else
+                 g_settings_set (settings, keys[j], "s",
+@@ -166,7 +166,7 @@ handle_file (const gchar *filename)
+ 
+             case GCONF_VALUE_INT:
+               if (dry_run)
+-                g_print ("set key '%s' to integer '%d'\n",
++                g_print ("Set key '%s' to integer '%d'\n",
+                          keys[j], gconf_value_get_int (value));
+               else
+                 {
+@@ -193,7 +193,7 @@ handle_file (const gchar *filename)
+ 
+             case GCONF_VALUE_BOOL:
+               if (dry_run)
+-                g_print ("set key '%s' to boolean '%d'\n",
++                g_print ("Set key '%s' to boolean '%d'\n",
+                          keys[j], gconf_value_get_bool (value));
+               else
+                 g_settings_set (settings, keys[j], "b",
+@@ -202,7 +202,7 @@ handle_file (const gchar *filename)
+ 
+             case GCONF_VALUE_FLOAT:
+               if (dry_run)
+-                g_print ("set key '%s' to double '%g'\n",
++                g_print ("Set key '%s' to double '%g'\n",
+                          keys[j], gconf_value_get_float (value));
+               else
+                 g_settings_set (settings, keys[j], "d",
+@@ -232,7 +232,7 @@ handle_file (const gchar *filename)
+                   if (dry_run)
+                     {
+                       str = g_variant_print (v, FALSE);
+-                      g_print ("set key '%s' to a list of strings: %s\n",
++                      g_print ("Set key '%s' to a list of strings: %s\n",
+                                keys[j], str);
+                       g_free (str);
+                     }
+@@ -263,7 +263,7 @@ handle_file (const gchar *filename)
+                   if (dry_run)
+                     {
+                       str = g_variant_print (v, FALSE);
+-                      g_print ("set key '%s' to a list of integers: %s\n",
++                      g_print ("Set key '%s' to a list of integers: %s\n",
+                                keys[j], str);
+                       g_free (str);
+                     }
+-- 
+1.7.8.3
+
diff --git a/0002-Skip-nonexisting-schemas.patch b/0002-Skip-nonexisting-schemas.patch
new file mode 100644
index 0000000..f472043
--- /dev/null
+++ b/0002-Skip-nonexisting-schemas.patch
@@ -0,0 +1,57 @@
+From 120f116e608bc1f09cf65435333e40e00c6b8ad2 Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Thu, 19 Jan 2012 09:53:08 -0500
+Subject: [PATCH 2/3] Skip nonexisting schemas
+
+This can happen in practice, due to e.g. schemas being packaged
+in subpackages, while all the conversions are kept in a single
+file.
+---
+ gsettings/gsettings-data-convert.c |   17 +++++++++++++++++
+ 1 files changed, 17 insertions(+), 0 deletions(-)
+
+diff --git a/gsettings/gsettings-data-convert.c b/gsettings/gsettings-data-convert.c
+index 9b33700..595091e 100644
+--- a/gsettings/gsettings-data-convert.c
++++ b/gsettings/gsettings-data-convert.c
+@@ -65,6 +65,8 @@ handle_file (const gchar *filename)
+   gchar *str;
+   gint ii;
+   GSList *list, *l;
++  GSettingsSchemaSource *source;
++  GSettingsSchema *schema;
+   GSettings *settings;
+   GError *error;
+ 
+@@ -83,6 +85,7 @@ handle_file (const gchar *filename)
+     }
+ 
+   client = gconf_client_get_default ();
++  source = g_settings_schema_source_get_default ();
+ 
+   groups = g_key_file_get_groups (keyfile, NULL);
+   for (i = 0; groups[i]; i++)
+@@ -91,6 +94,20 @@ handle_file (const gchar *filename)
+ 
+       schema_path = g_strsplit (groups[i], ":", 2);
+ 
++      schema = g_settings_schema_source_lookup (source, schema_path[0], FALSE);
++      if (schema == NULL)
++        {
++          if (verbose)
++            {
++              g_print ("Schema '%s' not found, skipping\n", schema_path[0]);
++            }
++
++          g_strfreev (schema_path);
++          continue;
++        }
++
++      g_settings_schema_unref (schema);
++
+       if (verbose)
+         {
+           g_print ("Collecting settings for schema '%s'\n", schema_path[0]);
+-- 
+1.7.8.3
+
diff --git a/0003-Bump-GIO-dep-to-2.32.patch b/0003-Bump-GIO-dep-to-2.32.patch
new file mode 100644
index 0000000..2b728ac
--- /dev/null
+++ b/0003-Bump-GIO-dep-to-2.32.patch
@@ -0,0 +1,26 @@
+From e06e9553b060d6b0fd96cdf40dbd5918045c52ca Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen at redhat.com>
+Date: Thu, 19 Jan 2012 09:54:58 -0500
+Subject: [PATCH 3/3] Bump GIO dep to 2.32
+
+This is needed for the settings schema API.
+---
+ configure.in |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 93253a4..c3e913b 100644
+--- a/configure.in
++++ b/configure.in
+@@ -168,7 +168,7 @@ AC_ARG_ENABLE(gtk,
+     [Enable GTK+ support (for gconf-sanity-check) @<:@default=auto@:>@]),
+   , enable_gtk=auto)
+ 
+-PKGCONFIG_MODULES='glib-2.0 > 2.14.0 gio-2.0 >= 2.25.9 gthread-2.0 gmodule-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0'
++PKGCONFIG_MODULES='glib-2.0 > 2.14.0 gio-2.0 >= 2.32.0 gmodule-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0'
+ PKGCONFIG_MODULES_WITH_XML="$PKGCONFIG_MODULES libxml-2.0"
+ PKGCONFIG_MODULES_WITH_GTK=" $PKGCONFIG_MODULES gtk+-$GTK_API_VERSION >= $GTK_REQUIRED"
+ PKGCONFIG_MODULES_WITH_XML_AND_GTK=" $PKGCONFIG_MODULES gtk+-$GTK_API_VERSION >= $GTK_REQUIRED libxml-2.0"
+-- 
+1.7.8.3
+
diff --git a/GConf2.spec b/GConf2.spec
index f9ed345..61490a1 100644
--- a/GConf2.spec
+++ b/GConf2.spec
@@ -14,6 +14,13 @@ Source0: http://download.gnome.org/sources/GConf/3.2/GConf-%{version}.tar.xz
 Source1: macros.gconf2
 URL: http://projects.gnome.org/gconf/
 
+Patch0: GConf-gettext.patch
+
+# upstream patches
+Patch1: 0001-Cosmetics-Consistenly-capitalize-messages.patch
+Patch2: 0002-Skip-nonexisting-schemas.patch
+Patch3: 0003-Bump-GIO-dep-to-2.32.patch
+
 BuildRequires: libxml2-devel >= %{libxml2_version}
 BuildRequires: libxslt-devel
 BuildRequires: glib2-devel >= %{glib2_version}
@@ -31,8 +38,6 @@ Requires: dbus
 Requires: /usr/bin/killall
 Conflicts: GConf2-dbus
 
-Patch0: GConf-gettext.patch
-
 %description
 GConf is a process-transparent configuration database API used to
 store user preferences. It has pluggable backends and features to
@@ -66,6 +71,9 @@ which require GTK+.
 %prep
 %setup -q -n GConf-%{version}
 %patch0 -p1 -b .gettext
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
 
 
 %build
@@ -159,6 +167,7 @@ fi
 %changelog
 * Thu Jan 19 2012 Matthias Clasen <mclasen at redhat.com> - 3.2.3-2
 - Don't build the openldap backend
+- Deal gracefully with missing schemas in gsettings-data-convert
 
 * Thu Jan 12 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.2.3-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild


More information about the scm-commits mailing list